« Back to channel list

#ruby - 09 April 2018

« Back 1 day Forward 1 day »
[00:03:10] erlend: has joined #ruby
[00:07:12] schneider: has joined #ruby
[00:16:27] schneider: has joined #ruby
[00:17:54] bmurt: has joined #ruby
[00:21:01] pelegreno: has joined #ruby
[00:21:09] mroutis_: has joined #ruby
[00:25:39] schneider: has joined #ruby
[00:33:20] Xiti: has joined #ruby
[00:34:44] schneider: has joined #ruby
[00:42:39] Creatornator: has joined #ruby
[00:43:50] schneider: has joined #ruby
[00:45:31] roshanavand: has joined #ruby
[00:48:19] konsolebox: has joined #ruby
[00:52:58] schneider: has joined #ruby
[00:58:23] cadillac_: has joined #ruby
[01:00:40] tolerablyjake: has joined #ruby
[01:01:22] mroutis: has joined #ruby
[01:02:11] schneider: has joined #ruby
[01:04:33] Ryzokuken: has joined #ruby
[01:11:17] schneider: has joined #ruby
[01:16:50] yukai: has joined #ruby
[01:20:25] schneider: has joined #ruby
[01:20:33] Creatornator: has joined #ruby
[01:26:28] yxhuvud: has joined #ruby
[01:28:49] gizmore|2: has joined #ruby
[01:29:35] schneider: has joined #ruby
[01:33:37] liamat_: has joined #ruby
[01:38:40] schneider: has joined #ruby
[01:46:23] ramfjord: has joined #ruby
[01:46:59] ogres: has joined #ruby
[01:47:50] schneider: has joined #ruby
[01:50:09] woodruffw: has joined #ruby
[01:56:57] schneider: has joined #ruby
[01:57:50] yxhuvud: has joined #ruby
[01:58:06] adjustingmaitai: has joined #ruby
[02:00:54] nicesignal: has joined #ruby
[02:01:57] dinfuehr: has joined #ruby
[02:06:01] schneider: has joined #ruby
[02:08:25] Asher: has joined #ruby
[02:13:38] agent_white: has joined #ruby
[02:15:09] n0m4d1c: has joined #ruby
[02:17:03] yxhuvud: has joined #ruby
[02:17:08] s2013: has joined #ruby
[02:20:06] schneider: has joined #ruby
[02:20:10] mroutis_: has joined #ruby
[02:22:07] ur5us: has joined #ruby
[02:22:13] skweek: has joined #ruby
[02:29:17] schneider: has joined #ruby
[02:30:27] ramfjord: has joined #ruby
[02:32:57] yxhuvud: has joined #ruby
[02:36:22] ur5us: has joined #ruby
[02:36:48] NorthLumberJack: has joined #ruby
[02:38:26] schneider: has joined #ruby
[02:38:46] ramfjord: has joined #ruby
[02:47:36] schneider: has joined #ruby
[02:52:16] arescorpio: has joined #ruby
[02:56:43] schneider: has joined #ruby
[02:57:52] yxhuvud: has joined #ruby
[03:00:09] cadillac_: has joined #ruby
[03:05:50] schneider: has joined #ruby
[03:05:52] ramfjord: has joined #ruby
[03:14:43] alfiemax: has joined #ruby
[03:15:00] schneider: has joined #ruby
[03:23:10] Yzguy: has joined #ruby
[03:24:04] schneider: has joined #ruby
[03:26:48] gix: has joined #ruby
[03:27:37] yxhuvud: has joined #ruby
[03:28:48] mroutis: has joined #ruby
[03:31:18] erlend: has joined #ruby
[03:31:51] schneider: has joined #ruby
[03:32:17] yxhuvud: has joined #ruby
[03:40:56] schneider: has joined #ruby
[03:44:26] Creatornator: has joined #ruby
[03:44:58] Puffball: has joined #ruby
[03:47:44] n0m4d1c: has joined #ruby
[03:48:10] jenrzzz: has joined #ruby
[03:48:10] jenrzzz: has joined #ruby
[03:50:05] schneider: has joined #ruby
[03:51:43] yxhuvud: has joined #ruby
[03:56:27] yxhuvud: has joined #ruby
[03:59:13] schneider: has joined #ruby
[04:00:13] s2013: has joined #ruby
[04:02:42] r3m: has joined #ruby
[04:04:49] shakes: has joined #ruby
[04:06:55] kapil___: has joined #ruby
[04:08:20] schneider: has joined #ruby
[04:08:46] govg: has joined #ruby
[04:14:11] imode: has joined #ruby
[04:17:27] schneider: has joined #ruby
[04:20:21] tdy: has joined #ruby
[04:26:33] schneider: has joined #ruby
[04:29:52] law: has joined #ruby
[04:30:08] law: hey all, is there a standard way to tell resque to write files with a certain chmod or umask?
[04:30:34] law: I've got a legacy job that wants to write files out with '600' permissions by default, and I can't seem to find the knob to twiddle to change that to '644'
[04:35:24] cschneid_: has joined #ruby
[04:35:44] schneider: has joined #ruby
[04:35:45] asif: has joined #ruby
[04:38:46] ramfjord: has joined #ruby
[04:40:28] stairmast0r: has joined #ruby
[04:44:49] schneider: has joined #ruby
[04:47:31] jenrzzz: has joined #ruby
[04:47:32] jenrzzz: has joined #ruby
[04:54:00] schneider: has joined #ruby
[04:55:21] Asher: has joined #ruby
[05:02:57] safetypin: has joined #ruby
[05:03:10] schneider: has joined #ruby
[05:10:38] reber: has joined #ruby
[05:12:16] schneider: has joined #ruby
[05:19:20] jamesaxl: has joined #ruby
[05:21:25] schneider: has joined #ruby
[05:22:21] aufi: has joined #ruby
[05:30:42] schneider: has joined #ruby
[05:35:54] jalcine: has joined #ruby
[05:35:55] jalcine: has joined #ruby
[05:39:07] ferr1: has joined #ruby
[05:39:41] schneider: has joined #ruby
[05:39:44] erlend: has joined #ruby
[05:40:05] cschneid_: has joined #ruby
[05:41:43] zautomata3: has joined #ruby
[05:43:00] rivalomega: has joined #ruby
[05:45:11] zautomata4: has joined #ruby
[05:45:26] cschneid_: has joined #ruby
[05:48:14] aupadhye: has joined #ruby
[05:48:50] schneider: has joined #ruby
[05:51:00] KeyJoo: has joined #ruby
[05:52:12] jcarl43: has joined #ruby
[05:53:55] mtkd: has joined #ruby
[05:56:06] kent\n: has joined #ruby
[05:57:57] schneider: has joined #ruby
[05:59:32] alfiemax: has joined #ruby
[06:02:10] cam27: has joined #ruby
[06:07:02] schneider: has joined #ruby
[06:08:40] n008f4g_: has joined #ruby
[06:16:13] schneider: has joined #ruby
[06:16:47] Mortomes|Work: has joined #ruby
[06:25:21] schneider: has joined #ruby
[06:34:29] schneider: has joined #ruby
[06:39:10] alfiemax: has joined #ruby
[06:40:56] amar: has joined #ruby
[06:42:15] ferr1: has left #ruby: ("WeeChat 2.1")
[06:43:08] jenrzzz: has joined #ruby
[06:43:39] schneider: has joined #ruby
[06:45:07] segy_: has joined #ruby
[06:52:43] schneider: has joined #ruby
[06:53:40] andikr: has joined #ruby
[06:58:06] phaul: has joined #ruby
[07:01:55] schneider: has joined #ruby
[07:05:33] TomyWork: has joined #ruby
[07:11:11] schneider: has joined #ruby
[07:13:45] yohji: has joined #ruby
[07:14:36] amar: has joined #ruby
[07:15:40] tAn: has joined #ruby
[07:15:59] blackmesa: has joined #ruby
[07:18:16] ramfjord: has joined #ruby
[07:20:18] schneider: has joined #ruby
[07:21:46] burgestrand: has joined #ruby
[07:22:52] zenspider: has joined #ruby
[07:23:22] claudiuinberlin: has joined #ruby
[07:25:17] vondruch: has joined #ruby
[07:28:09] clemens3_: has joined #ruby
[07:29:28] schneider: has joined #ruby
[07:30:29] drale2k_: has joined #ruby
[07:32:18] ramfjord: has joined #ruby
[07:42:52] schneider: has joined #ruby
[07:45:34] cam27: has joined #ruby
[07:46:24] iMadper: has joined #ruby
[07:48:28] erlend: has joined #ruby
[07:48:35] whst: has joined #ruby
[07:48:45] ur5us: has joined #ruby
[07:55:01] tvw: has joined #ruby
[08:05:16] vondruch: has joined #ruby
[08:05:19] ramfjord: has joined #ruby
[08:06:48] mikecmpbll: has joined #ruby
[08:08:38] pwnd_nsfw: has joined #ruby
[08:10:00] alfiemax: has joined #ruby
[08:13:49] venmx: has joined #ruby
[08:14:10] tomphp: has joined #ruby
[08:16:54] guille-moe: has joined #ruby
[08:21:01] jordila: has joined #ruby
[08:21:22] Ryzokuken: has joined #ruby
[08:21:57] karapetyan: has joined #ruby
[08:22:02] cadillac_: has joined #ruby
[08:28:27] karapetyan: has joined #ruby
[08:29:33] cadillac_: has joined #ruby
[08:30:26] amar: has joined #ruby
[08:30:45] marr: has joined #ruby
[08:36:46] einarj: has joined #ruby
[08:47:12] dr3wo: has joined #ruby
[08:48:41] Bish: if i use @inside a class, whose instance variable will that actually be?
[08:49:09] Bish: (inside a class << self block)
[08:51:09] jordila: has left #ruby: ()
[08:52:43] ramfjord: has joined #ruby
[08:56:31] wang: has joined #ruby
[08:56:37] karapetyan: has joined #ruby
[08:57:27] Beams: has joined #ruby
[08:58:40] zautomata4: has joined #ruby
[08:59:53] dminuoso: Bish: `class << a` opens the singleton class of whatever `a` is
[09:00:06] dminuoso: Bish: so you are within the object of the singleton class itself.
[09:00:17] dminuoso: You should know this
[09:00:20] elomatreb: I.e. an instance of Class
[09:00:28] Bish: yeah i do.. but i am confused of @@ and @ then
[09:00:34] dminuoso: Bish: Forget about @@
[09:00:42] dminuoso: I have yet to see a valid usecase for @@
[09:01:22] dminuoso: Bish: (note that means you can also do things like: arr = [1,2,3]; class << arr; ...; end
[09:02:26] Bish: still would like to understand
[09:02:31] Bish: i can use @something insude class << self
[09:02:35] Bish: and it becomes a @@, right?
[09:02:45] zautomata: has joined #ruby
[09:02:48] Bish: they're just seemingly the same thing, aren't they?
[09:03:26] mikecmpb_: has joined #ruby
[09:03:51] psychicist__: has joined #ruby
[09:05:20] Bish: that makes using @ inside class << self pretty pointless, doesn't it?
[09:05:59] tobiasvl: they're not the same thing
[09:06:10] mtkd: has joined #ruby
[09:06:28] tbuehlmann: @@ is the same for subclasses, @ is just for this one class instance
[09:06:37] zautomata1: has joined #ruby
[09:08:07] ur5us: has joined #ruby
[09:11:05] Bish: tbuehlmann: more like, one are class variables, aren't they?
[09:11:13] tAn: has joined #ruby
[09:13:00] ^mtkd: has joined #ruby
[09:15:21] Bish: so to summarzy
[09:15:26] zautomata2: has joined #ruby
[09:15:44] Bish: class T;class << self;@t = 1;end;end; t will only be accessible for T.new?
[09:17:06] phaul: >> class T; class << self; @t = 1; end; end; T.singleton_class.instance_variable_get(:@t)
[09:17:07] ruby[bot]: phaul: # => 1 (https://eval.in/986173)
[09:17:42] Bish: yeah well i figured there are hacks
[09:17:50] Bish: but not a normal way?(
[09:17:52] schneider: has joined #ruby
[09:19:15] venmx: has joined #ruby
[09:19:30] phaul: how do you access it from T.new ?
[09:19:57] Bish: that's what i thought, but now thinking about it doesn't make sense
[09:20:01] tbuehlmann: it's not an "instance" instance variable, it's a "class" instance variable
[09:20:36] Bish: i get that, i was just confused
[09:20:51] tbuehlmann: it belongs to T (or its singleton class, if you will), not any instance of T and not any of T's subclasses
[09:21:17] phaul: the instance's class's singleton class's instance :D
[09:23:28] Bish: but to get around the xy problem
[09:23:51] Bish: i want to have a instance variable for the singleton class
[09:23:58] Bish: and initialize it inside class << self
[09:24:14] Bish: but if i do it inside there, it does not seem to be accessbile from the methods i created inside class << self
[09:24:36] tbuehlmann: have a minimal example?
[09:25:11] Bish: >> class T; class << self;@intervals = {}; def test;@intervals[1]=3;end;end; T.test;
[09:25:22] Bish: >> class T; class << self;@intervals = {}; def test;@intervals[1]=3;end;end; T.test;
[09:25:23] ruby[bot]: Bish: # => /tmp/execpad-51c15bd78483/source-51c15bd78483:7: syntax error, unexpected end-of-input, expecting ke ...check link for more (https://eval.in/986178)
[09:25:57] Bish: >> class T; class << self;@intervals = {}; def test;@intervals[1]=3;end;end;end; T.test;
[09:25:58] ruby[bot]: Bish: # => nil (https://eval.in/986179)
[09:26:00] Bish: that's it
[09:26:10] Bish: :o, that gives a raise for me
[09:26:20] EXCHGR: has joined #ruby
[09:26:33] Bish: (and shouldn't it be 3?)
[09:26:45] amar: has joined #ruby
[09:27:09] schneider: has joined #ruby
[09:27:49] vondruch: has joined #ruby
[09:28:04] alfiemax: has joined #ruby
[09:28:50] karapetyan: has joined #ruby
[09:29:03] tbuehlmann: >> class T; @intervals = {}; class << self; def test; @intervals[1] = 3; end; end; end; T.test;
[09:29:04] ruby[bot]: tbuehlmann: # => 3 (https://eval.in/986180)
[09:29:05] Bish: and why the fuck does it work for the bot
[09:29:07] phaul: self changes when you enter the def
[09:29:46] Bish: but.. if i say class T; @intervals = {};end; this is a instance variable of a T instance..
[09:29:49] Bish: that's not what i want
[09:29:56] alfiemax: has joined #ruby
[09:29:58] tbuehlmann: oh? why's that?
[09:29:58] tAn: has joined #ruby
[09:30:06] Bish: well, i want a class variable style behaviour
[09:30:27] Bish: but i don't get why self << class; does not make the behaviour identical
[09:30:29] Bish: to a class variable
[09:30:56] Bish: phaul: why does self change?
[09:30:56] pd2000: has joined #ruby
[09:31:02] Bish: what will self be?
[09:31:08] Bish: well im printing both..
[09:31:32] phaul: Bish, I misread your code, so my comment is true but not relevant to your example
[09:31:44] Bish: yeah, i see, they're equal
[09:31:49] Bish: so this is the thing i am not getting
[09:32:00] elomatreb: Bish: That's not an instance variable of a T instance. Outside of a method definition you are not in an instance context
[09:32:18] Bish: elomatreb: i see.. that's just normal class_eval i guess?
[09:32:37] Bish: dminuoso: isn't that a valid use case for @@ :D
[09:32:45] Bish: having instance variables inside class << self
[09:33:22] dminuoso: They are not instance variables.
[09:33:39] Bish: how would u share data between those methods then?
[09:33:43] elomatreb: Forgetting that @@ even exists was the best advice in this discussion so far
[09:33:46] Bish: if not with @@
[09:33:58] Bish: elomatreb: yeah well, give me an alternative then
[09:34:03] Bish: i don't have any
[09:34:04] dminuoso: Bish: @ works fine.
[09:34:05] tbuehlmann: if you need that variable in subclasses, @@ is fine. else use a class instance variable
[09:34:07] xuyuheng: has joined #ruby
[09:34:11] Bish: dminuoso: but it doesn't, as you can see
[09:34:20] dminuoso: No it does work.
[09:34:23] dminuoso: Ask differently.
[09:34:33] Bish: i've shown my example
[09:34:44] Bish: >> class T; class << self;@intervals = {}; def test;@intervals[1]=3;end;end;end; T.test;
[09:34:45] ruby[bot]: Bish: # => nil (https://eval.in/986181)
[09:34:46] dminuoso: Bish: You're in different universes.
[09:34:54] dminuoso: Bish: There are instance variables inside the _CLASS_ object
[09:34:59] xuyuheng: has joined #ruby
[09:35:02] dminuoso: Bish: and there are instance variables inside the "normal" object
[09:35:11] dminuoso: Bish: instance variables by default are HIDDEN, that is a good thing.
[09:35:15] dminuoso: You shouldn't get direct access to them.
[09:35:23] Bish: simple use case = share data between 2 methods inside class << self
[09:35:26] elomatreb: What are you trying to do, actually? Because @@ vars usually end up biting you down the line, even if you manage to use them "correctly"
[09:35:32] dminuoso: Bish: attr_reader
[09:35:39] Bish: so far i am only able to do it with class <<self
[09:35:40] dminuoso: and then go self.class.foo
[09:35:43] Bish: i mean @@
[09:35:52] Bish: dminuoso: guess that would be possible
[09:36:01] Bish: but kinda equivalent
[09:36:15] schneider: has joined #ruby
[09:36:16] dminuoso: Bish: @@ just leads to quirky and buggy code most of the time.
[09:36:16] zautomata3: has joined #ruby
[09:36:30] dminuoso: And it exposes details into entire inheritance hierarchies
[09:36:46] zautomata: has joined #ruby
[09:37:07] dminuoso: 11:35 elomatreb | What are you trying to do, actually? Because @@ vars usually end up biting you down the line, even if you manage to use them "correctly"
[09:37:11] ruby[bot]: 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
[09:37:30] Bish: they never hurt me, but i try to listen to oyu
[09:37:48] dminuoso: "Look, guns are not dangerous. I not shot myself"
[09:37:57] elomatreb: Sharing data between two methods inside class << self: https://eval.in/986182 ?
[09:37:57] Bish: i never shot myself*
[09:38:06] dminuoso: You get the point.
[09:38:07] Bish: it's just stupid that 3rd from of hurt is the same
[09:38:22] RyanMcCoskrie: has joined #ruby
[09:38:40] dminuoso: Bish: at any rate, "class methods" are no different from "instance methods"
[09:38:42] Bish: elomatreb: yeah well :D i thought about this one too
[09:38:47] dminuoso: Bish: they are all just regular methods.
[09:38:48] Bish: dminuoso: yeah i get that
[09:38:59] dminuoso: Bish: So how do you share data between "regular" instance methods?
[09:39:04] Bish: guess the inheritance argument is valid, but i don't use that often
[09:39:06] dminuoso: instance variables right?
[09:39:09] Bish: dminuoso: usually, yes
[09:39:39] dminuoso: Bish: Great. Since we have established that class methods are no different from "instance methods", it makes for consistent code.
[09:40:11] dminuoso: Bish: If you think you want class variables to dripple down through inheritance, I can promise you: you dont.
[09:40:27] elomatreb: Imagine how weird it was if changing an instance variable on some "regular" instance messed with other instances. That's essentially what @@vars do
[09:40:28] Bish: well, all you say is right.. but i feel like @ inside class << self should be @@
[09:40:38] dminuoso: Im willing to say: The presence of class variables is almost always an indicator of a bug.
[09:40:39] Bish: i won't argue that what you say is cleaner code
[09:40:44] Bish: but this behaviour is still stupid
[09:40:50] dminuoso: Just like `volatile` in C.
[09:41:05] dminuoso: Bish: What behavior is stupid?
[09:41:12] dminuoso: Bish: That objects dont expose their details?
[09:41:27] Bish: that i can create a instance variable inside class << self, and not use it inside its methods
[09:41:36] Bish: dminuoso: because i already took your advice of not doing it that way
[09:41:40] elomatreb: Personal opinion: If you are doing this at all you should be careful, you're creating centralized, mutable state that can be hard to test/keep bug-free
[09:41:41] dminuoso: Bish: but youc an use it inside methods.
[09:41:47] dminuoso: Bish: You're in different universes.
[09:41:49] Bish: but it's still stupid that it's not possible, what i wante dto try
[09:41:51] dminuoso: You are trying to share between universes.
[09:41:54] dminuoso: *that* is silly
[09:41:57] Bish: dminuoso: so
[09:42:13] Bish: begin @lol = 3;def careful_different_universe; p @lol; end;
[09:42:17] Bish: sounds good to you?
[09:42:25] Bish: while EVERYWHERE else in ruby this works?
[09:42:37] Bish: .. i just feel like the combiniation
[09:42:38] elomatreb: It *only* works in the main/"eval" context
[09:42:50] Bish: @lol = 3;def x;p @lol;end; should always work
[09:42:57] dminuoso: Bish: read: @lol = 3 as:
[09:43:18] dminuoso: self.instance_variable_set(:@lol, 3)
[09:43:23] dminuoso: so the question you should ask yourself
[09:43:28] dminuoso: "what is self in this context right now"
[09:43:42] dminuoso: what is the `object` you are focussing
[09:43:48] Bish: yes, and the context is the same, which i create the method in
[09:43:58] Bish: and that method has no freaking access to the variable i just created in the same context
[09:44:07] Bish: so that's exactly what i am mad about
[09:44:09] tAn: has joined #ruby
[09:44:15] dminuoso: no it is not the same.
[09:44:26] dminuoso: class Foo; ... here self is the class object ...; end
[09:44:26] Bish: in terms of code it is.. i understand where the problem is
[09:44:29] elomatreb: It's not, that's the essential difference. The only place where they are the same is in the case where self is "main", i.e. you're working on top-level outside of classes
[09:44:39] dminuoso: class Foo; def m... here self is the instance object ... end; end
[09:44:42] dminuoso: See the difference?
[09:44:44] Bish: you cannot just change the behaviour of @ just because it's inside a class << self;
[09:44:46] dminuoso: Bish: no not in terms of code.
[09:44:57] dminuoso: Bish: you have the wrong idea about what `self` is in different places.
[09:45:06] elomatreb: @ never changes behavior, that's the "beauty" of it
[09:45:09] Bish: no.. i understand it very well now
[09:45:14] dminuoso: Bish: apparently you dont.
[09:45:15] Bish: doesn't change the fact i think it's stupid
[09:45:24] Bish: i do, i just think it's stupid
[09:45:26] schneider: has joined #ruby
[09:45:42] alfiemax: has joined #ruby
[09:45:44] dminuoso: Bish: if you understand it very well, you wouldn't have asked your question to begin wtih so..
[09:45:53] Bish: i understand it now, i didn't in the beginning
[09:46:14] dminuoso: Bish: But I do agree, that things like `self`, default assignee and other things are way too random
[09:46:24] dminuoso: It's frequently hard to keep track of `what self is in the place you are looking at`
[09:46:31] Bish: it's as stupid as having to add @ or @@ when accessing class/instance variables as symbol
[09:46:40] dminuoso: Bish: forget about class variables.
[09:46:43] dminuoso: they are an accident.
[09:46:49] tobiasvl: never add @@
[09:47:05] Bish: okay, then it's stupid to add @ when accessing instance variables as symbols
[09:47:11] Bish: as stupid*
[09:47:26] burgestrand: Does @lol = 3; def x; p @lol; end ever work outside of main?
[09:47:31] dminuoso: Bish: Well that I agree with. :-)
[09:47:36] elomatreb: The argument here is that the symbol-based accessor functions are hax anyway
[09:47:49] dminuoso: Bish: It's (ab)used in core to provide for hidden instance variables you cant possibly access.
[09:47:49] Bish: Burgestrand: .. im doing that all the time inside classes? am i stupid?
[09:47:59] zautomata1: has joined #ruby
[09:48:09] dminuoso: Bish: so that ruby actually uses instance variables like `:foo` but they are completely inaccessible, because the frontend requires `:@...`
[09:48:26] elomatreb: Accessing an undefined instance variable returns nil, so you might just not notice it? Because it will most certainly not do what you expect in classes
[09:48:33] burgestrand: Bish to verify, you write stuff like this all the time: https://eval.in/986192
[09:48:39] Bish: >> class T;@lol = 3;def test; p @lol;end; p T.new.test
[09:48:40] ruby[bot]: Bish: # => /tmp/execpad-4bb94c3fc112/source-4bb94c3fc112:7: syntax error, unexpected end-of-input, expecting ke ...check link for more (https://eval.in/986193)
[09:48:50] Bish: >> class T;@lol = 3;def test; p @lol;end;end; p T.new.test
[09:48:51] ruby[bot]: Bish: # => nil ...check link for more (https://eval.in/986195)
[09:48:58] dminuoso: surprise surprise.
[09:48:58] Bish: eh.. now im confused
[09:49:03] burgestrand: Bish https://eval.in/986196
[09:49:07] burgestrand: Bish because it doesn't work
[09:49:12] dminuoso: Bish: Like I said, Im sure you dont understand it yet.
[09:49:25] Bish: well.. i am sure im doing this alll the time
[09:49:30] tAn: has joined #ruby
[09:49:36] dminuoso: If you do then you have lots of bugs
[09:49:39] dminuoso: 11:48 elomatreb | Accessing an undefined instance variable returns nil, so you might just not notice it? Because it will most certainly not do what you expect in classes
[09:49:40] Bish: am i not?
[09:50:06] Bish: looks like i am not.
[09:50:22] Bish: why did i ever think it's this way
[09:50:32] burgestrand: It's a common thing in e.g. java, php, python (?)
[09:50:44] dminuoso: Bish: Because Ruby tries to act as if its some Javaism, while in truth it has a completely different object model
[09:50:49] Bish: but i am doing ruby alooooot
[09:51:09] elomatreb: I can see why people are confused/inconvenienced by this, e.g. having to initialize lots of stuff inside the constructor method does feel weird
[09:51:28] dminuoso: elomatreb: Things get really subtle when you also talk about class_eval/instance_eval
[09:51:34] burgestrand: It's uncommon for sure
[09:51:56] burgestrand: However, if you frame it as "you can't assign instance variables on instances that don't exist" I do think it makes sense, it doesn't make it more intuitive though
[09:52:34] phaul: Bish: I keep recommending this to everybody all the time, yu might have seen it. It's the best explanation of this Ive seen https://www.youtube.com/watch?v=X2sgQ38UDVY
[09:52:40] dminuoso: Bish: Ultimately the main problem is that Ruby has no mechanism to filter out silly programs.
[09:52:55] burgestrand: I'm not sure any language does…
[09:53:03] dminuoso: Burgestrand: Lots do.
[09:53:12] dminuoso: Burgestrand: The mechanism is called: type system.
[09:53:18] burgestrand: dminuoso yeah, no, not buying that
[09:53:30] Bish: dminuoso: it's weird, i do so much shit that people tell me not to do
[09:53:34] Bish: and it almost never hurts
[09:53:49] Bish: i have some really hardcore ugly @@ shit inside my codebase
[09:53:54] Bish: and it works like a charm
[09:53:58] dminuoso: "works like charm"
[09:54:08] dminuoso: Bish: Its not about whether it works, its about what implications it has for design
[09:54:10] dminuoso: Potential pitfalls
[09:54:16] dminuoso: And whether it leads to wrong abstractions
[09:54:26] elomatreb: Weird stuff gets exponentially more problematic as you increase the number of developers on something
[09:54:36] Bish: yeah guess that's true
[09:54:50] dminuoso: Bish: And if you practice this on your own, you will develop habits that are really hard to kick
[09:54:58] dminuoso: after a while you convince yourself that "this is right because my program works"
[09:55:08] dminuoso: And that's how bad developers develop.
[09:55:19] burgestrand: dminuoso and to make it clear, I do enjoy languages with different type systems from ruby (e.g. haskell, swift, c) partly _because_ of their type system, but they do have their own challenges and I still enjoy my ruby
[09:55:21] elomatreb: Imagine e.g. a new dev coming along and extending your class to do something new, and just because they didn't read or notice that your class uses @@s you now have weird shared state bugs
[09:55:36] dminuoso: Burgestrand: not sure why you are "not buying that"
[09:55:48] burgestrand: dminuoso I would not go as far as saying they filter out silly programs more than ruby, python, php, or blub
[09:55:53] elomatreb: "C" "type system"
[09:56:16] dminuoso: Burgestrand: The entire purpose of a type system is to filter out bad/incorrect/wrong programs while filtering out as few good programs as possible.
[09:56:32] dminuoso: Burgestrand: Good type systems let you express domain specific things even.
[09:56:52] dminuoso: Burgestrand: If it doesn't type check, that's just an expression for: "Your program does not make sense here. This is a bug"
[09:56:52] ramfjord: has joined #ruby
[09:57:10] erlend: has joined #ruby
[09:58:03] burgestrand: dminuoso it certainly sounds like you're arguing for that a robust type system is objectively better
[09:58:09] zautomata1: has joined #ruby
[09:58:43] dminuoso: Burgestrand: Im studying type theory currently, so Im beginning to understand a lot of the motivation and techniques. There's basically very few reasons to _not_ have a type system.
[09:58:55] elomatreb: Better in terms of safety/program correctness isn't hard to argue, it's a balancing act with "productivity"/easy of use
[09:59:28] dminuoso: elomatreb: The second you have type inference the "productivity" argument falls apart.
[09:59:28] schneider: has joined #ruby
[09:59:34] dminuoso: You get types for free.
[09:59:37] burgestrand: dminuoso except not all type systems are not sound, i.e. they can't be proven correct even if types line up
[09:59:53] phaul: If type systems are there to ensure propgram correctness, than a test system like RSpec is far more expressive than that
[09:59:57] Xiti`: has joined #ruby
[09:59:59] dminuoso: phaul: no its not.
[10:00:05] karapetyan: has joined #ruby
[10:00:10] elomatreb: dminuoso: Productivity is a difficult term anyway, I was thinking of things like Rust where it takes a long while to get started for most precisely because of the type system
[10:00:25] dminuoso: phaul: It's the other way around really. RSpec has to check whether under all possible conditions the right types flow through the program. It cant simulate any state and input.
[10:01:27] dminuoso: phaul: Let me argue why.
[10:02:02] dminuoso: phaul: Did you ever have the situation where you made some error (maybe a typo, maybe just a flaw in your head), just to see some NoMethodError because the thing you are holding in your hands is something different?
[10:02:22] dminuoso: Maybe it was some Symbol/String confusion. Or maybe instead of a `Client` object you actually get back a `Client::Proxy`, or actually an Array
[10:02:27] inerthia_: has joined #ruby
[10:02:49] dminuoso: phaul: Why did this happen? Because you mentally ran the types and you made a mistake. Now imagine how frequently happens.
[10:03:05] dminuoso: Why should you suddenly be rigorously correct when writing specs?
[10:03:25] phaul: sure. I am not saying that type systems are useless, or they cannot protect against certain issues
[10:03:34] dminuoso: You're writing the specs under the already existing assumption that your code is right. You dont know *where* its wrong.
[10:03:38] dminuoso: If you did, you would be fixing the bug instead.
[10:03:41] zautomata2: has joined #ruby
[10:04:04] inerthia_: has joined #ruby
[10:04:08] dminuoso: phaul: It's not about "my program is correct", but its rather about "my program is definitely not obviously incorrect"
[10:04:15] phaul: But you can express very comlex expectations with RSpec, the expectation is basically just ruby. It can be hard to express the same in a type signature
[10:04:31] burgestrand: … but that's not true, just because the type system lines up there's no guarantee that your program isn't obviously incorrect
[10:04:36] dminuoso: phaul: Sure. Im not saying that any invariant goes into a type.
[10:05:08] elomatreb: And not every type problem always implies an actual problem
[10:05:20] dminuoso: Burgestrand: Well it doesnt replace the test. But a type system proves program wide that NoMethodErrors cant happen.
[10:05:30] dminuoso: Burgestrand: It doesnt just test based on some random input, it *proves* it.
[10:06:05] dminuoso: elomatreb: Sure. That's basically the main thing to consider.
[10:06:18] dminuoso: elomatreb: type systems do filter out some good programs, but usually they are few.
[10:06:32] elomatreb: Yeah, that's where the tradeoffs and ergonomics come in
[10:07:11] burgestrand: dminuoso I agree with what you're saying, but I don't understand the point you're trying to make
[10:07:13] dminuoso: elomatreb: An expressive type system will let you work around many of such cases, say some form of ad-hoc polymorphism will take care of situations where you need an `int` to fit into a `long`
[10:07:33] dminuoso: (because if you want ergonomics, then you want type inference, and subtyping basically breaks type inference left and right)
[10:08:15] elomatreb: Another good example IMO is .unwrap() in Rust, while the type system says "this value may be absent" I can override it because I know it to be there
[10:08:41] dminuoso: elomatreb: Yeah. Most languages have some sort of backdoor for type systems.
[10:08:50] schneider: has joined #ruby
[10:08:51] phaul: my biggest argument for a type system like haskell's is that it clearly communicates the intention of the function as long as it's just plain types. but when you push more and more complex stuff in the type systems, to "catch more" bugs, that's when it starts becoming painful. dependent types. thank you but not thank you :)
[10:09:23] elomatreb: ACTION mumbles something about Gödel
[10:09:45] dminuoso: elomatreb: Though it's questionable whether that's the right approach though.
[10:10:07] dminuoso: I mean in some cases you have a way of proving totality for certain cases, then some .unrwap is fine.
[10:10:17] dminuoso: In Ruby that amounts to `using . instead of &.`
[10:10:31] dminuoso: But we rarely prove totality. We just assume we never get a nil back everywhere
[10:10:38] dminuoso: Until we do.
[10:11:03] j0bk: has joined #ruby
[10:11:07] elomatreb: With the difference being that &. does something silently weird, whereas a violated .unwrap()-expectation will cause a runtime error
[10:11:18] dminuoso: elomatreb: actually they are the same kind of.
[10:11:55] dminuoso: elomatreb: lets assume for a second that you always use `&.`. This means if any method returns a `nil`, it shortcircuits computation.
[10:11:57] elomatreb: Oh, I thought about the wrong way around. I get what you mean now
[10:12:39] dr3wo: has joined #ruby
[10:13:02] dminuoso: elomatreb: pattern matching is more elegant than .unwrap though
[10:13:32] elomatreb: It's the same thing though in my example, just with the None branch being a runtime error
[10:14:44] dminuoso: elomatreb: I mean ultimately Ruby users make type assumptions everywhere. If you type `.length` you are expressing an implicit assumption that you are holding some `Array` in your hand.
[10:15:26] elomatreb: Anything that has #length, yeah, the expectation that it's an Array is implicit
[10:16:16] elomatreb: Which is probably more of a problem than expecting something to have a method I think? Because it doesn't necessarily cause an immediate error, but does something silently different
[10:16:19] dminuoso: Sure. You could say .count more generally and mean Enumerable
[10:16:58] dminuoso: elomatreb: I mean we have to assume that the implementation of whatever interface you are using is lawful/correct right?
[10:17:40] dr3wo: has joined #ruby
[10:17:57] schneider: has joined #ruby
[10:19:13] elomatreb: Mh, this discussion is becoming a bit pointless in the Ruby context, because somehow Ruby programs manage to crash rarely compared to how many assumptions are being made
[10:19:33] dminuoso: elomatreb: So you never run your code in between saving to see whether the code you have written is correct?
[10:19:39] Sylario: has joined #ruby
[10:19:50] dminuoso: You must be one mighty good ruby developer to always write correct Ruby on the first save.
[10:19:59] elomatreb: I do, but I also spend a lot of time fixing my code to appease the Rust type checker
[10:20:19] dminuoso: elomatreb: So if you make that many incorrect type assumptions in Rust, why would you be any better in Ruby?
[10:20:35] dminuoso: My argument is: Your rust experience should demonstrate how frequently wrong our assumptions are.
[10:21:02] elomatreb: I agree completely, it's just that this leads nowhere (unless there are plans to introduce a type system to Ruby?)
[10:21:25] dminuoso: Matz did some talks recently about it
[10:21:47] elomatreb: OK, I admit I don't really follow Ruby development like that, a little presumptive to say something like that, sorry
[10:22:11] dminuoso: elomatreb: https://www.youtube.com/watch?v=Fjv9GxPXtck
[10:22:42] dminuoso: elomatreb: It's a really lackluster type system though. Basically the same problems that bust optimizations also bust a type system. Ruby is simply too dynaimc.
[10:23:09] dminuoso: (I mean how do you statically determine whether some thing has a method with a correct signature when you can simply .define_method it away dynaically)
[10:23:26] dminuoso: Or you generate an ISeq stream to do the same, and compile/run it.
[10:23:31] elomatreb: Or randomly add/remove methods, which is my favorite example for this, yeah
[10:24:07] dminuoso: I think Crystal manages to do all these things by simply removing the dynamic nature of things.
[10:26:55] ur5us: has joined #ruby
[10:27:07] schneider: has joined #ruby
[10:27:56] Bish: yeah i was hyped about crystal, too
[10:28:03] Bish: until i realized it removes everything that makes ruby cool
[10:28:42] rabajaj: has joined #ruby
[10:32:53] indiche: has joined #ruby
[10:33:06] blackmesa: has joined #ruby
[10:35:53] stormpack: has joined #ruby
[10:36:14] schneider: has joined #ruby
[10:37:09] fullstack: has joined #ruby
[10:37:34] rahul_bajaj: has joined #ruby
[10:38:24] blackchalk: has joined #ruby
[10:40:01] Bish: i once heard doing immutable objects makes better cached code, how does that work
[10:40:10] Rr4sT: has joined #ruby
[10:45:16] blackchalk: has joined #ruby
[10:45:24] schneider: has joined #ruby
[10:46:40] blackmesa: has joined #ruby
[10:48:44] blackchalk_: has joined #ruby
[10:51:22] dr3wo: has joined #ruby
[10:53:05] schneider: has joined #ruby
[10:54:51] ramfjord: has joined #ruby
[10:57:38] Azure: has joined #ruby
[10:58:24] kurko_: has joined #ruby
[10:59:29] zautomata: has joined #ruby
[10:59:42] zautomata: has joined #ruby
[11:01:19] ellcs: has joined #ruby
[11:03:45] \void: has joined #ruby
[11:07:05] zapata_: has joined #ruby
[11:11:44] dminuoso: Bish: The highly dynamic nature of Ruby is not cool.
[11:12:17] dminuoso: At best it acts as a backdoor to shoehorn features into existing software without the hassle of writing extensible and modular software.
[11:12:26] dminuoso: Bish: How often do you use define_method?
[11:12:27] schneider: has joined #ruby
[11:12:34] pd2000: has joined #ruby
[11:14:00] Bish: ACTION searches through is project
[11:14:19] Bish: No Results.
[11:16:08] Cavallari: has joined #ruby
[11:17:15] dminuoso: Bish: How often do you use ObjectSpace?
[11:18:05] dminuoso: Bish: How often do you use eval?
[11:18:16] dminuoso: How often do you use binding (aside for pry)
[11:18:20] dminuoso: Do you notice a pattern here?
[11:18:23] Bish: phew.. alot
[11:18:30] dminuoso: Bish: What for?
[11:18:43] Bish: different things.. but i do a lot of proc shenaniganss
[11:18:50] Bish: i even can't put that into words
[11:19:05] dminuoso: Bish: Just a random example.
[11:19:14] Bish: i wrote a crud plugin for "roda"
[11:19:22] Bish: where you can define a crud resource like
[11:19:38] Bish: res.post { |r| Model::Something.create(r.params)}
[11:19:47] Bish: and these procs (the blocks) sometimes need binding stuff
[11:19:56] schneider: has joined #ruby
[11:20:29] dminuoso: Bish: What for?
[11:20:40] dminuoso: Bish: Im specifically asking to see whether you actually need _runtime_ behavior.
[11:20:57] dminuoso: Bish: Do you have interference between that binding and IO, say getline/HTTP rest call?
[11:21:06] Bish: well i guess i never "need" it because laws of logic
[11:21:07] dminuoso: Or is the behavior of that code determined entirely by the code itself
[11:21:28] dminuoso: That is, does your shenanigans with binding depend on some database query?
[11:21:29] Bish: ... few days ago i used binding, but i don't know where :(
[11:21:36] dminuoso: It probably does not.
[11:21:36] Bish: dminuoso: might be, but can't find it
[11:22:11] dminuoso: Bish: If your goal is just metaprogramming, crystal can do that too.
[11:22:25] Bish: oh, is that so?
[11:22:34] Bish: i love metaprogramming
[11:22:36] dminuoso: Bish: https://crystal-lang.org/docs/syntax_and_semantics/macros.html
[11:22:56] AJA4350: has joined #ruby
[11:22:56] Bish: well.. macros is not metaprogramming.. it alwayshas more limits
[11:23:19] Bish: than being able to walk over all classes of a module and patch the methods
[11:23:20] dminuoso: Bish: If programs that transform programs is not metaprogramming, I dont know what is.
[11:23:24] dminuoso: "patch the methods"
[11:23:41] dminuoso: Bish: Why would you want to do that?
[11:23:43] dminuoso: Bish: Imagine this:
[11:23:45] dminuoso: You write a class:
[11:23:50] Bish: i enjoy things like.. that you can write fibonacci naive and cache it with extern code
[11:23:56] dminuoso: class Foo; def bar; important_code_goes_here; end; end
[11:23:57] Bish: (not that i would recommend) but i did something like that
[11:23:59] dminuoso: and some other file does
[11:24:04] dminuoso: require 'money'
[11:24:13] dminuoso: and the `money` gem happens to *PATCH* the class Foo.
[11:24:19] dminuoso: Would you be happy?
[11:24:20] Bish: what i once had was.. i wrote code.. that did a lot of database queries.. and it was stupid and big
[11:24:49] Bish: but it was super slow.. so i patched it from outside making every method 'memorized'
[11:25:02] dminuoso: Bish: Why not *fork* the thing and fix it?
[11:25:16] Bish: i tried, i couldn't because that would've been alot of work
[11:25:18] dminuoso: Bish: You suddenly end up with some thing that LOOKS as if its the original, but in fact is not.
[11:25:29] Bish: yes :) but it made me happy and didn't cost time
[11:25:32] dminuoso: Which is horrible for anyone that doesnt know all yuor magic hooks and monkepatches
[11:25:33] Bish: i don't say you should do that
[11:25:42] Bish: i say it's cool it's possible
[11:25:52] dminuoso: Bish: Also there are simple idioms for memorization.
[11:26:03] dminuoso: *memoization even!
[11:26:14] dminuoso: Bish: monkey patching is an anti pattern.
[11:26:42] Bish: so is IPC over database, and i luv it
[11:28:05] Bish: fact is no matter how you do it, someone will call it an anti pattern
[11:28:41] dminuoso: Bish: The problem with monkey patching is that its invisible and changes expectation
[11:28:52] dminuoso: you have to understand *the entire* order in whcih your project will be eval'ed to understand how the software behaves
[11:28:54] Bish: well, why use ruby then, that's all ruby has?
[11:28:56] dminuoso: consider that a good thing? I dont.
[11:29:03] Bish: i had the same discussion with a gem-maintainer
[11:29:06] schneider: has joined #ruby
[11:29:11] Bish: he changed all objects to be non-mutable from one version to the other
[11:29:18] Bish: and i was like ":( i use that stuff alot"
[11:29:30] Bish: and hes like " mutable objects are dangerous and performance sucks"
[11:29:33] dminuoso: Bish: Imagine you're an ActiveRecord expert.
[11:29:36] dminuoso: You hop into a rails project.
[11:29:39] dminuoso: See a class that goes:
[11:29:47] dminuoso: class User < ActiveRecord::Base; end
[11:29:56] dminuoso: Would it be safe to assume that all your AR knowledge transfers over?
[11:30:09] dminuoso: That `User.find(1)` will do the expected thing.
[11:30:28] dminuoso: If any user at any time can monkey patch any method, it means if I show you this line of code:
[11:30:33] dminuoso: [1,2,3].last
[11:30:36] dminuoso: What is the result?
[11:30:49] dminuoso: The answer is: Well that depends on the code that was executed before.. maybe this will print "7"
[11:30:55] dminuoso: Maybe it will delete a file on the file system
[11:30:56] Bish: i know what can go wrong.. but i don't get why you would use ruby otherwise
[11:31:02] Bish: that was my argument there too
[11:31:11] Bish: he was like "mutable objects are a gun lying around"
[11:31:26] Bish: well, it's not lying.. but laying? i don't know
[11:31:31] dminuoso: Ultimately mutable objects are fine as opt-in.
[11:31:40] dminuoso: If you need mutability as an optimization, fine.
[11:31:41] RougeR: has joined #ruby
[11:31:41] RougeR: has joined #ruby
[11:32:40] dminuoso: Bish: If you dont know whether ActiveRecord will modify the arguments you pass, then you are basically forced to deep_dup an argument.
[11:33:08] dminuoso: If you want your assumption "my object is the same after the call" to hold.
[11:33:28] dminuoso: Or you have to check the *entire* call tree and trace where that object and its parts get used.
[11:33:49] dminuoso: And then you have to check the entire project, and *the entire source code of all transient dependencies* to know whether ActiveRecord was monkey patched
[11:33:57] dminuoso: (Or any other code that may have somehow access to that)
[11:34:13] dminuoso: Dynamic code is freaking hard to reason about.
[11:34:16] Bish: i know all that
[11:34:18] dminuoso: Code that is freaking hard to reason about is likely buggy.
[11:34:24] Bish: that's why i chill in haskell
[11:34:38] dminuoso: Which is why nobody really uses dynamic features in Ruby except for certain metaprogramming techniques
[11:34:42] Bish: and i agree.. you don't have to tell me that stuf
[11:34:46] dminuoso: But thats mostly because we dont have AST-manipulation macros
[11:34:48] Bish: dminuoso: but i don.t get the choice for ruby then
[11:35:07] tbuehlmann: on the upside, it doesn't have to be like that
[11:35:31] Bish: dminuoso: do stuff i put into Queues get dup-ed?
[11:35:56] Bish: guess not, right?
[11:35:58] apparition: has joined #ruby
[11:36:04] dminuoso: Bish: From my PoV the fact that you have to ask the question shows the problem.
[11:36:40] Bish: well, no.. i am asking without having problems, doesn't mean i never have them
[11:36:41] zautomata1: has joined #ruby
[11:36:49] \void: has joined #ruby
[11:36:53] Bish: i am like 95% sure that it doesn't
[11:37:11] dminuoso: Bish: check out immutable-ruby
[11:37:18] dminuoso: Bish: that thing gives you guarantees that are nice to work with
[11:38:12] schneider: has joined #ruby
[11:39:00] ldnunes: has joined #ruby
[11:40:23] burgestrand: has joined #ruby
[11:41:35] tAn: has joined #ruby
[11:44:39] vondruch: has joined #ruby
[11:44:54] amar: has joined #ruby
[11:47:32] tcopeland: has joined #ruby
[11:49:10] ramfjord: has joined #ruby
[11:59:04] dminuoso: The main reason I use Ruby is because we have Ruby projects in development. Newer tools are written in Haskell at the moment.
[11:59:30] dminuoso: We have failed to identify any advantages of Ruby specifically compared to other languages for basically any task.
[11:59:45] dminuoso: Apart from making it really easy to shoot yourself and others in the foot, head and hands.
[12:00:55] vondruch: has joined #ruby
[12:01:43] duderonomy: has joined #ruby
[12:05:17] synthroid: has joined #ruby
[12:05:53] erlend: has joined #ruby
[12:07:12] adbjesus: has joined #ruby
[12:08:27] John_Ivan: has joined #ruby
[12:08:27] John_Ivan: has joined #ruby
[12:10:41] adbjesus: has joined #ruby
[12:12:22] adbjesus: has joined #ruby
[12:13:46] yohji: has joined #ruby
[12:17:34] shinnya: has joined #ruby
[12:19:31] mostly-harmless: has joined #ruby
[12:22:25] dr3wo: has joined #ruby
[12:30:05] veloutin: dminuoso: there are a few positive points... it makes you appreciate the other languages you use more, and you feel rewarded when you figure out where a certain behavior was added inside all the dependencies.
[12:31:33] donofrio: has joined #ruby
[12:33:08] bmurt: has joined #ruby
[12:33:42] indiche: has joined #ruby
[12:34:47] barq: has joined #ruby
[12:35:03] alfiemax: has joined #ruby
[12:35:35] adbjesus: has joined #ruby
[12:36:02] barq: How can I install with gem behind a proxy? The docs says -p or --http-proxy but I gte no match for argument when I try gem -p 127.0.0.1 install
[12:37:37] NL3limin4t0r: has joined #ruby
[12:40:48] dminuoso: veloutin: Corn mazes are good labyrinths too.
[12:40:57] dminuoso: That doesn't make corn mazes a good tool for software development though.
[12:41:01] dminuoso: Even though they are fun.
[12:41:29] dminuoso: I'd rather spend my time being productive than debugging.
[12:42:24] netherwolfe: has joined #ruby
[12:43:34] Psybur: has joined #ruby
[12:44:58] burgestrand: has joined #ruby
[12:47:39] veloutin: it feels more and more like "There's more than one bad way to do it"
[12:48:30] konsolebox: has joined #ruby
[12:50:07] nadir: has joined #ruby
[12:53:15] ramfjord: has joined #ruby
[12:53:41] workmad3: has joined #ruby
[12:56:59] jcalla: has joined #ruby
[12:57:28] alfiemax: has joined #ruby
[12:57:30] dionysus69: has joined #ruby
[13:00:12] iMadper: has joined #ruby
[13:01:25] karapetyan: has joined #ruby
[13:01:43] amar: has joined #ruby
[13:02:00] amar: has joined #ruby
[13:02:02] mtkd: has joined #ruby
[13:04:29] bmurt: has joined #ruby
[13:04:54] pd2000: has joined #ruby
[13:05:34] dr3wo: has joined #ruby
[13:05:42] rivalomega: has joined #ruby
[13:07:59] tjbp: has joined #ruby
[13:14:45] alfiemax: has joined #ruby
[13:15:28] alfiemax_: has joined #ruby
[13:16:31] louvre06: has joined #ruby
[13:18:21] rf`: has joined #ruby
[13:19:45] dminuoso: I mean that isn't to say that I see the value of some things in Ruby.
[13:20:11] Bish: lol the rant still continues
[13:20:14] dminuoso: RSpec for example is a really elegant DSL. =)
[13:20:36] dminuoso: Bish: Hah you completely triggered me there.
[13:21:05] vondruch: has joined #ruby
[13:21:11] Bish: "there" right now?
[13:21:17] Bish: or with saying "monkey patching, yay"
[13:21:39] duderonomy: has joined #ruby
[13:38:24] apeiros: has joined #ruby
[13:41:00] safetypin: has joined #ruby
[13:41:14] tcopeland: has joined #ruby
[13:43:04] chouhoulis: has joined #ruby
[13:49:26] gnufied: has joined #ruby
[13:50:48] Strepsils: has joined #ruby
[13:51:07] jeffreylevesque: has joined #ruby
[13:52:04] ramfjord: has joined #ruby
[13:52:11] schneider: has joined #ruby
[13:55:10] chouhoul_: has joined #ruby
[13:56:23] memo1: has joined #ruby
[13:58:03] memo1: hi friends. Im learing Ruby, and im excuting bash command from ruby with open3. If i want to execute 2 or more commands, i have to: Open3.popen3(cmd1) do...Open3.popen3(com2)...etc?
[13:58:36] Phrogz: As promised on Friday, I made a gem of my little safe templating and evaluation library: https://github.com/Phrogz/Flooph
[13:59:31] blackmesa: has joined #ruby
[14:00:10] Bish: memo1: using open3 to solve a problem should be the last straw if you ask me, but i don't want to be "that irc guy"
[14:00:13] Bish: but why do you need open3?
[14:00:21] Phrogz: memo1: Are you using open3 because you need to capture stderr, or because that's all you knew how to do.
[14:00:26] Phrogz: Yeah, what Bish said :)
[14:01:06] Phrogz: If you don't need to capture stderr, I'd just use output = `cmd1; cmd2; cmd3` (assuming Linux)
[14:01:09] Phrogz: If you don't need to capture stderr, I'd just use output = `cmd1; cmd2; cmd3` (assuming Linux/OS X)
[14:01:27] Phrogz: (Oops, too much Slack up-arrow editing. Sorry for spam.)
[14:02:19] orbyt_: has joined #ruby
[14:02:35] alfiemax: has joined #ruby
[14:03:32] rfoust: has joined #ruby
[14:04:13] Strepsils: has joined #ruby
[14:12:05] memo1: Phrogz: Bish im using it because i need to use bash commands. I need to execute ffmepeg commads. I want to execute 3 times, because i have 3 cameras.
[14:14:35] erlend: has joined #ruby
[14:14:55] Bish: that's like the only valid use case there is :D ffmpeg
[14:15:02] Bish: i've seen someone doing that already
[14:15:37] Bish: https://github.com/streamio/streamio-ffmpeg/blob/master/lib/ffmpeg/transcoder.rb
[14:15:59] Phrogz: Educate me: why do you need open3 for ffmpeg instead of `...` or exec? https://ruby-doc.org/core-2.5.0/Kernel.html#method-i-exec
[14:16:07] memo1: Bish: right now im capturing one cmaara perfectly, but dont know yet how to start 2 more ffmep instance inside the ruby script
[14:16:59] memo1: Phrogz: Just learning, that was the command i found.
[14:17:08] kapil___: has joined #ruby
[14:17:19] Bish: Phrogz: well you might want to pipe ffmpeg into ffmpeg
[14:17:59] Bish: >> [{}] == [{}]
[14:18:00] ruby[bot]: Bish: # => true (https://eval.in/986407)
[14:18:12] Bish: can i safely do that, like all the time?
[14:18:48] memo1: Bish: sry, dont understand
[14:19:02] Bish: memo1: it's okay
[14:19:08] oleo: has joined #ruby
[14:19:25] tAn: has joined #ruby
[14:19:36] Rapture: has joined #ruby
[14:21:10] suukim: has joined #ruby
[14:22:01] amar: has joined #ruby
[14:22:42] amar: has joined #ruby
[14:27:47] Strepsils: has joined #ruby
[14:28:07] rivalomega: has joined #ruby
[14:28:39] dr3wo: has joined #ruby
[14:29:21] zautomata1: has joined #ruby
[14:32:49] Phrogz: >> a={x:1}; b={x:1}; [a==b, a.object_id==b.object_id]
[14:32:50] ruby[bot]: Phrogz: # => [true, false] (https://eval.in/986426)
[14:33:09] Phrogz: Bish: Yes, you can, because Hash#== is special-cased from Object#==
[14:36:00] netherwolfe: has joined #ruby
[14:42:04] Bish: Phrogz: i figured
[14:42:18] Bish: Phrogz: but is it fast? like
[14:42:31] Bish: if i have
[14:42:38] Bish: [1,2,3] = {..huge.ass object}
[14:42:50] Bish: will it go all through huge ass object
[14:43:19] drale2k_: has joined #ruby
[14:47:24] louvre06_: has joined #ruby
[14:48:10] k0mpa: has joined #ruby
[14:48:26] skweek: has joined #ruby
[14:48:45] memo1: has joined #ruby
[14:49:47] ramfjord: has joined #ruby
[14:51:49] ltt: has joined #ruby
[14:52:23] amatas: has joined #ruby
[14:53:55] amatas: has joined #ruby
[14:55:19] yeticry: has joined #ruby
[14:55:36] ramfjord: has joined #ruby
[14:56:26] Phrogz: Bish: I don't know. My knee-jerk response is "test it and see". My dismissive gut reaction is "it's fast enough you don't need to care". But I truly don't know.
[14:56:28] lelliott: has joined #ruby
[14:56:32] spiette: has joined #ruby
[14:58:28] apeiros: has joined #ruby
[14:59:27] Phrogz: In general, Ruby has been around long enough, and MRI has been be rewritten and optimized enough, that I expect intelligent decisions have been made at the core, especially involving such fundamental data types.
[14:59:38] pd2000: has joined #ruby
[15:01:59] alfiemax: has joined #ruby
[15:02:16] apeiros: Bish: since [] is an array and {} is a hash, that'll instantly return false
[15:02:42] apeiros: if you actually do have to huge hashes, then yes, if they're equal, all objects within it will be compared
[15:03:19] apeiros: unless it's the *same* hash, as in a.equal?(b), that test is done first and it's assumed that a.equal?(b) implies a == b
[15:03:46] apeiros: (and honestly, if you manage to fuck that up, you earn it if == returns wrong results)
[15:04:02] phaul: ACTION blushes :)
[15:04:18] apeiros: phaul: you managed that? :D
[15:04:50] phaul: I was hacking tho, well aware of what I was doing. I need to cheat the system in a challange
[15:05:26] Cavallari: has joined #ruby
[15:05:40] phaul: that's where I found that even the stdlib rdoc is not always aware of this
[15:07:59] fiachetti: has joined #ruby
[15:09:09] cschneid_: has joined #ruby
[15:12:28] dr3wo: has joined #ruby
[15:12:52] phaul: or more precisely there is an implicit assumption that you don't hack ==, or statements in the documentation might not hold
[15:13:55] apeiros: hm, I actually found a case where the assumption breaks
[15:13:59] apeiros: or rather, remembered
[15:14:23] apeiros: >> a = [Float::NAN]; a == a # note: `Float::NAN == Float::NAN` => false
[15:14:24] ruby[bot]: apeiros: # => true (https://eval.in/986472)
[15:14:51] alfiemax: has joined #ruby
[15:16:21] phaul: >> a = 1; def a.==(other) false; end; [a].include?(a)
[15:16:22] ruby[bot]: phaul: # => can't define singleton (TypeError) ...check link for more (https://eval.in/986473)
[15:16:34] phaul: >> a = 'x'; def a.==(other) false; end; [a].include?(a)
[15:16:35] ruby[bot]: phaul: # => true (https://eval.in/986474)
[15:16:51] ellcs: has joined #ruby
[15:17:00] s2013: has joined #ruby
[15:17:04] cyberg: has joined #ruby
[15:17:31] guille-moe: has joined #ruby
[15:18:56] GodFather: has joined #ruby
[15:20:02] ogres: has joined #ruby
[15:24:06] TomyWork: https://ruby-doc.org/stdlib-2.3.1/libdoc/date/rdoc/DateTime.html#method-i-strftime says "%T" means "Local time (extended)"
[15:24:37] TomyWork: however "DateTime.parse('2018-04-09T15:20:00Z').strftime('%F %T')" returns "2018-04-09 15:20:00". even though my time zone is CEST (UTC+2)
[15:25:44] TomyWork: how do i translate a DateTime object to my local time zone?
[15:26:02] justinmrkva_: has joined #ruby
[15:27:23] memo1: has joined #ruby
[15:27:34] synthroid: has joined #ruby
[15:27:34] ams__: has joined #ruby
[15:27:53] TomyWork: or should i use Time instead?
[15:27:57] apeiros: TomyWork: datetime isn't timezone-aware.
[15:27:59] RougeR: has joined #ruby
[15:28:00] RougeR: has joined #ruby
[15:28:09] apeiros: >> require 'time'; Time.iso8601('2018-04-09T15:20:00Z').localtime.strftime("%F %T")
[15:28:10] ruby[bot]: apeiros: # => "2018-04-09 15:20:00" (https://eval.in/986477)
[15:28:28] apeiros: ah, well, that server is probably set to use utc
[15:30:02] troys: has joined #ruby
[15:32:36] Danishman: has joined #ruby
[15:33:25] TomyWork: oh, that's iso-8601?
[15:33:53] TomyWork: and well DateTime stores timezones :)
[15:34:12] TomyWork: but looks like it cant do very much with them
[15:35:00] TomyWork: alright this is looking good, gives me "2018-04-09 17:20:00"
[15:36:49] apeiros: oh, it now stores it at least? well, I guess that's a step?
[15:37:02] apeiros: rails has different tools btw.
[15:40:38] KeyJoo: has joined #ruby
[15:42:28] mroutis: has joined #ruby
[15:43:18] safetypin: has joined #ruby
[15:43:38] tolerablyjake: has joined #ruby
[15:43:46] TomyWork: it's a small sinatra script, not rails
[15:44:01] ltt: has joined #ruby
[15:46:13] ramfjord: has joined #ruby
[15:46:56] amatas: has joined #ruby
[15:47:56] cthulchu: has joined #ruby
[15:48:59] Asher: has joined #ruby
[15:49:27] tomphp_: has joined #ruby
[15:53:51] dr3wo: has joined #ruby
[15:55:19] cagomez: has joined #ruby
[15:58:15] cam27: has joined #ruby
[15:58:37] cagomez: has joined #ruby
[15:59:21] jcarl43: has joined #ruby
[16:00:52] TomyWork: apeiros yay for good docs: it's actually "2018-04-09 15:55:58 UTC", not "2018-04-09T15:55:58Z"
[16:01:05] TomyWork: https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#merge-request-events even though this says otherwise
[16:01:18] TomyWork: so i'm switching back to #parse
[16:01:35] pastorinni: has joined #ruby
[16:02:29] amar: has joined #ruby
[16:05:18] blackmesa: has joined #ruby
[16:05:49] alfiemax: has joined #ruby
[16:10:58] marxarelli: has joined #ruby
[16:11:52] noobineer: has joined #ruby
[16:13:50] darkhanb: has joined #ruby
[16:14:12] ltt: has joined #ruby
[16:14:57] schneider: has joined #ruby
[16:15:22] noobineer: has joined #ruby
[16:22:43] stormpack: has joined #ruby
[16:23:20] erlend: has joined #ruby
[16:24:11] sepp2k: has joined #ruby
[16:24:32] jamesaxl: has joined #ruby
[16:27:47] ltt: has joined #ruby
[16:35:13] Azure: has joined #ruby
[16:35:49] n0m4d1c: has joined #ruby
[16:36:04] lelliott: has joined #ruby
[16:37:36] schneider: has joined #ruby
[16:44:41] n0m4d1c: has joined #ruby
[16:46:10] orbyt_: has joined #ruby
[16:47:27] cadillac_: has joined #ruby
[16:48:23] stormpack_: has joined #ruby
[16:48:33] TomyLobo: has joined #ruby
[16:50:25] sanscoeur: has joined #ruby
[16:50:29] Creatornator: has joined #ruby
[16:52:13] s2013: has joined #ruby
[16:55:00] ramfjord: has joined #ruby
[17:00:21] Asher: has joined #ruby
[17:00:58] ramfjord: has joined #ruby
[17:05:46] Creatornator: has joined #ruby
[17:06:30] amar: has joined #ruby
[17:07:08] ramfjord: has joined #ruby
[17:07:11] ltt: has joined #ruby
[17:11:41] sparr: Ruby 1.8, is attempting ''.to_sym the only way to trigger the "interning empty string" error?
[17:15:13] pd2000: has joined #ruby
[17:16:56] schneider: has joined #ruby
[17:17:24] apeiros: sparr: probably
[17:18:06] quuxman: how would I use rspec to test if a certain method is called, but eliminate the side effects of that call?
[17:18:27] dviola: has joined #ruby
[17:18:34] quuxman: I want to mock out the method and test that it was called
[17:18:49] havenwood: quuxman: use a mock?
[17:19:23] tolerablyjake: has joined #ruby
[17:20:27] havenwood: quuxman: Are you debating how to do the double or stub?
[17:20:35] safetypin: has joined #ruby
[17:21:02] quuxman: I just haven't used Ruby for this before, just know how to do it in Python. I'm reading http://www.rubydoc.info/gems/rspec-mocks/frames
[17:21:50] havenwood: I'm more familiar with Minitest mocks: https://gist.github.com/havenwood/84207afa092ce5d5a680
[17:22:25] quuxman: I have to use rspec for this
[17:23:00] havenwood: quuxman: This seems like a reasonable writeup: https://semaphoreci.com/community/tutorials/mocking-with-rspec-doubles-and-expectations
[17:24:28] Asher: has joined #ruby
[17:24:37] quuxman: In this case I don't want the double to resemble the original object at all, just have one method that when called, ends the test succesfully, and if it wasn't called by the end of the test, it fails
[17:26:23] TomyLobo2: has joined #ruby
[17:26:25] dr3wo: has joined #ruby
[17:27:15] alfiemax: has joined #ruby
[17:31:33] phaul: https://relishapp.com/rspec/rspec-mocks/docs/basics/expecting-messages, quuxman
[17:32:36] eckhardt: has joined #ruby
[17:33:02] t0rchy: has joined #ruby
[17:33:42] indiche: has joined #ruby
[17:34:08] quuxman: So if the method is defined on a global object that's called by the code I'm testing, I could use something like: Foo::Bar.baz = double; expect(Foo::Bar.baz).to receive(:do_stuff) #?
[17:34:39] phaul: don't do that use let construct
[17:35:12] quuxman: what would that look like?
[17:36:13] phaul: let (:something) { double('blah') } ; it 'receives stuff' { expect something.to receive(:stuff) }
[17:36:29] mikecmpbll: has joined #ruby
[17:36:35] quuxman: but then how would the code being tested actually call the double? It uses the gobal reference
[17:37:13] phaul: ah, dependency injection :)
[17:38:38] phaul: if it's a global refrence then you can point that reference to the double as you did, but then you have to make sure you reset it otherwise you have leaky tests
[17:39:17] phaul: you could do something like that with the before and after hooks
[17:39:40] karapetyan: has joined #ruby
[17:39:54] quuxman: ah ok, thanks
[17:43:37] sparr: apeiros: thanks
[17:43:41] duderonomy: has joined #ruby
[17:43:46] amar: has joined #ruby
[17:44:00] sparr: other than an explicit call to somestring.to_sym, what code might trigger an implicit string.to_sym?
[17:44:01] yxhuvud: has joined #ruby
[17:44:08] pd2000: has joined #ruby
[17:45:09] mtkd: has joined #ruby
[17:45:21] suutala_: has joined #ruby
[17:45:57] rivalomega: has joined #ruby
[17:47:27] amar: has joined #ruby
[17:47:28] s2013: has joined #ruby
[17:49:43] dr3w__: has joined #ruby
[17:50:18] troulouliou_div2: has joined #ruby
[17:52:37] claudiuinberlin: has joined #ruby
[17:54:09] drale2k_: has joined #ruby
[17:55:11] rivalomega: has joined #ruby
[17:56:47] sparr: aha, there's also .intern ?
[17:59:28] Creatornator: has joined #ruby
[18:00:09] despai: has joined #ruby
[18:00:40] pd2000: has joined #ruby
[18:01:54] eckhardt: has joined #ruby
[18:02:56] Zaab1t: has joined #ruby
[18:09:14] Mike11: has joined #ruby
[18:09:34] audy: has joined #ruby
[18:12:14] ramfjord: has joined #ruby
[18:12:42] face: has joined #ruby
[18:13:29] pd2000: has joined #ruby
[18:13:43] karapetyan: has joined #ruby
[18:14:08] ghoti: has joined #ruby
[18:15:19] pd2000: has joined #ruby
[18:16:31] pd2000: has joined #ruby
[18:17:06] sameerynho: has joined #ruby
[18:18:25] ramfjord: has joined #ruby
[18:22:05] phaul: quuxman: https://gist.github.com/phaul/9e87df5a1ad3dd81ccd069fc2fb519af
[18:23:32] Eiam: has joined #ruby
[18:24:05] Eiam: when doing a .reduce is there some way to get the original object being passed to reduce? I thought something like method(__method__).parameters but, no dice
[18:24:18] Eiam: I want to know how long the original array is
[18:24:33] Eiam: and I don't want to store it in a value outside of the block
[18:25:30] phaul: you can hack it in the accumulator I guess, but it's ugly. why not store it in a variable?
[18:25:56] baweaver: Eiam: what exactly are you trying to do?
[18:26:28] baweaver: Because this sounds like a very specific solution you're seeking where a more general solution could be better
[18:26:53] Eiam: baweaver: I've got an array with either a string with content or an empty string and I want to merge them all together with /
[18:26:59] Eiam: but I don't want a trailing / or empty //
[18:27:15] Eiam: join leaves a /
[18:27:39] alfiemax: has joined #ruby
[18:27:40] baweaver: join and sub/strip
[18:27:45] Eiam: ["a","b",""].join("/") ==> "a/b/"
[18:28:09] baweaver: >> ["a","b",""].join('/').rstrip('/')
[18:28:09] Eiam: middle missing gives "a//c"
[18:28:10] ruby[bot]: baweaver: # => wrong number of arguments (given 1, expected 0) (ArgumentError) ...check link for more (https://eval.in/986596)
[18:28:59] Eiam: guess i can remove the mfirst
[18:28:59] phaul: join in the reduce, but don't join if empty
[18:29:08] baweaver: >> ['a', '', 'c'].reject(&:empty?).join('/')
[18:29:09] ruby[bot]: baweaver: # => "a/c" (https://eval.in/986597)
[18:29:27] baweaver: Using reduce here isn't necessary and would make the solution far more complicated than it needs to be
[18:29:31] phaul: or that :)
[18:29:36] Eiam: meh, stupid nils
[18:29:39] schneider: has joined #ruby
[18:30:01] Eiam: wish we could conditionalize the (&:thing) without splitting it out
[18:30:12] baweaver: >> ['a', '', nil, 'c'].reject { |v| v.nil? || v.empty? }.join('/')
[18:30:13] ruby[bot]: baweaver: # => "a/c" (https://eval.in/986598)
[18:30:14] Eiam: .reject(&:empty? && &:nil?)
[18:30:22] quuxman: phaul: and add an after call too. Could I make the before run only before one "context" block in the test file?
[18:31:07] baweaver: technically you could compose them, but that's making things more complicated as well.
[18:31:08] baweaver: If you're in Rails land there's blank
[18:31:32] Eiam: yeah no rails. sort of drives me nuts that core ruby doesn't have .blank
[18:31:41] phaul: quuxman: yes, you have full controll. have a look at https://relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks
[18:31:54] Eiam: baweaver thanks. been a long time since I've written any code my brain is rusty
[18:31:59] erlend: has joined #ruby
[18:34:23] phaul: Eiam: you didn't spec what happens with ['a', 'b/'] or is that not a valid input?
[18:34:50] Eiam: phaul:its not valid. its from an input CSV so each column is "a", "B"
[18:35:00] Eiam: but not each column has a value
[18:37:10] Axy: has joined #ruby
[18:41:01] John_Ivan: has joined #ruby
[18:41:17] venmx: has joined #ruby
[18:41:34] kapil___: has joined #ruby
[18:43:03] schneider: has joined #ruby
[18:45:28] baweaver: >> OR = -> *fns { -> o { fns.any? { |fn| fn[o] }}}; blank = OR[:nil?.to_proc, :empty?.to_proc]; ['a', '', nil, 'c'].reject(&blank) # Eiam :D
[18:45:29] ruby[bot]: baweaver: # => ["a", "c"] (https://eval.in/986612)
[18:46:35] baweaver: If I gemified something like that, would it be of interest?
[18:47:08] baweaver: I'd trim down the API quite a bit though
[18:47:14] Eiam: baweaver: loll
[18:47:34] Eiam: thats just cruel
[18:47:48] baweaver: Something.method_or(:nil?, :empty?) # Names are hard, I'll come up with one later
[18:48:08] ruby-lang110: has joined #ruby
[18:49:12] baweaver: May well refactor Izzy for it as it came close to that API already
[18:50:13] baweaver: ['a', '', nil, 'c'].reject(Izzy.or[:nil?, :empty?])
[18:50:19] nielsk: has joined #ruby
[18:50:29] duderonomy: has joined #ruby
[18:50:45] Eiam: its kind of like the blackhole stuff from avdi
[18:51:08] baweaver: https://gist.github.com/baweaver/611389c41c9005d025fb8e55448bf5f5 - found it!
[18:51:09] baweaver: M and Q are fun
[18:51:11] Eiam: most days I've just taken to wrapping data sets up into :noValueProvided or something so atleast I can check on just a symbol vs empty/nil
[18:51:13] trautwein: has joined #ruby
[18:52:19] trautwein: has joined #ruby
[18:54:16] baweaver: Yeah, shoot, this sounds fun. Time to refactor Izzy to have more FP powers! :D
[18:54:27] baweaver: Will report back some time later tonight after my mad hackery
[18:56:06] mtkd: has joined #ruby
[18:58:38] s2013: has joined #ruby
[18:58:38] FastJack: has joined #ruby
[18:58:51] jrm: has joined #ruby
[18:58:53] cagomez: has joined #ruby
[18:59:07] TinkerT: has joined #ruby
[18:59:23] tolerablyjake: has joined #ruby
[18:59:52] trautwein: has joined #ruby
[18:59:54] eckhardt: has joined #ruby
[19:02:36] duderonomy: has joined #ruby
[19:04:30] despai: has joined #ruby
[19:04:58] rivalomega: has joined #ruby
[19:05:08] ramfjord: has joined #ruby
[19:13:40] pragmatism: has joined #ruby
[19:14:57] trautwein: has joined #ruby
[19:15:01] SeepingN: has joined #ruby
[19:20:11] ramfjord: has joined #ruby
[19:21:15] trautwein: has joined #ruby
[19:22:14] bmurt: has joined #ruby
[19:23:06] trautwein: has joined #ruby
[19:23:13] SeepingN: has joined #ruby
[19:25:04] trautwein_: has joined #ruby
[19:26:17] mtkd: has joined #ruby
[19:26:19] zapata_: has joined #ruby
[19:26:39] trautwein: has joined #ruby
[19:26:57] schneider: has joined #ruby
[19:27:49] cr3: has joined #ruby
[19:28:05] imode: has joined #ruby
[19:29:07] cr3: how can I instantiate a class inside a module that was defined in that module: module Foo; class Bar; end; BAR = Bar(); end
[19:29:50] jecht: has joined #ruby
[19:29:58] cagomez: has joined #ruby
[19:31:36] audy: cr3: Foo::Bar()
[19:31:51] audy: ooh.. misread your q
[19:32:30] Creatornator: has joined #ruby
[19:32:43] Phrogz: >> module Foo; class Bar; end; BAR = Bar.new; end; Foo::BAR.class
[19:32:44] ruby[bot]: Phrogz: # => Foo::Bar (https://eval.in/986621)
[19:33:12] cr3: audy: by the way, I actually have Bar.new() and the error is pointing right after '=' with: syntax error, unexpected ':'
[19:33:14] Phrogz: cr3: Same as any other class instantiation, as long as you get the constant resolution correct to refer to it.
[19:33:43] Phrogz: cr3: As seen above, works for the bot.
[19:34:24] Phrogz: Maybe you should gist your actual code (as a simplified test case).
[19:34:32] cr3: Phrogz: thanks, the problem must be elsewhere. I'll have a closer look :(
[19:34:37] ledestin: has joined #ruby
[19:35:02] nikivi: has joined #ruby
[19:35:29] minimalism: has joined #ruby
[19:37:45] indiche: has joined #ruby
[19:39:19] memo1: has joined #ruby
[19:42:06] TomyLobo2: has joined #ruby
[19:42:32] halbbalda: has joined #ruby
[19:43:03] TomyLobo3: has joined #ruby
[19:44:45] gix: has joined #ruby
[19:45:04] safetypin: has joined #ruby
[19:45:10] harrycs: has joined #ruby
[19:45:48] cagomez: has joined #ruby
[19:46:06] shtirlic: has joined #ruby
[19:46:18] burgestrand: has joined #ruby
[19:46:21] claw: has joined #ruby
[19:46:32] sepp2k: has joined #ruby
[19:46:38] jinie: has joined #ruby
[19:47:33] TomyLobo: has joined #ruby
[19:49:20] skarlso: has joined #ruby
[19:49:58] Cybergeek: has joined #ruby
[19:52:26] gremax: has joined #ruby
[19:53:34] Hanmac: has joined #ruby
[19:53:45] matled: has joined #ruby
[19:54:05] schneider: has joined #ruby
[19:54:49] orbyt_: has joined #ruby
[19:56:38] s2013: has joined #ruby
[19:57:16] dr3wo: has joined #ruby
[19:59:12] eckhardt: has joined #ruby
[20:01:40] eckhardt_: has joined #ruby
[20:03:18] cagomez: has joined #ruby
[20:05:34] superscott: has joined #ruby
[20:08:04] dr3wo: has joined #ruby
[20:09:48] despai: has joined #ruby
[20:13:05] burgestrand: has joined #ruby
[20:14:58] bmurt: has joined #ruby
[20:17:21] mroutis: has joined #ruby
[20:18:02] n008f4g_: has joined #ruby
[20:18:38] burgestrand: has joined #ruby
[20:21:32] workmad3: has joined #ruby
[20:25:53] duderonomy: has joined #ruby
[20:26:30] _aeris_: has joined #ruby
[20:33:01] mroutis: has joined #ruby
[20:40:27] pastorinni: has joined #ruby
[20:40:42] erlend: has joined #ruby
[20:44:52] troulouliou_div2: has joined #ruby
[20:53:42] sammi`: has joined #ruby
[20:55:23] mkaito: has joined #ruby
[20:55:23] mkaito: has joined #ruby
[20:56:37] troulouliou_div2: has joined #ruby
[20:59:03] zautomata: has joined #ruby
[21:00:07] zautomata: has joined #ruby
[21:01:25] nowhereman_: has joined #ruby
[21:02:14] Sammichmaker: has joined #ruby
[21:02:14] Sammichmaker: has joined #ruby
[21:08:09] ur5us: has joined #ruby
[21:10:03] pilne: has joined #ruby
[21:11:04] cyberg: has joined #ruby
[21:11:05] quobo: has joined #ruby
[21:12:51] tomphp: has joined #ruby
[21:24:50] clemens3: has joined #ruby
[21:32:18] hinbody: has joined #ruby
[21:34:17] Azure: has joined #ruby
[21:34:18] chouhoulis: has joined #ruby
[21:34:44] memo1: has joined #ruby
[21:37:34] quuxman: phaul: I don't see anything about that in the doc you linked. There's just before(:all) and before(:each). I have many context blocks in a describe block, and I want to set then unset a global before and after just one of the context blocks
[21:38:57] phaul: have you seen my gist why that upsets RSpec soubles?
[21:39:04] phaul: *doubles ^
[21:41:28] quuxman: yeah. I guess I could actually do before and after :all because this particular global isn't used anywhere else in the file. But I don't know if that would leak outside this particular test file
[21:41:45] quuxman: I imagine it would when running the full test sweet
[21:42:27] phaul: quuxman: my point with that gist is that if you look at what happened in the second example that is identical to the first, it failed.
[21:42:47] phaul: I tried to demonstrate what not to do, and why
[21:43:27] quuxman: ah ok, so I should just forget about before and after, and do it for every test case
[21:43:45] quuxman: there are only 2 anyway
[21:44:49] phaul: there is before(:each), after(:each) that you should use for this.
[21:45:15] quuxman: but I don't want to do that, because there a _lot_ of tests in this describe block
[21:45:56] chouhoulis: has joined #ruby
[21:46:09] phaul: But setting up a mock is really cheap. and you don't really have a choice, you can reuse a mock
[21:46:29] phaul: sigh, my typing is really bad sorry
[21:46:45] phaul: you cannot reuse the mock across examples
[21:47:37] quuxman: only 2 tests will use the mock, so before(:each) will be confusing because it won't be clear which test it's for. Guess adding a comment isn't the end of the world or anything
[21:48:02] burgestrand: has joined #ruby
[21:48:18] phaul: is there a sensible context block you can use for those 2 tests?
[21:48:37] phaul: put them in a context and do the before(:each) inside that context
[21:49:34] quuxman: aaah you can do that. Cool
[21:50:01] phaul: oh, yeah you can arbitrarily nest describes, and contexts
[21:50:57] quuxman: That's pretty nice how you can just add blocks that are basically comments (I'm pretty much completely new to Ruby)
[21:51:14] quuxman: but are also blocks and can contain things like before and after
[21:53:43] phaul: so when you are inside a context or a describe then you can define befores, afters, and it examples. You don't have access to expects and doubles. Inside the before and after, and inside the it example blocks you can use the doubles, and the expects. It pretty much holds your and and doesn't let you misuse it.
[21:54:12] phaul: actually expect are only in it examples of course
[21:54:37] phaul: *holds your hand^
[21:55:27] jeffreylevesque: has joined #ruby
[21:58:35] Creatornator: has joined #ruby
[21:59:21] mooe: has joined #ruby
[22:01:06] n0m4d1c: has joined #ruby
[22:01:10] ElFerna: has joined #ruby
[22:04:02] Cork: has joined #ruby
[22:12:16] guacamole: has joined #ruby
[22:12:16] guacamole: has joined #ruby
[22:16:48] orbyt_: has joined #ruby
[22:21:03] workmad3: has joined #ruby
[22:24:30] rivalomega: has joined #ruby
[22:25:51] Creatornator: has joined #ruby
[22:26:45] rivalomega: has joined #ruby
[22:29:22] ur5us: has joined #ruby
[22:32:05] venmx: has joined #ruby
[22:33:46] tcopeland: has joined #ruby
[22:35:16] cadillac_: has joined #ruby
[22:37:08] ElFerna: has joined #ruby
[22:39:45] mikecmpbll: has joined #ruby
[22:42:58] duderonomy: has joined #ruby
[22:43:07] cschneid_: has joined #ruby
[22:43:42] graft: has joined #ruby
[22:44:27] cschneid_: has joined #ruby
[22:47:26] s3nd1v0g1us: has joined #ruby
[22:49:25] erlend: has joined #ruby
[22:54:15] cadillac_: has joined #ruby
[22:57:51] orbyt_: has joined #ruby
[22:59:45] cadillac_: has joined #ruby
[23:00:11] yukai: has joined #ruby
[23:19:26] lelliott: has joined #ruby
[23:19:27] shinnya: has joined #ruby
[23:22:05] rwb: has joined #ruby
[23:29:29] n0m4d1c: has joined #ruby
[23:32:22] rivalomega: has joined #ruby
[23:38:29] rivalome_: has joined #ruby
[23:38:47] duderonomy: has joined #ruby
[23:44:57] rivalomega: has joined #ruby
[23:51:06] minimalism: has joined #ruby
[23:54:29] n0m4d1c_: has joined #ruby
[23:57:10] yxhuvud: has joined #ruby