« Back to channel list

#ruby - 03 August 2017

« Back 1 day Forward 1 day »
[00:01:03] RahulT: has joined #ruby
[00:02:53] _sfiguser: has joined #ruby
[00:08:04] Neo--: has joined #ruby
[00:10:50] Moosashi: has joined #ruby
[00:12:19] Jameser: has joined #ruby
[00:13:07] bruno-: has joined #ruby
[00:22:45] charliesome: has joined #ruby
[00:28:43] tedL: has joined #ruby
[00:31:48] ujjain: has joined #ruby
[00:31:48] ujjain: has joined #ruby
[00:32:56] Jameser: has joined #ruby
[00:34:17] FahmeF: has joined #ruby
[00:35:14] paradisaeidae: has joined #ruby
[00:35:16] paradisaeidae_: has joined #ruby
[00:38:02] brent__: has joined #ruby
[00:43:08] leandrobighetti: has joined #ruby
[00:44:11] Radar: adaedra: this might be relevant to your interests: http://bundler.io/v1.3/git.html#local
[00:44:44] HoierM: has joined #ruby
[00:45:04] amclain: has joined #ruby
[00:45:54] brent__: has joined #ruby
[00:48:18] brent__: has joined #ruby
[00:48:36] brent__: has joined #ruby
[00:49:40] Brent___: has joined #ruby
[00:52:18] mim1k: has joined #ruby
[00:54:53] brian_penguin: has joined #ruby
[00:56:10] SuperTaz: has joined #ruby
[00:56:44] [spoiler]: has joined #ruby
[00:57:37] sneep: has joined #ruby
[00:58:55] hutch34: has joined #ruby
[00:59:02] eregon: has joined #ruby
[01:00:52] rileyy: has joined #ruby
[01:00:55] cats: has joined #ruby
[01:02:08] BackEndCoder: has joined #ruby
[01:03:20] wilbert: has joined #ruby
[01:06:47] ArtCorvelay: has joined #ruby
[01:08:19] turt2live: has joined #ruby
[01:08:20] torarne: has joined #ruby
[01:08:21] KevinMGranger: has joined #ruby
[01:12:29] Hanmac: has joined #ruby
[01:13:52] enterprisey: has joined #ruby
[01:16:02] bronson: has joined #ruby
[01:19:01] mbr: has joined #ruby
[01:19:04] 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 :(
[01:20:03] griffindy: has joined #ruby
[01:21:42] mim1k: has joined #ruby
[01:23:02] RahulT: has joined #ruby
[01:23:15] Radar: rapha: You could probably reduce it.
[01:23:21] Radar: I'll give you some code, one moment
[01:24:28] rapha: I'm playing around with something that's probably quite ugly, no rush :)
[01:25:54] 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] }
[01:25:56] ruby[bot]: Radar: # => {:foo=>[1.2, 3.2], :bar=>[2.3, 3.0]} (https://eval.in/840891)
[01:26:07] Radar: rapha: ^ is that what you're after? Or did you want foo + bar to be in two separate hashes?
[01:26:36] rapha: Radar: no, that's exactly what I was after!
[01:26:38] rapha: ACTION reads
[01:26:55] rapha: what sort of construct is "p begin"?
[01:27:23] rapha: oic that's just the bot's code
[01:27:31] ozcanesen: has joined #ruby
[01:28:15] duderonomy: has joined #ruby
[01:28:43] rapha: Radar: what do you mean by "acc"?
[01:28:51] Radar: accumulator,
[01:29:30] 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
[01:29:55] 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]}
[01:30:04] Radar: Then there are no more elements, so it returns the final result
[01:30:29] rapha: ah, that's an apt name then
[01:30:38] rapha: i think i need to read up on each_with_object
[01:32:46] gizmore|2: has joined #ruby
[01:33:36] jdawgaz: has joined #ruby
[01:34:46] charliesome: has joined #ruby
[01:37:08] Jameser: has joined #ruby
[01:37:43] rapha: the _with_object part is what i give it in the argument array, not in the block
[01:37:55] rapha: so it's not that complicated even :)
[01:39:41] rahult_: has joined #ruby
[01:57:42] jdawgaz: has joined #ruby
[01:57:56] rapha: Radar: it's quite practical btw: https://gist.github.com/sixtyfive/aa8dc49c5fe0fdccaaf81818a8ca300b
[01:58:08] rapha: ACTION marvels at how many packets his router routes
[01:59:17] duderonomy: has joined #ruby
[02:01:07] Radar: Gruff is a name I haven't seen in a while.
[02:02:43] carnegie: has joined #ruby
[02:03:17] rapha: It's a nice little Gem!
[02:04:01] rapha: Radar: say, is something like each_with_object crossing over into the functional programming realm?
[02:04:56] Radar: rapha: Well it is running a function (proc) for each element in the list, so yeah, I think it is.
[02:05:18] bruno-: has joined #ruby
[02:05:23] rapha: Hmm. I will have to tell my Haskell-wielding friends to stop laughing at Ruby and me.
[02:08:29] Radar: I think they'll still keep doing that.
[02:09:29] milardovich: has joined #ruby
[02:10:54] jrafanie: has joined #ruby
[02:13:33] cahoots: has joined #ruby
[02:13:59] rapha: I guess, but then I'll just call them Haskellipsters or something.
[02:20:07] 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."
[02:20:09] konsolebox: What happens if I don't specify dmark?
[02:20:14] konsolebox: @extension.rdoc
[02:20:50] konsolebox: the example further below it does not specify any: {0, free_dbm, memsize_dbm,},
[02:23:11] guacamole: has joined #ruby
[02:24:38] guacamole: has joined #ruby
[02:25:21] 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?
[02:25:33] cahoots: is gem install starting some async task that i need to wait for?
[02:29:03] 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
[02:29:04] ruby[bot]: baweaver: # => {:foo=>[1.2, 3.2], :bar=>[2.3, 3.0]} (https://eval.in/840914)
[02:29:16] gusrub: has joined #ruby
[02:29:26] baweaver: ACTION admits ewo is clearer
[02:31:08] leandrobighetti: has joined #ruby
[02:31:22] sneakerhax: has joined #ruby
[02:32:14] cahoots: meh, looks like this fixed more elegantly anyways by using Gem::Commands::InstallCommand
[02:34:28] sleepee: has joined #ruby
[02:35:58] konsolebox: (nevermind i got it. i just forgot the concept)
[02:36:05] Radar: cahoots: why are you doing it that way? Why not use a Gemfile to install the gems?
[02:38:56] 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
[02:39:10] Radar: cahoots: bundle install --path vendor/gems
[02:39:12] ruby[bot]: Radar: I don't know anything about next
[02:39:18] Radar: ruby[bot]: I thought you loved me.
[02:40:10] RahulT: has joined #ruby
[02:43:02] cahoots: Radar, but then i still have to install the bundle gem, no?
[02:43:26] swills_: has joined #ruby
[02:44:27] cahoots: also, if i went the bundle route, i would need to remember to run "bundle exec ruby" instead of "ruby" every time, correct?
[02:45:40] nofxxxx: cahoots, not necessarly, if there's no gem clashs just ruby will work, but yeah, that ensures it'll
[02:45:54] RahulT: has joined #ruby
[02:46:39] nofxxxx: cahoots, also, if you're running something do a executable so you just ./myapp
[02:46:41] swills: has joined #ruby
[02:46:41] swills: has joined #ruby
[02:46:56] nofxxxx: and it starts it properly
[02:50:18] guardianx: has joined #ruby
[02:50:35] 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?
[02:53:17] nofxxxx: cahoots, actually I was talking about bin/env sh ... so inside you bundle exec, but that would be nice
[02:53:28] nofxxxx: can we do that? heh
[02:53:38] nofxxxx: bin/env bundle ... ?
[02:56:18] cahoots: nofxxxx, i'm confused, can you rephrase what you're talking about?
[02:59:38] nofxxxx: cahoots, I meant use a sh script, #/usr/bin/env sh
[02:59:45] empty_cup: has joined #ruby
[02:59:50] nofxxxx: but your idea is plausible https://coderwall.com/p/vcw0wg/hiding-rvm-bundler-from-your-users
[03:02:17] milardovich: has joined #ruby
[03:03:30] nofxxxx: cahoots, but even so I like the simple sh way, nothing there but executable and it's params
[03:04:16] nofxxxx: #!/usr/bin/env sh
[03:04:17] cahoots: nofxxxx, so you'd have like, script.sh which calls bundle exec on script.rb?
[03:04:32] nofxxxx: bundle exec bin/myapp --with-nice-args 5
[03:05:02] nofxxxx: cahoots, yeah, but loose the '.sh'
[03:05:25] nofxxxx: executables should not have extension
[03:13:35] gix: has joined #ruby
[03:16:02] chouhoulis: has joined #ruby
[03:17:06] bronson: has joined #ruby
[03:18:58] cahoots: nofxxxx and Radar, thanks, i'll keep messing with bundler
[03:23:32] siloxid: has joined #ruby
[03:26:04] 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
[03:26:33] xuanrui: has joined #ruby
[03:28:30] blznblzn2: has joined #ruby
[03:30:47] siloxid: and I can puts the string and cat the filename in the terminal and the path is sane
[03:39:47] __Yiota: has joined #ruby
[03:41:25] z3uS: has joined #ruby
[03:41:41] siloxid: but it appears that I can `cat #{path}` *facepasm*
[03:41:50] wilbert: has joined #ruby
[03:44:36] hndk: has joined #ruby
[03:45:28] xuanrui: has joined #ruby
[03:46:18] minimalism: has joined #ruby
[03:48:22] kent\n: has joined #ruby
[03:55:55] brent__: has joined #ruby
[03:58:50] sneakerhax: has joined #ruby
[04:02:33] umaaji: has joined #ruby
[04:02:52] segy_: has joined #ruby
[04:04:50] gusrub: has joined #ruby
[04:05:21] segy-: has joined #ruby
[04:06:21] RahulT: has joined #ruby
[04:07:30] segy: has joined #ruby
[04:10:54] segy_: has joined #ruby
[04:12:06] mesamoo: has joined #ruby
[04:13:23] emers2n: has joined #ruby
[04:13:26] emers2n: Could someone explain what the multiplication/asterisk (*) means here: myCustomHash.inject(Hash[ *myCustomHash.first ]) do |tmp,kv|
[04:13:44] segy: has joined #ruby
[04:15:47] segy-: has joined #ruby
[04:17:36] segy_: has joined #ruby
[04:19:16] leandrobighetti: has joined #ruby
[04:19:45] segy: has joined #ruby
[04:22:44] ur5us: has joined #ruby
[04:23:43] segy_: has joined #ruby
[04:25:50] paradisaeidae: has joined #ruby
[04:26:03] hutch34: has joined #ruby
[04:26:16] paradisaeidae_: has joined #ruby
[04:27:07] anisha: has joined #ruby
[04:29:33] aurelien: has joined #ruby
[04:30:23] Silthias: has joined #ruby
[04:33:12] RahulT: has joined #ruby
[04:35:29] swills: has joined #ruby
[04:35:29] swills: has joined #ruby
[04:36:31] howdoi: has joined #ruby
[04:42:32] worknick: has joined #ruby
[04:43:19] worknick: i have X = {"A":1, "B":2} and Y = {"C":11, "D": 22} how can i do 1*2 + 2*22 ??
[04:44:10] worknick: i mean, 1*11 + 2 * 22
[04:46:43] wilbert: has joined #ruby
[04:47:01] tildes: has joined #ruby
[04:55:03] jinie_: has joined #ruby
[04:55:48] milardovich: has joined #ruby
[04:58:14] emers2n: still need that worknick?
[04:59:56] govg: has joined #ruby
[05:06:17] Norm_: has joined #ruby
[05:06:34] pwnd_nsfw`: has joined #ruby
[05:09:00] Xiti`: has joined #ruby
[05:09:58] jordanm: has joined #ruby
[05:15:19] govg: has joined #ruby
[05:17:14] SeepingN: has joined #ruby
[05:18:34] kspencer: has joined #ruby
[05:18:46] bronson: has joined #ruby
[05:23:04] mim1k: has joined #ruby
[05:23:32] HashNuke: has joined #ruby
[05:24:36] sunrunner20: has joined #ruby
[05:25:51] moeabdol: has joined #ruby
[05:25:59] brent__: has joined #ruby
[05:26:22] davidmichaelkarr: has joined #ruby
[05:26:54] havenwood: worknick: X.values.zip(Y.values).map(&:sum) #=> [12, 24]
[05:27:41] havenwood: worknick: X.values.zip(Y.values).map { |x, y| x * y } #=> [11, 44]
[05:27:54] benlieb: has joined #ruby
[05:28:14] emers2n: havenwood: I've been trying to figure this out for past two hours > any ideas?
[05:28:20] emers2n: https://www.jdoodle.com/a/4Wn
[05:28:33] havenwood: emers2n: destructuring
[05:28:45] havenwood: emers2n: sec
[05:29:39] emers2n: I'm sorry?
[05:29:41] havenwood: emers2n: numbers = [1, 2, 3, 4]; Hash[numbers] #!> warning: wrong element type Integer at 0 (expected array)
[05:30:04] havenwood: emers2n: Hash[*numbers] #=> {1=>2, 3=>4}
[05:30:23] havenwood: emers2n: The splat passes the elements of the array as arguments.
[05:30:42] havenwood: emers2n: Instead of a single array, it splats it out to four arguments.
[05:31:04] emers2n: Thanks, but my question is how to essentially reverse a part of the code here: https://www.jdoodle.com/a/4Wn
[05:31:11] havenwood: emers2n: [*[1, 2, 3], 4] #=> [1, 2, 3, 4]
[05:31:26] havenwood: emers2n: which part?
[05:31:43] havenwood: emers2n: reading
[05:32:34] emers2n: havenwood: Cheers. Compare Desired vs Actual Output to see what the issue is the quickest
[05:33:31] Tony-St4rk: has joined #ruby
[05:34:17] worknick: havenwood, Thanks. emers2n havenwood answered.
[05:37:40] phate408: has joined #ruby
[05:43:26] havenwood: emers2n: hmm, let's see
[05:44:03] 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]
[05:44:07] havenwood: emers2n: not quite right
[05:44:16] planigan: has joined #ruby
[05:45:12] 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
[05:45:54] Bock: has joined #ruby
[05:45:59] moeabdol: has joined #ruby
[05:46:08] emers2n: havenwood: awesome, I'll check that out. Thanks so much
[05:46:17] tens0r: has joined #ruby
[05:46:31] havenwood: emers2n: lemme think, gotta get those fallback times
[05:47:40] pwnd_nsfw: has joined #ruby
[05:48:09] vuoto: has joined #ruby
[05:49:05] 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
[05:49:26] havenwood: emers2n: yeah, that's true
[05:51:40] Bock: has joined #ruby
[05:52:24] pwnd_nsfw`: has joined #ruby
[05:52:34] milardovich: has joined #ruby
[05:52:55] yabbes: has joined #ruby
[05:57:17] mim1k: has joined #ruby
[05:59:15] mtkd: has joined #ruby
[06:04:09] anas: has joined #ruby
[06:05:33] roshanavand: has joined #ruby
[06:07:22] leandrobighetti: has joined #ruby
[06:11:05] rabajaj: has joined #ruby
[06:11:09] TomyLobo3: has joined #ruby
[06:14:25] tvw: has joined #ruby
[06:15:31] BrokenBard: has joined #ruby
[06:15:43] BrokenBard: has left #ruby: ("Leaving")
[06:17:19] govg: has joined #ruby
[06:20:27] carnegie_: has joined #ruby
[06:25:44] andikr: has joined #ruby
[06:29:18] tildes: has joined #ruby
[06:29:22] RahulT: has joined #ruby
[06:32:23] rahult_: has joined #ruby
[06:41:48] vali: has joined #ruby
[06:43:53] ledestin: has joined #ruby
[06:43:55] dcunit3d: has joined #ruby
[06:49:14] milardovich: has joined #ruby
[06:50:01] conta: has joined #ruby
[06:50:17] FahmeF: has joined #ruby
[06:51:22] djbkd: has joined #ruby
[06:51:48] RahulT: has joined #ruby
[06:55:54] anas: has joined #ruby
[06:58:28] ltem: has joined #ruby
[06:59:22] vindvaki: has joined #ruby
[07:06:39] moeabdol: has joined #ruby
[07:09:48] jackjackdripper: has joined #ruby
[07:17:39] nofxxx: has joined #ruby
[07:19:46] bronson: has joined #ruby
[07:20:46] TvL2386_: has joined #ruby
[07:21:48] Silthias1: has joined #ruby
[07:23:37] Trynemjoel: has joined #ruby
[07:24:09] tfitts: has joined #ruby
[07:24:25] SenpaiSilver: has joined #ruby
[07:27:48] leandrobighetti: has joined #ruby
[07:28:40] mark_66: has joined #ruby
[07:31:32] ramfjord: has joined #ruby
[07:37:03] ur5us: has joined #ruby
[07:38:07] Trynemjoel: has joined #ruby
[07:38:38] govg: has joined #ruby
[07:41:17] swills: has joined #ruby
[07:43:22] ur5us: has joined #ruby
[07:45:27] benjen: has joined #ruby
[07:47:16] govg: has joined #ruby
[07:48:34] cptAngry: has joined #ruby
[07:50:31] kkiero: has joined #ruby
[07:54:23] mikecmpbll: has joined #ruby
[07:55:34] domgetter: has joined #ruby
[07:56:59] lamppid: has joined #ruby
[07:57:15] workmad3: has joined #ruby
[07:58:26] bambanx: has joined #ruby
[07:58:28] carnegie: has joined #ruby
[07:59:57] baroquebobcat: has joined #ruby
[08:01:21] marr: has joined #ruby
[08:02:49] DoubleMalt: has joined #ruby
[08:08:15] antgel_: has joined #ruby
[08:14:18] dionysus69: has joined #ruby
[08:15:28] duderonomy: has joined #ruby
[08:15:50] sysvalve: has joined #ruby
[08:17:31] TomyWork: has joined #ruby
[08:18:15] mim1k: has joined #ruby
[08:20:42] bronson: has joined #ruby
[08:22:22] ruby[bot]: dminuoso: # => /tmp/execpad-d627da89a4e6/source-d627da89a4e6:2: syntax error, unexpected '\n', expecting &. or :: o ...check link for more (https://eval.in/841016)
[08:22:24] dminuoso: >> a = *{a:1}
[08:22:25] ruby[bot]: dminuoso: # => [[:a, 1]] (https://eval.in/841017)
[08:22:55] ByronJohnson: has joined #ruby
[08:23:22] dminuoso: Okay, so splatarray ends up calling to_a
[08:23:42] dminuoso: >> class Hash; def to_a; raise "NO"; end; end; a = *{a:1}
[08:23:43] ruby[bot]: dminuoso: # => NO (RuntimeError) ...check link for more (https://eval.in/841018)
[08:23:49] Ishido: has joined #ruby
[08:24:59] segy: has joined #ruby
[08:25:04] 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
[08:26:32] hutch34: has joined #ruby
[08:27:23] charliesome: has joined #ruby
[08:29:01] Derperperd: has joined #ruby
[08:30:29] ChewCraft: has joined #ruby
[08:31:12] Beams: has joined #ruby
[08:33:48] simmaniac: has joined #ruby
[08:34:32] Ishido: has joined #ruby
[08:35:46] aupadhye: has joined #ruby
[08:39:10] cabotto: has joined #ruby
[08:45:37] ianfleeton: has joined #ruby
[08:48:50] claw: has joined #ruby
[08:51:18] bane_: has joined #ruby
[09:00:25] jdawgaz: has joined #ruby
[09:02:15] anisha: has joined #ruby
[09:03:47] FahmeF: has joined #ruby
[09:07:01] alex``: has joined #ruby
[09:07:15] milardovich: has joined #ruby
[09:08:18] claw: has joined #ruby
[09:11:21] lel: has joined #ruby
[09:22:03] bronson: has joined #ruby
[09:26:05] Mia: has joined #ruby
[09:26:05] Mia: has joined #ruby
[09:31:43] ramfjord: has joined #ruby
[09:32:00] rapha: baweaver: cool, thanks for the alternative solution! :)
[09:32:06] kkiero: has left #ruby: ()
[09:38:48] yabbes: has joined #ruby
[09:40:45] carnegie: has joined #ruby
[09:43:01] anisha: has joined #ruby
[09:45:46] Papierkorb: has joined #ruby
[09:48:33] tvw: has joined #ruby
[09:49:23] Jameser: has joined #ruby
[09:50:41] tens0r: has joined #ruby
[09:55:03] nunchuck: has joined #ruby
[10:00:14] sepp2k: has joined #ruby
[10:05:36] mikecmpbll: has joined #ruby
[10:11:58] jaruga: has joined #ruby
[10:16:07] mikecmpb_: has joined #ruby
[10:22:50] bronson: has joined #ruby
[10:26:02] LyndsySimon: has joined #ruby
[10:26:41] romankapitonov: has joined #ruby
[10:39:05] FahmeF: has joined #ruby
[10:39:50] cabotto: has joined #ruby
[10:40:20] carnegie: has joined #ruby
[10:40:47] ujjain: has joined #ruby
[10:40:47] ujjain: has joined #ruby
[10:48:07] charles81_: has joined #ruby
[10:49:06] meinside: has joined #ruby
[10:56:58] Takumo: has joined #ruby
[10:58:49] Terens: which is a good lightweight document database to use?
[10:59:59] Papierkorb: Postgres with JSONB columns.
[11:01:24] Papierkorb: Terens: Also, use Sequel as ORM.
[11:02:34] dminuoso: You're such a sequel fanboy.
[11:02:38] dminuoso: someone needs to take your toys away
[11:02:43] Terens: I want it for a ruby app to store some configuration. But since it might be schemaless I dont want sql
[11:02:52] dminuoso: Terens: Toss it into yaml.
[11:03:04] dminuoso: That's what everyone and their mothers do.
[11:03:05] Terens: I have postgresql so it might work
[11:03:15] Papierkorb: dminuoso: It's just a darn solid ORM.
[11:03:22] dminuoso: Papierkorb: See?!
[11:13:18] ljarvis: I have been spoiled by Ecto (the elixir ORM)
[11:13:26] ljarvis: it's a thing of beauty
[11:14:13] dminuoso: ljarvis: Yeah it really is.
[11:14:36] dminuoso: ljarvis: I've properly started with elixir, the experience has been a blast.
[11:14:40] cabotto: has joined #ruby
[11:14:50] ljarvis: yeah it's great
[11:15:07] ljarvis: the true power really lies in otp imo :)
[11:15:33] dminuoso: ljarvis: Oh yes! Free CORBA for the world!
[11:16:44] DTZUZO: has joined #ruby
[11:17:24] chouhoulis: has joined #ruby
[11:18:33] anisha: has joined #ruby
[11:22:50] phinxy: has joined #ruby
[11:23:36] bronson: has joined #ruby
[11:25:02] anisha: has joined #ruby
[11:27:26] dennisvennink: has joined #ruby
[11:31:56] ramfjord: has joined #ruby
[11:33:21] phinxy: has joined #ruby
[11:38:01] ldnunes: has joined #ruby
[11:39:57] tacoboy: has joined #ruby
[11:48:13] milardovich: has joined #ruby
[11:54:30] cabotto: has joined #ruby
[12:01:49] ioquatix: has joined #ruby
[12:02:10] moeabdol: has joined #ruby
[12:03:10] BSAlb: has joined #ruby
[12:04:48] InfinityFye: has joined #ruby
[12:05:57] millerti: has joined #ruby
[12:06:16] aupadhye: has joined #ruby
[12:09:44] pskosinski: has joined #ruby
[12:10:59] baroquebobcat: has joined #ruby
[12:11:17] synthroid: has joined #ruby
[12:12:03] noem: has joined #ruby
[12:12:28] nickjj: has joined #ruby
[12:13:27] baroquebobcat: has joined #ruby
[12:15:06] __Yiota: has joined #ruby
[12:19:11] carnegie: has joined #ruby
[12:20:59] ianfleeton: has joined #ruby
[12:24:19] bronson: has joined #ruby
[12:25:45] anisha: has joined #ruby
[12:27:00] hutch34: has joined #ruby
[12:30:44] chouhoulis: has joined #ruby
[12:31:03] HoierM: has joined #ruby
[12:32:11] tens0r: has joined #ruby
[12:32:21] hogetaro: has joined #ruby
[12:33:23] ur5us: has joined #ruby
[12:38:20] jrafanie: has joined #ruby
[12:43:55] Radeds: has joined #ruby
[12:44:07] Radeds: Hi everyone,
[12:44:58] Radeds: I know I can use methods_missing with normal arguments like so : method_missing(method_name, *args, &block)
[12:45:45] Radeds: If I wish to use keyword arguments, I have to the double splatter instead like so : method_missing, **args, &block)
[12:46:32] 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.
[12:52:13] ramfjord: has joined #ruby
[12:53:08] __Yiota: has joined #ruby
[12:53:29] jdawgaz: has joined #ruby
[12:53:33] dminuoso: Radeds: def foo(mname, *args, **kwargs, &callable)
[12:54:16] tens0r: has joined #ruby
[12:56:33] 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?
[12:56:57] elsevero: has joined #ruby
[12:57:51] dminuoso: >> def foo(name, *args, **kwargs); [name, args, kwargs] end; public_send(:foo, 1, {a:1}, foo: 4) # Radeds
[12:57:52] ruby[bot]: dminuoso: # => private method `foo' called for main:Object ...check link for more (https://eval.in/841149)
[12:57:52] lipoqil_: has joined #ruby
[12:58:06] dminuoso: >> def piyo(name, *args, **kwargs); [name, args, kwargs] end; public_send(:piyo, 1, {a:1}, foo: 4) # Radeds
[12:58:12] ruby[bot]: dminuoso: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[12:58:14] dminuoso: Die even more.
[12:58:15] dminuoso: >> def piyo(name, *args, **kwargs); [name, args, kwargs] end; public_send(:piyo, 1, {a:1}, foo: 4) # Radeds
[12:58:16] ruby[bot]: dminuoso: # => private method `piyo' called for main:Object (NoMethodError) ...check link for more (https://eval.in/841150)
[12:58:27] dminuoso: >> def piyo(name, *args, **kwargs); [name, args, kwargs] end; send(:piyo, 1, {a:1}, foo: 4) # Radeds
[12:58:51] dminuoso: => [1, [{:a=>1}], {:foo=>4}]
[12:58:58] dminuoso: Since ruby[bot] is being particularly hateful.
[13:00:26] dminuoso: Radeds: Basically a hash at the end or kwargs are automatically bound to specified kwargs, the rest just follow normal pattern matching.
[13:00:39] imperator: has joined #ruby
[13:01:51] Radeds: dminuoso: But what do I do if I want to match it with method_missing? this I guess won't work:
[13:03:06] dminuoso: >> def method_missing(name, *args, **kwargs); p [name, args, kwargs] end; public_send(:nope, 1, {foo: 4}, a:2) # Radeds
[13:03:07] Radeds: def method_missing(method_name, *args, **kwargs, &block); MyObject.new.public_send(method_name, *args, **kwargs) end;
[13:03:12] ruby[bot]: dminuoso: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[13:03:41] dminuoso: => [:nope, [1, {:foo=>4}], {:a=>2}]
[13:03:48] dminuoso: So yeah, even that works.
[13:04:30] Radeds: dminuoso: Going to on pry, brb :)
[13:05:46] dminuoso: Radeds: Ohh, I see what you are on about
[13:06:09] dminuoso: &ri Delegator Radeds
[13:06:09] `derpy: Radeds: http://ruby-doc.org/stdlib-2.4.1/libdoc/delegate/rdoc/Delegator.html
[13:07:50] ramfjord: has joined #ruby
[13:08:52] rgtk: has joined #ruby
[13:11:18] Radeds: dminuoso: https://gist.github.com/anonymous/d6653d1961ee14124712138d7ef46d1a
[13:11:44] dminuoso: Radeds: Delegator.
[13:12:08] Radeds: Oh, sorry. I missed your previous comment. Checking...
[13:13:36] imperator: has left #ruby: ("Leaving")
[13:14:01] dminuoso: Radeds: Though that code would work if you splat args and kwargs.
[13:15:33] Radeds: dminuoso: The delgate class you mentioned seems like another way to implment the delegate: method from Rails?
[13:15:57] Radeds: dminuoso: Aren't those already splat (method declration?)
[13:17:35] dminuoso: Radeds: they do different things
[13:17:49] ineb: API.public_send(method_name, *args, **kwargs, &block)
[13:18:05] dminuoso: ineb: the second star at kwargs is not necessary.
[13:18:41] carnegie: has joined #ruby
[13:19:00] dminuoso: or neither star in fact.
[13:19:27] 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".
[13:19:39] dminuoso: Radeds: So you need to splat that rest args array back.
[13:21:01] Radeds: dminuoso: how can I splat it back?
[13:21:23] dminuoso: Radeds: API.public_send(method_name, *args, kwargs, &block)
[13:21:30] dminuoso: Radeds: But really just use delegator :P
[13:22:06] ineb: dminuoso: no star on kwargs works, but not one star
[13:22:17] dminuoso: ineb: Mmm, one star turns it into an array right.
[13:22:26] dminuoso: And the second splats that array of a single element back...
[13:23:54] jdawgaz: has joined #ruby
[13:25:16] bronson: has joined #ruby
[13:26:28] 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:
[13:26:54] Radeds: https://gist.github.com/anonymous/0be2c5376451eb7e69fe41fc738a5451
[13:27:42] Radeds: Should use that &block as I'm not using it.
[13:28:37] ineb: not until you use it :))
[13:29:21] Jameser: has joined #ruby
[13:29:23] apparition47: has joined #ruby
[13:31:45] Radeds: Ermm, I think I found a case that will not work... https://gist.github.com/anonymous/c7c2febbbdd1c0c4b7e9ac1c4a28e7a4
[13:32:27] Radeds: I'm guessing it's splating the hash and method_missing can't find a keyword argument called 'c'.
[13:32:47] ineb: Radeds: a is missing in your example call
[13:33:49] Radeds: ineb: why? my a is number argument. I'm passing Hash.
[13:33:57] Radeds: number = normal.
[13:35:07] 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.
[13:35:10] kkiero: has joined #ruby
[13:36:24] 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.
[13:38:17] bruno-: has joined #ruby
[13:39:04] spheric: has joined #ruby
[13:40:29] synthroid: has joined #ruby
[13:40:53] ineb: ohh yes. hmm youre right
[13:41:15] ineb: but it works here
[13:42:40] ineb: your code. i get {:c=>"d"} and b as parameters
[13:42:43] __Yiota: has joined #ruby
[13:43:09] matthewd: Don't use kwsplat if you don't need it
[13:44:13] haylon: has joined #ruby
[13:45:04] Radeds: ineb: strange. I'm getting `unknown keyword: c`
[13:45:25] Radeds: Let me try another ruby version.
[13:46:00] mim1k: has joined #ruby
[13:46:15] havenwood: Radeds: This is a Symbol not a String: 'c':
[13:46:32] havenwood: Radeds: This is a String: 'c' =>
[13:47:29] havenwood: >> {'c': 'a symbol key'}.keys.first
[13:47:31] ruby[bot]: havenwood: # => :c (https://eval.in/841164)
[13:48:06] havenwood: Radeds: If you mean it to be a Symbol, just write: c:
[13:50:58] Radeds: havenwood: yes, your right.
[13:51:58] carnegie: has joined #ruby
[13:52:30] cadillac_: has joined #ruby
[13:53:17] dcunit3d: has joined #ruby
[13:53:37] Radeds: Is there a way to add argument that is not passed by method_missing? something like so: https://gist.github.com/anonymous/024dd59e4c860af3dd550ac57213e01d
[13:54:21] Radeds: As I can evaluate c inside method missing? perhaps adding it to the kwargs?
[13:54:36] DLSteve: has joined #ruby
[13:56:02] ineb: Radeds: yes, but no you have to do **kwargs again API.public_send(method_name, *args, **kwargs, c: 'hello')
[13:56:22] kkiero: has left #ruby: ()
[13:58:48] ineb: however, its getting messy and delegator solves all your problems.. so yeah.
[14:00:26] banisterfiend: has joined #ruby
[14:00:27] Radeds: Ermm, how would you do the above with delegation?
[14:04:42] ineb: by just doing it.
[14:04:55] jrafanie: has joined #ruby
[14:06:50] ineb: Radeds: here https://paste.xinu.at/0iTb/
[14:07:50] haylon: has joined #ruby
[14:09:21] tomphp: has joined #ruby
[14:11:23] Rapture: has joined #ruby
[14:11:29] neo95: has joined #ruby
[14:13:11] mtkd: has joined #ruby
[14:13:26] hutch34: has joined #ruby
[14:17:12] InfinityFye: has joined #ruby
[14:20:05] 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.
[14:25:07] dangerousdave: has joined #ruby
[14:25:27] ResidentBiscuit: has joined #ruby
[14:26:06] mim1k: has joined #ruby
[14:26:26] nadir: has joined #ruby
[14:26:57] ineb: i go out now bye bye
[14:30:38] jrafanie: has joined #ruby
[14:30:43] Derperperd: has joined #ruby
[14:31:47] ramfjord: has joined #ruby
[14:32:47] Radeds: ineb: thanks bye bye! :)
[14:33:26] PaulCapestany: has joined #ruby
[14:35:34] opekktar: has joined #ruby
[14:38:57] banisterfiend: has joined #ruby
[14:40:17] chouhoulis: has joined #ruby
[14:40:25] polishdub: has joined #ruby
[14:48:43] baroquebobcat: has joined #ruby
[14:54:02] jrafanie: has joined #ruby
[14:55:58] alex``: has joined #ruby
[14:57:20] guacamole: has joined #ruby
[14:57:30] jinie_: has joined #ruby
[15:01:02] dangerousdave: has joined #ruby
[15:05:32] Ryzokuken: has joined #ruby
[15:05:41] ams__: has joined #ruby
[15:07:38] synthroid: has joined #ruby
[15:08:55] moei: has joined #ruby
[15:09:25] FahmeF: has joined #ruby
[15:10:08] voltai[m]: has left #ruby: ("User left")
[15:11:25] djbkd: has joined #ruby
[15:12:39] guacamole: has joined #ruby
[15:14:13] maryo_: has joined #ruby
[15:15:06] [Butch]: has joined #ruby
[15:15:53] marr: has joined #ruby
[15:16:49] high_fiver: has joined #ruby
[15:21:27] cam27: has joined #ruby
[15:22:10] Dimik: has joined #ruby
[15:26:04] bronson: has joined #ruby
[15:26:39] nacsurte: has joined #ruby
[15:27:11] banisterfiend: has joined #ruby
[15:28:17] t-recx: has joined #ruby
[15:28:56] yabbes_: has joined #ruby
[15:29:18] creaked: has joined #ruby
[15:34:55] maryo: has joined #ruby
[15:35:24] stephenh: has joined #ruby
[15:36:01] nobitanobi: has joined #ruby
[15:38:18] swills: has joined #ruby
[15:40:04] brent__: has joined #ruby
[15:52:30] cagomez: has joined #ruby
[15:54:47] GinoMan: has joined #ruby
[15:55:10] rippa: has joined #ruby
[15:56:59] hoangtg: has joined #ruby
[15:57:25] juandavidcowboy: has joined #ruby
[15:59:12] naprimer2: has joined #ruby
[15:59:26] ltem: has joined #ruby
[16:00:39] amclain: has joined #ruby
[16:03:23] dionysus69: has joined #ruby
[16:07:30] tomphp: has joined #ruby
[16:09:40] cpruitt: has joined #ruby
[16:11:48] TomyLobo3: has joined #ruby
[16:15:19] tacoboy: has joined #ruby
[16:17:54] gusrub: has joined #ruby
[16:19:50] airdisa: has joined #ruby
[16:20:05] cagomez: has joined #ruby
[16:21:22] cagomez_: has joined #ruby
[16:21:37] carnegie: has joined #ruby
[16:25:16] duderonomy: has joined #ruby
[16:32:18] dstrunk: has joined #ruby
[16:33:37] conta: has joined #ruby
[16:36:48] impermanence: has joined #ruby
[16:38:03] impermanence: Say X is a class with a method new that has params. And I do Y = X.new(:value1, :value2, ...)
[16:38:09] impermanence: and then I have a module such that
[16:38:48] tildes: has joined #ruby
[16:39:00] impermanence: module Z has a method self.something that creates a new instance of Y(value1: 123, value2: "hi", ...)
[16:39:23] impermanence: how would I access the values of value1, value2, etc.?
[16:40:51] impermanence: yeah, that was poor. I tried to say it instead of gist it. sorry :(
[16:42:59] impermanence: Let me try it another way
[16:43:52] impermanence: If a new object is created such that its parameters are individual hash values i.e. val1: 12, val2: 'hi', etc.
[16:44:08] jackjackdripper: has joined #ruby
[16:44:08] impermanence: how can I access that object's hash values?
[16:45:30] matthewd: That doesn't really sound like a thing. An object doesn't have parameters, and doesn't have hash values.
[16:45:54] ineb: impermanence: does this help you? https://www.codecademy.com/en/forum_questions/50f0192b102455349200372d
[16:46:00] eam: impermanence: do you have a background in perl?
[16:46:21] jackjackdripper1: has joined #ruby
[16:46:37] impermanence: matthewd: sorry, attributes :)
[16:46:54] eam: in perl, ivars are typically stored in a hash in the object instance
[16:47:11] impermanence: matthew: the object's attributes are like val1: value1, val2: value2
[16:47:15] impermanence: Is that a thing?
[16:47:43] matthewd: Nope. Do you have some more-real code we can relate to?
[16:48:06] eam: impermanence: you may be looking for instance_variable_get / set
[16:48:14] matthewd: (either in not-yet-working ruby, or in some other language)
[16:48:32] impermanence: matthewd: yeah. I'll spin something up.
[16:49:39] eam: the ivar symbol table is essentially the same thing as a blessed hashref in a perl object
[16:53:20] impermanence: matthewd: https://gist.github.com/jonassteinberg1/b4152f59b333d71504eb44ec107f627c
[16:53:40] cahoots: has joined #ruby
[16:53:42] eckhardt: has joined #ruby
[16:54:32] impermanence: not good, but close...admittedly there is stuff left out...
[16:54:39] dgarstang: has joined #ruby
[16:54:55] dgarstang: In rake, how would I invoke a task in the format namespace::job[args] ?
[16:55:20] wilbert: has joined #ruby
[16:55:37] matthewd: impermanence: Is MyClass actually Struct here?
[16:55:56] impermanence: matthewd: it is :)
[16:56:17] matthewd: dgarstang: `rake namespace:job[foo]` I think?
[16:56:37] benlieb: has joined #ruby
[16:56:42] matthewd: impermanence: Okay, so the question is "how do I use Struct"
[16:56:59] impermanence: matthewd: behh...I guess...
[16:57:17] dgarstang: matthewd: From inside the Rakefile tho
[16:57:27] matthewd: impermanence: value1 is a method on the instance returned by MyOtherClass.new
[16:57:56] impermanence: matthewd: okay
[16:57:58] 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
[16:58:17] dgarstang: matthewd ... except, they're being called from inside the Rakefile. Some sort of eval and invoke combo?
[16:59:02] cahoots: has joined #ruby
[16:59:11] matthewd: dgarstang: Rake::Task["namespace:job"].invoke("foo") ?
[16:59:31] dgarstang: matthewd: What's foo in this case if job is the job?
[16:59:37] matthewd: impermanence: But yeah, this is a behaviour of Struct, not some general concept
[16:59:43] matthewd: dgarstang: The argument(s)
[16:59:46] Ryzokuken: has joined #ruby
[16:59:55] tryfan: has joined #ruby
[17:00:16] dgarstang: matthewd: but it's being read as a single string, as if executed from the command line, in the format ns:job[args]
[17:00:38] dgarstang: matthewd: so, I guess Rake needs to call itself
[17:00:38] cagomez: has joined #ruby
[17:01:01] matthewd: Rake.application.invoke_task("ns:job[args]") then maybe?
[17:01:10] dgarstang: matthewd: I don't want to split the arguments out and parse as I want to keep generic in case the args change
[17:01:15] 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?
[17:01:17] matthewd: I'm just googling and reading this off stackoverflow ¯\_(ツ)_/¯
[17:01:54] carnegie: has joined #ruby
[17:01:55] cagomez: has joined #ruby
[17:02:35] matthewd: tryfan: Easiest is probably to open the method you're calling and add some tracing (`puts`)
[17:02:53] tryfan: matthewd: so I'm on the right track then
[17:02:55] dgarstang: matthewd: That was it, thanks
[17:03:14] carnegie: has joined #ruby
[17:03:30] tryfan: I did that from the origination point, but nothing delays until the first logger.info call
[17:03:34] Guest14429: has joined #ruby
[17:05:15] 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
[17:06:02] cagomez_: has joined #ruby
[17:06:05] dgarstang: matthewd: ok, sort of worked, it seems that the Rakefile just stops after the first job
[17:06:36] 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
[17:07:06] matthewd: ?xy dgarstang
[17:07:06] 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
[17:07:18] tryfan: matthewd: it's sending them to my home directory, and perms are good
[17:07:46] matthewd: dgarstang: (just maybe..) but maybe we can help with a higher level discussion of your goal
[17:07:58] 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
[17:08:29] kies: has joined #ruby
[17:08:29] 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
[17:09:14] Rr4sT: has joined #ruby
[17:09:58] 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
[17:10:32] howdoi: has joined #ruby
[17:10:53] hutch34: has joined #ruby
[17:12:03] dgarstang: matthewd: Yes?
[17:12:49] matthewd: dgarstang: I guess I'd start by checking whether that's invoke_task, or something about the particular task you're calling
[17:12:49] dgarstang: hm maybe it does
[17:13:28] dgarstang: matthewd: Ok, so the loop is executing twice. The second task returns an error but none of that output is displayed
[17:13:39] MarkBilk_: has joined #ruby
[17:13:55] 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
[17:14:24] tryfan: matthewd: does seem to be outputting anything when I place puts in the various methods in the logger
[17:14:30] tryfan: matthewd: doesn't, rather
[17:15:01] 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
[17:15:04] matthewd: dgarstang: Does invoke just return the output / something, instead of writing directly, maybe?
[17:15:20] dgarstang: jeez I dunno
[17:15:25] matthewd: dgarstang: Okay that's a different thing: rake tasks run once by design
[17:15:50] dgarstang: matthewd: Ok, so.. what if it's the same task with different arguments?
[17:16:08] matthewd: dgarstang: Are you sure you actually want to do this? Where's the yaml file coming from?
[17:16:09] dgarstang: Won't that run twice?
[17:16:15] matthewd: dgarstang: Same task, AFAIK
[17:16:21] dgarstang: matthewd: The yaml file has a list of projects to build
[17:17:09] 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?
[17:17:24] 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)
[17:18:44] matthewd: dgarstang: I guess the easy option would be to run rake in a subprocess for each one
[17:18:44] 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
[17:19:11] dgarstang: matthewd: you mean drive it from a script, which defeats the purpose of Rake
[17:19:27] dgarstang: or a second Rakefile, which I presume can call the other, seems hacky
[17:19:55] matthewd: I don't remember the last time I saw a rake task that took an argument, so...
[17:19:59] baroquebobcat: has joined #ruby
[17:20:21] dgarstang: matthewd: There's a bazillion examples of rake tasks taking arguments
[17:21:39] milardovich: has joined #ruby
[17:23:36] matthewd: Maybe I've just been looking in the wrong places, then
[17:24:00] dgarstang: matthewd: http://cobwwweb.com/4-ways-to-pass-arguments-to-a-rake-task
[17:25:04] matthewd: I know it's *possible* -- I'm speaking to real-world usage, leading into "must be a common problem"
[17:26:28] 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
[17:26:30] tsul: has joined #ruby
[17:27:25] bronson: has joined #ruby
[17:27:50] dgarstang: matthewd: Build for a single project, with args, no problem. Building for ALL the projects, if so desired, how?
[17:28:03] cagomez: has joined #ruby
[17:28:48] cagomez: has joined #ruby
[17:29:13] dgarstang: matthewd: or, put anothe way, if you want to build for multiple projects, what drives that?
[17:29:35] dgarstang: matthewd: Stick the call to rake inside a shell script that iterates over them?
[17:30:13] SeepingN: has joined #ruby
[17:30:16] matthewd: I'd normally expect a rakefile to exist within a project, so.. probably?
[17:32:07] 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
[17:32:32] dgarstang: some idiot checks in something that breaks, ok, remove their project from the build list
[17:34:17] AxelAlex: has joined #ruby
[17:34:56] matthewd: Using the same rake tasks? Yeah, that just sounds measurably different from how I'd expect a thing to work.
[17:35:21] dgarstang: matthewd: Different rake tasks, same Rakefile
[17:38:29] vuoto: has joined #ruby
[17:38:52] mikecmpbll: has joined #ruby
[17:43:03] lungi: has joined #ruby
[17:43:48] lungi: hey anyone around?
[17:45:29] lungi: i hope this is a good place to ask rexml question...
[17:46:48] imajes: has joined #ruby
[17:46:49] 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
[17:47:02] lungi: i would like to add the following line to my xml file using rexml:
[17:47:07] andrzejku: has joined #ruby
[17:47:11] lungi: <?xml-stylesheet type="text/xsl" href="junit.xsl"?>
[17:47:51] t-recx: has joined #ruby
[17:56:31] 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
[17:58:19] 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
[18:00:49] ahrs: has joined #ruby
[18:01:46] duderonomy: has joined #ruby
[18:03:08] kobain: has joined #ruby
[18:03:30] gusrub: has joined #ruby
[18:05:18] carnegie: has joined #ruby
[18:06:08] t-recx: has joined #ruby
[18:08:49] guacamole: has joined #ruby
[18:11:22] sneakerhax: has joined #ruby
[18:15:59] romankapitonov: has joined #ruby
[18:16:02] ramfjord: has joined #ruby
[18:17:24] minimalism: has joined #ruby
[18:17:55] xuanrui: has joined #ruby
[18:23:22] impermanence: matthewd: https://gist.github.com/jonassteinberg1/b4152f59b333d71504eb44ec107f627c
[18:23:32] impermanence: I've made some progress :)
[18:23:41] impermanence: but still a bit confused
[18:24:28] matthewd: impermanence: They're just methods
[18:25:18] impermanence: matthewd: hm.
[18:25:56] 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 }
[18:25:57] apeiros: impermanence: `Thing.new(val1: 12, val2: "hey", val3: "hi")` does not do what you think it does
[18:26:15] apeiros: you want `Thing.new(12, "hey", "hi")`
[18:26:19] matthewd: Ohh, good catch apeiros
[18:26:40] apeiros: >> Thing = Struct.new(:val1, :val2, :val3); Thing.new(val1: 12, val2: "hey", val3: "hi")
[18:26:41] carnegie: has joined #ruby
[18:26:51] apeiros: god damit eval.in :(
[18:27:01] apeiros: well, manually then
[18:27:11] 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>
[18:27:13] ruby[bot]: apeiros: # => #<struct Thing val1={:val1=>12, :val2=>"hey", :val3=>"hi"}, val2=nil, val3=nil> (https://eval.in/841236)
[18:27:20] apeiros: oh, finally…
[18:27:25] matthewd: And if I'd included the initialize in my example, I would've seen it 🙈
[18:27:30] apeiros: >> Thing = Struct.new(:val1, :val2, :val3); Thing.new(12, "hey", "hi")
[18:27:31] ruby[bot]: apeiros: # => #<struct Thing val1=12, val2="hey", val3="hi"> (https://eval.in/841237)
[18:28:15] apeiros: matthewd: sometimes you lose, sometimes the others win… ;-)
[18:28:22] bronson: has joined #ruby
[18:28:56] amitchellbullard: has joined #ruby
[18:29:21] conta1: has joined #ruby
[18:29:27] Dimik: has joined #ruby
[18:30:28] 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.
[18:30:39] t-recx: has joined #ruby
[18:31:16] matthewd: impermanence: `select` seems like you're on the right path
[18:36:14] 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?
[18:37:16] impermanence: matthewd: hm. I think I'm leaving something out then (which is my fault :) )
[18:37:17] matthewd: (I'm assuming you intend select here, and not map, say)
[18:37:39] impermanence: matthewd: yeah. I just need to return certain things from the array is all.
[18:37:42] tomphp: has joined #ruby
[18:44:06] cabotto: has joined #ruby
[18:45:40] ltem: has joined #ruby
[18:48:19] guacamole: has joined #ruby
[18:48:57] normie1: has joined #ruby
[18:52:00] dennisvennink: has joined #ruby
[18:53:07] jdawgaz: has joined #ruby
[18:55:25] cabotto: has joined #ruby
[18:56:06] minimalism: has joined #ruby
[18:58:44] Archrove-: has joined #ruby
[19:00:05] vindvaki: has joined #ruby
[19:07:37] nobitanobi: has joined #ruby
[19:07:41] Murda: has joined #ruby
[19:11:25] dionysus69: has joined #ruby
[19:12:06] carnegie: has joined #ruby
[19:17:08] NightMonkey: has joined #ruby
[19:18:30] gusrub: has joined #ruby
[19:18:44] guacamole: has joined #ruby
[19:20:47] Pierreb: has joined #ruby
[19:21:14] baroquebobcat: has joined #ruby
[19:24:54] kculpis: has joined #ruby
[19:25:01] andrzejku: has joined #ruby
[19:26:07] kculpis: has joined #ruby
[19:29:49] carnegie: has joined #ruby
[19:32:09] Mrgoose2: has joined #ruby
[19:32:29] Mrgoose2: Question, I have a hash of type #<Google::Protobuf::Any:0x00555a095af290> is there anyway I can see what the contents of that are?
[19:32:37] Mrgoose2: inspect doesnt seem to work
[19:33:09] benlieb: has joined #ruby
[19:36:37] Nicmavr: has joined #ruby
[19:36:45] normie1: has joined #ruby
[19:38:46] milardovich: has joined #ruby
[19:38:57] havenwood: Mrgoose2: Google::Protobuf::Any.kind_of? Hash #=> false
[19:39:37] havenwood: Mrgoose2: #to_h
[19:39:47] Mrgoose2: Familiar with decoding a grpc any message?
[19:39:52] mikecmpb_: has joined #ruby
[19:40:10] gusrub: has joined #ruby
[19:40:55] havenwood: Mrgoose2: It inherits from Google::Protobuf::MessageExts, so you also get #to_json and #to_proto
[19:41:08] Mrgoose2: yea to_json gives me a type_url and a value
[19:41:26] Mrgoose2: where value is encoded
[19:42:06] Guest21404: has joined #ruby
[19:44:16] rabajaj: has joined #ruby
[19:46:36] Nahra: has joined #ruby
[19:47:17] impermanence: [#<SomeClass val1: number, val2: "string", val3: number>]
[19:47:21] impermanence: I have a method returning that
[19:47:32] impermanence: I thought it was a Struct, but now I'm unsure
[19:47:47] impermanence: is this a ruby structure?
[19:48:07] impermanence: It's an array with one entry of #<>
[19:48:15] aclark: has joined #ruby
[19:57:52] gusrub: has joined #ruby
[20:04:45] gusrub: has joined #ruby
[20:05:20] Rapture: has joined #ruby
[20:05:48] thecommongeek: has joined #ruby
[20:08:39] cagomez: has joined #ruby
[20:08:58] havenwood: impermanence: It's an instance of SomeCLass
[20:09:21] eckhardt: has joined #ruby
[20:09:25] havenwood: impermanence: Ask it
[20:09:33] havenwood: >> Class.new.is_a? Struct
[20:09:35] ruby[bot]: havenwood: # => false (https://eval.in/841252)
[20:09:41] havenwood: >> Class.new.instance_of? Struct
[20:09:42] ruby[bot]: havenwood: # => false (https://eval.in/841253)
[20:10:35] havenwood: >> SomeClass = Struct.new :x; SomeClass.new(42).is_a? Struct
[20:10:36] dcunit3d: has joined #ruby
[20:10:36] ruby[bot]: havenwood: # => true (https://eval.in/841255)
[20:10:40] nopolitica: has joined #ruby
[20:10:53] nobitanobi: has joined #ruby
[20:11:13] guacamole: has joined #ruby
[20:11:18] SenpaiSilver: has joined #ruby
[20:12:00] 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...
[20:12:50] havenwood: impermanence: Look at it with Pry
[20:12:53] havenwood: ?pry impermanence
[20:12:54] 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
[20:13:02] impermanence: I am trying :)
[20:13:11] impermanence: use it everyday
[20:14:17] code_zombie: has joined #ruby
[20:15:17] vindvaki: has joined #ruby
[20:18:13] Mia: has joined #ruby
[20:18:14] Mia: has joined #ruby
[20:21:09] jenrzzz: has joined #ruby
[20:23:34] __Yiota: has joined #ruby
[20:24:26] lxsameer: has joined #ruby
[20:24:34] bsartek: has joined #ruby
[20:24:53] veex: has joined #ruby
[20:29:11] bronson: has joined #ruby
[20:30:36] _sfiguser: has joined #ruby
[20:34:07] 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).
[20:34:55] jdawgaz: has joined #ruby
[20:34:57] havenwood: impermanence: How would getting the value mutate? What is the class? What methods are available?
[20:35:37] milardovich: has joined #ruby
[20:36:12] impermanence: havenwood: hm...
[20:40:30] baroquebobcat: has joined #ruby
[20:41:20] profsimm: has joined #ruby
[20:41:38] 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?
[20:42:17] havenwood: profsimm: Are you familiar with stdlib's StringScanner?
[20:42:30] havenwood: &ri StringSCanner
[20:42:30] `derpy: No results
[20:42:33] havenwood: &ri StringScanner
[20:42:33] `derpy: http://ruby-doc.org/stdlib-2.4.1/libdoc/strscan/rdoc/StringScanner.html
[20:43:51] baweaver: impermanence: is it in an array?
[20:45:33] impermanence: baewaver: yes, it's an array of these: [#<MyClass val1: value1, val2: value2, etc.>].
[20:45:46] impermanence: baweaver: it's coming from here:
[20:46:06] impermanence: https://github.com/tcrayford/Values
[20:46:19] synthroid: has joined #ruby
[20:46:36] impermanence: And it has been implemented a bit differently, but fairlly close, fairly close
[20:46:51] impermanence: And I can return the array...but I don't know how to retrieve a specific value...
[20:47:44] __Yiota: has joined #ruby
[20:47:49] _sfiguser: has joined #ruby
[20:48:00] impermanence: so for example
[20:48:14] impermanence: if I say my array of those whatevers is called ary.
[20:49:27] brent__: has joined #ruby
[20:49:40] impermanence: if I do: ary.each { |x| x.val1 } it simply returns the array....?
[20:50:24] matthewd: impermanence: Yes, that's what each does
[20:51:00] impermanence: matthewd: hm. I though each would iterate through each element of the array and do stuff if I tell it to.
[20:51:12] matthewd: It does that too
[20:51:13] impermanence: matthewd: oh, so maybe it's not mutating it?
[20:51:15] matthewd: [08-04 04:07:17] <matthewd> (I'm assuming you intend select here, and not map, say)
[20:53:19] enterprisey: has joined #ruby
[20:54:46] orion88: has joined #ruby
[20:55:16] ur5us: has joined #ruby
[20:55:42] orion88: hi all! getting a very strange error: NoMethodError - undefined method `result_with_hash' for #<ERB:0x0000000381f9b8>, using Ruby 2.4.1
[20:56:06] 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?
[20:56:33] zenspider: orion88: the method should exist _where_?
[20:56:35] eckhardt: has joined #ruby
[20:56:58] orion88: zenspider: on an ERB object
[20:56:58] zenspider: I don't have it in my rdoc for ERB
[20:57:10] orion88: zenspider: ERB.new(get_template).result_with_hash(self.data)
[20:57:30] zenspider: again... no. can you point me to where you think the code is?
[20:57:31] orion88: zenspider: https://ruby-doc.org/stdlib-2.4.1/libdoc/erb/rdoc/ERB.html#method-i-result_with_hash
[20:57:42] orion88: zenspider: are those the right docs?
[20:58:26] zenspider: right-ish... lemme poke
[20:58:36] orion88: cool, thank you :)
[20:59:06] zenspider: starting to think "no"... stdlib erb is a single file, ~27k, and doesn't contain that method... but still poking
[20:59:18] havenwood: It's a Ruby 2.5 method that made it into the docs early.
[20:59:33] havenwood: In Ruby 2.5: ERB.new('').result_with_hash({}) #=> ""
[20:59:39] romankapitonov: has joined #ruby
[20:59:46] orion88: ok so i'm not crazy and the docs are not correct
[20:59:51] havenwood: orion88: right
[20:59:54] zenspider: yeah. the method doesn't exist anywhere in all of stdlib
[21:00:02] zenspider: I hate that website, personally...
[21:00:03] orion88: ok i feel better now :)
[21:00:15] zenspider: stick to `ri` and use your local code for doco
[21:00:31] nicolai86: has joined #ruby
[21:00:48] zenspider: I wish people would realize that ruby-doc.org is NOT official and is always suspect :/
[21:01:10] orion88: well i certainly realize that now
[21:01:24] ramfjord: has joined #ruby
[21:01:41] havenwood: https://docs.ruby-lang.org/en/2.4.0/ERB.html
[21:01:43] zenspider: orion88: can you email suggestions@ruby-doc.org to report the bug?
[21:01:55] zenspider: or jump through these hoops: http://documenting-ruby.org
[21:02:17] zenspider: no. don't do that
[21:02:20] orion88: i will add it to my todo list :)
[21:02:24] zenspider: nothing has happened on that project for 2 years
[21:02:27] orion88: thanks so much guys!
[21:02:28] zenspider: just send an email
[21:03:18] Mrgoose2: Anyone familiar with GRPC and ruby?
[21:09:28] ahrs: has joined #ruby
[21:11:30] jenrzzz: has joined #ruby
[21:11:30] jenrzzz: has joined #ruby
[21:14:04] kkiero: has joined #ruby
[21:15:13] swills: has joined #ruby
[21:20:08] mim1k: has joined #ruby
[21:21:03] elsevero: has joined #ruby
[21:22:20] thecommongeek: has joined #ruby
[21:24:31] mjolnird: has joined #ruby
[21:26:28] hinbody: has joined #ruby
[21:26:42] cagomez: has joined #ruby
[21:29:04] code_zombie_: has joined #ruby
[21:29:24] eckhardt: has joined #ruby
[21:35:28] baroquebobcat: has joined #ruby
[21:35:32] dstrunk: has joined #ruby
[21:38:02] lol: has joined #ruby
[21:48:32] jackjackdripper: has joined #ruby
[21:51:00] cagomez: has joined #ruby
[21:52:43] cagomez: has joined #ruby
[21:53:03] impermanence: What is the best way to achieve the following? some_array.map { |x| x == some_val ? x.some_property : delete x from array }
[21:53:13] impermanence: It's the last part I'm wondering about.
[21:53:46] impermanence: or is ternary just not the right way to go...?
[21:53:49] havenwood: impermanence: #select then #map
[21:53:50] eckhardt: has joined #ruby
[21:53:59] havenwood: impermanence: nope
[21:54:07] impermanence: havenwood: mm, okay. cool :)
[21:55:48] baweaver: impermanence: Or just use each_with_object / reduce or map / compact
[21:56:18] baweaver: some_array.map { |x| x == some_val && x.prop }.compact
[21:57:59] baweaver: some_array.each_with_object([]) { |x, o| o << x.prop if x == some_val }
[21:58:36] impermanence: I was thinking: some_array.select { |x| x == "whatever" }.map { |y| y.prop }
[21:58:39] impermanence: Is that bad syntax?
[21:58:42] havenwood: some_array.select { |x| x == some_val }.map(&:prop)
[21:58:47] havenwood: impermanence: all fine solutions
[21:59:13] kt: has joined #ruby
[21:59:14] havenwood: impermanence: that's fine syntax
[21:59:49] havenwood: the : is attached to the prop, it's the Symbol `:prop`
[22:00:13] impermanence: oh, okay. And that & ?
[22:00:21] havenwood: impermanence: the & is syntactic sugar that calls #to_proc and passes it as a block
[22:00:31] havenwood: :prop.to_proc
[22:00:43] havenwood: >> :abs2.to_proc.call 5
[22:00:44] ruby[bot]: havenwood: # => 25 (https://eval.in/841281)
[22:01:06] impermanence: oh, okay, cool
[22:01:08] ruby[bot]: havenwood: # => 25 (https://eval.in/841282)
[22:13:14] cagomez: has joined #ruby
[22:14:08] kt: has joined #ruby
[22:14:43] InfinityFye: has joined #ruby
[22:15:18] InfinityFye: has joined #ruby
[22:15:24] runescape07rsps: has joined #ruby
[22:19:57] dennisvennink: has joined #ruby
[22:24:59] romankapitonov: has joined #ruby
[22:25:43] benlieb: has joined #ruby
[22:26:06] impermanence: havenwood: Is there a way to do multiple &:things?
[22:26:24] impermanence: i.e. &:prop1 &:prop2 &:prop3 ?
[22:27:07] baroquebobcat: has joined #ruby
[22:27:47] impermanence: also is map(&:price) old syntax? It's working against 2.4.1 but I'm just wondering if it is outdated...?
[22:29:17] ramfjord: has joined #ruby
[22:29:52] cagomez: has joined #ruby
[22:30:43] bronson: has joined #ruby
[22:30:55] goyox86: has joined #ruby
[22:31:49] 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
[22:32:10] havenwood: impermanence: at that point you might prefer to: map { |thing| thing.prop1.prop2.prop3 }
[22:32:32] goyox86: has joined #ruby
[22:33:28] impermanence: havenwood: ah, okay. I am curious about a concise way to add multiple Integer attributes from an array of objects
[22:33:53] havenwood: impermanence: show the code you have so far? or what you have and what you want?
[22:35:14] impermanence: some_array.map(&:prop1 + &:prop2 + &:prop3).inject(0, :+)
[22:35:22] impermanence: obviously does not work :)
[22:35:25] ramfjord: has joined #ruby
[22:35:54] havenwood: impermanence: #sum takes a block
[22:36:16] jenrzzz: has joined #ruby
[22:36:16] jenrzzz: has joined #ruby
[22:36:21] impermanence: yeah, okay. I'll look at sum.
[22:36:34] havenwood: impermanence: https://docs.ruby-lang.org/en/2.4.0/Enumerable.html#method-i-sum
[22:39:28] Axsuul: has joined #ruby
[22:40:32] impermanence: array.sum { |x| x.prop1 + x.prop2 + x.prop3 ... } got me there :)
[22:40:39] cagomez: has joined #ruby
[22:40:46] ramfjord: has joined #ruby
[22:41:52] kt: has joined #ruby
[22:42:03] RahulT: has joined #ruby
[22:43:53] romankapitonov: has joined #ruby
[22:44:00] gusrub: has joined #ruby
[22:47:09] CrazyEddy: has joined #ruby
[22:47:17] CrazyEddy: has joined #ruby
[22:48:39] cagomez: has joined #ruby
[22:48:55] kt: has joined #ruby
[22:50:52] ixti: has joined #ruby
[22:51:15] cagomez_: has joined #ruby
[22:56:15] perniciouscaffei: has joined #ruby
[22:57:37] Ropeney: has joined #ruby
[23:03:28] jnollette: has joined #ruby
[23:06:29] cagomez: has joined #ruby
[23:09:29] cagomez: has joined #ruby
[23:10:31] jenrzzz: has joined #ruby
[23:10:31] jenrzzz: has joined #ruby
[23:11:50] cagomez: has joined #ruby
[23:20:37] mim1k: has joined #ruby
[23:20:38] cagomez: has joined #ruby
[23:20:54] segy: has joined #ruby
[23:21:53] jdbrowne: has joined #ruby
[23:22:08] ur5us_: has joined #ruby
[23:22:27] _sfiguser: has joined #ruby
[23:25:53] ur5us: has joined #ruby
[23:27:39] impermanence: hm. so i have something like some_array.zip(other_array).map { |x, y| y - x }
[23:27:53] impermanence: works great in pry, but throws "unknown method -
[23:28:04] impermanence: " when ran against mrb...?
[23:30:10] dcunit3d: has joined #ruby
[23:34:09] RahulT: has joined #ruby
[23:35:12] alveric2: has joined #ruby
[23:36:13] QualityAddict: has joined #ruby
[23:36:19] Ropeney_: has joined #ruby
[23:38:02] cagomez: has joined #ruby
[23:41:03] t-recx: has joined #ruby
[23:41:14] kt: has joined #ruby
[23:49:24] romankapitonov: has joined #ruby
[23:58:21] chouhoulis: has joined #ruby
[23:59:09] chouhoul_: has joined #ruby
[23:59:44] orion88: has joined #ruby