havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.4.1, 2.3.4 & 2.2.7: https://www.ruby-lang.org || Paste >3 lines of text to: https://gist.github.com || Rails questions? Ask in: #RubyOnRails || Logs: https://irclog.whitequark.org/ruby || Books: https://goo.gl/wpGhoQ
rahult has joined #ruby
_sfiguser has joined #ruby
Moosashi has quit [Quit: Moosashi]
Neo__ has joined #ruby
Moosashi has joined #ruby
Moosashi has quit [Client Quit]
jameser has joined #ruby
bruno- has joined #ruby
airdisa has quit []
marr has quit [Ping timeout: 260 seconds]
charliesome has joined #ruby
ujjain has quit [Quit: ZNC - 1.6.0 - http://znc.in]
duderonomy has quit [Ping timeout: 276 seconds]
jackjackdripper has quit [Quit: Leaving.]
blznblzn2 has quit [Ping timeout: 246 seconds]
jameser has quit [Ping timeout: 260 seconds]
mach_kernel has quit [Remote host closed the connection]
ted_ has joined #ruby
ted_ has quit [Read error: Connection reset by peer]
z0mbee has quit [Remote host closed the connection]
ujjain has joined #ruby
ujjain has joined #ruby
ujjain has quit [Changing host]
HoierM has quit [Ping timeout: 260 seconds]
phinxy has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
FahmeF has joined #ruby
paradisaeidae has joined #ruby
jameser has quit [Client Quit]
paradisaeidae_ has joined #ruby
brent__ has joined #ruby
FahmeF has quit [Ping timeout: 248 seconds]
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
bruno- has quit [Ping timeout: 260 seconds]
amclain has quit [Quit: Leaving]
brent__ has quit [Ping timeout: 248 seconds]
leandrobighetti has joined #ruby
<Radar> adaedra: this might be relevant to your interests: http://bundler.io/v1.3/git.html#local
HoierM has joined #ruby
troys is now known as troys_
amclain has joined #ruby
brent__ has joined #ruby
brent__ has quit [Remote host closed the connection]
leandrobighetti has quit [Ping timeout: 240 seconds]
brent__ has joined #ruby
brent__ has quit [Remote host closed the connection]
brent__ has joined #ruby
brent__ has quit [Read error: Connection reset by peer]
brent___ has joined #ruby
mim1k has joined #ruby
BackEndCoder has quit [Ping timeout: 276 seconds]
brian_penguin has joined #ruby
eregon has quit [Quit: No Ping reply in 180 seconds.]
_sfiguser has quit [Quit: Leaving]
[spoiler] has quit [Ping timeout: 276 seconds]
hanmac has quit [Ping timeout: 276 seconds]
KevinMGranger has quit [Ping timeout: 276 seconds]
torarne has quit [Ping timeout: 276 seconds]
turt2live has quit [Ping timeout: 276 seconds]
sneep has quit [Ping timeout: 276 seconds]
SuperTaz has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
cats has quit [Ping timeout: 276 seconds]
rileyy has quit [Ping timeout: 276 seconds]
[spoiler] has joined #ruby
mbr has quit [Ping timeout: 240 seconds]
sneep has joined #ruby
brent___ has quit [Remote host closed the connection]
hutch34 has joined #ruby
eregon has joined #ruby
rileyy has joined #ruby
cats has joined #ruby
BackEndCoder has joined #ruby
wilbert has joined #ruby
ArtCorvelay has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
domgetter has quit [Ping timeout: 246 seconds]
turt2live has joined #ruby
torarne has joined #ruby
KevinMGranger has joined #ruby
profsimm has quit [Ping timeout: 260 seconds]
rahult is now known as rahult_
hanmac has joined #ruby
rahult_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
enterprisey has joined #ruby
gusrub_ has quit [Remote host closed the connection]
bronson has joined #ruby
raspado has quit [Quit: Leaving...]
mbr has joined #ruby
<rapha> if i have lots of [{foo: 1.2, bar: 2.3}, {foo: 3.2, bar: 3.0}] but need lots of [{foo: [1.2, 3.2]}, {bar: [2.3, 3.0]}] is that something I would use .map for? my brain is a bunch of knots right now :(
amclain has quit [Quit: Leaving]
griffindy has joined #ruby
phate408 has quit [Ping timeout: 240 seconds]
griffindy has quit [Client Quit]
bronson has quit [Ping timeout: 268 seconds]
mim1k has joined #ruby
aurelien has quit [Ping timeout: 276 seconds]
rahult has joined #ruby
<Radar> rapha: You could probably reduce it.
<Radar> I'll give you some code, one moment
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<rapha> I'm playing around with something that's probably quite ugly, no rush :)
<Radar> >> src = [{foo: 1.2, bar: 2.3}, {foo: 3.2, bar: 3.0}]; src.each_with_object({foo: [], bar: []}) { |data, acc| acc[:foo] << data[:foo]; acc[:bar] << data[:bar] }
<ruby[bot]> Radar: # => {:foo=>[1.2, 3.2], :bar=>[2.3, 3.0]} (https://eval.in/840891)
<Radar> rapha: ^ is that what you're after? Or did you want foo + bar to be in two separate hashes?
mim1k has quit [Ping timeout: 240 seconds]
<rapha> Radar: no, that's exactly what I was after!
* rapha reads
ozcanesen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<rapha> oh.
<rapha> what sort of construct is "p begin"?
<rapha> oic that's just the bot's code
ozcanesen has joined #ruby
duderonomy has joined #ruby
<rapha> Radar: what do you mean by "acc"?
<Radar> accumulator,
<Radar> The acc starts off being the object passed in as the argument to each_with_object, and then that object changes every time the block is called
hutch34 has quit [Ping timeout: 276 seconds]
<Radar> So the first time it would go from {foo: [], bar: []} to {foo: [1.2], bar: [2.3]} and then the 2nd time it goes to {foo: [1.2, 3.2], bar: [2.3, 3.0]}
<Radar> Then there are no more elements, so it returns the final result
<rapha> ah, that's an apt name then
<rapha> i think i need to read up on each_with_object
ArtCorvelay has quit [Quit: WeeChat 1.9]
nacsurte has quit [Ping timeout: 240 seconds]
cahoots_ has quit [Ping timeout: 240 seconds]
gizmore|2 has joined #ruby
jdawgaz has joined #ruby
charliesome has joined #ruby
gizmore has quit [Ping timeout: 260 seconds]
jameser has joined #ruby
<rapha> oh
<rapha> the _with_object part is what i give it in the argument array, not in the block
<rapha> so it's not that complicated even :)
rahult has quit [Read error: Connection reset by peer]
rahult_ has joined #ruby
brian_penguin has quit [Remote host closed the connection]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ozcanesen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rahult_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jdawgaz has joined #ruby
* rapha marvels at how many packets his router routes
duderonomy has joined #ruby
<Radar> Gruff is a name I haven't seen in a while.
carnegie has quit [Remote host closed the connection]
carnegie has joined #ruby
<rapha> :)
<rapha> It's a nice little Gem!
<rapha> Radar: say, is something like each_with_object crossing over into the functional programming realm?
<Radar> rapha: Well it is running a function (proc) for each element in the list, so yeah, I think it is.
carnegie has quit [Remote host closed the connection]
bruno- has joined #ruby
<rapha> Hmm. I will have to tell my Haskell-wielding friends to stop laughing at Ruby and me.
Derperperd has quit [Quit: Peace out]
dcunit3d has quit [Ping timeout: 246 seconds]
<Radar> I think they'll still keep doing that.
milardovich has quit [Remote host closed the connection]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
milardovich has joined #ruby
jrafanie has joined #ruby
cahoots has joined #ruby
<rapha> I guess, but then I'll just call them Haskellipsters or something.
milardovich has quit [Ping timeout: 260 seconds]
sleepee has quit [Read error: Connection reset by peer]
runescape07rsps has quit [Quit: Leaving]
<konsolebox> "dmark is a function to mark Ruby objects referred from your struct. It must mark all references from your struct with rb_gc_mark or its family if your struct keeps such references."
<konsolebox> What happens if I don't specify dmark?
<konsolebox> @extension.rdoc
<konsolebox> the example further below it does not specify any: {0, free_dbm, memsize_dbm,},
grant has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
guacamole has joined #ruby
guacamol_ has joined #ruby
guacamol_ has quit [Client Quit]
<cahoots> hi, i'm having a strange issue. if a gem, mygem, isn't installed, and i run `gem install mygem` and then 'gem "mygem", "=1.0"' immediately after, it tells me that it can't find the gem. but then on subsequent runs, where the gem has been installed, that call to the gem function works. how can i fix this?
<cahoots> is gem install starting some async task that i need to wait for?
poloych has quit [Remote host closed the connection]
guacamole has quit [Ping timeout: 260 seconds]
<baweaver> >> [{foo: 1.2, bar: 2.3}, {foo: 3.2, bar: 3.0}].reduce { |a,b| a.merge(b) { |_,o,n| Array(o) << n } } # Radar / rapha :D
<ruby[bot]> baweaver: # => {:foo=>[1.2, 3.2], :bar=>[2.3, 3.0]} (https://eval.in/840914)
gusrub has joined #ruby
* baweaver admits ewo is clearer
leandrobighetti has joined #ruby
sneakerhax has joined #ruby
crankhar1er has quit [Ping timeout: 240 seconds]
<cahoots> meh, looks like this fixed more elegantly anyways by using Gem::Commands::InstallCommand
sleepee has joined #ruby
<konsolebox> (nevermind i got it. i just forgot the concept)
<Radar> cahoots: why are you doing it that way? Why not use a Gemfile to install the gems?
leandrobighetti has quit [Ping timeout: 276 seconds]
ramfjord has quit [Ping timeout: 260 seconds]
<cahoots> Radar, this is a script that will run on a remote CI machine. so i want to only install gems within the directory of the script, and then i want to delete all untracked files on a fresh run
<Radar> cahoots: bundle install --path vendor/gems
<Radar> ?next
<ruby[bot]> Radar: I don't know anything about next
<Radar> ruby[bot]: I thought you loved me.
rahult has joined #ruby
QualityAddict has quit [Quit: Leaving]
<cahoots> Radar, but then i still have to install the bundle gem, no?
swills_ has joined #ruby
rahult has quit [Client Quit]
<cahoots> also, if i went the bundle route, i would need to remember to run "bundle exec ruby" instead of "ruby" every time, correct?
swills has quit [Ping timeout: 255 seconds]
<nofxxxx> cahoots, not necessarly, if there's no gem clashs just ruby will work, but yeah, that ensures it'll
rahult has joined #ruby
swills_ has quit [Client Quit]
<nofxxxx> cahoots, also, if you're running something do a executable so you just ./myapp
swills has joined #ruby
swills has joined #ruby
swills has quit [Changing host]
<nofxxxx> and it starts it properly
rahult has quit [Client Quit]
empty_cup has quit [Ping timeout: 240 seconds]
guardianx has joined #ruby
<cahoots> nofxxxx, how does that work, because i put "#!/usr/bin/env ruby" at the top which would make it just run /usr/bin/ruby, right? how does bundle get involved?
gusrub has quit [Remote host closed the connection]
<nofxxxx> cahoots, actually I was talking about bin/env sh ... so inside you bundle exec, but that would be nice
<nofxxxx> can we do that? heh
<nofxxxx> bin/env bundle ... ?
mesamoo has quit [Quit: Konversation terminated!]
<cahoots> nofxxxx, i'm confused, can you rephrase what you're talking about?
HoierM has quit [Ping timeout: 240 seconds]
Dimik has quit [Ping timeout: 260 seconds]
<nofxxxx> cahoots, I meant use a sh script, #/usr/bin/env sh
empty_cup has joined #ruby
ur5us has quit [Remote host closed the connection]
milardovich has joined #ruby
<nofxxxx> cahoots, but even so I like the simple sh way, nothing there but executable and it's params
<nofxxxx> #!/usr/bin/env sh
<cahoots> nofxxxx, so you'd have like, script.sh which calls bundle exec on script.rb?
<nofxxxx> bundle exec bin/myapp --with-nice-args 5
<nofxxxx> cahoots, yeah, but loose the '.sh'
<nofxxxx> executables should not have extension
milardovich has quit [Ping timeout: 268 seconds]
gix has quit [Ping timeout: 240 seconds]
gix has joined #ruby
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has joined #ruby
bronson has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
<cahoots> nofxxxx and Radar, thanks, i'll keep messing with bundler
bronson has quit [Ping timeout: 240 seconds]
siloxid has joined #ruby
<siloxid> I'm trying to open a file, read a few filenames, then use those filenames to open more files. unfortunately when I use File.open(path) it always tells me "No such file". But 1. the path is correct and 2. if I open the file first, it works. does ruby only allow one file to be open at a time? something seems terribly wrong
xuanrui has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blznblzn2 has joined #ruby
<siloxid> and I can puts the string and cat the filename in the terminal and the path is sane
xuanrui has quit [Ping timeout: 260 seconds]
wilbert has quit [Ping timeout: 240 seconds]
z3uS has quit [Remote host closed the connection]
__Yiota has joined #ruby
z3uS has joined #ruby
<siloxid> but it appears that I can `cat #{path}` *facepasm*
wilbert has joined #ruby
minimalism has quit [Quit: minimalism]
hndk has joined #ruby
xuanrui has joined #ruby
tacoboy has quit [Remote host closed the connection]
siloxid has quit [Remote host closed the connection]
sneakerhax has quit [Read error: Connection reset by peer]
minimalism has joined #ruby
kent\n has quit [Quit: No Ping reply in 180 seconds.]
kent\n has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cahoots has quit [Ping timeout: 276 seconds]
brent__ has joined #ruby
hndk has quit [Ping timeout: 260 seconds]
sneakerhax has joined #ruby
umaaji has joined #ruby
segy_ has joined #ruby
dviola has quit [Quit: WeeChat 1.9]
brent__ has quit [Remote host closed the connection]
gusrub has joined #ruby
segy- has joined #ruby
segy has quit [Ping timeout: 260 seconds]
rahult has joined #ruby
segy has joined #ruby
segy_ has quit [Ping timeout: 240 seconds]
segy- has quit [Ping timeout: 240 seconds]
segy_ has joined #ruby
mesamoo has joined #ruby
segy has quit [Ping timeout: 260 seconds]
emers2n has joined #ruby
<emers2n> Could someone explain what the multiplication/asterisk (*) means here: myCustomHash.inject(Hash[ *myCustomHash.first ]) do |tmp,kv|
segy has joined #ruby
guardianx has quit []
segy- has joined #ruby
segy_ has quit [Ping timeout: 276 seconds]
segy_ has joined #ruby
segy has quit [Ping timeout: 248 seconds]
leandrobighetti has joined #ruby
segy has joined #ruby
kobain has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
paradisaeidae has quit [Ping timeout: 240 seconds]
paradisaeidae_ has quit [Ping timeout: 248 seconds]
segy- has quit [Ping timeout: 276 seconds]
tobiasvl has quit [Remote host closed the connection]
gusrub has quit []
ur5us has joined #ruby
cam27 has quit [Ping timeout: 248 seconds]
segy_ has quit [Ping timeout: 276 seconds]
leandrobighetti has quit [Ping timeout: 258 seconds]
segy_ has joined #ruby
segy has quit [Ping timeout: 260 seconds]
segy_ has quit [K-Lined]
paradisaeidae has joined #ruby
hutch34 has joined #ruby
wilbert has quit [Ping timeout: 255 seconds]
swills has quit [Ping timeout: 240 seconds]
paradisaeidae_ has joined #ruby
anisha has joined #ruby
rahult has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aurelien has joined #ruby
Silthias has joined #ruby
hutch34 has quit [Ping timeout: 258 seconds]
Silthias2 has quit [Ping timeout: 246 seconds]
rahult has joined #ruby
swills has joined #ruby
swills has joined #ruby
swills has quit [Changing host]
howdoi has joined #ruby
rahult has quit [Client Quit]
worknick has joined #ruby
<worknick> hi
<worknick> i have X = {"A":1, "B":2} and Y = {"C":11, "D": 22} how can i do 1*2 + 2*22 ??
chouhoulis has quit [Remote host closed the connection]
<worknick> i mean, 1*11 + 2 * 22
wilbert has joined #ruby
tildes has joined #ruby
jinie_ has quit [Ping timeout: 268 seconds]
jinie_ has joined #ruby
milardovich has joined #ruby
govg has quit [Ping timeout: 240 seconds]
<emers2n> still need that worknick?
govg has joined #ruby
milardovich has quit [Ping timeout: 248 seconds]
Norm_ has joined #ruby
pwnd_nsfw` has joined #ruby
Norm has quit [Ping timeout: 268 seconds]
Norm_ is now known as Norm
Xiti` has joined #ruby
pwnd_nsfw has quit [Ping timeout: 258 seconds]
jordanm has quit [Remote host closed the connection]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Xiti has quit [Ping timeout: 260 seconds]
jordanm has joined #ruby
oleo has quit [Quit: irc client terminated!]
govg has quit [Ping timeout: 240 seconds]
govg has joined #ruby
kspencer has quit [Ping timeout: 255 seconds]
SeepingN has joined #ruby
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kspencer has joined #ruby
bronson has joined #ruby
swills has quit [Ping timeout: 260 seconds]
HashNuke has quit [Ping timeout: 246 seconds]
mim1k has joined #ruby
HashNuke has joined #ruby
ur5us has quit [Remote host closed the connection]
bronson has quit [Ping timeout: 268 seconds]
sunrunner20 has quit [Quit: So Long and Thanks for All the fish]
sunrunner20 has joined #ruby
davidmichaelkarr has quit [Ping timeout: 255 seconds]
tfitts has quit [Ping timeout: 255 seconds]
moeabdol has joined #ruby
brent__ has joined #ruby
davidmichaelkarr has joined #ruby
<havenwood> worknick: X.values.zip(Y.values).map(&:sum) #=> [12, 24]
<havenwood> oh, *
moeabdol has quit [Client Quit]
<havenwood> worknick: X.values.zip(Y.values).map { |x, y| x * y } #=> [11, 44]
benlieb has joined #ruby
<emers2n> havenwood: I've been trying to figure this out for past two hours > any ideas?
<havenwood> emers2n: destructuring
<havenwood> emers2n: sec
<emers2n> I'm sorry?
<havenwood> emers2n: numbers = [1, 2, 3, 4]; Hash[numbers] #!> warning: wrong element type Integer at 0 (expected array)
<havenwood> emers2n: Hash[*numbers] #=> {1=>2, 3=>4}
<havenwood> emers2n: The splat passes the elements of the array as arguments.
<havenwood> emers2n: Instead of a single array, it splats it out to four arguments.
<emers2n> Thanks, but my question is how to essentially reverse a part of the code here: https://www.jdoodle.com/a/4Wn
<havenwood> emers2n: [*[1, 2, 3], 4] #=> [1, 2, 3, 4]
<havenwood> emers2n: which part?
Tony-St4rk has quit [Ping timeout: 240 seconds]
mim1k has quit [Ping timeout: 276 seconds]
<havenwood> emers2n: reading
<emers2n> havenwood: Cheers. Compare Desired vs Actual Output to see what the issue is the quickest
Tony-St4rk has joined #ruby
<worknick> havenwood, Thanks. emers2n havenwood answered.
phate408 has joined #ruby
brent__ has quit [Remote host closed the connection]
Papierkorb has quit [Ping timeout: 246 seconds]
troys_ is now known as troys
planigan has quit [Ping timeout: 258 seconds]
<havenwood> emers2n: hmm, let's see
<havenwood> emers2n: data_hash.keys.first.step(data_hash.keys.last, 1/1440r).map { |datetime| data_hash[datetime] } #=> [5, 22, nil, 3, nil, nil, nil, 7]
<havenwood> emers2n: not quite right
planigan has joined #ruby
<havenwood> emers2n: This is nearly what you asked for, but nils instead of falling back to the last time: data_hash.keys.first.step(data_hash.keys.last, 1/1440r).map { |datetime| [datetime, data_hash[datetime]] }.to_h
Bock has joined #ruby
Bock has quit [Max SendQ exceeded]
moeabdol has joined #ruby
<emers2n> havenwood: awesome, I'll check that out. Thanks so much
tens0r has joined #ruby
<havenwood> emers2n: lemme think, gotta get those fallback times
pwnd_nsfw has joined #ruby
vuoto has joined #ruby
<emers2n> havenwood: Well now that I have that I can just loop through from the start date and if null is encountered it is set to the previous date's vale
<emers2n> value*
<havenwood> emers2n: yeah, that's true
pwnd_nsfw` has quit [Ping timeout: 240 seconds]
Bock has joined #ruby
pwnd_nsfw` has joined #ruby
milardovich has joined #ruby
yabbes has joined #ruby
iMadper` has quit [Read error: Connection reset by peer]
pwnd_nsfw has quit [Ping timeout: 246 seconds]
mim1k has joined #ruby
milardovich has quit [Ping timeout: 260 seconds]
mtkd has quit [Ping timeout: 255 seconds]
mtkd has joined #ruby
P_R_Deltoid has quit [Quit: Leaving]
ana_ has joined #ruby
roshanavand has joined #ruby
leandrobighetti has joined #ruby
rabajaj has joined #ruby
TomyLobo3 has joined #ruby
leandrobighetti has quit [Ping timeout: 240 seconds]
tvw has joined #ruby
govg has quit [Ping timeout: 240 seconds]
BrokenBard has joined #ruby
BrokenBard has left #ruby ["Leaving"]
govg has joined #ruby
tildes has quit [Ping timeout: 260 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
carnegie_ has joined #ruby
TomyLobo3 has quit [Ping timeout: 240 seconds]
vuoto has quit [Remote host closed the connection]
carnegie_ has quit [Ping timeout: 276 seconds]
andikr has joined #ruby
wilbert has quit [Ping timeout: 260 seconds]
tildes has joined #ruby
rahult has joined #ruby
worknick has quit [Ping timeout: 240 seconds]
rahult_ has joined #ruby
rahult has quit [Read error: Connection reset by peer]
ChewCraft has quit [Ping timeout: 240 seconds]
code_zombie has quit [Ping timeout: 246 seconds]
tvw has quit []
paradisaeidae has quit [Quit: ChatZilla 0.9.93 [Firefox 54.0.1/20170628145605]]
paradisaeidae_ has quit [Quit: ChatZilla 0.9.93 [Firefox 54.0.1/20170628145605]]
rahult_ has quit [Client Quit]
tildes has quit [Remote host closed the connection]
vali has joined #ruby
ledestin has joined #ruby
dcunit3d has joined #ruby
troys is now known as troys_
milardovich has joined #ruby
conta has joined #ruby
FahmeF has joined #ruby
troys_ is now known as troys
djbkd has joined #ruby
rahult has joined #ruby
milardovich has quit [Ping timeout: 260 seconds]
ana_ has quit [Quit: Leaving]
ana_ has joined #ruby
ltem has joined #ruby
vindvaki has joined #ruby
moeabdol has quit [Quit: WeeChat 1.9]
troys has quit [Ping timeout: 240 seconds]
rahult has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
moeabdol has joined #ruby
jackjackdripper has joined #ruby
djbkd has quit []
nofxxx has joined #ruby
bronson has joined #ruby
TvL2386_ has joined #ruby
nofxxxx has quit [Ping timeout: 260 seconds]
Silthias1 has joined #ruby
Silthias has quit [Read error: Connection reset by peer]
TvL2386 has quit [Ping timeout: 240 seconds]
Trynemjoel has joined #ruby
tfitts has joined #ruby
bronson has quit [Ping timeout: 255 seconds]
SenpaiSilver has joined #ruby
minimalism has quit [Quit: minimalism]
mim1k has quit [Ping timeout: 255 seconds]
leandrobighetti has joined #ruby
mark_66 has joined #ruby
ramfjord has joined #ruby
Trynemjoel has quit [Ping timeout: 276 seconds]
ramfjord has quit [Ping timeout: 255 seconds]
ur5us has joined #ruby
govg has quit [Ping timeout: 260 seconds]
Trynemjoel has joined #ruby
govg has joined #ruby
benjen has quit [Ping timeout: 260 seconds]
swills has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
benjen has joined #ruby
govg has quit [Ping timeout: 246 seconds]
govg has joined #ruby
cptAngry has joined #ruby
kkiero has joined #ruby
mikecmpbll has joined #ruby
domgetter has joined #ruby
lamppid has joined #ruby
workmad3 has joined #ruby
nunchuck has quit [Ping timeout: 240 seconds]
bambanx has joined #ruby
carnegie has joined #ruby
baroquebobcat has joined #ruby
marr has joined #ruby
DoubleMalt has joined #ruby
carnegie has quit [Ping timeout: 246 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bambanx has quit [Quit: Leaving]
antgel_ has joined #ruby
dionysus69 has joined #ruby
tens0r has quit [Quit: tens0r]
duderonomy has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
sysvalve has joined #ruby
TomyWork has joined #ruby
mim1k has joined #ruby
duderonomy has quit [Client Quit]
bronson has joined #ruby
ByronJohnson has quit [Ping timeout: 276 seconds]
<dminuoso> >> *{a:1}
<ruby[bot]> dminuoso: # => /tmp/execpad-d627da89a4e6/source-d627da89a4e6:2: syntax error, unexpected '\n', expecting &. or :: o ...check link for more (https://eval.in/841016)
<dminuoso> >> a = *{a:1}
<ruby[bot]> dminuoso: # => [[:a, 1]] (https://eval.in/841017)
ByronJohnson has joined #ruby
Ishido has quit [Ping timeout: 260 seconds]
<dminuoso> Okay, so splatarray ends up calling to_a
<dminuoso> >> class Hash; def to_a; raise "NO"; end; end; a = *{a:1}
<ruby[bot]> dminuoso: # => NO (RuntimeError) ...check link for more (https://eval.in/841018)
Ishido has joined #ruby
segy has joined #ruby
<dminuoso> module Enumerable; def first; head, *rest = *self; return head; end; end # apeiros, there - without #each. We don't need the block return behavior as just proven! :P
bronson has quit [Ping timeout: 240 seconds]
hutch34 has joined #ruby
charliesome has joined #ruby
Ishido has quit [Ping timeout: 246 seconds]
Derperperd has joined #ruby
enterprisey has quit [Remote host closed the connection]
ChewCraft has joined #ruby
hutch34 has quit [Ping timeout: 255 seconds]
Beams has joined #ruby
claw has quit [Ping timeout: 255 seconds]
simmaniac has joined #ruby
Ishido has joined #ruby
DTZUZO has quit [Ping timeout: 255 seconds]
aupadhye has joined #ruby
sysvalve has quit [Ping timeout: 248 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cabotto has joined #ruby
FahmeF has quit [Ping timeout: 240 seconds]
ianfleeton has joined #ruby
postmodern has quit [Quit: Leaving]
claw has joined #ruby
bane_ has joined #ruby
benlieb has quit [Quit: benlieb]
algun has quit [Quit: algun]
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
anisha has quit [Read error: Connection reset by peer]
anisha has joined #ruby
claw has quit [Ping timeout: 255 seconds]
FahmeF has joined #ruby
alex`` has joined #ruby
milardovich has joined #ruby
claw has joined #ruby
lel has quit [Ping timeout: 240 seconds]
yabbes has quit [Ping timeout: 255 seconds]
lel has joined #ruby
milardovich has quit [Ping timeout: 260 seconds]
cabotto is now known as cabotto_
cabotto_ is now known as cabotto
bronson has joined #ruby
cabotto has quit []
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
bronson has quit [Ping timeout: 268 seconds]
ramfjord has joined #ruby
<rapha> baweaver: cool, thanks for the alternative solution! :)
kkiero has left #ruby [#ruby]
ramfjord has quit [Ping timeout: 268 seconds]
yabbes has joined #ruby
emers2n has quit [Ping timeout: 260 seconds]
carnegie has joined #ruby
anisha has quit [Ping timeout: 240 seconds]
anisha has joined #ruby
Papierkorb has joined #ruby
carnegie has quit [Ping timeout: 276 seconds]
umaaji has quit [Ping timeout: 248 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tvw has joined #ruby
jameser has joined #ruby
tens0r has joined #ruby
nunchuck has joined #ruby
sepp2k has joined #ruby
ujjain has quit [Quit: ZNC - 1.6.0 - http://znc.in]
mikecmpbll has quit [Quit: inabit. zz.]
mikecmpbll has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
bane_ has quit [Quit: Konversation terminated!]
jaruga has joined #ruby
mikecmpb_ has joined #ruby
mikecmpbll has quit [Ping timeout: 246 seconds]
bronson has joined #ruby
LyndsySimon has quit [Ping timeout: 246 seconds]
LyndsySimon has joined #ruby
romankapitonov has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
FahmeF has quit [Remote host closed the connection]
Ishido has quit [Ping timeout: 255 seconds]
FahmeF has joined #ruby
cabotto has joined #ruby
carnegie has joined #ruby
ujjain has joined #ruby
ujjain has joined #ruby
ujjain has quit [Changing host]
charles81_ has quit [Ping timeout: 246 seconds]
carnegie has quit [Ping timeout: 258 seconds]
ur5us has quit [Remote host closed the connection]
charles81_ has joined #ruby
meinside has joined #ruby
Takumo has joined #ruby
<Terens> hello
<Terens> which is a good lightweight document database to use?
cabotto has quit [Remote host closed the connection]
<Papierkorb> Postgres with JSONB columns.
<dminuoso> ^-
anisha has quit [Quit: Leaving]
<Papierkorb> Terens: Also, use Sequel as ORM.
<Terens> hm
<dminuoso> You're such a sequel fanboy.
<dminuoso> someone needs to take your toys away
<Terens> I want it for a ruby app to store some configuration. But since it might be schemaless I dont want sql
<dminuoso> Terens: Toss it into yaml.
<dminuoso> That's what everyone and their mothers do.
<Terens> I have postgresql so it might work
<Papierkorb> dminuoso: It's just a darn solid ORM.
<dminuoso> Papierkorb: See?!
<ljarvis> I have been spoiled by Ecto (the elixir ORM)
<ljarvis> it's a thing of beauty
<dminuoso> ljarvis: Yeah it really is.
<dminuoso> ljarvis: I've properly started with elixir, the experience has been a blast.
cabotto has joined #ruby
<ljarvis> yeah it's great
<ljarvis> the true power really lies in otp imo :)
<dminuoso> ljarvis: Oh yes! Free CORBA for the world!
DTZUZO has joined #ruby
chouhoulis has joined #ruby
anisha has joined #ruby
phinxy has joined #ruby
phinxy has quit [Max SendQ exceeded]
bronson has joined #ruby
dcunit3d has quit [Ping timeout: 240 seconds]
anisha has quit [Read error: Connection reset by peer]
anisha has joined #ruby
dennisvennink has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
ramfjord has joined #ruby
phinxy has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
ramfjord has quit [Ping timeout: 246 seconds]
ldnunes has joined #ruby
tacoboy has joined #ruby
cabotto has quit [Remote host closed the connection]
nickjj has quit [Read error: Connection reset by peer]
moeabdol has quit [Quit: WeeChat 1.9]
milardovich has joined #ruby
cabotto has joined #ruby
ar1arelaybot111 has quit [Remote host closed the connection]
ioquatix has joined #ruby
moeabdol has joined #ruby
Neo__ has quit [Quit: Leaving]
BSAlb has joined #ruby
tens0r has quit [Quit: tens0r]
pskosinski has quit [Quit: No Ping reply in 180 seconds.]
InfinityFye has joined #ruby
millerti has joined #ruby
BSaboia has quit [Ping timeout: 246 seconds]
aupadhye has quit [Quit: Leaving]
aupadhye has joined #ruby
chouhoulis has quit [Remote host closed the connection]
pskosinski has joined #ruby
pskosinski is now known as Guest76729
yabbes has quit [Ping timeout: 260 seconds]
ianfleeton has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
baroquebobcat has joined #ruby
synthroid has joined #ruby
blznblzn2 has quit [Remote host closed the connection]
baroquebobcat has quit [Client Quit]
noe_ has joined #ruby
nickjj has joined #ruby
baroquebobcat has joined #ruby
baroquebobcat has quit [Client Quit]
__Yiota has joined #ruby
carnegie has joined #ruby
ianfleeton has joined #ruby
carnegie has quit [Ping timeout: 246 seconds]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bronson has joined #ruby
anisha has quit [Read error: Connection reset by peer]
anisha has joined #ruby
hutch34 has joined #ruby
bronson has quit [Ping timeout: 255 seconds]
chouhoulis has joined #ruby
HoierM has joined #ruby
tacoboy has quit [Read error: Connection reset by peer]
hutch34 has quit [Ping timeout: 258 seconds]
tens0r has joined #ruby
hogetaro has joined #ruby
ur5us has joined #ruby
DoubleMalt has quit [Quit: Leaving]
ianfleeton has quit [Ping timeout: 255 seconds]
tens0r has quit [Client Quit]
govg has quit [Ping timeout: 255 seconds]
marr has quit [Ping timeout: 268 seconds]
ur5us has quit [Ping timeout: 240 seconds]
jrafanie has joined #ruby
Radeds has joined #ruby
<Radeds> Hi everyone,
<Radeds> I know I can use methods_missing with normal arguments like so : method_missing(method_name, *args, &block)
<Radeds> If I wish to use keyword arguments, I have to the double splatter instead like so : method_missing, **args, &block)
<Radeds> What happens if my methods passes both normal and keyword arguments? I can't find the proper way to trigger public_send so both will work.
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ramfjord has joined #ruby
__Yiota has joined #ruby
jdawgaz has joined #ruby
<dminuoso> Radeds: def foo(mname, *args, **kwargs, &callable)
vali has quit [Quit: vali]
tens0r has joined #ruby
chouhoulis has quit [Remote host closed the connection]
<Radeds> dminuoso: Oh, I didn't know you can pass them both like way. How can I handle it on public_send method then? it also can get both as parameters?
ramfjord has quit [Ping timeout: 240 seconds]
elsevero has joined #ruby
<dminuoso> >> def foo(name, *args, **kwargs); [name, args, kwargs] end; public_send(:foo, 1, {a:1}, foo: 4) # Radeds
<ruby[bot]> dminuoso: # => private method `foo' called for main:Object ...check link for more (https://eval.in/841149)
lipoqil_ has joined #ruby
lipoqil_ has quit [Client Quit]
<dminuoso> DIAF.
<dminuoso> >> def piyo(name, *args, **kwargs); [name, args, kwargs] end; public_send(:piyo, 1, {a:1}, foo: 4) # Radeds
<ruby[bot]> dminuoso: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<dminuoso> Die even more.
<dminuoso> >> def piyo(name, *args, **kwargs); [name, args, kwargs] end; public_send(:piyo, 1, {a:1}, foo: 4) # Radeds
<ruby[bot]> dminuoso: # => private method `piyo' called for main:Object (NoMethodError) ...check link for more (https://eval.in/841150)
<dminuoso> Sigh.
<dminuoso> >> def piyo(name, *args, **kwargs); [name, args, kwargs] end; send(:piyo, 1, {a:1}, foo: 4) # Radeds
<dminuoso> => [1, [{:a=>1}], {:foo=>4}]
<dminuoso> Since ruby[bot] is being particularly hateful.
ioquatix has quit [Quit: ioquatix]
<dminuoso> Radeds: Basically a hash at the end or kwargs are automatically bound to specified kwargs, the rest just follow normal pattern matching.
imperator has joined #ruby
<Radeds> dminuoso: But what do I do if I want to match it with method_missing? this I guess won't work:
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso> >> def method_missing(name, *args, **kwargs); p [name, args, kwargs] end; public_send(:nope, 1, {foo: 4}, a:2) # Radeds
<Radeds> def method_missing(method_name, *args, **kwargs, &block); MyObject.new.public_send(method_name, *args, **kwargs) end;
<ruby[bot]> dminuoso: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<dminuoso> SIGH.
<Radeds> :)
<dminuoso> => [:nope, [1, {:foo=>4}], {:a=>2}]
<dminuoso> So yeah, even that works.
<Radeds> dminuoso: Going to on pry, brb :)
<dminuoso> Radeds: Ohh, I see what you are on about
<dminuoso> &ri Delegator Radeds
ramfjord has joined #ruby
rgtk has joined #ruby
rabajaj has quit [Quit: Leaving]
vondruch has quit [Ping timeout: 240 seconds]
<dminuoso> Radeds: Delegator.
ramfjord has quit [Ping timeout: 240 seconds]
<Radeds> Oh, sorry. I missed your previous comment. Checking...
imperator has left #ruby ["Leaving"]
<dminuoso> Radeds: Though that code would work if you splat args and kwargs.
<Radeds> dminuoso: The delgate class you mentioned seems like another way to implment the delegate: method from Rails?
<Radeds> dminuoso: Aren't those already splat (method declration?)
<dminuoso> Radeds: they do different things
<ineb> API.public_send(method_name, *args, **kwargs, &block)
hoangtg has quit [Remote host closed the connection]
<dminuoso> ineb: the second star at kwargs is not necessary.
carnegie has joined #ruby
bruno- has quit [Ping timeout: 240 seconds]
<dminuoso> or neither star in fact.
<dminuoso> Radeds: in the parameter list a single splat *foo means "put rest args into an array named foo", and **bar means "put kwargs into a hash named bar".
<dminuoso> Radeds: So you need to splat that rest args array back.
<Radeds> dminuoso: how can I splat it back?
howdoi has quit [Quit: Connection closed for inactivity]
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso> Radeds: API.public_send(method_name, *args, kwargs, &block)
<dminuoso> Radeds: But really just use delegator :P
tens0r has quit [Quit: tens0r]
<ineb> dminuoso: no star on kwargs works, but not one star
<dminuoso> ineb: Mmm, one star turns it into an array right.
<dminuoso> And the second splats that array of a single element back...
<dminuoso> So... :D
carnegie has quit [Ping timeout: 246 seconds]
jdawgaz has joined #ruby
bronson has joined #ruby
InfinityFye has quit [Quit: Leaving]
<Radeds> dminuoso: yea, I probably just delegate it like you mentioned. It's much more elegent. It will require some refactoring, for now I will try using what you mentioned. Will test it on pry soon:
<Radeds> Should use that &block as I'm not using it.
<ineb> not until you use it :))
<Radeds> True :P
jameser has joined #ruby
apparition47 has joined #ruby
bronson has quit [Ping timeout: 260 seconds]
cabotto has quit []
<Radeds> Ermm, I think I found a case that will not work... https://gist.github.com/anonymous/c7c2febbbdd1c0c4b7e9ac1c4a28e7a4
<Radeds> I'm guessing it's splating the hash and method_missing can't find a keyword argument called 'c'.
<ineb> Radeds: a is missing in your example call
<Radeds> ineb: why? my a is number argument. I'm passing Hash.
<Radeds> number = normal.
<Radeds> It just splat the hash, so it thinkg I'm trying to access a keyword parameter call c which does not exists on the method.
kkiero has joined #ruby
<Radeds> I probably need to sit down and refactor it. I was just looking for a quick-hack until I do it. Seems like it's not possible to handle both cases.
bruno- has joined #ruby
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
spheric has joined #ruby
synthroi_ has joined #ruby
<ineb> ohh yes. hmm youre right
<ineb> but it works here
<ineb> your code. i get {:c=>"d"} and b as parameters
__Yiota has joined #ruby
<matthewd> Don't use kwsplat if you don't need it
DLSteve_ has quit [Quit: All rise, the honorable DLSteve has left the channel.]
synthroid has quit [Ping timeout: 246 seconds]
haylon has joined #ruby
<Radeds> ineb: strange. I'm getting `unknown keyword: c`
<Radeds> Let me try another ruby version.
mim1k has quit [Ping timeout: 260 seconds]
mim1k has joined #ruby
<havenwood> Radeds: This is a Symbol not a String: 'c':
<havenwood> Radeds: This is a String: 'c' =>
<havenwood> >> {'c': 'a symbol key'}.keys.first
<ruby[bot]> havenwood: # => :c (https://eval.in/841164)
<havenwood> Radeds: If you mean it to be a Symbol, just write: c:
<Radeds> havenwood: yes, your right.
cptAngry has quit [Quit: KVIrc 4.9.1 Aria http://www.kvirc.net/]
carnegie has joined #ruby
cadillac_ has joined #ruby
BSAlb has quit [Quit: Leaving]
dcunit3d has joined #ruby
<Radeds> Is there a way to add argument that is not passed by method_missing? something like so: https://gist.github.com/anonymous/024dd59e4c860af3dd550ac57213e01d
<Radeds> As I can evaluate c inside method missing? perhaps adding it to the kwargs?
DLSteve has joined #ruby
<ineb> Radeds: yes, but no you have to do **kwargs again API.public_send(method_name, *args, **kwargs, c: 'hello')
kkiero has left #ruby [#ruby]
<ineb> however, its getting messy and delegator solves all your problems.. so yeah.
banisterfiend has joined #ruby
<Radeds> Ermm, how would you do the above with delegation?
FahmeF has quit []
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ineb> by just doing it.
<ineb> wait
jrafanie has joined #ruby
haylon has quit [Read error: Connection reset by peer]
<ineb> Radeds: here https://paste.xinu.at/0iTb/
haylon has joined #ruby
tomphp has joined #ruby
Rapture has joined #ruby
Neo95 has joined #ruby
mtkd has quit [Ping timeout: 255 seconds]
mtkd has joined #ruby
hutch34 has joined #ruby
InfinityFye has joined #ruby
<Radeds> ineb: ok, I see what you mean. What I'm trying to do is to create a flate API, that's why I'm using method_missing. Let me write it down.
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mim1k has quit [Ping timeout: 246 seconds]
dangerousdave has joined #ruby
ResidentBiscuit has joined #ruby
mim1k has joined #ruby
nadir has joined #ruby
<ineb> i go out now bye bye
haylon has quit [Remote host closed the connection]
TvL2386_ is now known as TvL2386
jrafanie has joined #ruby
Derperperd has quit [Changing host]
Derperperd has joined #ruby
PaulCapestany has quit [Quit: .]
ramfjord has joined #ruby
<Radeds> ineb: thanks bye bye! :)
PaulCapestany has joined #ruby
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jdeen_ has quit [Remote host closed the connection]
opekktar has joined #ruby
ramfjord has quit [Ping timeout: 255 seconds]
banisterfiend has joined #ruby
chouhoulis has joined #ruby
polishdub has joined #ruby
Terens has quit [Ping timeout: 248 seconds]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dionysus69 has quit [Ping timeout: 276 seconds]
baroquebobcat has joined #ruby
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
npgm has quit [Quit: Connection closed for inactivity]
ana_ has quit [Ping timeout: 268 seconds]
pwnd_nsfw` is now known as pwnd_nsfw
jrafanie has joined #ruby
alex`` has quit [Ping timeout: 246 seconds]
jinie_ has quit [Ping timeout: 276 seconds]
alex`` has joined #ruby
guacamole has joined #ruby
jinie_ has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
dangerousdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dangerousdave has joined #ruby
dangerousdave has quit [Client Quit]
guacamole has quit [Client Quit]
antgel_ has quit [Ping timeout: 260 seconds]
ryzokuken has joined #ruby
ams__ has joined #ruby
synthroi_ has quit [Remote host closed the connection]
moei has quit [Quit: Leaving...]
synthroid has joined #ruby
moei has joined #ruby
FahmeF has joined #ruby
voltai[m] has left #ruby ["User left"]
djbkd has joined #ruby
guacamole has joined #ruby
maryo_ has joined #ruby
djbkd has quit [Client Quit]
TomyWork has quit [Ping timeout: 240 seconds]
[Butch] has joined #ruby
marr has joined #ruby
high_fiver has joined #ruby
apparition47 has quit [Quit: Bye]
maryo_ has quit [Ping timeout: 240 seconds]
cam27 has joined #ruby
Dimik has joined #ruby
ltem has quit [Quit: Leaving]
creaked has quit [Remote host closed the connection]
bronson has joined #ruby
nacsurte has joined #ruby
InfinityFye has quit [Read error: Connection reset by peer]
banisterfiend has joined #ruby
t-recx has joined #ruby
yabbes_ has joined #ruby
creaked has joined #ruby
andikr has quit [Remote host closed the connection]
elsevero has quit [Ping timeout: 276 seconds]
bronson has quit [Ping timeout: 240 seconds]
conta has quit [Ping timeout: 268 seconds]
stephenh has quit [Ping timeout: 240 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maryo has joined #ruby
stephenh has joined #ruby
nobitanobi has joined #ruby
swills has quit [Remote host closed the connection]
swills has joined #ruby
brent__ has joined #ruby
banisterfiend has quit [Quit: Textual IRC Client: www.textualapp.com]
creaked has quit [Quit: Lost terminal]
maryo has quit [Ping timeout: 255 seconds]
cagomez has joined #ruby
sgen has quit [Quit: Leaving]
mark_66 has quit [Remote host closed the connection]
GinoMan has joined #ruby
rippa has joined #ruby
hoangtg has joined #ruby
juandavidcowboy has joined #ruby
simmaniac has quit [Quit: Leaving]
naprimer2 has joined #ruby
ltem has joined #ruby
amclain has joined #ruby
naprimer has quit [Ping timeout: 268 seconds]
dionysus69 has joined #ruby
tomphp has joined #ruby
cpruitt has joined #ruby
cpruitt has quit [Client Quit]
TomyLobo3 has joined #ruby
cagomez has quit [Ping timeout: 260 seconds]
tacoboy has joined #ruby
leandrobighetti has quit []
gusrub has joined #ruby
airdisa has joined #ruby
cagomez has joined #ruby
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
carnegie has quit [Remote host closed the connection]
cagomez_ has joined #ruby
carnegie has joined #ruby
mim1k has quit [Ping timeout: 260 seconds]
cagomez has quit [Ping timeout: 276 seconds]
duderonomy has joined #ruby
carnegie has quit [Ping timeout: 246 seconds]
rgtk has quit [Ping timeout: 260 seconds]
vindvaki has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dstrunk has joined #ruby
conta has joined #ruby
mikecmpb_ has quit [Ping timeout: 240 seconds]
Dimik has quit [Ping timeout: 260 seconds]
impermanence has joined #ruby
<impermanence> Say X is a class with a method new that has params. And I do Y = X.new(:value1, :value2, ...)
<impermanence> and then I have a module such that
tildes has joined #ruby
<impermanence> module Z has a method self.something that creates a new instance of Y(value1: 123, value2: "hi", ...)
<impermanence> how would I access the values of value1, value2, etc.?
tildes has quit [Client Quit]
<matthewd> Huh? :/
conta has quit [Ping timeout: 240 seconds]
sneakerhax has quit [Ping timeout: 246 seconds]
<impermanence> yeah, that was poor. I tried to say it instead of gist it. sorry :(
CrazyEddy has quit [Remote host closed the connection]
<impermanence> Let me try it another way
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<impermanence> If a new object is created such that its parameters are individual hash values i.e. val1: 12, val2: 'hi', etc.
jackjackdripper has joined #ruby
<impermanence> how can I access that object's hash values?
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewd> That doesn't really sound like a thing. An object doesn't have parameters, and doesn't have hash values.
<eam> impermanence: do you have a background in perl?
jackjackdripper1 has joined #ruby
jackjackdripper has quit [Read error: Connection reset by peer]
<impermanence> matthewd: sorry, attributes :)
<eam> in perl, ivars are typically stored in a hash in the object instance
<impermanence> matthew: the object's attributes are like val1: value1, val2: value2
<impermanence> Is that a thing?
<matthewd> Nope. Do you have some more-real code we can relate to?
<eam> impermanence: you may be looking for instance_variable_get / set
<matthewd> (either in not-yet-working ruby, or in some other language)
<impermanence> matthewd: yeah. I'll spin something up.
<eam> the ivar symbol table is essentially the same thing as a blessed hashref in a perl object
cagomez_ has quit [Ping timeout: 240 seconds]
cahoots has joined #ruby
hutch34 has quit [Ping timeout: 246 seconds]
eckhardt has joined #ruby
<impermanence> not good, but close...admittedly there is stuff left out...
dgarstang has joined #ruby
<dgarstang> In rake, how would I invoke a task in the format namespace::job[args] ?
wilbert has joined #ruby
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewd> impermanence: Is MyClass actually Struct here?
<impermanence> matthewd: it is :)
<matthewd> dgarstang: `rake namespace:job[foo]` I think?
benlieb has joined #ruby
<matthewd> impermanence: Okay, so the question is "how do I use Struct"
<impermanence> matthewd: behh...I guess...
<dgarstang> matthewd: From inside the Rakefile tho
<matthewd> impermanence: value1 is a method on the instance returned by MyOtherClass.new
<impermanence> matthewd: okay
<dgarstang> matthewd: My rakefile is loading a list of tasks to build from a yaml file, and I need to execute each as if called from the command line
<dgarstang> matthewd ... except, they're being called from inside the Rakefile. Some sort of eval and invoke combo?
cahoots has quit [Ping timeout: 276 seconds]
cahoots has joined #ruby
<matthewd> dgarstang: Rake::Task["namespace:job"].invoke("foo") ?
ryzokuken has quit [Remote host closed the connection]
<dgarstang> matthewd: What's foo in this case if job is the job?
<matthewd> impermanence: But yeah, this is a behaviour of Struct, not some general concept
<matthewd> dgarstang: The argument(s)
ryzokuken has joined #ruby
tryfan has joined #ruby
<dgarstang> matthewd: but it's being read as a single string, as if executed from the command line, in the format ns:job[args]
<dgarstang> matthewd: so, I guess Rake needs to call itself
cagomez has joined #ruby
<matthewd> Rake.application.invoke_task("ns:job[args]") then maybe?
<dgarstang> matthewd: I don't want to split the arguments out and parse as I want to keep generic in case the args change
<tryfan> not a dev, and I'm trying to figure out a problem with a ruby script. I'm hitting a 120s delay on the first write to a log, using logging 1.8.2. is there any way I can debug the call to that class?
<matthewd> I'm just googling and reading this off stackoverflow ¯\_(ツ)_/¯
cagomez has quit [Read error: Connection reset by peer]
carnegie has joined #ruby
cagomez has joined #ruby
carnegie has quit [Remote host closed the connection]
<matthewd> tryfan: Easiest is probably to open the method you're calling and add some tracing (`puts`)
<tryfan> matthewd: so I'm on the right track then
<dgarstang> matthewd: That was it, thanks
carnegie has joined #ruby
<tryfan> I did that from the origination point, but nothing delays until the first logger.info call
Guest14429 has quit [Changing host]
Guest14429 has joined #ruby
Guest14429 is now known as Kestrel-029
t-recx has quit [Read error: Connection reset by peer]
<matthewd> tryfan: Right, so you can just keep going deeper; the library is all just ruby code (probably, but almost certainly), so there's no need to stop at the edge of the application boundary
cagomez_ has joined #ruby
<dgarstang> matthewd: ok, sort of worked, it seems that the Rakefile just stops after the first job
<matthewd> tryfan: Totally uninformed guess would be that's a network timeout, though, so I'd probably go looking for any configuration on where it's supposed to be sending those logs before I got too far in the weeds
<matthewd> ?xy dgarstang
<ruby[bot]> dgarstang: it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
<tryfan> matthewd: it's sending them to my home directory, and perms are good
<matthewd> dgarstang: (just maybe..) but maybe we can help with a higher level discussion of your goal
carnegie has quit [Ping timeout: 276 seconds]
<dgarstang> matthewd: So, basically if the jobs are loaded from a yaml file, and with projects['projects'].each do |p| Rake.application.invoke_task(p) end... the first one runs fine but the second does not
kies has joined #ruby
<dgarstang> matthewd: It doesn't even try and execute the 2nd one, it just stops. If I replace the rake command with a simple puts(p) it shows both jobs
Rr4sT has joined #ruby
cagomez has quit [Ping timeout: 276 seconds]
<dgarstang> So, it seems like when you use Rake.application.invoke_task(), execute doesn't return to the point it left off after it's finished
cagomez_ has quit [Ping timeout: 260 seconds]
howdoi has joined #ruby
hutch34 has joined #ruby
milardovich has quit [Read error: Connection reset by peer]
<dgarstang> matthewd: Yes?
<matthewd> dgarstang: I guess I'd start by checking whether that's invoke_task, or something about the particular task you're calling
<dgarstang> hm maybe it does
<dgarstang> matthewd: Ok, so the loop is executing twice. The second task returns an error but none of that output is displayed
MarkBilk_ has joined #ruby
<dgarstang> matthewd: ie If I run the task through rake, it shows errors, if it's run via the invoke, no output is shown. Weird
<tryfan> matthewd: does seem to be outputting anything when I place puts in the various methods in the logger
<tryfan> matthewd: doesn't, rather
Kestrel-029 has quit [Read error: Connection reset by peer]
<dgarstang> matthewd: ok if I call the same task twice, ie a working one twice, same thing. Output is shown for the first one , but no output is shown for the 2nd one. I know its executing both because I put a puts statement after each in the loop
<matthewd> dgarstang: Does invoke just return the output / something, instead of writing directly, maybe?
<dgarstang> jeez I dunno
<matthewd> dgarstang: Okay that's a different thing: rake tasks run once by design
jrafanie has quit [Quit: Textual IRC Client: www.textualapp.com]
<dgarstang> matthewd: Ok, so.. what if it's the same task with different arguments?
<matthewd> dgarstang: Are you sure you actually want to do this? Where's the yaml file coming from?
<dgarstang> Won't that run twice?
<matthewd> dgarstang: Same task, AFAIK
<dgarstang> matthewd: The yaml file has a list of projects to build
MarkBilk has quit [Ping timeout: 246 seconds]
<dgarstang> matthewd: Ok, what's the right way to do this? How do you have a Rakefile iterate over a list of projects, and be able to build one or all depending on how it's called?
<matthewd> tryfan: Might need to explicitly use $stderr.puts or $stdout.puts -- possible the logger object has its own puts defined that's going elsewhere (e.g. the log)
<matthewd> dgarstang: I guess the easy option would be to run rake in a subprocess for each one
<dgarstang> If rake only ever executes a task once inside a Rakefile, I don't see how a Rakefile could build for multiple projects if the tasks are the same, but the args differ. This must be a common problem
<dgarstang> matthewd: you mean drive it from a script, which defeats the purpose of Rake
<dgarstang> or a second Rakefile, which I presume can call the other, seems hacky
<matthewd> I don't remember the last time I saw a rake task that took an argument, so...
baroquebobcat has joined #ruby
<dgarstang> matthewd: There's a bazillion examples of rake tasks taking arguments
milardovich has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tsul has quit [Ping timeout: 240 seconds]
<matthewd> Maybe I've just been looking in the wrong places, then
davidmichaelkarr has quit [Quit: Connection closed for inactivity]
<matthewd> I know it's *possible* -- I'm speaking to real-world usage, leading into "must be a common problem"
<matthewd> dgarstang: In other words: it sounds like your rakefile structure is unusual... "how a Rakefile could build for multiple projects if the tasks are the same, but the args differ" - I can vaguely picture what that might look like, but it doesn't sound like an everyday rakefile to me
tsul has joined #ruby
milardovich has quit [Ping timeout: 276 seconds]
bronson has joined #ruby
<dgarstang> matthewd: Build for a single project, with args, no problem. Building for ALL the projects, if so desired, how?
cagomez has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
cagomez has joined #ruby
<dgarstang> matthewd: or, put anothe way, if you want to build for multiple projects, what drives that?
<dgarstang> matthewd: Stick the call to rake inside a shell script that iterates over them?
SeepingN has joined #ruby
<matthewd> I'd normally expect a rakefile to exist within a project, so.. probably?
ltem has quit [Quit: Leaving]
bronson has quit [Ping timeout: 246 seconds]
<dgarstang> matthewd: I wanted to have the ability to build specific projects if needed, and also the ability to build multiple based off a list. I don't want to build all in case there's an issue and it blocks everything else
<dgarstang> some idiot checks in something that breaks, ok, remove their project from the build list
AxelAlex has joined #ruby
<matthewd> Using the same rake tasks? Yeah, that just sounds measurably different from how I'd expect a thing to work.
<dgarstang> matthewd: Different rake tasks, same Rakefile
aupadhye has quit [Ping timeout: 260 seconds]
vuoto has joined #ruby
mikecmpbll has joined #ruby
romankapitonov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Beams has quit [Quit: .]
cagomez has quit [Ping timeout: 240 seconds]
lungi has joined #ruby
<lungi> hey anyone around?
<lungi> i hope this is a good place to ask rexml question...
imajes has joined #ruby
<lungi> i want to add xsl stylesheet to my xml file was looking for a REXML function to do so. I know nokogiri has a similar function http://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/ProcessingInstruction
<lungi> i would like to add the following line to my xml file using rexml:
andrzejk_ has joined #ruby
<lungi> <?xml-stylesheet type="text/xsl" href="junit.xsl"?>
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch34 has quit [Quit: WeeChat 1.5]
t-recx has joined #ruby
jaruga has quit [Quit: jaruga]
<matthewd> lungi: https://ruby-doc.org/stdlib-2.2.2/libdoc/rexml/rdoc/REXML/Instruction.html seems to be the relevant class.. but REXML is not generally a popular choice these days
<lungi> matthewd thank you so much! i know nokogiri is becoming more of a standard now but its just takes too long to install and rexml can do everything i want to
tvw has quit []
ahrs has quit [Remote host closed the connection]
ahrs has joined #ruby
xuanrui has quit [Ping timeout: 276 seconds]
duderonomy has joined #ruby
kobain has joined #ruby
gusrub has quit [Remote host closed the connection]
gusrub has joined #ruby
t-recx has quit [Ping timeout: 258 seconds]
carnegie has joined #ruby
t-recx has joined #ruby
guacamole has joined #ruby
gusrub has quit [Remote host closed the connection]
sneakerhax has joined #ruby
ams__ has quit [Quit: Connection closed for inactivity]
lungi has quit [Quit: Page closed]
romankapitonov has joined #ruby
ramfjord has joined #ruby
minimalism has joined #ruby
xuanrui has joined #ruby
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<impermanence> I've made some progress :)
<impermanence> but still a bit confused
<matthewd> impermanence: They're just methods
carnegie has quit [Remote host closed the connection]
<impermanence> matthewd: hm.
dgarstang has quit [Ping timeout: 246 seconds]
<matthewd> Struct.new(:foo, :bar) == Class.new { attr_accessor :foo, :bar } == Class.new { def foo @foo end; def foo=(v); @foo = v; end; def bar .. etc }
<apeiros> impermanence: `Thing.new(val1: 12, val2: "hey", val3: "hi")` does not do what you think it does
<apeiros> you want `Thing.new(12, "hey", "hi")`
<matthewd> Ohh, good catch apeiros
<apeiros> compare:
<apeiros> >> Thing = Struct.new(:val1, :val2, :val3); Thing.new(val1: 12, val2: "hey", val3: "hi")
carnegie has joined #ruby
<apeiros> god damit eval.in :(
<apeiros> well, manually then
<apeiros> » Thing = Struct.new(:val1, :val2, :val3); Thing.new(val1: 12, val2: "hey", val3: "hi") # => #<struct Thing val1={:val1=>12, :val2=>"hey", :val3=>"hi"}, val2=nil, val3=nil>
<ruby[bot]> apeiros: # => #<struct Thing val1={:val1=>12, :val2=>"hey", :val3=>"hi"}, val2=nil, val3=nil> (https://eval.in/841236)
<apeiros> oh, finally…
<matthewd> And if I'd included the initialize in my example, I would've seen it 🙈
<apeiros> >> Thing = Struct.new(:val1, :val2, :val3); Thing.new(12, "hey", "hi")
<ruby[bot]> apeiros: # => #<struct Thing val1=12, val2="hey", val3="hi"> (https://eval.in/841237)
<apeiros> matthewd: sometimes you lose, sometimes the others win… ;-)
bronson has joined #ruby
t-recx has quit [Ping timeout: 260 seconds]
amitchellbullard has joined #ruby
conta1 has joined #ruby
Dimik has joined #ruby
<impermanence> my question has become: if I had something like: things = [Thing1, Thing2, Thing3, ...] where things are structs, and a method like self.my_method(things) ...how can I access ThingN values from things? things.something...? I tried to be more specific in the gist.
t-recx has joined #ruby
carnegie has quit [Ping timeout: 255 seconds]
<matthewd> impermanence: `select` seems like you're on the right path
vee_ has quit [Ping timeout: 240 seconds]
minimalism has quit [Quit: minimalism]
Bock has quit [Ping timeout: 260 seconds]
conta1 has quit [Ping timeout: 246 seconds]
bronson has quit [Ping timeout: 276 seconds]
<impermanence> matthewd: my sense too, but in my select block: my_params.select { |x| x #something }... what syntax do I use to actually get at the Struct (methods) (values) whatever?
<matthewd> x.val1
<impermanence> matthewd: hm. I think I'm leaving something out then (which is my fault :) )
<matthewd> (I'm assuming you intend select here, and not map, say)
<impermanence> matthewd: yeah. I just need to return certain things from the array is all.
tomphp has joined #ruby
cabotto has joined #ruby
andrzejk_ has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
ltem has joined #ruby
guacamole has joined #ruby
normie1 has joined #ruby
dennisvennink has quit [Read error: Connection reset by peer]
dennisvennink has joined #ruby
jdawgaz has joined #ruby
anisha has quit [Quit: This computer has gone to sleep]
cabotto has quit [Remote host closed the connection]
cabotto has joined #ruby
minimalism has joined #ruby
Archrove- has quit [Changing host]
Archrove- has joined #ruby
ryzokuken has quit [Quit: Leaving]
cabotto has quit [Ping timeout: 240 seconds]
vindvaki has joined #ruby
zapata has quit [Quit: WeeChat 1.9]
normie1 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
baroquebobcat has quit [Quit: baroquebobcat]
nobitanobi has quit [Remote host closed the connection]
nobitanobi has joined #ruby
Murda has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
carnegie has joined #ruby
nobitanobi has quit [Ping timeout: 258 seconds]
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NightMonkey has quit [Quit: ZNC - http://znc.in]
carnegie has quit [Ping timeout: 258 seconds]
NightMonkey has joined #ruby
gusrub has joined #ruby
guacamole has joined #ruby
Pierreb has joined #ruby
baroquebobcat has joined #ruby
benlieb has quit [Quit: benlieb]
kculpis has quit [Remote host closed the connection]
kculpis has joined #ruby
andrzejk_ has joined #ruby
kculpis has quit [Max SendQ exceeded]
kculpis has joined #ruby
vindvaki has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kculpis has quit [Max SendQ exceeded]
Rr4sT has quit [Quit: Connection closed for inactivity]
carnegie has joined #ruby
Mrgoose2 has joined #ruby
<Mrgoose2> Question, I have a hash of type #<Google::Protobuf::Any:0x00555a095af290> is there anyway I can see what the contents of that are?
<Mrgoose2> inspect doesnt seem to work
benlieb has joined #ruby
domgetter has quit [Ping timeout: 258 seconds]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andrzejk_ has quit [Quit: Textual IRC Client: www.textualapp.com]
Nicmavr has joined #ruby
normie1 has joined #ruby
gusrub has quit [Remote host closed the connection]
Nicmavr is now known as Guest21404
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
milardovich has joined #ruby
<havenwood> Mrgoose2: Google::Protobuf::Any.kind_of? Hash #=> false
<Mrgoose2> hmm
<havenwood> Mrgoose2: #to_h
<Mrgoose2> Familiar with decoding a grpc any message?
mikecmpb_ has joined #ruby
Murda has quit [Quit: Murda]
gusrub has joined #ruby
mikecmpbll has quit [Ping timeout: 240 seconds]
<havenwood> Mrgoose2: It inherits from Google::Protobuf::MessageExts, so you also get #to_json and #to_proto
<Mrgoose2> yea to_json gives me a type_url and a value
<Mrgoose2> where value is encoded
AxelAlex has quit [Quit: AxelAlex]
Guest21404 has quit [Changing host]
Guest21404 has joined #ruby
Guest21404 is now known as Kestrel-029
rabajaj has joined #ruby
nahra has quit [Remote host closed the connection]
nahra has joined #ruby
aclark has quit [Remote host closed the connection]
<impermanence> [#<SomeClass val1: number, val2: "string", val3: number>]
<impermanence> I have a method returning that
<impermanence> I thought it was a Struct, but now I'm unsure
<impermanence> is this a ruby structure?
<impermanence> It's an array with one entry of #<>
aclark has joined #ruby
gusrub has quit [Remote host closed the connection]
baroquebobcat has quit [Quit: baroquebobcat]
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gusrub has joined #ruby
gusrub has quit [Remote host closed the connection]
dcunit3d has quit [Ping timeout: 260 seconds]
gusrub has joined #ruby
Rapture has joined #ruby
thecommongeek has joined #ruby
cagomez has joined #ruby
<havenwood> impermanence: It's an instance of SomeCLass
eckhardt has joined #ruby
<havenwood> impermanence: Ask it
<havenwood> >> Class.new.is_a? Struct
<ruby[bot]> havenwood: # => false (https://eval.in/841252)
<havenwood> >> Class.new.instance_of? Struct
<ruby[bot]> havenwood: # => false (https://eval.in/841253)
<havenwood> >> SomeClass = Struct.new :x; SomeClass.new(42).is_a? Struct
dcunit3d has joined #ruby
<ruby[bot]> havenwood: # => true (https://eval.in/841255)
SenpaiSilver has quit [Read error: Connection reset by peer]
nopolitica has joined #ruby
nobitanobi has joined #ruby
guacamole has joined #ruby
SenpaiSilver has joined #ruby
<impermanence> havenwood: Indeed, it is a Value Object implementation and I am having the darndest time accessing its values, apparently because they're immutable but it's a bit baffling...
brent__ has quit [Remote host closed the connection]
<havenwood> impermanence: Look at it with Pry
<havenwood> ?pry impermanence
<ruby[bot]> c
<ruby[bot]> impermanence: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-do
<impermanence> I am trying :)
<impermanence> loving pry
<impermanence> use it everyday
code_zombie has joined #ruby
vuoto has quit [Remote host closed the connection]
vindvaki has joined #ruby
dcunit3d has quit [Ping timeout: 240 seconds]
carnegie has quit [Quit: Leaving...]
Mia has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
thecommongeek has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
__Yiota has joined #ruby
Dimik has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
naprimer2 has quit [Ping timeout: 240 seconds]
bsartek has joined #ruby
FahmeF has quit [Remote host closed the connection]
vee_ has joined #ruby
bsartek has quit [Client Quit]
normie1 has quit [Quit: Textual IRC Client: www.textualapp.com]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bronson has joined #ruby
dionysus69 has quit [Remote host closed the connection]
_sfiguser has joined #ruby
swills has quit [Remote host closed the connection]
<impermanence> Havenwood: any insight into how I might go about accessing [#<SomeClass val1: number, val2: "string", val3: number>]? When I try to do param.val1 say it complains (because I happen to know that the values of this data structure are immutable).
jdawgaz has joined #ruby
<havenwood> impermanence: How would getting the value mutate? What is the class? What methods are available?
bronson has quit [Ping timeout: 276 seconds]
milardovich has quit [Read error: Connection reset by peer]
milardovich has joined #ruby
vindvaki has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_sfiguser has quit [Ping timeout: 276 seconds]
<impermanence> havenwood: hm...
jdawgaz has quit [Ping timeout: 276 seconds]
baroquebobcat has joined #ruby
profsimm has joined #ruby
<profsimm> Ok, what is the most efficient way to implement a read/write byte/text buffer? Where I have a separate "read" and "write" seek position? I write always in the end, and I read from the point I last read?
<havenwood> profsimm: Are you familiar with stdlib's StringScanner?
<havenwood> &ri StringSCanner
<`derpy> No results
Neo95 has quit [Read error: Connection reset by peer]
<havenwood> &ri StringScanner
<baweaver> impermanence: is it in an array?
<impermanence> baewaver: yes, it's an array of these: [#<MyClass val1: value1, val2: value2, etc.>].
<impermanence> baweaver: it's coming from here:
<impermanence> link coming:
synthroi_ has joined #ruby
<impermanence> And it has been implemented a bit differently, but fairlly close, fairly close
<impermanence> And I can return the array...but I don't know how to retrieve a specific value...
__Yiota has joined #ruby
_sfiguser has joined #ruby
<impermanence> so for example
<impermanence> if I say my array of those whatevers is called ary.
synthroid has quit [Ping timeout: 268 seconds]
brent__ has joined #ruby
<impermanence> if I do: ary.each { |x| x.val1 } it simply returns the array....?
<matthewd> impermanence: Yes, that's what each does
<impermanence> matthewd: hm. I though each would iterate through each element of the array and do stuff if I tell it to.
<matthewd> It does that too
<impermanence> matthewd: oh, so maybe it's not mutating it?
<matthewd> See also:
<matthewd> [08-04 04:07:17] <matthewd>(I'm assuming you intend select here, and not map, say)
<impermanence> right
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
enterprisey has joined #ruby
romankapitonov has quit [Read error: Connection reset by peer]
orion88 has joined #ruby
ur5us has joined #ruby
<orion88> hi all! getting a very strange error: NoMethodError - undefined method `result_with_hash' for #<ERB:0x0000000381f9b8>, using Ruby 2.4.1
synthroi_ has quit []
<orion88> according to the docs, this method should exist, and i've confirmed i'm running ruby 2.4.1, any ideas for how i could troubleshoot?
<zenspider> orion88: the method should exist _where_?
eckhardt has joined #ruby
<orion88> zenspider: on an ERB object
<zenspider> I don't have it in my rdoc for ERB
<orion88> zenspider: ERB.new(get_template).result_with_hash(self.data)
<zenspider> again... no. can you point me to where you think the code is?
__Yiota has quit [Quit: Textual IRC Client: www.textualapp.com]
baroquebobcat has quit [Quit: baroquebobcat]
<orion88> zenspider: are those the right docs?
<zenspider> right-ish... lemme poke
<orion88> cool, thank you :)
nicolai86_ has quit [Remote host closed the connection]
<zenspider> starting to think "no"... stdlib erb is a single file, ~27k, and doesn't contain that method... but still poking
ramfjord has quit [Ping timeout: 240 seconds]
<havenwood> It's a Ruby 2.5 method that made it into the docs early.
<havenwood> In Ruby 2.5: ERB.new('').result_with_hash({}) #=> ""
romankapitonov has joined #ruby
<zenspider> ugh
<orion88> ok so i'm not crazy and the docs are not correct
<havenwood> orion88: right
<zenspider> yeah. the method doesn't exist anywhere in all of stdlib
<zenspider> I hate that website, personally...
<orion88> ok i feel better now :)
SenpaiSilver has quit [Quit: Leaving]
t-recx has quit [Quit: t-recx]
jenrzzz has quit [Ping timeout: 260 seconds]
<zenspider> stick to `ri` and use your local code for doco
nicolai86 has joined #ruby
<zenspider> I wish people would realize that ruby-doc.org is NOT official and is always suspect :/
<orion88> well i certainly realize that now
ramfjord has joined #ruby
<zenspider> orion88: can you email suggestions@ruby-doc.org to report the bug?
<zenspider> or jump through these hoops: http://documenting-ruby.org
<zenspider> no. don't do that
<orion88> i will add it to my todo list :)
<zenspider> nothing has happened on that project for 2 years
<orion88> thanks so much guys!
<zenspider> just send an email
<Mrgoose2> Anyone familiar with GRPC and ruby?
orion88 has quit [Quit: Page closed]
ahrs has quit [Remote host closed the connection]
high_fiver has quit [Ping timeout: 258 seconds]
ahrs has joined #ruby
Papierkorb has quit [Quit: ArchLinux completes an endless loop faster than any other distro!]
wilbert has quit [Ping timeout: 240 seconds]
GinoMan has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jackjackdripper1 has quit [Quit: Leaving.]
someuser has quit [Quit: Lost terminal]
kkiero has joined #ruby
swills has joined #ruby
ldnunes has quit [Quit: Leaving]
ltem has quit [Quit: Leaving]
sepp2k has quit [Quit: Leaving.]
mim1k has joined #ruby
elsevero has joined #ruby
thecommongeek has joined #ruby
Isa_ has quit [Quit: Leaving]
mjolnird has joined #ruby
mim1k has quit [Ping timeout: 260 seconds]
cagomez has quit [Read error: Connection reset by peer]
hinbody has joined #ruby
cagomez has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
code_zombie_ has joined #ruby
eckhardt has joined #ruby
code_zombie has quit [Ping timeout: 246 seconds]
baroquebobcat has joined #ruby
dstrunk has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dennisvennink has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lol has joined #ruby
lol has quit [Client Quit]
TomyLobo3 has quit [Ping timeout: 255 seconds]
noe_ has quit [Remote host closed the connection]
marxarelli|afk is now known as marxarelli
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
enterprisey has quit [Remote host closed the connection]
jackjackdripper has joined #ruby
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
juandavidcowboy has quit [Quit: Page closed]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
<impermanence> What is the best way to achieve the following? some_array.map { |x| x == some_val ? x.some_property : delete x from array }
<impermanence> It's the last part I'm wondering about.
<impermanence> or is ternary just not the right way to go...?
<havenwood> impermanence: #select then #map
eckhardt has joined #ruby
<havenwood> impermanence: nope
<impermanence> havenwood: mm, okay. cool :)
baroquebobcat has quit [Quit: baroquebobcat]
<baweaver> impermanence: Or just use each_with_object / reduce or map / compact
<impermanence> okay, cool.
<baweaver> some_array.map { |x| x == some_val && x.prop }.compact
kt has quit [Ping timeout: 260 seconds]
<impermanence> ah, okay.
<baweaver> some_array.each_with_object([]) { |x, o| o << x.prop if x == some_val }
benlieb has quit [Quit: benlieb]
<impermanence> I was thinking: some_array.select { |x| x == "whatever" }.map { |y| y.prop }
<impermanence> Is that bad syntax?
<havenwood> some_array.select { |x| x == some_val }.map(&:prop)
<havenwood> impermanence: all fine solutions
kt has joined #ruby
<havenwood> impermanence: that's fine syntax
<impermanence> &:
<impermanence> cool
<havenwood> the : is attached to the prop, it's the Symbol `:prop`
<impermanence> oh, okay. And that & ?
<havenwood> impermanence: the & is syntactic sugar that calls #to_proc and passes it as a block
<havenwood> :prop.to_proc
<havenwood> >> :abs2.to_proc.call 5
<ruby[bot]> havenwood: # => 25 (https://eval.in/841281)
<impermanence> oh, okay, cool
<havenwood> >> 5.abs2
<ruby[bot]> havenwood: # => 25 (https://eval.in/841282)
kt has quit [Ping timeout: 260 seconds]
thecommongeek has quit [Ping timeout: 276 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
imajes has quit [Quit: Leaving...]
m27frogy has quit [Ping timeout: 240 seconds]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
kt has joined #ruby
InfinityFye has joined #ruby
InfinityFye has quit [Client Quit]
ResidentBiscuit has quit [Ping timeout: 248 seconds]
InfinityFye has joined #ruby
runescape07rsps has joined #ruby
romankapitonov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
[Butch] has quit [Quit: I'm out . . .]
cagomez has quit [Ping timeout: 276 seconds]
kt has quit [Ping timeout: 248 seconds]
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dennisvennink has joined #ruby
rabajaj has quit [Quit: Leaving]
romankapitonov has joined #ruby
benlieb has joined #ruby
<impermanence> havenwood: Is there a way to do multiple &:things?
<impermanence> i.e. &:prop1 &:prop2 &:prop3 ?
baroquebobcat has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
<impermanence> also is map(&:price) old syntax? It's working against 2.4.1 but I'm just wondering if it is outdated...?
ramfjord has joined #ruby
baroquebobcat has quit [Client Quit]
cagomez has joined #ruby
bronson has joined #ruby
goyox86 has joined #ruby
goyox86 has quit [Client Quit]
benlieb has quit [Quit: benlieb]
<havenwood> impermanence: `map(&:price)` is a fine syntax, if you want to map three times you have to `map(&:prop1).map(&:prop2).map(&:prop3)`, there's no shorthand - just the long form
<havenwood> impermanence: at that point you might prefer to: map { |thing| thing.prop1.prop2.prop3 }
goyox86 has joined #ruby
<impermanence> havenwood: ah, okay. I am curious about a concise way to add multiple Integer attributes from an array of objects
ramfjord has quit [Ping timeout: 246 seconds]
<havenwood> impermanence: show the code you have so far? or what you have and what you want?
<impermanence> k, one sec
axsuul has quit [Ping timeout: 248 seconds]
<impermanence> some_array.map(&:prop1 + &:prop2 + &:prop3).inject(0, :+)
<impermanence> obviously does not work :)
bronson has quit [Ping timeout: 260 seconds]
ramfjord has joined #ruby
<havenwood> impermanence: #sum takes a block
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<impermanence> yeah, okay. I'll look at sum.
opekktar has quit []
<impermanence> cool
cagomez has quit []
gusrub has quit [Remote host closed the connection]
axsuul has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
<impermanence> array.sum { |x| x.prop1 + x.prop2 + x.prop3 ... } got me there :)
<impermanence> nice
cagomez has joined #ruby
romankapitonov has quit [Ping timeout: 240 seconds]
ramfjord has joined #ruby
kt has joined #ruby
rahult has joined #ruby
marxarelli is now known as marxarelli|afk
romankapitonov has joined #ruby
gusrub has joined #ruby
cagomez has quit [Ping timeout: 240 seconds]
kt has quit [Ping timeout: 240 seconds]
moeabdol has quit [Quit: WeeChat 1.9]
CrazyEddy has joined #ruby
CrazyEddy has quit [Changing host]
CrazyEddy has joined #ruby
cagomez has joined #ruby
kt has joined #ruby
ixti has joined #ruby
cagomez_ has joined #ruby
cagomez has quit [Ping timeout: 260 seconds]
jnollette has quit [Ping timeout: 248 seconds]
chouhoulis has quit [Ping timeout: 260 seconds]
cagomez_ has quit [Ping timeout: 260 seconds]
perniciouscaffei has joined #ruby
Ropeney has joined #ruby
xuanrui has quit [Quit: Ex-Chat]
polishdub has quit [Quit: leaving]
jnollette has joined #ruby
cagomez has joined #ruby
kt has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 276 seconds]
cagomez has quit [Remote host closed the connection]
_sfiguser has quit [Ping timeout: 260 seconds]
cagomez has joined #ruby
alex`` has quit [Quit: WeeChat 1.9]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
lxsameer has quit [Quit: WeeChat 1.7]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has quit [Remote host closed the connection]
segy has quit [Ping timeout: 255 seconds]
mim1k has joined #ruby
cagomez has joined #ruby
segy has joined #ruby
jdbrowne has joined #ruby
ur5us_ has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
_sfiguser has joined #ruby
rahult has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
InfinityFye has quit [Quit: Leaving]
mim1k has quit [Ping timeout: 276 seconds]
<impermanence> hm. so i have something like some_array.zip(other_array).map { |x, y| y - x }
<impermanence> works great in pry, but throws "unknown method -
<impermanence> " when ran against mrb...?
ur5us_ has quit [Ping timeout: 246 seconds]
dcunit3d has joined #ruby
sneakerhax has quit [Ping timeout: 260 seconds]
rahult has joined #ruby
alveric2 has joined #ruby
QualityAddict has joined #ruby
Ropeney_ has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
alveric1 has quit [Ping timeout: 240 seconds]
cagomez has joined #ruby
Ropeney has quit [Ping timeout: 260 seconds]
jdbrowne has quit [Ping timeout: 276 seconds]
t-recx has joined #ruby
kt has joined #ruby
romankapitonov has quit [Read error: Connection reset by peer]
kkiero has quit [Read error: Connection reset by peer]
romankapitonov has joined #ruby
romankapitonov has quit [Client Quit]
goyox86 has quit [Quit: goyox86]
kt has quit [Ping timeout: 255 seconds]
impermanence has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
amitchellbullard has quit [Quit: Connection closed for inactivity]
chouhoulis has joined #ruby
chouhoul_ has joined #ruby
orion88 has joined #ruby