« Back to channel list

#ruby - 21 February 2018

« Back 1 day Forward 1 day »
[00:01:45] gary_: has joined #ruby
[00:03:05] chouhoulis: has joined #ruby
[00:05:33] sameerynho: has joined #ruby
[00:06:22] apricant_: has joined #ruby
[00:08:06] rwb: has joined #ruby
[00:08:16] herbmillerjr: has joined #ruby
[00:18:45] jaequery: has joined #ruby
[00:19:38] byte512_: has joined #ruby
[00:20:01] baweaver: dminuoso: Oh I'm much worse in person
[00:25:18] pablolm: has joined #ruby
[00:28:31] eckhardt: has joined #ruby
[00:31:10] bijan_: has joined #ruby
[00:31:37] gary: has joined #ruby
[00:37:15] karapetyan: has joined #ruby
[00:39:22] guacamole: has joined #ruby
[00:39:22] guacamole: has joined #ruby
[00:41:34] gary_: has joined #ruby
[00:46:33] arescorpio: has joined #ruby
[00:48:51] eckhardt: has joined #ruby
[00:52:10] willmichael: has joined #ruby
[00:57:30] Psybur_: has joined #ruby
[01:00:00] miah: we should have a #ruby sf lunch/dinner meet up some time
[01:00:06] miah: (in oakland though because sf is dumb)
[01:00:21] hdb2: has joined #ruby
[01:02:08] guacamole: has joined #ruby
[01:02:08] guacamole: has joined #ruby
[01:02:22] baweaver: miah: you get to suggest locale then
[01:05:24] govg: has joined #ruby
[01:07:58] ogres: has joined #ruby
[01:10:59] gary: has joined #ruby
[01:11:45] cdg_: has joined #ruby
[01:13:00] cdg__: has joined #ruby
[01:13:17] nowhereman_: has joined #ruby
[01:18:11] govg: has joined #ruby
[01:21:06] willmichael: has joined #ruby
[01:26:16] RougeR: has joined #ruby
[01:27:33] s3nd1v0g1us: has joined #ruby
[01:29:27] bigblind: has joined #ruby
[01:30:11] sanscoeur: has joined #ruby
[01:36:54] cthulchu: has joined #ruby
[01:42:00] kapil___: has joined #ruby
[01:42:02] vutral|kali: has joined #ruby
[01:42:03] vutral|kali: has joined #ruby
[01:42:10] shortdudey123: has joined #ruby
[01:43:52] gary_: has joined #ruby
[01:52:00] n0m4d1c: has joined #ruby
[01:53:55] cthulchu: has joined #ruby
[01:54:08] weaksauce: has joined #ruby
[01:54:39] vutral|kali: has joined #ruby
[01:54:50] vutral|kali: has joined #ruby
[01:54:58] snath: has joined #ruby
[02:05:04] karapetyan: has joined #ruby
[02:08:53] cthulchu: has joined #ruby
[02:09:42] shortdudey123: has joined #ruby
[02:12:13] vutral|kali: has joined #ruby
[02:12:14] vutral|kali: has joined #ruby
[02:14:44] gary: has joined #ruby
[02:17:15] orbyt_: has joined #ruby
[02:22:02] _aeris_: has joined #ruby
[02:24:13] shortdudey123: has joined #ruby
[02:24:37] dnewkerk: has joined #ruby
[02:29:10] bigblind: has joined #ruby
[02:32:28] memo1: has joined #ruby
[02:35:20] gizmore|2: has joined #ruby
[02:36:21] kmacleod: has joined #ruby
[02:37:20] houhoulis: has joined #ruby
[02:38:39] konsolebox: has joined #ruby
[02:39:57] ecuanaso: has joined #ruby
[02:40:19] alfiemax: has joined #ruby
[02:49:58] karapetyan: has joined #ruby
[02:50:31] morenoh149: has joined #ruby
[02:51:54] cthulchu: has joined #ruby
[02:52:32] ecuanaso: has joined #ruby
[02:52:39] darkhanb: has joined #ruby
[02:53:44] gary_: has joined #ruby
[02:58:54] kmacleod: has left #ruby: ("Leaving")
[03:04:48] karapetyan: has joined #ruby
[03:06:54] cthulchu: has joined #ruby
[03:13:10] Olipro: has joined #ruby
[03:15:03] nowhere_man: has joined #ruby
[03:25:33] howdoi: has joined #ruby
[03:30:18] gary: has joined #ruby
[03:31:01] sumobob: has joined #ruby
[03:31:27] BTRE: has joined #ruby
[03:41:52] govg: has joined #ruby
[03:44:49] sanscoeur: has joined #ruby
[03:45:18] willmichael: has joined #ruby
[03:51:58] sumobob: has joined #ruby
[03:52:32] raynold: has joined #ruby
[03:55:04] gary_: has joined #ruby
[03:56:54] cthulchu: has joined #ruby
[04:03:09] apricant_: has joined #ruby
[04:04:12] Gary_B: has joined #ruby
[04:11:29] willmichael: has joined #ruby
[04:11:38] sumobob: has joined #ruby
[04:11:56] cthulchu: has joined #ruby
[04:18:45] sumobob: has joined #ruby
[04:25:15] trautwein: has joined #ruby
[04:28:33] willmichael: has joined #ruby
[04:28:44] herbmillerjr: has joined #ruby
[04:31:10] morenoh149: has joined #ruby
[04:33:25] alfiemax: has joined #ruby
[04:34:24] nopoliti1: has joined #ruby
[04:36:04] gary: has joined #ruby
[04:39:45] konsolebox: has joined #ruby
[04:40:27] alfiemax_: has joined #ruby
[04:42:28] willmichael: has joined #ruby
[04:49:48] alfiemax: has joined #ruby
[04:51:55] SuperLag: has joined #ruby
[04:52:54] morenoh149: has joined #ruby
[04:53:24] Abhijit: has joined #ruby
[04:53:52] Abhijit: whats the recommended way to run shell commands from ruby, when my program needs to make decision based upon output of that shell command and not just execute it?
[04:57:16] gix: has joined #ruby
[04:57:42] milardovich: has joined #ruby
[04:58:56] cthulchu: has joined #ruby
[05:00:32] Tagami[m]: has left #ruby: ("User left")
[05:01:54] hdb2: has joined #ruby
[05:05:18] willmichael: has joined #ruby
[05:13:54] cthulchu: has joined #ruby
[05:24:32] alfiemax: has joined #ruby
[05:34:38] s2013: has joined #ruby
[05:40:17] alfiemax: has joined #ruby
[05:42:55] willmichael: has joined #ruby
[05:50:56] cthulchu: has joined #ruby
[06:03:19] kapil___: has joined #ruby
[06:04:04] sidx64: has joined #ruby
[06:05:56] cthulchu: has joined #ruby
[06:06:41] willmichael: has joined #ruby
[06:07:56] darkhanb: has joined #ruby
[06:09:23] instrud: has joined #ruby
[06:12:37] aspiers: has joined #ruby
[06:15:43] milardovich: has joined #ruby
[06:26:03] naprimer: has joined #ruby
[06:26:35] ramfjord: has joined #ruby
[06:34:52] jenrzzz: has joined #ruby
[06:34:52] jenrzzz: has joined #ruby
[06:43:03] dionysus69: has joined #ruby
[06:43:17] aufi: has joined #ruby
[06:50:55] cthulchu: has joined #ruby
[06:51:48] mtkd: has joined #ruby
[06:52:03] LocaMocha: has joined #ruby
[06:52:49] darkhanb: has joined #ruby
[06:53:09] d5sx43: has joined #ruby
[07:05:48] reber: has joined #ruby
[07:06:17] cthulchu: has joined #ruby
[07:06:45] DTZUZO: has joined #ruby
[07:17:01] n008f4g_: has joined #ruby
[07:17:37] andikr: has joined #ruby
[07:19:35] karapetyan: has joined #ruby
[07:25:40] willmichael: has joined #ruby
[07:27:00] sumobob: has joined #ruby
[07:27:25] alfiemax: has joined #ruby
[07:28:14] alfiemax_: has joined #ruby
[07:28:59] alex``: has joined #ruby
[07:29:59] gary: has joined #ruby
[07:32:59] anisha: has joined #ruby
[07:33:20] apeiros: has joined #ruby
[07:36:46] sidx64: has joined #ruby
[07:42:44] milardovich: has joined #ruby
[07:44:02] ShekharReddy: has joined #ruby
[07:45:58] conta: has joined #ruby
[07:48:12] agent_white: has joined #ruby
[07:49:05] clemens3: has joined #ruby
[07:50:11] maum: has joined #ruby
[07:51:35] alex``: has joined #ruby
[07:52:32] tAn: has joined #ruby
[07:53:57] cthulchu: has joined #ruby
[07:54:48] Q---: has joined #ruby
[07:55:35] alex``: has joined #ruby
[07:58:01] orbyt_: has joined #ruby
[07:58:01] gmcintire: has joined #ruby
[07:58:50] RushPL: has joined #ruby
[08:00:23] timmow: has joined #ruby
[08:00:28] sidx64: has joined #ruby
[08:02:37] bokayio: has joined #ruby
[08:02:44] shortdudey123: has joined #ruby
[08:03:00] iNs: has joined #ruby
[08:06:54] Dimik: has joined #ruby
[08:08:55] cthulchu: has joined #ruby
[08:21:57] DaniG2k: has joined #ruby
[08:24:56] gary: has joined #ruby
[08:28:02] mtkd: has joined #ruby
[08:30:19] gary_: has joined #ruby
[08:36:24] anisha_: has joined #ruby
[08:39:37] claudiuinberlin: has joined #ruby
[08:39:40] Gary_B: has joined #ruby
[08:42:06] aupadhye: has joined #ruby
[08:47:48] devil_tux: has joined #ruby
[08:47:52] vutral|kali: has joined #ruby
[08:47:53] vutral|kali: has joined #ruby
[08:52:41] mello: has joined #ruby
[08:53:57] cthulchu: has joined #ruby
[08:54:07] Sylario: has joined #ruby
[08:56:06] marr: has joined #ruby
[08:56:36] dminuoso: >> f = -> (r, name, url) { r.map { |i| [name % i, url % i ] } }; f[1..5, "a-%s", "b-%s"]
[08:56:37] ruby[bot]: dminuoso: # => [["a-1", "b-1"], ["a-2", "b-2"], ["a-3", "b-3"], ["a-4", "b-4"], ["a-5", "b-5"]] (https://eval.in/959992)
[08:58:04] dminuoso: >> spr = -> s, v { s % v }; 1.step.lazy.zip(&spr["a-%s"])
[08:58:05] ruby[bot]: dminuoso: # => wrong number of arguments (given 1, expected 2) (ArgumentError) ...check link for more (https://eval.in/959993)
[08:58:13] dminuoso: >> spr = -> s, v { s % v }.curry; 1.step.lazy.zip(&spr["a-%s"])
[08:58:20] ruby[bot]: dminuoso: # => (https://eval.in/959994)
[08:58:56] dminuoso: >> spr = -> s, v { s % v }.curry; 1.step.lazy.map(&spr["a-%s"]).take(10).force
[08:58:57] ruby[bot]: dminuoso: # => ["a-1", "a-2", "a-3", "a-4", "a-5", "a-6", "a-7", "a-8", "a-9", "a-10"] (https://eval.in/959995)
[08:59:05] Gary_B: has joined #ruby
[08:59:14] kapil___: has joined #ruby
[08:59:18] guille-moe: has joined #ruby
[09:00:36] willmichael: has joined #ruby
[09:02:15] mikecmpbll: has joined #ruby
[09:03:29] hdb2: has joined #ruby
[09:06:02] Azure: has joined #ruby
[09:08:19] dminuoso: apeiros: How would you like a fixed tuple type?
[09:08:24] dminuoso: Something like
[09:08:36] dminuoso: Array without push/pop
[09:08:57] cthulchu: has joined #ruby
[09:09:11] apeiros: like Tuple = Struct.new(:a, :b) ?
[09:09:36] tomphp: has joined #ruby
[09:09:58] RougeR: has joined #ruby
[09:09:58] RougeR: has joined #ruby
[09:10:07] dminuoso: apeiros: Well imagine you could write: <1, "foo">
[09:10:20] dminuoso: But deconstruct in blocks.
[09:10:37] dminuoso: grammar issues aside
[09:11:06] dminuoso: apeiros: My main problem with Struct is just that you lose that easy access to .map { |(fst, snd)| ... }
[09:11:07] apeiros: so you're asking whether I'd like syntax for that?
[09:11:44] apeiros: sure, I'd like syntax for that. but my list of priorities re literals is different.
[09:11:51] apeiros: I'd want date & datetime first
[09:11:55] dminuoso: What do you mean?
[09:12:15] apeiros: re .map: easy enough, no?
[09:12:22] sidx64: has joined #ruby
[09:12:46] dminuoso: Why? This is not exposed in userland api is it?
[09:12:57] apeiros: Tuple = Struct.new(:a, :b) do include Enumerable; def each; return enum_for(__method__) unless block_given?; yield(a); yield(b); end; end; end
[09:13:04] dminuoso: No way. It is exposed?
[09:13:37] dminuoso: That is absolutely great. You may have instantly triggered a gitlab issue "REFACTOR ALL THE THINGS"
[09:13:40] apeiros: oh actually map is even in there already
[09:14:07] apeiros: but maybe not the way you want it, looking at your example
[09:14:16] apeiros: seems like you want the .map to yield all members?
[09:14:56] dminuoso: apeiros: Let me approach it differently because I think I can show you with an implementation.
[09:14:59] dminuoso: Where is this documented?
[09:15:03] vutral|kali: has joined #ruby
[09:15:03] vutral|kali: has joined #ruby
[09:15:28] dminuoso: Im guessing (a, b) simply uses .each to produce the values?
[09:16:27] dminuoso: >> def Pair a, b; Pair.new(a, b); end; Pair = Struct.new(:a, :b) do include Enumerable; def each; return enum_for(__method__) unless block_given?; yield(a); yield(b); end; end; end; [Pair(1, 2), Pair(3, 4)].map { |(fst, snd)| fst + snd }
[09:16:28] ruby[bot]: dminuoso: # => /tmp/execpad-fc153388ce96/source-fc153388ce96:3: syntax error, unexpected keyword_rescue, expecting ...check link for more (https://eval.in/960008)
[09:17:07] dminuoso: >> def Pair a, b; Pair.new(a, b); end; Pair = Struct.new(:a, :b) do; include Enumerable; def each; return enum_for(__method__) unless block_given?; yield(a); yield(b); end; end; [Pair(1, 2), Pair(3, 4)].map { |(fst, snd)| fst + snd }
[09:17:08] ruby[bot]: dminuoso: # => undefined method `+' for #<struct Pair a=1, b=2> (NoMethodError) ...check link for more (https://eval.in/960011)
[09:17:36] dminuoso: apeiros: ^- mm this is what I want.
[09:17:41] dminuoso: Except for the "not working part"
[09:17:43] willmichael: has joined #ruby
[09:18:43] gary: has joined #ruby
[09:18:58] dminuoso: >> class A; def each; puts "called"; end; end [A.new].map { |(e)| }
[09:18:59] ruby[bot]: dminuoso: # => no implicit conversion of A into Integer (TypeError) ...check link for more (https://eval.in/960017)
[09:19:19] tvw: has joined #ruby
[09:19:38] dminuoso: >> class A; def each; puts "called"; end; end; [A.new].map { |(e)| }
[09:19:39] ruby[bot]: dminuoso: # => [nil] (https://eval.in/960019)
[09:19:45] dminuoso: >> class A; def each; puts "called"; end; end; [A.new].map { |(e, v)| }
[09:19:46] ruby[bot]: dminuoso: # => [nil] (https://eval.in/960020)
[09:19:56] dminuoso: >> class A; def each; raise "called"; end; end; [A.new].map { |(e, v)| }
[09:21:22] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/960023
[09:21:28] dminuoso: asm>> q = *a
[09:21:29] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/960024
[09:21:52] dminuoso: tbuehlmann: Its not like there's any discussion going on anyway
[09:23:48] gary_: has joined #ruby
[09:24:49] beauby: has joined #ruby
[09:26:38] dminuoso: >> class Array; def each; raise; end; end; ->((a, b)) {}[[1,2]]
[09:26:40] ruby[bot]: dminuoso: # => nil (https://eval.in/960036)
[09:27:23] dminuoso: >> class Array; def to_ary; raise; end; end; ->((a, b)) {}[[1,2]]
[09:27:25] ruby[bot]: dminuoso: # => nil (https://eval.in/960037)
[09:28:21] dminuoso: >> Tuple = Struct.new(:a, :b) do def to_ary; [a, b]; end end; [Tuple.new(1,2), Tuple.new(3,4)].map { |(fst, snd)| fst + snd }
[09:28:22] ruby[bot]: dminuoso: # => [3, 7] (https://eval.in/960038)
[09:28:27] dminuoso: apeiros: Lovely! Thanks!
[09:28:46] riotjones: has joined #ruby
[09:29:07] dminuoso: >> Tuple = Struct.new(:a, :b) do def to_ary; [a, b]; end end; [Tuple.new(1,2), Tuple.new(3,4)].map { |(fst)| fst }
[09:29:08] ruby[bot]: dminuoso: # => [1, 3] (https://eval.in/960039)
[09:29:10] dminuoso: This is great.
[09:29:50] mikecmpbll: has joined #ruby
[09:30:01] Tempesta: has joined #ruby
[09:30:02] Tempesta: has joined #ruby
[09:30:50] JoshS: has joined #ruby
[09:30:51] wnd: has joined #ruby
[09:31:02] milardovich: has joined #ruby
[09:36:24] yonahw: has joined #ruby
[09:39:20] willmichael: has joined #ruby
[09:40:41] bijan_: has joined #ruby
[09:42:23] bijan_: has joined #ruby
[09:44:28] alfiemax: has joined #ruby
[09:46:34] vutral|kali: has joined #ruby
[09:46:34] vutral|kali: has joined #ruby
[09:46:51] tomphp: has joined #ruby
[09:47:15] Gary_B: has joined #ruby
[09:48:52] willmichael: has joined #ruby
[09:49:56] cthulchu: has joined #ruby
[09:52:34] Gary_B: has joined #ruby
[09:57:04] mello: has joined #ruby
[09:57:07] Beams: has joined #ruby
[10:00:55] dionysus69: I have a rescue > retry confusion going on
[10:00:56] dionysus69: https://gist.github.com/anonymous/34bce10c077b7a840b908a6d87a3168c
[10:01:17] dionysus69: in here, if wallet is locked it throws exception with code 12
[10:01:28] dionysus69: but after it unlocks, and reties, it still throws 12
[10:01:57] dionysus69: if I terminate script and rerun, then it doesn't throw 12 anymore and executes the main part of program
[10:02:07] Gary_B: has joined #ruby
[10:02:56] dionysus69: so why isn't it unlocking on runtime without terminating and rerunning ?
[10:03:07] dionysus69: doesn't make sense :S
[10:03:27] user2: has joined #ruby
[10:04:58] cthulchu: has joined #ruby
[10:05:03] vutral|kali: has joined #ruby
[10:05:03] vutral|kali: has joined #ruby
[10:07:26] Gary_B: has joined #ruby
[10:12:20] apeiros: dionysus69: probably cached information somewhere?
[10:13:11] mtkd: has joined #ruby
[10:13:56] vutral|kali: has joined #ruby
[10:13:56] vutral|kali: has joined #ruby
[10:14:15] jaruga: has joined #ruby
[10:15:32] ecuanaso: has joined #ruby
[10:22:54] bngsudheer: has left #ruby: ("Leaving")
[10:23:18] AJA4350: has joined #ruby
[10:24:30] np4433: has joined #ruby
[10:26:06] bijan_: has joined #ruby
[10:26:17] ramfjord: has joined #ruby
[10:28:00] yohji: has joined #ruby
[10:30:03] gary: has joined #ruby
[10:30:06] sidx64: has joined #ruby
[10:30:53] lesce: has joined #ruby
[10:32:01] karapetyan: has joined #ruby
[10:34:38] sidx64: has joined #ruby
[10:35:04] gary_: has joined #ruby
[10:36:43] karapetyan: has joined #ruby
[10:36:50] adlerdias: has joined #ruby
[10:39:50] GodFather: has joined #ruby
[10:46:19] cthulchu: has joined #ruby
[10:49:43] Mike11: has joined #ruby
[10:49:45] sidx64: has joined #ruby
[10:55:53] milardovich: has joined #ruby
[10:57:27] milardovich: has joined #ruby
[11:00:58] cthulchu: has joined #ruby
[11:02:57] sumobob: has joined #ruby
[11:05:10] Gary_B: has joined #ruby
[11:07:39] goatish: has joined #ruby
[11:08:17] Mia: has joined #ruby
[11:08:17] Mia: has joined #ruby
[11:09:30] jnollette: has joined #ruby
[11:10:22] Gary_B: has joined #ruby
[11:13:56] Cavallari: has joined #ruby
[11:20:49] vutral|kali: has joined #ruby
[11:20:49] vutral|kali: has joined #ruby
[11:21:07] gary: has joined #ruby
[11:26:10] gary_: has joined #ruby
[11:29:39] Serpent7776: has joined #ruby
[11:31:32] ldnunes: has joined #ruby
[11:31:54] amatas_: has joined #ruby
[11:32:09] apparition: has joined #ruby
[11:36:21] amatas__: has joined #ruby
[11:38:28] tomphp: has joined #ruby
[11:38:55] Gary_B: has joined #ruby
[11:46:55] cthulchu: has joined #ruby
[11:48:17] karapetyan: has joined #ruby
[11:50:21] adlerdias: has left #ruby: ()
[11:50:37] discopatrick: has joined #ruby
[11:51:22] ecuanaso: has joined #ruby
[11:53:42] apeiros_: has joined #ruby
[11:56:11] Gary_B: has joined #ruby
[11:57:21] despai: has joined #ruby
[11:57:59] Psybur_: has joined #ruby
[11:58:35] nowhereman_: has joined #ruby
[12:01:42] ziso: has joined #ruby
[12:01:57] cthulchu: has joined #ruby
[12:03:08] ziso: Can anyone recommend an alternative to basically just using Classes as namespaces for methods? No experience in OOP, so it just seems like a verbose way to use methods.
[12:05:41] vutral|kali: has joined #ruby
[12:05:41] vutral|kali: has joined #ruby
[12:06:20] apeiros_: ziso: then I'd recommend you to get familiar with OO instead of trying to write COBOL in ruby.
[12:06:28] tobiasvl: ziso: an alternative to using classes as namespaces? well, what about using namespaces as namespaces
[12:06:59] ziso: I just took that from Steve Yegge's argument against using singletons, realizing that's basically all I was using classes for
[12:08:02] apeiros: that's a good realization. however, your "fix" of the perceived problem is terrible.
[12:09:07] apeiros: you realized "I wrote badly architected code". your fix is "how can I write badly architected code in a different way?". IMO the proper approach is "how can I use OO to have better architecture."
[12:09:08] ziso: my project is constrained to only use one global module, so would it make more sense to use sub modules for namespacing where necessary?
[12:09:27] ziso: you're right
[12:09:40] apeiros: you can nest modules and classes as deeply as you want
[12:10:09] apeiros: and restricting toplevel surface of a project/library to a single module (or class) is a good idea.
[12:11:12] tomphp: has joined #ruby
[12:13:05] apeiros: and if you need help with how to structure your non-OO code into classes, you can always create a gist or link your repository here and ask for help.
[12:13:09] ziso: thank you. POODR went a bit over my head but i would like to slowly move an in-production project over to somethiing more easily maintainable
[12:14:23] bijan_awaaaay: has joined #ruby
[12:15:34] apeiros: it's entirely possible that OO isn't a style which fits you. it might be worth considering e.g. functional languages and see whether that style matches your way of thinking.
[12:16:23] apeiros: it's not like OO was "the one true way". it's just that I think it's a bad idea to use ruby in a non-OO way (note that OO and functional can mix to a degree)
[12:16:23] tAn: has joined #ruby
[12:17:46] alex``: has joined #ruby
[12:18:23] mtkd: has joined #ruby
[12:19:02] willmichael: has joined #ruby
[12:19:23] DTZUZO: has joined #ruby
[12:19:38] cabotto: has joined #ruby
[12:24:01] gregf_: has joined #ruby
[12:25:57] adlerdias: has joined #ruby
[12:26:10] ramfjord: has joined #ruby
[12:26:35] lvmbdv: has joined #ruby
[12:26:38] Nightmare: has joined #ruby
[12:28:33] alfiemax: has joined #ruby
[12:28:47] vutral|kali: has joined #ruby
[12:28:48] vutral|kali: has joined #ruby
[12:28:51] workmad3: has joined #ruby
[12:29:02] Psybur__: has joined #ruby
[12:31:45] alfiemax_: has joined #ruby
[12:33:04] darix: has joined #ruby
[12:34:02] alex``: has joined #ruby
[12:36:47] thinkpad: has joined #ruby
[12:37:53] alfiemax: has joined #ruby
[12:39:47] jaruga: has joined #ruby
[12:42:00] gary: has joined #ruby
[12:42:09] LenPayne: has joined #ruby
[12:42:13] karapetyan: has joined #ruby
[12:42:38] karapetyan: has joined #ruby
[12:43:40] Cyrus: has joined #ruby
[12:43:51] vutral|kali: has joined #ruby
[12:43:51] vutral|kali: has joined #ruby
[12:43:53] jaruga: has joined #ruby
[12:44:03] alfiemax: has joined #ruby
[12:44:54] minimalism: has joined #ruby
[12:45:49] shinnya: has joined #ruby
[12:46:21] houhoulis: has joined #ruby
[12:48:01] sidx64: has joined #ruby
[12:48:36] jordanm: has joined #ruby
[12:49:42] vutral|kali: has joined #ruby
[12:49:42] vutral|kali: has joined #ruby
[12:52:02] sidx64: has joined #ruby
[12:54:51] Guest80262: has joined #ruby
[12:56:05] ldnunes: has joined #ruby
[12:56:59] cthulchu: has joined #ruby
[12:58:06] vutral|kali: has joined #ruby
[12:58:06] vutral|kali: has joined #ruby
[12:59:29] John_Ivan: has joined #ruby
[12:59:29] John_Ivan: has joined #ruby
[12:59:54] dionysus69: thanks apeiros, class variable was being cached with ||= assignment, I was using it not to recreate connection object multiple times :)
[13:00:15] Gary_B: has joined #ruby
[13:01:02] sidx64: has joined #ruby
[13:01:59] synthroid: has joined #ruby
[13:03:17] nowhere_man: has joined #ruby
[13:05:06] hdb2: has joined #ruby
[13:06:21] memo1: has joined #ruby
[13:06:35] apeiros: dionysus69: yay, my psychic tele-debugging capabilities are unmatched ;-D
[13:08:09] RougeR: has joined #ruby
[13:08:09] RougeR: has joined #ruby
[13:08:56] jaruga: has joined #ruby
[13:10:26] amatas_: has joined #ruby
[13:10:46] Gary_B: has joined #ruby
[13:10:54] vutral|kali: has joined #ruby
[13:10:55] vutral|kali: has joined #ruby
[13:11:29] goatish: has joined #ruby
[13:11:56] cthulchu: has joined #ruby
[13:12:26] dminuoso: Stupid arel :(
[13:12:39] vutral|kali: has joined #ruby
[13:12:39] vutral|kali: has joined #ruby
[13:13:04] amatas__: has joined #ruby
[13:13:32] SuperL4g: has joined #ruby
[13:16:04] desperek: has joined #ruby
[13:20:33] cabotto: has joined #ruby
[13:21:36] tAn: has joined #ruby
[13:22:43] vondruch_: has joined #ruby
[13:24:18] gary: has joined #ruby
[13:24:58] tAn: has joined #ruby
[13:28:42] willmichael: has joined #ruby
[13:30:17] willmichael: has joined #ruby
[13:30:55] Puffball: has joined #ruby
[13:32:48] ziso: I'm sure I'm doing this wrong. Trying to access an instance variable from a module using attr_reader fails with "undefined method". But defining my own succeeds. any ideas? https://gist.github.com/anonymous/8827267302ae6498cff3bf6ded9f37c6
[13:35:22] minimalism: has joined #ruby
[13:36:35] tbuehlmann: `attr_reader :special` defines the getter for instance variables (for instances), whereas you're defining @special as a class instance variable (for the class)
[13:37:25] gary_: has joined #ruby
[13:38:13] ecuanaso: has joined #ruby
[13:38:38] ziso: tbuehlmann: Right, so there's no instance of a module, unless you use it as a mixin, correct?
[13:39:52] Papierkorb: has joined #ruby
[13:40:24] cdg: has joined #ruby
[13:41:12] tbuehlmann: in this case defining instance variables only makes sense when including/extending the module, right
[13:42:14] bmurt: has joined #ruby
[13:42:22] apeiros: ziso: the module itself is an object too, though. and https://gist.github.com/anonymous/8827267302ae6498cff3bf6ded9f37c6#file-inner_module-rb-L6 accesses that object's @special ivar
[13:42:28] apeiros: and you can create an accessor for that via:
[13:42:42] apeiros: class << self; attr_reader :special; end (within Inner)
[13:43:29] Papierkorb: has left #ruby: ("Konversation terminated!")
[13:46:58] cthulchu: has joined #ruby
[13:49:52] amatas_: has joined #ruby
[13:50:33] oroborous: has joined #ruby
[13:50:33] oroborous: has joined #ruby
[13:52:25] amatas_: has joined #ruby
[13:54:03] Psybur: has joined #ruby
[13:54:12] Gary_B: has joined #ruby
[13:54:27] tomphp: has joined #ruby
[13:56:46] EnderMB: has joined #ruby
[13:57:11] nowhereman_: has joined #ruby
[14:01:59] cthulchu: has joined #ruby
[14:02:57] dionysus69: I want to do something super custom dunno if it's possible or if it makes sense
[14:03:17] dionysus69: I want to call a method on some class lets say Classs.method_name(param)
[14:03:31] dionysus69: and param needs to be constructed depending on what the method name is
[14:03:51] dionysus69: with a custructor method, which takes a method name as a param
[14:05:28] dionysus69: so I want to something like this Class.method_name(param(method_name_as_variable))
[14:05:31] vutral|kali: has joined #ruby
[14:05:31] vutral|kali: has joined #ruby
[14:05:42] Mike11: has joined #ruby
[14:05:56] Junaos: has joined #ruby
[14:06:23] rabajaj: hey, i am new to ruby. having issues understanding symbols! i understood that they are unique and always have the same object_id but not clear with where to use it and why to use it.
[14:06:54] hdb2: has joined #ruby
[14:06:59] rabajaj: can they store some value like a variable?
[14:07:34] rabajaj: any links or articles related to this will be a great help :)
[14:07:41] ziso: apeiros: Thanks! that works. Is there a name for that pattern I can research further?
[14:10:35] EnderMB: has joined #ruby
[14:10:58] jcalla: has joined #ruby
[14:11:07] Gary_B: has joined #ruby
[14:11:18] Psybur_: has joined #ruby
[14:12:39] Tempesta: has joined #ruby
[14:12:55] xfbs: has joined #ruby
[14:17:09] rwb: has joined #ruby
[14:21:32] Bish: rabajaj: symbols don't differ in any way from immutable strings EXCEPT the object_id stays static
[14:21:46] Bish: they're mostly used to have quick acccess in hashes
[14:21:57] Bish: and ofcourse their type is different
[14:22:21] rabajaj: Bish, i have been it being passed to the a method as a parameter, if it is passed what will it do ?
[14:22:45] rabajaj: s/been/seen
[14:22:47] Bish: it will be the same thing inside the method, ofcourse
[14:23:07] Bish: as i said, only thing that differs, is that they're immutable/have always the same object_>d
[14:23:21] Bish: (and type)
[14:23:22] jeffreylevesque: has joined #ruby
[14:23:25] mtkd: has joined #ruby
[14:23:32] Bish: the only benefits you have is speed & abstraction
[14:23:42] ecuanaso: has joined #ruby
[14:24:08] rabajaj: Bish, can they be used as a method name ?
[14:25:06] adlerdias: has left #ruby: ()
[14:25:13] Bish: if you create a method they are already a symbol.. in the set of methods of current object
[14:25:36] rabajaj: so you mena i can call a method by using its symbol ?
[14:25:43] rabajaj: s/mena/mean
[14:25:57] Bish: >> 1.method(:+).call(1)
[14:26:04] ramfjord: has joined #ruby
[14:26:05] Bish: >> 1.method(:+).call(1)
[14:26:06] ruby[bot]: Bish: # => 2 (https://eval.in/960335)
[14:26:19] vutral|kali: has joined #ruby
[14:26:19] vutral|kali: has joined #ruby
[14:26:28] Bish: i took the + method of the number 1, and called it with the parameter 1
[14:26:48] Bish: you can always access the methods of an object with
[14:27:00] Bish: Object.method(:methodNameAsASymbol)
[14:27:27] Bish: you can't have symbols (using the literal) that begin with 1
[14:27:36] Bish: the reason is that, you can't have methods beginning with a number
[14:27:40] Bish: >> def 1method;end;
[14:27:41] ruby[bot]: Bish: # => /tmp/execpad-ffba1356f94d/source-ffba1356f94d:2: syntax error, unexpected tINTEGER ...check link for more (https://eval.in/960336)
[14:27:48] Bish: >> :1illegalsymbol
[14:27:49] ruby[bot]: Bish: # => /tmp/execpad-e95689d74b6c/source-e95689d74b6c:2: syntax error, unexpected tINTEGER, expecting tSTRIN ...check link for more (https://eval.in/960337)
[14:28:12] Bish: (you can craft symbols that begin with numbers, but then you must know what you're doing
[14:28:47] rabajaj: ohkay, is a chance that i want to print hello world in a def and then want to call that method using symbol ?
[14:28:57] rabajaj: is there a chance*
[14:29:03] Bish: sure, just the way i did it
[14:29:30] rabajaj: ohkay, let me try it.
[14:29:41] Bish: you can even use symbols to create methods
[14:29:47] Bish: that way you can do really nice metaprogramming
[14:29:52] Psybur: has joined #ruby
[14:30:03] spiette: has joined #ruby
[14:30:30] Bish: for example.. you could write a JSON parser, that parses '{"hello":"world"}' that then dynamicially gets the method "hello" which returns "world"
[14:31:03] rabajaj: Bish, thanks. i just got cleared with the whole symbols thing!
[14:31:18] Bish: :) that makes me happy
[14:31:56] DLSteve: has joined #ruby
[14:33:05] apeiros_: has joined #ruby
[14:35:35] mozzarella: has joined #ruby
[14:38:44] krawchyk: has joined #ruby
[14:38:54] vutral|kali: has joined #ruby
[14:38:55] vutral|kali: has joined #ruby
[14:41:19] alex``: has joined #ruby
[14:41:22] gary: has joined #ruby
[14:45:55] devil_tux: has joined #ruby
[14:45:58] cthulchu: has joined #ruby
[14:46:10] apeiros_: >> define_method(:"1") do "I'm the one!" end; send(:"1")
[14:46:11] ruby[bot]: apeiros_: # => "I'm the one!" (https://eval.in/960338)
[14:46:20] apeiros_: Bish: ^ there, a method named 1 :D
[14:51:46] vondruch_: has joined #ruby
[14:52:51] vutral|kali: has joined #ruby
[14:52:51] vutral|kali: has joined #ruby
[14:54:05] gary_: has joined #ruby
[14:55:55] morenoh149: has joined #ruby
[14:56:52] k0mpa: has joined #ruby
[14:56:56] workmad3: has joined #ruby
[14:58:44] cpruitt: has joined #ruby
[14:59:35] Mike11: hello all, I am new ruby
[14:59:36] Mike11: if I have a function that has this signature:
[14:59:36] Mike11: def pass_var_to_block(var, &block)
[14:59:36] Mike11: how can I call it?
[14:59:55] Mike11: I am just looking for the right syntax to call it
[15:00:04] apeiros: pass_var_to_block(123) do …your block… end
[15:00:11] apeiros: Mike11: also it's method, not function ;-)
[15:00:45] Mike11: apeiros: aha, thanks. btw what is the difference between a method and a function?
[15:00:57] apeiros: alternatively, if you have a Proc instance, or anything which responds to to_proc in a variable named 'your_proc_instance': pass_var_to_block(123, &your_proc_instance)
[15:01:59] apeiros: there's no formal definition. but commonly methods are attached to objects and are aware of a "self" (or "this" in some languages), whereas functions are not attached to an object and are "pure", i.e. get all their input from params and all their output is the return value
[15:02:05] lxsameer: has joined #ruby
[15:02:57] Mike11: apeiros: I get that, thank you very much :D
[15:03:59] apeiros: the self/this being the main differentiator. there are plenty of languages which have functions which can access/manipulate global state, or which can mutate the passed arguments (those things are called "side effects")
[15:04:10] Mike11: and if my example was a method defined globally, it would be a method too, since this makes it associated with the ruby Object class
[15:04:24] Mike11: apeiros: is that right? ^^
[15:04:35] apeiros: actually with main, which is an instance of Object and slightly special. but yes, it still has a self.
[15:05:16] apeiros: > ruby -e 'p [self.equal?(Object), self.is_a?(Object)]' --> [false, true]
[15:05:54] cpruitt: Mike11: I could be wrong about the details but there are also some subtleties in ruby that won't make much difference to you now but may later be beneficial. Your method is never "called" directly. Instead a "message" is sent to the object the method is associated with telling it to execute the method. In most cases you'll never notice, but it's worth noting that you can send the message yourself using someobj.send(:method_name).
[15:05:58] chouhoulis: has joined #ruby
[15:06:25] cpruitt: (That's regarding the function vs method question)
[15:06:27] vutral|kali: has joined #ruby
[15:06:27] vutral|kali: has joined #ruby
[15:07:07] Mike11: cpruitt: I am actually interested in these subtleties whether they are beneficial for me now or not :)
[15:07:45] Mike11: but I am still boggling at apeiros's last example :p
[15:08:01] cpruitt: Mike11: I assumed so which is why I mentioned it. :-) I just wouldn't recommend getting too hung up on them. In most cases they don't have any tangible impact on your code.
[15:08:29] apeiros: cpruitt: you should do the example with public_send
[15:08:42] alex``: has joined #ruby
[15:08:45] apeiros: using send directly is a bad habit and shouldn't be started with :)
[15:09:25] apeiros: Mike11: my code simply queries the toplevel self for whether it is the "Object class" object (false), and whether it is an instance of Object (true)
[15:09:28] Mike11: I am guessing public_send causes the object to call a public method, while send causes it to call any method, right?
[15:09:43] apeiros: yes. send can bypass private/protected
[15:10:05] cpruitt: apeiros: Unfortunately it's a bad habit that plagues my own code so I'd feel better if more people made the mistake. (j/k) Mike11, use #public_send. lol
[15:10:08] apeiros: public_send otoh does not. it'll behave the same as if you called it literally.
[15:10:18] apeiros: cpruitt: :-p
[15:10:27] apeiros: cpruitt: global search and replace :-D
[15:10:45] apeiros: s/\bsend\b/public_send/
[15:11:02] tAn: has joined #ruby
[15:11:04] Gary_B: has joined #ruby
[15:11:09] safetypin: has joined #ruby
[15:11:09] Mike11: apeiros: I can understand the "is an instance of" relationship, but not the "whethere it is the "Object class" object
[15:11:45] Mike11: certainly self is not a Class object, right?
[15:12:19] apeiros: >> class Foo; p self.equal?(Foo); end
[15:12:21] ruby[bot]: apeiros: # => true ...check link for more (https://eval.in/960352)
[15:12:29] morenoh149: has joined #ruby
[15:12:49] apeiros: classes are objects in ruby. they follow mostly the same rules as other objects.
[15:13:16] n0m4d1c: has joined #ruby
[15:13:41] apeiros: the differences being class and module specific behaviors, like being able to serve as a namespace (module behavior), and being able to be inherited from and instantiated (class behaviors)
[15:13:51] cpruitt: Mike11: In Ruby *everything* is an object so everything is an instance of something. What you probably think of as a "class definition" creates a constant. The value of that constant is an instance of a Class object. (or something along those lines)
[15:13:56] tcopeland: has joined #ruby
[15:14:03] Mike11: isn't that somehow similar to Java's java.lang.Class?
[15:14:13] apeiros: ACTION inserts an "almost" in front of the *everything*
[15:14:53] cpruitt: apeiros: What isn't?
[15:15:03] chouhoul_: has joined #ruby
[15:15:12] dminuoso: cpruitt: blocks.
[15:15:15] dminuoso: cpruitt: constants
[15:15:17] dminuoso: cpruitt: variables
[15:15:23] dminuoso: cpruitt: methods are not objects either
[15:15:42] cpruitt: dminuoso: I thought methods were instances of Method ?
[15:16:31] Rapture: has joined #ruby
[15:17:07] jamiejackson: has joined #ruby
[15:17:42] cpruitt: Blocks I'd agree with. Constants & variables... I'm not sure how you'd address them in and of themselves. They're elements of source code but not really "things". They just reference something.
[15:18:02] apeiros: cpruitt: code isn't. variables aren't. blocks aren't. methods aren't (but you can create objects from the latter too)
[15:18:18] apeiros: well, dminuoso already up for the task. got to go :D
[15:19:38] Mike11: apeiros: I am sorry I was still staring at your last example :p
[15:19:38] Mike11: class Foo; p self.equal?(Foo); end
[15:19:38] Mike11: what is the semi-colon here called? I googled ruby semi-colon operator and I couldn't find any results
[15:20:06] cpruitt: Mike11: It terminates a statement, same as C or JS
[15:20:15] cpruitt: Those are three statements on one line.
[15:20:57] Mike11: I was barking the wrong tree I guess
[15:22:24] Mike11: so any line of code that is executed inside the "definition" of a class, has the self pointing to a Class object, right?
[15:22:29] n0m4d1c: has joined #ruby
[15:22:58] cpruitt: Define "inside the definition"?
[15:23:20] Mike11: mm, well, what is that called then?
[15:23:31] Mike11: class Foo; p self.equal?(Foo); end
[15:23:37] apeiros: in the class body, yes
[15:23:54] apeiros: and yes, the ; are just like newlines. convenient to write multiple lines in one.
[15:24:08] Bish: apeiros: i just asked mysself if that's possible
[15:24:10] Bish: why the fuck is it
[15:24:33] Mike11: thank you guys very much, I can understand a bit more now :) sorry for my noob questions :D
[15:24:36] Bish: cpruitt: are blocks objects?
[15:24:40] Bish: ACTION runs
[15:26:27] apeiros: ACTION gtg, cya
[15:27:09] ramfjord: has joined #ruby
[15:28:56] sumobob: has joined #ruby
[15:29:18] tcopeland: has joined #ruby
[15:29:36] dminuoso: cpruitt: methods are not. you can reify a method, but natively they are not objects
[15:29:49] dminuoso: just like blocks are not objects, even though you can reify them with Proc
[15:32:03] cpruitt: dminuoso: Was just googling and found the same thing. Blocks I'd read about in the past (though forgot till now) but not methods. I always understood them to be object instances so thanks for the clarification. :-)
[15:32:37] riotjoe: has joined #ruby
[15:35:29] vutral|kali: has joined #ruby
[15:35:29] vutral|kali: has joined #ruby
[15:37:19] soniya29: has joined #ruby
[15:37:24] gary: has joined #ruby
[15:39:17] chouhoulis: has joined #ruby
[15:40:41] soniya29: has joined #ruby
[15:42:25] andygeorge: has joined #ruby
[15:42:47] soniya29_: has joined #ruby
[15:42:54] soniya29__: has joined #ruby
[15:43:26] sumobob: has joined #ruby
[15:44:45] soniya29__: has joined #ruby
[15:45:17] gary_: has joined #ruby
[15:47:10] soniya29: has joined #ruby
[15:47:16] rippa: has joined #ruby
[15:48:27] kapil___: has joined #ruby
[15:48:52] soniya29: has joined #ruby
[15:50:51] NightMonkey: has joined #ruby
[15:50:52] soniya29: has joined #ruby
[15:50:57] soniya29_: has joined #ruby
[15:51:52] xfbs: has joined #ruby
[15:53:46] vutral|kali: has joined #ruby
[15:53:46] vutral|kali: has joined #ruby
[15:57:33] s2013: has joined #ruby
[15:57:46] Gary_B: has joined #ruby
[15:59:50] troys: has joined #ruby
[16:00:34] RougeR: has joined #ruby
[16:00:34] RougeR: has joined #ruby
[16:01:43] devil_tux: has joined #ruby
[16:04:31] tomphp: has joined #ruby
[16:05:10] devil_tu1: has joined #ruby
[16:06:09] vondruch: has joined #ruby
[16:06:47] maxyz_: has joined #ruby
[16:07:35] dinfuehr: has joined #ruby
[16:08:54] dionysus69: has joined #ruby
[16:09:16] dviola: has joined #ruby
[16:10:09] vondruch: has joined #ruby
[16:10:09] brodul: has joined #ruby
[16:11:51] bmurt: has joined #ruby
[16:11:53] mtkd: has joined #ruby
[16:13:59] krawchyk: has joined #ruby
[16:14:48] Gary_B: has joined #ruby
[16:14:53] tomphp: has joined #ruby
[16:17:38] bmurt: has joined #ruby
[16:18:04] yohji: has joined #ruby
[16:21:27] SirOliver: has joined #ruby
[16:22:39] tcopeland: has joined #ruby
[16:23:53] tomphp: has joined #ruby
[16:24:18] gary: has joined #ruby
[16:25:15] seal_: has joined #ruby
[16:26:11] seal_: What's better Django or Ror?
[16:27:08] Bish: seal_: there is no better and they're both pretty old already
[16:27:20] Bish: i, for one, don't like either
[16:27:26] Bish: and i played around alot
[16:27:55] lvmbdv: where did the "soft typing" entry go, from https://github.com/rubygsoc/rubygsoc/wiki/Ideas-for-MRI-(Matz-Ruby-Interpreter) ?
[16:28:37] bmurt: has joined #ruby
[16:30:05] seal_: Guys I nothing can say to #linux comunity :( I registred, but I cant write anything :( Why?
[16:30:41] synthroid: has joined #ruby
[16:31:38] llua: did you auth after registering?
[16:37:19] adlerdias: has joined #ruby
[16:37:38] rubycoder38: has joined #ruby
[16:39:54] rubycoder38: I have to make some jsonrpc call to some servre, can I just use a http library for this?
[16:39:59] rubycoder38: it works with curl in the command line
[16:40:02] bmurt: has joined #ruby
[16:40:39] gary_: has joined #ruby
[16:44:18] seal_: @llua All ok, I had to verefy my account with command of I get in the email :3
[16:45:30] tomphp: has joined #ruby
[16:45:57] Gary_B: has joined #ruby
[16:49:11] Bish: seal_: you're sealed out
[16:49:29] Bish: rubycoder38: just use net/http
[16:49:34] Bish: mechanize is also pretty good
[16:49:57] pastorinni: has joined #ruby
[16:50:05] Bish: and there is stuff like https://rubygems.org/gems/jsonrpc-client/versions/0.1.3
[16:50:08] Bish: im out, cya!
[16:50:13] cabotto: has joined #ruby
[16:50:43] rsilor: has joined #ruby
[16:51:24] rrutkowski: has joined #ruby
[16:51:24] rsilor: Hey. Anyone tried to do Grusman's boo
[16:51:57] rubycoder38: I'll use net/http
[16:52:04] X-Jester: has joined #ruby
[16:52:08] rsilor: Book 'machifrom scratch
[16:52:48] X-Jester: if you were trying to map a trigger to particular code path, say receiving the text "hello", how stupid is it to store a collection of triggers to procs as opposed to trying to do a method callback?
[16:53:12] seal_: has left #ruby: ()
[16:53:56] rsilor: Ehem.. what I meant to ask was: have any of you worked through Grusman's text 'data science from scratch', you
[16:54:17] rsilor: But adapted his python examples to Ruby
[16:55:09] rsilor: I'd like to attempt that, thought I would ask if anyone else had attempted it. Thx
[16:55:11] ogres: has joined #ruby
[16:56:02] rrutkowski: has joined #ruby
[17:00:34] cdg: has joined #ruby
[17:02:04] snath: has joined #ruby
[17:02:05] raynold: has joined #ruby
[17:02:49] cabotto: has joined #ruby
[17:05:20] n0m4d1c: has joined #ruby
[17:05:41] claudiuinberlin: has joined #ruby
[17:07:04] cagomez: has joined #ruby
[17:09:16] rrutkowski: has joined #ruby
[17:11:56] cthulchu: has joined #ruby
[17:12:47] s2013: has joined #ruby
[17:14:11] riotjones: has joined #ruby
[17:16:43] tomphp: has joined #ruby
[17:18:35] bmurt: has joined #ruby
[17:18:38] infernix: has joined #ruby
[17:19:32] yohji: has joined #ruby
[17:20:20] apricant_: has joined #ruby
[17:23:31] Silthias: has joined #ruby
[17:23:59] gary: has joined #ruby
[17:25:01] SirOliver: has joined #ruby
[17:25:44] guacamole: has joined #ruby
[17:26:04] tomphp: has joined #ruby
[17:26:38] Silthias1: has joined #ruby
[17:27:34] darkhanb: has joined #ruby
[17:28:30] garyserj: I've heard that perl has equivalents to rails, and that perl is faster than ruby. what advantages(if any), does Ruby have over Perl?
[17:28:55] havenwood: garyserj: Are you talking about Perl 5 or Perl 6?
[17:29:06] dminuoso: lvmbdv: It's heading into 3x3
[17:29:21] garyserj: havenwood: either
[17:29:46] dminuoso: X-Jester: not at all.
[17:29:56] dminuoso: X-Jester: a proc is just a reified block
[17:30:10] dminuoso: X-Jester: and rubyists really have no problem passing blocks absolutely everywhere
[17:30:24] dminuoso: So you might as well reify them and make it easier to use.
[17:30:31] tomphp: has joined #ruby
[17:30:51] havenwood: garyserj: There's a lot of performance work going on in Ruby right now so it's probably a good bet.
[17:31:17] karapetyan: has joined #ruby
[17:32:09] havenwood: garyserj: A very recent step forward for Ruby performance is the introduction of a JIT for the reference implementation: https://medium.com/@k0kubun/the-method-jit-compiler-for-ruby-2-6-388ee0989c13
[17:34:42] havenwood: garyserj: There's also a high performance implementation of Ruby called TruffleRuby that's heading towards being production ready.
[17:35:02] havenwood: garyserj: https://github.com/oracle/truffleruby#readme
[17:35:47] Cyrus: has joined #ruby
[17:37:32] havenwood: garyserj: What are you doing that you're considering Rails for?
[17:41:03] jcarl43: has joined #ruby
[17:41:25] lacour: has joined #ruby
[17:42:10] tomphp: has joined #ruby
[17:42:43] bmurt: has joined #ruby
[17:44:15] bigblind: has joined #ruby
[17:45:51] rrutkowski_: has joined #ruby
[17:46:49] garyserj: havenwood: I've used rails just to learn rails.
[17:47:16] garyserj: for what it's for.. writing a website particularly one involving CRUD operations.
[17:47:52] havenwood: garyserj: Rails is quite nice for sane conventions around a CRUD website. Sounds like a good choice.
[17:48:03] garyserj: havenwood: but ruby performing faster than before isn't an advantage over perl though
[17:48:12] garyserj: which is what i'm asking about
[17:48:50] havenwood: garyserj: I was just addressing the "perl is faster than ruby" comment, which I don't think is particularly true anymore.
[17:49:39] cdg: has joined #ruby
[17:49:57] havenwood: garyserj: As far as reasons why to use Rails versus [Perl framework here], you might want to ask in the #RubyOnRails channel.
[17:50:40] sanscoeur: has joined #ruby
[17:50:48] havenwood: garyserj: There's a huge community of smart people working on Rails and they tend to lead. Lots of languages have nicely copied Sinatra and Rails.
[17:51:27] havenwood: garyserj: Ruby is closer to Perl 6 in terms of beauty of the language, in my opinion.
[17:52:08] havenwood: garyserj: In Ruby you'll find battle tested HTTP 1.1 tooling. In Perl 6 there's a lot more room to create tools that others might adopt.
[17:53:37] eckhardt: has joined #ruby
[17:53:58] clemens3: has joined #ruby
[17:54:14] eckhardt: has joined #ruby
[17:54:39] garyserj: so perl's version of sinatra might be less battle tested?
[17:55:57] havenwood: garyserj: It looks like Dancer is a Sinatra-esque Perl 5 framework.
[17:56:27] tomphp: has joined #ruby
[17:56:28] havenwood: garyserj: My favorite along those lines in Ruby is Roda: http://roda.jeremyevans.net/'
[17:56:29] n0m4d1c: has joined #ruby
[17:57:08] eckhardt: has joined #ruby
[17:57:29] cpruitt: has joined #ruby
[17:57:39] havenwood: garyserj: It looks like Bailador is a Perl 6 option: https://github.com/Bailador/Bailador#readme
[17:57:46] havenwood: garyserj: I'd vote Roda between those. ;-)
[17:58:22] havenwood: You compose the framework you need with Roda by just enabling relevant plugins.
[17:58:25] nfsnobody: has joined #ruby
[17:58:58] vutral|kali: has joined #ruby
[17:58:59] vutral|kali: has joined #ruby
[17:59:33] havenwood: Speaking of which... would four people here please star Roda on Github!! A fork with fewer than 1,000 stars doesn't get properly indexed on Github. >.>
[17:59:39] havenwood: Star me!!: https://github.com/jeremyevans/roda
[17:59:43] gary_: has joined #ruby
[18:00:10] havenwood: garyserj: This is Roda's garden of plugins: https://github.com/jeremyevans/roda/tree/master/lib/roda/plugins
[18:00:26] havenwood: garyserj: It's just a routing tree, and you add the plugins you actually need to compose the framework for your project.
[18:01:04] havenwood: garyserj: (There's a #roda channel for Roda and #sinatra for Sinatra as well.)
[18:01:33] havenwood: They're both very well maintained.
[18:02:19] Psybur_: has joined #ruby
[18:03:22] tbuehlmann: havenwood: have my star!
[18:03:22] guille-moe: has joined #ruby
[18:08:19] dminuoso: havenwood: but
[18:08:24] dminuoso: havenwood: that required like
[18:08:27] dminuoso: writing code.
[18:09:36] dinfuehr: has joined #ruby
[18:11:33] havenwood: dminuoso: That does often seem to be the choice, spend time 1) debugging the *just works* automagical code, or 2) writing code.
[18:12:09] dminuoso: havenwood: By debugging you mean posting in IRC and Stackoverflow until someone tells you how to fix it right?
[18:12:56] havenwood: dminuoso: Yes. Ask in IRC every 30 minutes but disconnect immediately after asking and never read backlogs.
[18:13:36] dminuoso: Anyway. After 2 days of debugging a bug that caused my Automaton to produce garbage result...
[18:14:08] dminuoso: I finally nailed it to.. guess what - an off-by-one error in the one function I thought "I dont need a test for this, I formally proved correctness in my head"
[18:14:12] char_var[buffer]: has joined #ruby
[18:14:48] n0m4d1c: has joined #ruby
[18:15:46] willmichael: has joined #ruby
[18:17:23] vutral|kali_: has joined #ruby
[18:20:31] larissa: has joined #ruby
[18:20:38] armyriad: has joined #ruby
[18:21:32] moei: has joined #ruby
[18:22:53] sumobob_: has joined #ruby
[18:23:03] anisha_: has joined #ruby
[18:25:28] alex``: has joined #ruby
[18:27:45] n0m4d1c: has joined #ruby
[18:28:17] vutral|kali: has joined #ruby
[18:28:17] vutral|kali: has joined #ruby
[18:31:01] beauby: has joined #ruby
[18:31:22] mikecmpbll: has joined #ruby
[18:32:31] ramfjord: has joined #ruby
[18:33:52] gary: has joined #ruby
[18:33:58] n0m4d1c: has joined #ruby
[18:36:12] Lytol: has joined #ruby
[18:36:17] karapetyan: has joined #ruby
[18:37:44] solo_: has joined #ruby
[18:37:58] alfiemax: has joined #ruby
[18:38:31] devil_tux: has joined #ruby
[18:38:46] cabotto: has joined #ruby
[18:41:36] clemens3: has joined #ruby
[18:42:40] solo_: has left #ruby: ()
[18:42:46] anisha: has joined #ruby
[18:44:21] alfiemax_: has joined #ruby
[18:45:32] n008f4g_: has joined #ruby
[18:46:19] n0m4d1c: has joined #ruby
[18:46:58] cabotto: has joined #ruby
[18:48:19] vutral|kali_: has joined #ruby
[18:49:52] jamesaxl: has joined #ruby
[18:49:53] netherwolfe: has joined #ruby
[18:50:00] Nicmavr: has joined #ruby
[18:50:01] rocx: has joined #ruby
[18:51:16] tomphp: has joined #ruby
[18:51:19] n0m4d1c: has joined #ruby
[18:51:32] mcr1: has joined #ruby
[18:52:04] cabotto: has joined #ruby
[18:52:14] karapetyan: has joined #ruby
[18:52:49] roshanavand: has joined #ruby
[18:53:48] vutral|kali: has joined #ruby
[18:53:48] vutral|kali: has joined #ruby
[18:54:25] kies: has joined #ruby
[18:57:19] claudiuinberlin: has joined #ruby
[18:58:19] bmurt: has joined #ruby
[18:59:42] cagomez: has joined #ruby
[19:00:44] willmichael: has joined #ruby
[19:04:59] cabotto: has joined #ruby
[19:06:28] vutral|kali: has joined #ruby
[19:06:28] vutral|kali: has joined #ruby
[19:06:47] apeiros: has joined #ruby
[19:07:20] gary_: has joined #ruby
[19:08:49] bigblind: has joined #ruby
[19:12:38] cabotto: has joined #ruby
[19:13:48] tomphp: has joined #ruby
[19:17:02] mtkd: has joined #ruby
[19:18:38] ldepandis: has joined #ruby
[19:18:57] SeepingN: has joined #ruby
[19:19:35] buyfn: has joined #ruby
[19:23:13] krawchyk: has joined #ruby
[19:32:29] n0m4d1c: has joined #ruby
[19:33:19] Asher: has joined #ruby
[19:35:25] \void: has joined #ruby
[19:37:59] workmad3: has joined #ruby
[19:38:09] morenoh149: has joined #ruby
[19:39:03] dyyylan: has joined #ruby
[19:41:25] vutral|kali: has joined #ruby
[19:41:25] vutral|kali: has joined #ruby
[19:41:51] gary: has joined #ruby
[19:41:57] theSolTrain: has joined #ruby
[19:44:21] buyfn: has joined #ruby
[19:45:48] alfiemax: has joined #ruby
[19:46:09] cthulchu: has joined #ruby
[19:53:11] nadir: has joined #ruby
[19:53:18] nowhere_man: has joined #ruby
[19:53:40] dminuoso: Folks, do you consider integers real objects?
[19:53:45] dminuoso: >> 1.singleton_class
[19:53:47] ruby[bot]: dminuoso: # => can't define singleton (TypeError) ...check link for more (https://eval.in/960482)
[19:54:04] ecuanaso: has joined #ruby
[19:54:18] dminuoso: Guess it boils down to what one means by "is it an object"
[19:56:53] morenoh149: has joined #ruby
[19:56:58] Pisuke: has joined #ruby
[19:58:32] buyfn: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[19:59:55] Dimik: has joined #ruby
[19:59:56] jrafanie: has joined #ruby
[20:00:27] ramfjord: has joined #ruby
[20:04:39] rubycoder38: any ideas how I can refactor this code? https://gist.github.com/anonymous/8e7d5886efea16172e1cbca8a1507b98
[20:05:36] rubycoder38: my #create method creates the transaction and #broadcast broadcasts it
[20:06:47] apeiros: rubycoder38: I guess I'd factor out the http post part
[20:06:48] marr: has joined #ruby
[20:06:58] apeiros: and parametrize it with method & params
[20:07:43] apeiros: i.e.: `def create(to, amount); api_post "payto", destination: to, amount: amount, password: @wallet_password; end
[20:07:47] griffindy: has joined #ruby
[20:08:27] apeiros: and `def broadcast(to, amount); api_post 'broadcast', tx: result['hex']; end`
[20:08:41] apeiros: oh, forgot a line there to get `result`
[20:08:51] rubycoder38: apeiros: nice, thanks for your nice idea
[20:08:55] apeiros: and an if, though that should IMO have an explicit else.
[20:12:21] vutral|kali: has joined #ruby
[20:12:22] vutral|kali: has joined #ruby
[20:12:24] ecuanaso: has joined #ruby
[20:12:28] Mike11: has joined #ruby
[20:16:22] gary_: has joined #ruby
[20:18:58] bmurt: has joined #ruby
[20:23:25] bmurt: has joined #ruby
[20:24:17] sameerynho: has joined #ruby
[20:26:36] cagomez_: has joined #ruby
[20:28:05] Mike111: has joined #ruby
[20:32:11] phaul: has joined #ruby
[20:33:09] alfiemax: has joined #ruby
[20:40:04] Guest32855: has joined #ruby
[20:40:24] sumobob_: has joined #ruby
[20:41:30] bonhoeffer: has joined #ruby
[20:43:44] cdg: has joined #ruby
[20:44:27] shinnya: has joined #ruby
[20:45:24] drewmcmillan: has joined #ruby
[20:45:43] tomphp: has joined #ruby
[20:45:57] alfiemax: has joined #ruby
[20:46:17] gary: has joined #ruby
[20:48:58] kiltzman: has joined #ruby
[20:49:35] kiltzman: has joined #ruby
[20:50:05] kiltzman: has joined #ruby
[20:54:39] vutral|kali: has joined #ruby
[20:55:09] vutral|kali: has joined #ruby
[20:59:40] segy: has joined #ruby
[21:01:18] Mike11: has joined #ruby
[21:04:04] alfiemax: has joined #ruby
[21:04:35] rubycoder38: apeiros: like this? https://gist.github.com/anonymous/e833eef538ef2ffe7add908592a4ee8a
[21:05:15] mistergibson: has joined #ruby
[21:05:15] rubycoder38: I don't like this if command == "payto"
[21:05:42] rubycoder38: I've been brainwashed by sandi metz, ffs!
[21:05:46] apeiros: that's one of the things I suggested to parametrize. then you wouldn't need it.
[21:05:50] apeiros: gimme a sec
[21:06:03] rubycoder38: apeiros: thanks
[21:06:09] apeiros: btw., you can just update your old gist. then we can see the revisions.
[21:08:40] anjen: has joined #ruby
[21:09:27] apeiros: rubycoder38: https://gist.github.com/apeiros/bcaaeecfbbba85b44c6a178ac817c456
[21:09:47] troulouliou_div2: has joined #ruby
[21:09:48] apeiros: though probably it'd be better to just make params a required kwarg
[21:09:50] troulouliou_div2: has joined #ruby
[21:09:56] guacamole: has joined #ruby
[21:09:56] guacamole: has joined #ruby
[21:11:38] miskatonic: has joined #ruby
[21:11:52] \void: has joined #ruby
[21:12:20] vutral|kali: has joined #ruby
[21:12:20] vutral|kali: has joined #ruby
[21:15:07] phaul: has joined #ruby
[21:15:50] rubycoder38: apeiros: thanks a lot!
[21:17:14] Gnut: has joined #ruby
[21:17:50] Gnut: Is there a way to create an instance method used for sorting an array of the object
[21:19:03] cagomez: has joined #ruby
[21:19:04] Gnut: e.g. I have an array of objects and when i call sort on them, I want them to be sorted using a sort method i specify in the class
[21:20:48] despai: has joined #ruby
[21:21:55] vutral|kali: has joined #ruby
[21:21:56] vutral|kali: has joined #ruby
[21:22:03] apeiros: Gnut: sort uses <=>
[21:22:14] ramfjord: has joined #ruby
[21:22:19] apeiros: and if you define <=>, it's a good idea to include Comparable
[21:22:49] Gnut: aperios: That's a mixin?
[21:22:55] apeiros: ?tabnick Gnut
[21:22:55] ruby[bot]: Gnut: pro-tip - use tab completion for nicks. avoids typos in nicks.
[21:23:05] eckhardt: has joined #ruby
[21:23:11] apeiros: yes, that's a module. you can only include modules.
[21:23:31] dminuoso: ACTION accepts apeiros' challenge
[21:23:32] Gnut: son-of-a-gun, irssi has auto-completion :the_more_ya_know:
[21:23:47] apeiros: ACTION feels dminuoso fiddling around
[21:24:00] apeiros: (pun intended)
[21:24:00] Gnut: apeiros: Thanks, that's exactly what i'm looking for
[21:24:11] dminuoso: ACTION . o O (pun already understood)
[21:24:38] apeiros: dminuoso: that was more a collateral announcement. from you I expected to understand :D
[21:24:57] apeiros: Gnut: for more complex comparisons, sort and sort_by both take a block
[21:25:07] gary_: has joined #ruby
[21:26:09] cdg_: has joined #ruby
[21:31:54] pastorinni: has joined #ruby
[21:32:02] alfiemax: has joined #ruby
[21:33:18] vutral|kali: has joined #ruby
[21:33:18] vutral|kali: has joined #ruby
[21:34:52] ecuanaso: has joined #ruby
[21:36:27] marr: has joined #ruby
[21:38:59] lagweezle: has left #ruby: ()
[21:40:34] despai: has joined #ruby
[21:46:35] eckhardt_: has joined #ruby
[21:47:55] nowhere_man: has joined #ruby
[21:50:26] cagomez: has joined #ruby
[21:50:54] willmichael: has joined #ruby
[21:51:53] vutral|kali: has joined #ruby
[21:51:53] vutral|kali: has joined #ruby
[21:54:59] orbyt_: has joined #ruby
[21:58:51] gary: has joined #ruby
[21:59:33] alfiemax: has joined #ruby
[22:03:16] jeffreylevesque_: has joined #ruby
[22:04:04] Gnut: Probably more of a philosophical question, but where should I put my object instantiation methods?
[22:04:20] _aeris_: has joined #ruby
[22:04:33] apeiros: Gnut: I don't get your question
[22:04:46] Gnut: e.g. I have a class called `Guest` and i have a method that creates Guest objects based off a puppet query
[22:06:06] Gnut: It doesn't feel like it belongs in the class since how I create those guests shouldn't be tied to the behavior of the Guests
[22:06:33] apeiros: sounds like you should have a class handling your puppet queries
[22:06:53] apeiros: but it's a bit too little information to make any meaningful statement
[22:07:17] apeiros: and I got to go. there are certainly others around who can help. good night :)
[22:07:55] cagomez: has joined #ruby
[22:07:57] xelkarin: has joined #ruby
[22:09:37] \void: has joined #ruby
[22:10:46] bijan_: has joined #ruby
[22:11:48] _aeris_: has joined #ruby
[22:12:01] Gnut: apeiros: Thanks, that's how i figured i'd do it. Just didn't know if i should add another module to the Guest class.
[22:20:22] remix2000: has joined #ruby
[22:23:31] Prutheus: has joined #ruby
[22:24:23] Prutheus: Hello. I have two arrays a = [[1,2],[3,4]] and b = [[5,6],[7,8]] and need a function which converts them to c = [[1,2,5,6],[3,4,7,8]]
[22:24:55] dminuoso: prutheus: zip and flatten
[22:25:35] Prutheus: hm and how combined? i dont get it
[22:25:54] dminuoso: >> [[1,2],[3,4]].zip [[5,6],[7,8]]
[22:25:55] ruby[bot]: dminuoso: # => [[[1, 2], [5, 6]], [[3, 4], [7, 8]]] (https://eval.in/960494)
[22:26:05] dminuoso: prutheus: Ill let you figure out the rest.
[22:26:16] Prutheus: i dont get the rest, that is the problem :/
[22:26:23] kireevco: has joined #ruby
[22:26:23] dminuoso: prutheus: I see.
[22:26:33] Prutheus: not at least without a loop
[22:26:39] dminuoso: prutheus: How do you turn [[1,2],[3,4]] into [1,2,3,4] ?
[22:26:40] Radar: >> [[1,2],[3,4]].zip([[5,6],[7,8]]).map(&:flatten)
[22:26:41] ruby[bot]: Radar: # => [[1, 2, 5, 6], [3, 4, 7, 8]] (https://eval.in/960495)
[22:26:46] dminuoso: ruby[bot]: Shhh!
[22:26:49] dminuoso: ACTION spanks Radar
[22:26:56] ruby[bot]: Radar: I don't know anything about next
[22:27:05] Radar: ruby[bot]: I don't even know why I bother.
[22:27:08] Prutheus: oh yeah i forget the map function so often :/
[22:27:20] dminuoso: prutheus: Whenever you want to interact with the elements inside, you use `map`
[22:27:21] Radar: prutheus: it's a loop, technically
[22:27:32] karapetyan: has joined #ruby
[22:27:39] dminuoso: prutheus: `map` basically takes a function, and applies it to every element inside the list, and returns the new list.
[22:27:41] Prutheus: yeah but not like i meant it
[22:30:00] rwb: has joined #ruby
[22:31:53] goatish: has joined #ruby
[22:32:42] devil_tux: has joined #ruby
[22:32:44] devil_tu1: has joined #ruby
[22:33:02] gary: has joined #ruby
[22:34:45] beauby: has joined #ruby
[22:34:45] havenwood: Just an aside, but funny non-map solution taking advantage of zip's weird block form: result = []; a.zip(b) { |a, b| result << a + b }; result
[22:36:26] dminuoso: havenwood: HOnestly, when I started reading I kind of expected some lazy enum answer.
[22:36:39] dminuoso: Was a bit disappointed.
[22:36:54] havenwood: dminuoso: i'd have provided one if #zip wasn't so odd
[22:36:55] sparr: has joined #ruby
[22:37:23] drewmcmillan: has joined #ruby
[22:37:55] sparr: has joined #ruby
[22:43:05] sparr: has joined #ruby
[22:44:07] sparr: has joined #ruby
[22:49:20] Asher: has joined #ruby
[22:55:02] alfiemax: has joined #ruby
[22:56:27] ramfjord: has joined #ruby
[22:59:01] cagomez: is it bad practice to curry an object instantiation?
[22:59:26] _aeris_: has joined #ruby
[23:01:29] ramfjord: has joined #ruby
[23:05:12] willmichael: has joined #ruby
[23:10:43] snath: has joined #ruby
[23:11:59] xfbs: has joined #ruby
[23:12:06] gary_: has joined #ruby
[23:13:23] xfbs: has joined #ruby
[23:13:28] pastorin_: has joined #ruby
[23:25:39] Psybur_: has joined #ruby
[23:29:16] sumobob_: has joined #ruby
[23:30:04] mitt3ns: has joined #ruby
[23:30:53] dminuoso: cagomez: What does that mean
[23:31:08] dminuoso: cagomez: Do you mean a curried function that will eventually produce an object?
[23:31:27] dminuoso: Currying is a good thing. The fact that Ruby makes it kind of hard and annoying is a sad fact.
[23:31:43] dminuoso: I generally curry all my lambdas.
[23:31:55] cagomez: scratch that ^. I have a class with keyword arguments, and need to add another argument. is there a way to add the new arg without it also being required?
[23:32:32] dminuoso: cagomez: Ruby allows you to define optional parameters.
[23:36:53] alfiemax: has joined #ruby
[23:38:20] Psybur__: has joined #ruby
[23:39:25] morenoh149: has joined #ruby
[23:42:24] guacamole: has joined #ruby
[23:42:24] guacamole: has joined #ruby
[23:44:43] mitt3ns: has joined #ruby
[23:44:56] Xeago: has joined #ruby
[23:46:36] zapata: has joined #ruby
[23:47:00] gary: has joined #ruby
[23:47:27] jnollette: has joined #ruby
[23:49:08] jeffreylevesque: has joined #ruby
[23:52:19] elphe: has joined #ruby
[23:53:52] orbyt_: has joined #ruby
[23:57:56] ResidentBiscuit: has joined #ruby
[23:58:30] sanscoeur: has joined #ruby