baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview1: https://www.ruby-lang.org || Paste 4+ lines of text to https://gist.github.com || Rails questions? Ask in #RubyOnRails || Books: https://goo.gl/wpGhoQ || Logs: https://irclog.whitequark.org/ruby
kurko_ has quit [Ping timeout: 260 seconds]
schneider has quit [Ping timeout: 260 seconds]
erlend has quit [Ping timeout: 260 seconds]
erlend has joined #ruby
pelegreno has quit [Remote host closed the connection]
schneider has joined #ruby
sepp2k has quit [Read error: Connection reset by peer]
schneider has quit [Ping timeout: 268 seconds]
schneider has joined #ruby
bmurt has joined #ruby
pelegreno has joined #ruby
mroutis_ has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
mroutis has quit [Read error: Connection reset by peer]
schneider has joined #ruby
sameerynho has quit [Ping timeout: 265 seconds]
TomyLobo has quit [Ping timeout: 255 seconds]
Xiti has quit [Ping timeout: 260 seconds]
schneider has quit [Ping timeout: 265 seconds]
Xiti has joined #ruby
schneider has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
Creatornator has joined #ruby
schneider has joined #ruby
erlend has quit [Ping timeout: 256 seconds]
roshanavand has joined #ruby
tdy has quit [Ping timeout: 256 seconds]
konsolebox has quit [Ping timeout: 264 seconds]
konsolebox has joined #ruby
schneider has quit [Ping timeout: 256 seconds]
kurko__ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
marr has quit [Ping timeout: 240 seconds]
schneider has joined #ruby
Asher has quit [Quit: Leaving.]
cadillac_ has quit [Ping timeout: 240 seconds]
schneider has quit [Ping timeout: 264 seconds]
cadillac_ has joined #ruby
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tolerablyjake has joined #ruby
mroutis_ has quit [Read error: Connection reset by peer]
mroutis has joined #ruby
schneider has joined #ruby
ryzokuken has joined #ruby
s3nd1v0g1us has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 265 seconds]
schneider has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
schneider has quit [Ping timeout: 255 seconds]
yukai has joined #ruby
schneider has joined #ruby
Creatornator has joined #ruby
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
schneider has quit [Ping timeout: 256 seconds]
herbmillerjr has quit [Quit: Konversation terminated!]
Yxhuvud has joined #ruby
gizmore|2 has joined #ruby
schneider has joined #ruby
ogres has quit []
gizmore has quit [Ping timeout: 260 seconds]
liam___ has joined #ruby
cyberg has quit [Quit: Leaving]
liam___ is now known as lelliott
schneider has quit [Ping timeout: 260 seconds]
schneider has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
ramfjord has joined #ruby
ogres has joined #ruby
ogres has quit [Client Quit]
schneider has joined #ruby
woodruffw has joined #ruby
schneider has quit [Ping timeout: 240 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
schneider has joined #ruby
lelliott has quit [Remote host closed the connection]
Yxhuvud has joined #ruby
adjustingmaitai has joined #ruby
dinfuehr has quit [Ping timeout: 255 seconds]
nicesignal has quit [Remote host closed the connection]
nicesignal has joined #ruby
dinfuehr has joined #ruby
schneider has quit [Ping timeout: 264 seconds]
schneider has joined #ruby
Asher has joined #ruby
agent_white has joined #ruby
schneider has quit [Ping timeout: 255 seconds]
n0m4d1c has joined #ruby
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Yxhuvud has joined #ruby
s2013 has joined #ruby
ramfjord has quit [Ping timeout: 265 seconds]
mroutis has quit [Read error: Connection reset by peer]
schneider has joined #ruby
mroutis_ has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us_ has quit [Remote host closed the connection]
ur5us has joined #ruby
skweek has joined #ruby
schneider has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 260 seconds]
schneider has joined #ruby
ramfjord has joined #ruby
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #ruby
eckhardt has quit [Ping timeout: 256 seconds]
schneider has quit [Ping timeout: 260 seconds]
ur5us has joined #ruby
NorthLumberJack has joined #ruby
ramfjord has quit [Ping timeout: 264 seconds]
schneider has joined #ruby
ramfjord has joined #ruby
noobineer has quit [Ping timeout: 260 seconds]
schneider has quit [Ping timeout: 265 seconds]
schneider has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
arescorpio has joined #ruby
schneider has quit [Ping timeout: 265 seconds]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
schneider has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
alfiemax has quit [Ping timeout: 240 seconds]
Yxhuvud has joined #ruby
Psybur has quit [Ping timeout: 260 seconds]
cadillac_ has quit [Quit: I quit]
cadillac_ has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
imode has quit [Ping timeout: 260 seconds]
schneider has joined #ruby
ramfjord has joined #ruby
agent_white has quit [Remote host closed the connection]
Yzguy has quit [Quit: Zzz...]
schneider has quit [Ping timeout: 255 seconds]
sungard has quit [Ping timeout: 260 seconds]
n0m4d1c has quit [Remote host closed the connection]
alfiemax has joined #ruby
schneider has joined #ruby
schneider has quit [Ping timeout: 264 seconds]
Yzguy has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
schneider has joined #ruby
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
gix has joined #ruby
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Yxhuvud has joined #ruby
mroutis_ has quit [Read error: Connection reset by peer]
mroutis has joined #ruby
schneider has quit [Ping timeout: 264 seconds]
skweek has quit [Ping timeout: 260 seconds]
gix- has quit [Ping timeout: 260 seconds]
Yxhuvud has quit [Client Quit]
erlend has joined #ruby
schneider has joined #ruby
Yxhuvud has joined #ruby
cibs_ is now known as cibs
schneider has quit [Ping timeout: 264 seconds]
schneider has joined #ruby
mroutis has quit [Ping timeout: 276 seconds]
Creatornator has joined #ruby
Puffball has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
n0m4d1c has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
schneider has joined #ruby
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #ruby
n0m4d1c has quit [Ping timeout: 240 seconds]
schneider has quit [Ping timeout: 240 seconds]
Yxhuvud has quit [Client Quit]
Yxhuvud has joined #ruby
arescorpio has quit [Excess Flood]
r3m has quit [Ping timeout: 276 seconds]
schneider has joined #ruby
s2013 has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
r3m has joined #ruby
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schneider has quit [Ping timeout: 255 seconds]
shakes has joined #ruby
donofrio has quit [Remote host closed the connection]
dviola has quit [Quit: WeeChat 2.1]
kapil___ has joined #ruby
schneider has joined #ruby
govg has joined #ruby
schneider has quit [Ping timeout: 256 seconds]
imode has joined #ruby
schneider has joined #ruby
tdy has joined #ruby
NorthLumberJack has quit [Ping timeout: 260 seconds]
schneider has quit [Ping timeout: 260 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ramfjord has quit [Ping timeout: 260 seconds]
houhoulis has quit [Remote host closed the connection]
schneider has joined #ruby
law has joined #ruby
<law> hey all, is there a standard way to tell resque to write files with a certain chmod or umask?
<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'
schneider has quit [Ping timeout: 240 seconds]
cschneid_ has joined #ruby
schneider has joined #ruby
asif has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
asif has quit [Client Quit]
stairmast0r has quit [Quit: bye]
ramfjord has joined #ruby
stairmast0r has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
schneider has joined #ruby
sundhell_away is now known as sundhell
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
schneider has quit [Ping timeout: 240 seconds]
Asher has quit [Quit: Leaving.]
schneider has joined #ruby
Asher has joined #ruby
cschneid_ has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 260 seconds]
safetypin has joined #ruby
schneider has joined #ruby
safetypin has quit [Client Quit]
schneider has quit [Ping timeout: 260 seconds]
reber has joined #ruby
schneider has joined #ruby
jalcine has quit [Quit: ZNC - http://znc.in]
schneider has quit [Ping timeout: 245 seconds]
kent\n has quit [Ping timeout: 260 seconds]
jamesaxl has joined #ruby
schneider has joined #ruby
aufi has joined #ruby
schneider has quit [Ping timeout: 276 seconds]
schneider has joined #ruby
schneider has quit [Ping timeout: 240 seconds]
jalcine has joined #ruby
jalcine has quit [Changing host]
jalcine has joined #ruby
erlend has quit [Ping timeout: 264 seconds]
ryzokuken has quit [Remote host closed the connection]
ferr1 has joined #ruby
schneider has joined #ruby
erlend has joined #ruby
zautomata3 has quit [Ping timeout: 260 seconds]
cschneid_ has joined #ruby
oleo has quit [Quit: Leaving]
zautomata3 has joined #ruby
rivalomega has joined #ruby
cschneid_ has quit [Ping timeout: 260 seconds]
schneider has quit [Ping timeout: 264 seconds]
zautomata4 has joined #ruby
cschneid_ has joined #ruby
zautomata3 has quit [Ping timeout: 240 seconds]
aupadhye has joined #ruby
ur5us has quit [Remote host closed the connection]
schneider has joined #ruby
cschneid_ has quit [Ping timeout: 256 seconds]
KeyJoo has joined #ruby
jcarl43 has joined #ruby
schneider has quit [Ping timeout: 256 seconds]
mtkd has joined #ruby
aupadhye is now known as aupadhye|brb
kent\n has joined #ruby
alfiemax has quit [Remote host closed the connection]
schneider has joined #ruby
alfiemax has joined #ruby
cam27 has joined #ruby
schneider has quit [Ping timeout: 276 seconds]
schneider has joined #ruby
cam27 has quit [Ping timeout: 276 seconds]
n008f4g_ has joined #ruby
schneider has quit [Ping timeout: 276 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
schneider has joined #ruby
Mortomes|Work has joined #ruby
schneider has quit [Ping timeout: 256 seconds]
schneider has joined #ruby
n008f4g_ has quit [Ping timeout: 260 seconds]
schneider has quit [Ping timeout: 255 seconds]
alfiemax has quit [Remote host closed the connection]
ta_ has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 240 seconds]
schneider has joined #ruby
jcarl43 has quit [Quit: WeeChat 2.1]
Azure has quit [Ping timeout: 265 seconds]
alfiemax has joined #ruby
schneider has quit [Ping timeout: 268 seconds]
amar has joined #ruby
ferr1 has left #ruby ["WeeChat 2.1"]
jenrzzz has joined #ruby
schneider has joined #ruby
segy_ has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
segy has quit [Ping timeout: 264 seconds]
segy_ is now known as segy
ramfjord has quit [Ping timeout: 240 seconds]
schneider has joined #ruby
andikr has joined #ruby
vondruch has quit [Quit: vondruch]
schneider has quit [Ping timeout: 260 seconds]
phaul has joined #ruby
Yzguy has quit [Quit: Zzz...]
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schneider has joined #ruby
rivalomega has quit [Remote host closed the connection]
TomyWork has joined #ruby
schneider has quit [Ping timeout: 256 seconds]
jenrzzz has quit [Ping timeout: 264 seconds]
schneider has joined #ruby
yohji has joined #ruby
amar has quit [Remote host closed the connection]
amar has joined #ruby
schneider has quit [Ping timeout: 245 seconds]
ta_ has joined #ruby
blackmesa has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ramfjord has joined #ruby
schneider has joined #ruby
Burgestrand has joined #ruby
zenspider has quit [Changing host]
zenspider has joined #ruby
ramfjord has quit [Ping timeout: 265 seconds]
claudiuinberlin has joined #ruby
vondruch has joined #ruby
schneider has quit [Ping timeout: 263 seconds]
clemens3_ has joined #ruby
schneider has joined #ruby
drale2k_ has joined #ruby
amar has quit [Remote host closed the connection]
ramfjord has joined #ruby
alfiemax has quit [Remote host closed the connection]
ramfjord has quit [Ping timeout: 240 seconds]
schneider has quit [Ping timeout: 265 seconds]
schneider has joined #ruby
cam27 has joined #ruby
pwnd_nsfw has quit [Ping timeout: 276 seconds]
iMadper has joined #ruby
erlend has quit [Ping timeout: 264 seconds]
jamesaxl has quit [Ping timeout: 264 seconds]
erlend has joined #ruby
whst has joined #ruby
ur5us has joined #ruby
vondruch has quit [Ping timeout: 256 seconds]
ur5us has quit [Ping timeout: 264 seconds]
tvw has joined #ruby
vondruch has joined #ruby
ramfjord has joined #ruby
mikecmpbll has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
pwnd_nsfw has joined #ruby
ramfjord has quit [Ping timeout: 268 seconds]
alfiemax has joined #ruby
yukai has quit [Ping timeout: 256 seconds]
venmx has joined #ruby
tomphp has joined #ruby
guille-moe has joined #ruby
cadillac_ has quit [Ping timeout: 240 seconds]
jordila has joined #ruby
ryzokuken has joined #ruby
karapetyan has joined #ruby
cadillac_ has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
blackmesa has quit [Ping timeout: 256 seconds]
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
cadillac_ has joined #ruby
schneider has quit [Ping timeout: 245 seconds]
amar has joined #ruby
marr has joined #ruby
einarj has joined #ruby
amar has quit [Ping timeout: 256 seconds]
minimalism has quit [Ping timeout: 255 seconds]
dr3w_ has joined #ruby
<Bish> if i use @inside a class, whose instance variable will that actually be?
<Bish> (inside a class << self block)
claudiuinberlin has quit [Ping timeout: 264 seconds]
venmx has quit [Remote host closed the connection]
jordila has left #ruby [#ruby]
imode has quit [Ping timeout: 256 seconds]
Asher has quit [Ping timeout: 260 seconds]
ramfjord has joined #ruby
karapetyan has quit [Remote host closed the connection]
wang has joined #ruby
karapetyan has joined #ruby
ramfjord has quit [Ping timeout: 245 seconds]
wang is now known as Guest2486
zautomata4 has quit [Ping timeout: 240 seconds]
Beams has joined #ruby
zautomata4 has joined #ruby
<dminuoso> Bish: `class << a` opens the singleton class of whatever `a` is
mtkd has quit [Ping timeout: 256 seconds]
<dminuoso> Bish: so you are within the object of the singleton class itself.
whst has quit [Ping timeout: 245 seconds]
<dminuoso> You should know this
<elomatreb> I.e. an instance of Class
<Bish> yeah i do.. but i am confused of @@ and @ then
<dminuoso> Bish: Forget about @@
<dminuoso> I have yet to see a valid usecase for @@
<dminuoso> Bish: (note that means you can also do things like: arr = [1,2,3]; class << arr; ...; end
<Bish> still would like to understand
<Bish> i can use @something insude class << self
<Bish> and it becomes a @@, right?
zautomata has joined #ruby
<tbuehlmann> no
<Bish> they're just seemingly the same thing, aren't they?
mikecmpb_ has joined #ruby
psychicist__ has joined #ruby
zautomata4 has quit [Ping timeout: 260 seconds]
<Bish> that makes using @ inside class << self pretty pointless, doesn't it?
mikecmpbll has quit [Ping timeout: 268 seconds]
<tobiasvl> they're not the same thing
mtkd has joined #ruby
alfiemax has quit [Remote host closed the connection]
<tbuehlmann> @@ is the same for subclasses, @ is just for this one class instance
zautomata1 has joined #ruby
ur5us has joined #ruby
zautomata has quit [Ping timeout: 264 seconds]
ta_ has quit [Remote host closed the connection]
<Bish> tbuehlmann: more like, one are class variables, aren't they?
ta_ has joined #ruby
<tbuehlmann> correct
^mtkd has joined #ruby
ur5us has quit [Remote host closed the connection]
mtkd has quit [Ping timeout: 265 seconds]
zautomata1 has quit [Ping timeout: 276 seconds]
<Bish> so to summarzy
zautomata2 has joined #ruby
<Bish> class T;class << self;@t = 1;end;end; t will only be accessible for T.new?
ta_ has quit [Ping timeout: 255 seconds]
<phaul> >> class T; class << self; @t = 1; end; end; T.singleton_class.instance_variable_get(:@t)
<ruby[bot]> phaul: # => 1 (https://eval.in/986173)
<Bish> yeah well i figured there are hacks
<Bish> but not a normal way?(
schneider has joined #ruby
venmx has joined #ruby
<phaul> how do you access it from T.new ?
<Bish> with @
<Bish> that's what i thought, but now thinking about it doesn't make sense
<tbuehlmann> it's not an "instance" instance variable, it's a "class" instance variable
<Bish> i get that, i was just confused
<tbuehlmann> it belongs to T (or its singleton class, if you will), not any instance of T and not any of T's subclasses
<phaul> the instance's class's singleton class's instance :D
suk has quit [Quit: Leaving]
schneider has quit [Ping timeout: 260 seconds]
karapetyan has quit [Remote host closed the connection]
<Bish> but to get around the xy problem
<Bish> i want to have a instance variable for the singleton class
<Bish> and initialize it inside class << self
<Bish> but if i do it inside there, it does not seem to be accessbile from the methods i created inside class << self
exchgr has quit [Ping timeout: 240 seconds]
<tbuehlmann> have a minimal example?
<Bish> >> class T; class << self;@intervals = {}; def test;@intervals[1]=3;end;end; T.test;
<Bish> >> class T; class << self;@intervals = {}; def test;@intervals[1]=3;end;end; T.test;
<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)
<Bish> damnot!
<Bish> >> class T; class << self;@intervals = {}; def test;@intervals[1]=3;end;end;end; T.test;
<ruby[bot]> Bish: # => nil (https://eval.in/986179)
<Bish> that's it
<Bish> :o, that gives a raise for me
exchgr has joined #ruby
<Bish> (and shouldn't it be 3?)
amar has joined #ruby
schneider has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
alfiemax has joined #ruby
karapetyan has joined #ruby
<tbuehlmann> >> class T; @intervals = {}; class << self; def test; @intervals[1] = 3; end; end; end; T.test;
<ruby[bot]> tbuehlmann: # => 3 (https://eval.in/986180)
<Bish> and why the fuck does it work for the bot
<phaul> self changes when you enter the def
alfiemax has quit [Remote host closed the connection]
<Bish> but.. if i say class T; @intervals = {};end; this is a instance variable of a T instance..
<Bish> that's not what i want
alfiemax has joined #ruby
<tbuehlmann> oh? why's that?
ta_ has joined #ruby
<Bish> well, i want a class variable style behaviour
<Bish> but i don't get why self << class; does not make the behaviour identical
<Bish> to a class variable
<Bish> phaul: why does self change?
pd2000 has joined #ruby
<Bish> what will self be?
<Bish> well im printing both..
<phaul> Bish, I misread your code, so my comment is true but not relevant to your example
<Bish> yeah, i see, they're equal
<Bish> so this is the thing i am not getting
<elomatreb> Bish: That's not an instance variable of a T instance. Outside of a method definition you are not in an instance context
schneider has quit [Ping timeout: 264 seconds]
<Bish> elomatreb: i see.. that's just normal class_eval i guess?
<elomatreb> Yes
<Bish> dminuoso: isn't that a valid use case for @@ :D
<Bish> having instance variables inside class << self
<dminuoso> No.
<dminuoso> They are not instance variables.
<Bish> how so
<Bish> how would u share data between those methods then?
<elomatreb> Forgetting that @@ even exists was the best advice in this discussion so far
<Bish> if not with @@
<Bish> elomatreb: yeah well, give me an alternative then
<Bish> i don't have any
<dminuoso> Bish: @ works fine.
<tbuehlmann> if you need that variable in subclasses, @@ is fine. else use a class instance variable
xuyuheng has joined #ruby
<Bish> dminuoso: but it doesn't, as you can see
<dminuoso> What?
<dminuoso> No it does work.
alfiemax has quit [Ping timeout: 255 seconds]
<dminuoso> Ask differently.
<Bish> i've shown my example
xuyuheng has quit [Client Quit]
<Bish> >> class T; class << self;@intervals = {}; def test;@intervals[1]=3;end;end;end; T.test;
<ruby[bot]> Bish: # => nil (https://eval.in/986181)
<dminuoso> Bish: You're in different universes.
<dminuoso> Bish: There are instance variables inside the _CLASS_ object
karapetyan has quit [Remote host closed the connection]
xuyuheng has joined #ruby
<dminuoso> Bish: and there are instance variables inside the "normal" object
<dminuoso> Bish: instance variables by default are HIDDEN, that is a good thing.
<dminuoso> You shouldn't get direct access to them.
<Bish> simple use case = share data between 2 methods inside class << self
<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"
<dminuoso> Bish: attr_reader
<Bish> so far i am only able to do it with class <<self
<dminuoso> and then go self.class.foo
iMadper has quit [Remote host closed the connection]
<Bish> i mean @@
<Bish> dminuoso: guess that would be possible
<Bish> but kinda equivalent
schneider has joined #ruby
<dminuoso> Bish: @@ just leads to quirky and buggy code most of the time.
zautomata3 has joined #ruby
zautomata3 has quit [Client Quit]
<dminuoso> And it exposes details into entire inheritance hierarchies
zautomata has joined #ruby
<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"
<dminuoso> ?xy
<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
<Bish> they never hurt me, but i try to listen to oyu
<dminuoso> "Look, guns are not dangerous. I not shot myself"
<elomatreb> Sharing data between two methods inside class << self: https://eval.in/986182 ?
<Bish> i never shot myself*
<dminuoso> You get the point.
<Bish> it's just stupid that 3rd from of hurt is the same
RyanMcCoskrie has joined #ruby
zautomata2 has quit [Ping timeout: 265 seconds]
<dminuoso> Bish: at any rate, "class methods" are no different from "instance methods"
<Bish> elomatreb: yeah well :D i thought about this one too
<dminuoso> Bish: they are all just regular methods.
<Bish> dminuoso: yeah i get that
<dminuoso> Bish: So how do you share data between "regular" instance methods?
<Bish> guess the inheritance argument is valid, but i don't use that often
<dminuoso> instance variables right?
<Bish> dminuoso: usually, yes
<dminuoso> Bish: Great. Since we have established that class methods are no different from "instance methods", it makes for consistent code.
<dminuoso> Bish: If you think you want class variables to dripple down through inheritance, I can promise you: you dont.
<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
<Bish> well, all you say is right.. but i feel like @ inside class << self should be @@
ta_ has quit [Remote host closed the connection]
<dminuoso> Im willing to say: The presence of class variables is almost always an indicator of a bug.
<Bish> i won't argue that what you say is cleaner code
<Bish> but this behaviour is still stupid
<dminuoso> Just like `volatile` in C.
schneider has quit [Ping timeout: 240 seconds]
KeyJoo has quit [Quit: KeyJoo]
<dminuoso> Bish: What behavior is stupid?
<dminuoso> Bish: That objects dont expose their details?
<Bish> that i can create a instance variable inside class << self, and not use it inside its methods
<Bish> dminuoso: because i already took your advice of not doing it that way
<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
<dminuoso> Bish: but youc an use it inside methods.
<dminuoso> Bish: You're in different universes.
<Bish> but it's still stupid that it's not possible, what i wante dto try
<dminuoso> You are trying to share between universes.
<dminuoso> *that* is silly
<Bish> dminuoso: so
<Bish> begin @lol = 3;def careful_different_universe; p @lol; end;
<Bish> sounds good to you?
<Bish> while EVERYWHERE else in ruby this works?
<dminuoso> What?
<Bish> .. i just feel like the combiniation
<elomatreb> It *only* works in the main/"eval" context
<Bish> @lol = 3;def x;p @lol;end; should always work
<dminuoso> Bish: read: @lol = 3 as:
<dminuoso> self.instance_variable_set(:@lol, 3)
<dminuoso> so the question you should ask yourself
<dminuoso> "what is self in this context right now"
<dminuoso> what is the `object` you are focussing
<Bish> yes, and the context is the same, which i create the method in
<Bish> and that method has no freaking access to the variable i just created in the same context
<Bish> so that's exactly what i am mad about
ta_ has joined #ruby
<dminuoso> no it is not the same.
<dminuoso> class Foo; ... here self is the class object ...; end
<Bish> in terms of code it is.. i understand where the problem is
cam27 has quit [Quit: cam27]
<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
<dminuoso> class Foo; def m... here self is the instance object ... end; end
<dminuoso> See the difference?
<Bish> you cannot just change the behaviour of @ just because it's inside a class << self;
<dminuoso> Bish: no not in terms of code.
<dminuoso> Bish: you have the wrong idea about what `self` is in different places.
<elomatreb> @ never changes behavior, that's the "beauty" of it
<Bish> no.. i understand it very well now
<dminuoso> Bish: apparently you dont.
<Bish> doesn't change the fact i think it's stupid
<Bish> i do, i just think it's stupid
schneider has joined #ruby
alfiemax has joined #ruby
<dminuoso> Bish: if you understand it very well, you wouldn't have asked your question to begin wtih so..
<Bish> i understand it now, i didn't in the beginning
<dminuoso> Bish: But I do agree, that things like `self`, default assignee and other things are way too random
<dminuoso> It's frequently hard to keep track of `what self is in the place you are looking at`
<Bish> it's as stupid as having to add @ or @@ when accessing class/instance variables as symbol
<dminuoso> Bish: forget about class variables.
<dminuoso> they are an accident.
<tobiasvl> never add @@
<Bish> okay, then it's stupid to add @ when accessing instance variables as symbols
<Bish> as stupid*
<Burgestrand> Does @lol = 3; def x; p @lol; end ever work outside of main?
<dminuoso> Bish: Well that I agree with. :-)
<elomatreb> The argument here is that the symbol-based accessor functions are hax anyway
<dminuoso> Bish: It's (ab)used in core to provide for hidden instance variables you cant possibly access.
<Bish> Burgestrand: .. im doing that all the time inside classes? am i stupid?
zautomata1 has joined #ruby
<dminuoso> Bish: so that ruby actually uses instance variables like `:foo` but they are completely inaccessible, because the frontend requires `:@...`
ta_ has quit [Remote host closed the connection]
<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
<Burgestrand> Bish to verify, you write stuff like this all the time: https://eval.in/986192
<Burgestrand> Bish ?
<Bish> >> class T;@lol = 3;def test; p @lol;end; p T.new.test
<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)
<Bish> >> class T;@lol = 3;def test; p @lol;end;end; p T.new.test
<ruby[bot]> Bish: # => nil ...check link for more (https://eval.in/986195)
<dminuoso> Voila.
<dminuoso> surprise surprise.
<Bish> eh.. now im confused
<dminuoso> =)
<Burgestrand> Bish https://eval.in/986196
<Burgestrand> Bish because it doesn't work
<dminuoso> Bish: Like I said, Im sure you dont understand it yet.
zautomata has quit [Ping timeout: 256 seconds]
<Bish> well.. i am sure im doing this alll the time
ta_ has joined #ruby
<dminuoso> If you do then you have lots of bugs
<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
<Bish> am i not?
<Bish> looks like i am not.
<Bish> weird.
<Bish> why did i ever think it's this way
<Burgestrand> It's a common thing in e.g. java, php, python (?)
<Burgestrand> Swift too
<dminuoso> Bish: Because Ruby tries to act as if its some Javaism, while in truth it has a completely different object model
<Bish> but i am doing ruby alooooot
<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
<dminuoso> elomatreb: Things get really subtle when you also talk about class_eval/instance_eval
<Burgestrand> It's uncommon for sure
<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
<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
<dminuoso> Bish: Ultimately the main problem is that Ruby has no mechanism to filter out silly programs.
<Burgestrand> I'm not sure any language does…
<dminuoso> Burgestrand: Lots do.
<dminuoso> Burgestrand: The mechanism is called: type system.
<Burgestrand> dminuoso yeah, no, not buying that
<Bish> dminuoso: it's weird, i do so much shit that people tell me not to do
<Bish> and it almost never hurts
<Bish> i have some really hardcore ugly @@ shit inside my codebase
<Bish> and it works like a charm
<dminuoso> "works like charm"
<dminuoso> Bish: Its not about whether it works, its about what implications it has for design
<dminuoso> Potential pitfalls
<dminuoso> And whether it leads to wrong abstractions
<elomatreb> Weird stuff gets exponentially more problematic as you increase the number of developers on something
<Bish> yeah guess that's true
<dminuoso> Bish: And if you practice this on your own, you will develop habits that are really hard to kick
<dminuoso> after a while you convince yourself that "this is right because my program works"
<dminuoso> And that's how bad developers develop.
<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
<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
erlend has quit [Ping timeout: 264 seconds]
<dminuoso> Burgestrand: not sure why you are "not buying that"
<Burgestrand> dminuoso I would not go as far as saying they filter out silly programs more than ruby, python, php, or blub
schneider has quit [Ping timeout: 265 seconds]
<elomatreb> "C" "type system"
<elomatreb> :P
zautomata1 has quit [Ping timeout: 264 seconds]
RyanMcCoskrie has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<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.
<Burgestrand> elomatreb ;)
<dminuoso> Burgestrand: Good type systems let you express domain specific things even.
<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"
ramfjord has joined #ruby
erlend has joined #ruby
<Burgestrand> dminuoso it certainly sounds like you're arguing for that a robust type system is objectively better
zautomata1 has joined #ruby
<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.
<elomatreb> Better in terms of safety/program correctness isn't hard to argue, it's a balancing act with "productivity"/easy of use
<dminuoso> elomatreb: The second you have type inference the "productivity" argument falls apart.
schneider has joined #ruby
<dminuoso> You get types for free.
<Burgestrand> dminuoso except not all type systems are not sound, i.e. they can't be proven correct even if types line up
<phaul> If type systems are there to ensure propgram correctness, than a test system like RSpec is far more expressive than that
Xiti` has joined #ruby
<dminuoso> phaul: no its not.
karapetyan has joined #ruby
<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
<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.
ramfjord has quit [Ping timeout: 260 seconds]
<dminuoso> phaul: Let me argue why.
<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?
<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
xuyuheng has quit [Quit: Quit: My MacBook Pro has gone to sleep. ZZZzzz?]
inerthia_ has joined #ruby
<dminuoso> phaul: Why did this happen? Because you mentally ran the types and you made a mistake. Now imagine how frequently happens.
<dminuoso> Why should you suddenly be rigorously correct when writing specs?
<phaul> sure. I am not saying that type systems are useless, or they cannot protect against certain issues
<dminuoso> You're writing the specs under the already existing assumption that your code is right. You dont know *where* its wrong.
<dminuoso> If you did, you would be fixing the bug instead.
zautomata2 has joined #ruby
inerthia_ has quit [Client Quit]
Xiti has quit [Ping timeout: 264 seconds]
zautomata1 has quit [Ping timeout: 268 seconds]
inerthia_ has joined #ruby
<dminuoso> phaul: It's not about "my program is correct", but its rather about "my program is definitely not obviously incorrect"
<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
fullstack has quit [Ping timeout: 256 seconds]
<Burgestrand> … but that's not true, just because the type system lines up there's no guarantee that your program isn't obviously incorrect
<dminuoso> phaul: Sure. Im not saying that any invariant goes into a type.
karapetyan has quit [Ping timeout: 260 seconds]
<elomatreb> And not every type problem always implies an actual problem
<dminuoso> Burgestrand: Well it doesnt replace the test. But a type system proves program wide that NoMethodErrors cant happen.
<dminuoso> Burgestrand: It doesnt just test based on some random input, it *proves* it.
schneider has quit [Ping timeout: 264 seconds]
<dminuoso> elomatreb: Sure. That's basically the main thing to consider.
<dminuoso> elomatreb: type systems do filter out some good programs, but usually they are few.
<elomatreb> Yeah, that's where the tradeoffs and ergonomics come in
<Burgestrand> dminuoso I agree with what you're saying, but I don't understand the point you're trying to make
<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`
<dminuoso> (because if you want ergonomics, then you want type inference, and subtyping basically breaks type inference left and right)
<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
<dminuoso> elomatreb: Yeah. Most languages have some sort of backdoor for type systems.
schneider has joined #ruby
<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 :)
<phaul> *no*^
* elomatreb mumbles something about Gödel
<dminuoso> elomatreb: Though it's questionable whether that's the right approach though.
<dminuoso> I mean in some cases you have a way of proving totality for certain cases, then some .unrwap is fine.
<dminuoso> In Ruby that amounts to `using . instead of &.`
<dminuoso> But we rarely prove totality. We just assume we never get a nil back everywhere
<dminuoso> Until we do.
j0bk has joined #ruby
<elomatreb> With the difference being that &. does something silently weird, whereas a violated .unwrap()-expectation will cause a runtime error
<dminuoso> elomatreb: actually they are the same kind of.
<dminuoso> elomatreb: lets assume for a second that you always use `&.`. This means if any method returns a `nil`, it shortcircuits computation.
<elomatreb> Oh, I thought about the wrong way around. I get what you mean now
dr3w_ has joined #ruby
<dminuoso> elomatreb: pattern matching is more elegant than .unwrap though
<elomatreb> It's the same thing though in my example, just with the None branch being a runtime error
schneider has quit [Ping timeout: 256 seconds]
<dminuoso> oh yeah
dr3w_ has quit [Client Quit]
<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.
<elomatreb> Anything that has #length, yeah, the expectation that it's an Array is implicit
<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
<dminuoso> Sure. You could say .count more generally and mean Enumerable
<dminuoso> elomatreb: I mean we have to assume that the implementation of whatever interface you are using is lawful/correct right?
dr3w_ has joined #ruby
schneider has joined #ruby
<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
<dminuoso> elomatreb: So you never run your code in between saving to see whether the code you have written is correct?
sylario has joined #ruby
<dminuoso> You must be one mighty good ruby developer to always write correct Ruby on the first save.
<elomatreb> I do, but I also spend a lot of time fixing my code to appease the Rust type checker
<dminuoso> elomatreb: So if you make that many incorrect type assumptions in Rust, why would you be any better in Ruby?
<dminuoso> My argument is: Your rust experience should demonstrate how frequently wrong our assumptions are.
<elomatreb> I agree completely, it's just that this leads nowhere (unless there are plans to introduce a type system to Ruby?)
<dminuoso> There are.
<dminuoso> =)
<dminuoso> Matz did some talks recently about it
<elomatreb> OK, I admit I don't really follow Ruby development like that, a little presumptive to say something like that, sorry
<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.
schneider has quit [Ping timeout: 260 seconds]
<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)
<dminuoso> Or you generate an ISeq stream to do the same, and compile/run it.
<elomatreb> Or randomly add/remove methods, which is my favorite example for this, yeah
<dminuoso> I think Crystal manages to do all these things by simply removing the dynamic nature of things.
ur5us has joined #ruby
schneider has joined #ruby
<Bish> yeah i was hyped about crystal, too
<Bish> until i realized it removes everything that makes ruby cool
rabajaj has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
indiche has joined #ruby
blackmesa has joined #ruby
Burgestrand has quit [Quit: Closing time!]
stormpack has joined #ruby
schneider has joined #ruby
fullstack has joined #ruby
rahul_bajaj has joined #ruby
blackmesa has quit [Ping timeout: 246 seconds]
rabajaj has quit [Ping timeout: 255 seconds]
blackchalk has joined #ruby
<Bish> i once heard doing immutable objects makes better cached code, how does that work
<Bish> ?
Rr4sT has joined #ruby
schneider has quit [Ping timeout: 264 seconds]
einarj has quit []
blackchalk has quit [Quit: quitting]
blackchalk has joined #ruby
schneider has joined #ruby
blackmesa has joined #ruby
blackchalk_ has joined #ruby
schneider has quit [Ping timeout: 264 seconds]
blackchalk_ has quit [Client Quit]
dr3w_ has joined #ruby
tcopeland has quit [Quit: tcopeland]
blackmesa has quit [Ping timeout: 246 seconds]
blackchalk has quit [Ping timeout: 245 seconds]
schneider has joined #ruby
ramfjord has joined #ruby
Azure has joined #ruby
zautomata2 has quit [Quit: WeeChat 1.9.1]
kurko_ has joined #ruby
zautomata has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
zautomata has quit [Changing host]
zautomata has joined #ruby
ellcs has joined #ruby
\void has joined #ruby
schneider has quit [Ping timeout: 240 seconds]
zapata_ has joined #ruby
zapata has quit [Ping timeout: 256 seconds]
rahul_bajaj has quit [Read error: Connection reset by peer]
<dminuoso> Bish: The highly dynamic nature of Ruby is not cool.
pd2000 has quit [Remote host closed the connection]
<dminuoso> At best it acts as a backdoor to shoehorn features into existing software without the hassle of writing extensible and modular software.
<dminuoso> Bish: How often do you use define_method?
schneider has joined #ruby
pd2000 has joined #ruby
* Bish searches through is project
<Bish> No Results.
Cavallari has joined #ruby
<dminuoso> Bish: How often do you use ObjectSpace?
<Bish> none
schneider has quit [Ping timeout: 276 seconds]
<dminuoso> Bish: How often do you use eval?
<Bish> none
<dminuoso> How often do you use binding (aside for pry)
<dminuoso> Do you notice a pattern here?
<Bish> phew.. alot
<dminuoso> Bish: What for?
<Bish> different things.. but i do a lot of proc shenaniganss
<Bish> i even can't put that into words
<dminuoso> Bish: Just a random example.
<Bish> i wrote a crud plugin for "roda"
<Bish> where you can define a crud resource like
<Bish> res.post { |r| Model::Something.create(r.params)}
<Bish> and these procs (the blocks) sometimes need binding stuff
schneider has joined #ruby
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso> Bish: What for?
<dminuoso> Bish: Im specifically asking to see whether you actually need _runtime_ behavior.
<dminuoso> Bish: Do you have interference between that binding and IO, say getline/HTTP rest call?
<Bish> well i guess i never "need" it because laws of logic
<dminuoso> Or is the behavior of that code determined entirely by the code itself
<dminuoso> That is, does your shenanigans with binding depend on some database query?
<Bish> ... few days ago i used binding, but i don't know where :(
<dminuoso> It probably does not.
<Bish> dminuoso: might be, but can't find it
<dminuoso> Bish: If your goal is just metaprogramming, crystal can do that too.
<Bish> oh, is that so?
<Bish> i love metaprogramming
AJA4350 has joined #ruby
<Bish> well.. macros is not metaprogramming.. it alwayshas more limits
<Bish> than being able to walk over all classes of a module and patch the methods
<dminuoso> Bish: If programs that transform programs is not metaprogramming, I dont know what is.
<dminuoso> "patch the methods"
<Bish> yes.
<dminuoso> Bish: Why would you want to do that?
<dminuoso> Bish: Imagine this:
<dminuoso> You write a class:
<Bish> i enjoy things like.. that you can write fibonacci naive and cache it with extern code
<dminuoso> class Foo; def bar; important_code_goes_here; end; end
<Bish> (not that i would recommend) but i did something like that
<dminuoso> and some other file does
<dminuoso> require 'money'
<dminuoso> and the `money` gem happens to *PATCH* the class Foo.
<dminuoso> Would you be happy?
<Bish> what i once had was.. i wrote code.. that did a lot of database queries.. and it was stupid and big
<Bish> but it was super slow.. so i patched it from outside making every method 'memorized'
schneider has quit [Ping timeout: 268 seconds]
<dminuoso> Bish: Why not *fork* the thing and fix it?
<Bish> i tried, i couldn't because that would've been alot of work
<dminuoso> Bish: You suddenly end up with some thing that LOOKS as if its the original, but in fact is not.
<Bish> yes :) but it made me happy and didn't cost time
<dminuoso> Which is horrible for anyone that doesnt know all yuor magic hooks and monkepatches
<Bish> i don't say you should do that
<Bish> i say it's cool it's possible
<dminuoso> Bish: Also there are simple idioms for memorization.
<dminuoso> *memoization even!
<dminuoso> Bish: monkey patching is an anti pattern.
<Bish> so is IPC over database, and i luv it
<Bish> fact is no matter how you do it, someone will call it an anti pattern
<dminuoso> Bish: The problem with monkey patching is that its invisible and changes expectation
<dminuoso> you have to understand *the entire* order in whcih your project will be eval'ed to understand how the software behaves
<Bish> well, why use ruby then, that's all ruby has?
<dminuoso> consider that a good thing? I dont.
<Bish> i had the same discussion with a gem-maintainer
schneider has joined #ruby
<Bish> he changed all objects to be non-mutable from one version to the other
<Bish> and i was like ":( i use that stuff alot"
<Bish> and hes like " mutable objects are dangerous and performance sucks"
<dminuoso> Bish: Imagine you're an ActiveRecord expert.
<dminuoso> You hop into a rails project.
<dminuoso> See a class that goes:
<dminuoso> class User < ActiveRecord::Base; end
<dminuoso> Would it be safe to assume that all your AR knowledge transfers over?
<dminuoso> That `User.find(1)` will do the expected thing.
<dminuoso> If any user at any time can monkey patch any method, it means if I show you this line of code:
<dminuoso> [1,2,3].last
<dminuoso> What is the result?
<dminuoso> The answer is: Well that depends on the code that was executed before.. maybe this will print "7"
<dminuoso> Maybe it will delete a file on the file system
<Bish> i know what can go wrong.. but i don't get why you would use ruby otherwise
<Bish> that was my argument there too
<Bish> he was like "mutable objects are a gun lying around"
<Bish> well, it's not lying.. but laying? i don't know
<dminuoso> Ultimately mutable objects are fine as opt-in.
<dminuoso> If you need mutability as an optimization, fine.
RougeR has joined #ruby
RougeR has quit [Changing host]
RougeR has joined #ruby
<dminuoso> Bish: If you dont know whether ActiveRecord will modify the arguments you pass, then you are basically forced to deep_dup an argument.
<dminuoso> If you want your assumption "my object is the same after the call" to hold.
<dminuoso> Or you have to check the *entire* call tree and trace where that object and its parts get used.
<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
<dminuoso> (Or any other code that may have somehow access to that)
ur5us has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 265 seconds]
<dminuoso> Dynamic code is freaking hard to reason about.
<Bish> i know all that
<dminuoso> Code that is freaking hard to reason about is likely buggy.
<Bish> that's why i chill in haskell
<dminuoso> Which is why nobody really uses dynamic features in Ruby except for certain metaprogramming techniques
<Bish> and i agree.. you don't have to tell me that stuf
<dminuoso> But thats mostly because we dont have AST-manipulation macros
<Bish> dminuoso: but i don.t get the choice for ruby then
<dminuoso> Bish: =)
<tbuehlmann> on the upside, it doesn't have to be like that
\void has quit [Quit: So long, and thanks for all the fish.]
<Bish> dminuoso: do stuff i put into Queues get dup-ed?
<Bish> guess not, right?
apparition has joined #ruby
<dminuoso> Bish: From my PoV the fact that you have to ask the question shows the problem.
<Bish> well, no.. i am asking without having problems, doesn't mean i never have them
zautomata1 has joined #ruby
\void has joined #ruby
<Bish> i am like 95% sure that it doesn't
zautomata has quit [Ping timeout: 265 seconds]
<dminuoso> Bish: check out immutable-ruby
<dminuoso> Bish: that thing gives you guarantees that are nice to work with
schneider has joined #ruby
ldnunes has joined #ruby
Burgestrand has joined #ruby
ta_ has quit [Remote host closed the connection]
ta_ has joined #ruby
vondruch has quit [Quit: vondruch]
amar has quit [Remote host closed the connection]
vondruch has joined #ruby
amar has joined #ruby
ta_ has quit [Ping timeout: 240 seconds]
jeffreylevesque has quit [Ping timeout: 260 seconds]
tcopeland has joined #ruby
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
Guest2486 has quit [Quit: WeeChat 1.4]
<dminuoso> The main reason I use Ruby is because we have Ruby projects in development. Newer tools are written in Haskell at the moment.
<dminuoso> We have failed to identify any advantages of Ruby specifically compared to other languages for basically any task.
<dminuoso> Apart from making it really easy to shoot yourself and others in the foot, head and hands.
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
duderonomy has joined #ruby
yohji has quit [Ping timeout: 256 seconds]
erlend has quit [Ping timeout: 276 seconds]
synthroid has joined #ruby
erlend has joined #ruby
adbjesus has joined #ruby
John_Ivan has joined #ruby
John_Ivan has joined #ruby
John_Ivan has quit [Changing host]
inerthia has quit [Quit: Byez]
adbjesus has quit [Client Quit]
adbjesus has joined #ruby
workmad3 has quit [Ping timeout: 240 seconds]
adbjesus has quit [Client Quit]
adbjesus has joined #ruby
yohji has joined #ruby
Burgestrand has quit [Quit: Closing time!]
Mortomes|Work has quit [Ping timeout: 260 seconds]
shinnya has joined #ruby
mostly-harmless has quit [Ping timeout: 256 seconds]
mostly-harmless has joined #ruby
pd2000 has quit [Read error: Connection reset by peer]
dr3w_ has joined #ruby
alfiemax has quit [Remote host closed the connection]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<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.
indiche has quit [Ping timeout: 256 seconds]
donofrio has joined #ruby
psychicist__ has quit [Ping timeout: 264 seconds]
bmurt has joined #ruby
indiche has joined #ruby
barq has joined #ruby
adbjesus has quit [Quit: adbjesus]
alfiemax has joined #ruby
adbjesus has joined #ruby
<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
NL3limin4t0r has joined #ruby
alfiemax has quit [Ping timeout: 245 seconds]
<dminuoso> veloutin: Corn mazes are good labyrinths too.
<dminuoso> That doesn't make corn mazes a good tool for software development though.
<dminuoso> Even though they are fun.
<dminuoso> I'd rather spend my time being productive than debugging.
netherwolfe has joined #ruby
Psybur has joined #ruby
Burgestrand has joined #ruby
<veloutin> it feels more and more like "There's more than one bad way to do it"
bmurt has quit [Quit: Textual IRC Client: www.textualapp.com]
konsolebox has quit [Ping timeout: 240 seconds]
konsolebox has joined #ruby
nadir has joined #ruby
adbjesus has quit [Quit: adbjesus]
ramfjord has joined #ruby
workmad3 has joined #ruby
jcalla has joined #ruby
nikivi has quit [Quit: ZNC 1.6.6 - http://znc.in]
alfiemax has joined #ruby
dionysus69 has joined #ruby
ramfjord has quit [Ping timeout: 264 seconds]
rfoust has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rr4sT has quit [Quit: Connection closed for inactivity]
duderonomy has quit [Ping timeout: 260 seconds]
iMadper has joined #ruby
^mtkd has quit [Ping timeout: 268 seconds]
amar has quit [Remote host closed the connection]
karapetyan has joined #ruby
amar has joined #ruby
amar has quit [Remote host closed the connection]
amar has joined #ruby
dr3w_ has quit [Read error: Connection reset by peer]
mtkd has joined #ruby
stormpack has quit [Quit: Leaving]
bmurt has joined #ruby
alfiemax has quit [Ping timeout: 268 seconds]
pd2000 has joined #ruby
dr3w_ has joined #ruby
rivalomega has joined #ruby
tjbp_ has quit [Quit: No Ping reply in 180 seconds.]
tjbp has joined #ruby
alfiemax has joined #ruby
alfiemax_ has joined #ruby
pd2000 has quit [Ping timeout: 240 seconds]
louvre06 has joined #ruby
rf` has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
<dminuoso> I mean that isn't to say that I see the value of some things in Ruby.
<Bish> lol the rant still continues
<dminuoso> RSpec for example is a really elegant DSL. =)
rf has quit [Ping timeout: 265 seconds]
<dminuoso> Bish: Hah you completely triggered me there.
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
<Bish> "there" right now?
<Bish> or with saying "monkey patching, yay"
duderonomy has joined #ruby
schneider has quit [Ping timeout: 240 seconds]
tcopeland has quit [Quit: tcopeland]
rivalomega has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 256 seconds]
tvw has quit [Remote host closed the connection]
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby
safetypin has joined #ruby
tcopeland has joined #ruby
apeiros has quit [Ping timeout: 256 seconds]
chouhoulis has joined #ruby
pilne has quit [Quit: Leaving]
gnufied has joined #ruby
Strepsils has joined #ruby
jeffreylevesque has joined #ruby
ramfjord has joined #ruby
schneider has joined #ruby
amar has quit [Remote host closed the connection]
Strepsils has quit [Read error: Connection reset by peer]
chouhoul_ has joined #ruby
RougeR has quit [Ping timeout: 245 seconds]
memo1 has joined #ruby
netherwolfe has quit [Ping timeout: 240 seconds]
ramfjord has quit [Ping timeout: 264 seconds]
<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?
chouhoulis has quit [Ping timeout: 255 seconds]
<Phrogz> As promised on Friday, I made a gem of my little safe templating and evaluation library: https://github.com/Phrogz/Flooph
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackmesa has joined #ruby
<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"
<Bish> but why do you need open3?
<Phrogz> memo1: Are you using open3 because you need to capture stderr, or because that's all you knew how to do.
<Phrogz> Yeah, what Bish said :)
<Phrogz> If you don't need to capture stderr, I'd just use output = `cmd1; cmd2; cmd3` (assuming Linux)
<Phrogz> If you don't need to capture stderr, I'd just use output = `cmd1; cmd2; cmd3` (assuming Linux/OS X)
<Phrogz> (Oops, too much Slack up-arrow editing. Sorry for spam.)
alfiemax_ has quit [Remote host closed the connection]
orbyt_ has joined #ruby
alfiemax has joined #ruby
ellcs has quit [Remote host closed the connection]
rfoust has joined #ruby
Strepsils has joined #ruby
shakes has quit [Quit: Leaving]
orbyt_ has quit [Ping timeout: 260 seconds]
<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.
erlend has quit [Ping timeout: 256 seconds]
erlend has joined #ruby
<Bish> that's like the only valid use case there is :D ffmpeg
<Bish> i've seen someone doing that already
<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
<memo1> Bish: right now im capturing one cmaara perfectly, but dont know yet how to start 2 more ffmep instance inside the ruby script
<memo1> Phrogz: Just learning, that was the command i found.
kapil___ has joined #ruby
<Bish> Phrogz: well you might want to pipe ffmpeg into ffmpeg
<Bish> >> [{}] == [{}]
<ruby[bot]> Bish: # => true (https://eval.in/986407)
<Bish> can i safely do that, like all the time?
<memo1> Bish: sry, dont understand
<Bish> memo1: it's okay
oleo has joined #ruby
ta_ has joined #ruby
Rapture has joined #ruby
IcyDragon has quit [Ping timeout: 240 seconds]
suukim has joined #ruby
amar has joined #ruby
mtkd has quit []
amar has quit [Remote host closed the connection]
amar has joined #ruby
Strepsil_ has joined #ruby
zautomata1 has quit [Ping timeout: 264 seconds]
memo1 has quit [Ping timeout: 240 seconds]
rivalomega has joined #ruby
apparition has quit [Read error: Connection reset by peer]
dr3w_ has joined #ruby
zautomata1 has joined #ruby
Strepsils has quit [Ping timeout: 260 seconds]
<Phrogz> >> a={x:1}; b={x:1}; [a==b, a.object_id==b.object_id]
<ruby[bot]> Phrogz: # => [true, false] (https://eval.in/986426)
<Phrogz> Bish: Yes, you can, because Hash#== is special-cased from Object#==
Burgestrand has quit [Quit: Closing time!]
netherwolfe has joined #ruby
aupadhye|brb has quit [Ping timeout: 240 seconds]
<Bish> Phrogz: i figured
<Bish> Phrogz: but is it fast? like
<Bish> if i have
<Bish> [1,2,3] = {..huge.ass object}
<Bish> will it go all through huge ass object
drale2k_ has joined #ruby
indiche has quit [Ping timeout: 240 seconds]
louvre06_ has joined #ruby
k0mpa has joined #ruby
skweek has joined #ruby
memo1 has joined #ruby
ramfjord has joined #ruby
louvre06 has quit [Ping timeout: 260 seconds]
ltt has joined #ruby
amatas has joined #ruby
amatas has quit [Client Quit]
amatas has joined #ruby
yeticry has quit [Read error: Connection reset by peer]
ramfjord has quit [Ping timeout: 256 seconds]
yeticry has joined #ruby
ramfjord has joined #ruby
blackmesa has quit [Ping timeout: 276 seconds]
<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.
lelliott has joined #ruby
spiette has joined #ruby
rfoust has quit [Ping timeout: 276 seconds]
schneider has quit [Ping timeout: 240 seconds]
alfiemax has quit [Remote host closed the connection]
apeiros has joined #ruby
<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.
pd2000 has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
alfiemax has joined #ruby
<apeiros> Bish: since [] is an array and {} is a hash, that'll instantly return false
<apeiros> if you actually do have to huge hashes, then yes, if they're equal, all objects within it will be compared
Cavallari has quit [Quit: Cavallari]
<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
<apeiros> (and honestly, if you manage to fuck that up, you earn it if == returns wrong results)
<apeiros> *deserve
* phaul blushes :)
<apeiros> phaul: you managed that? :D
<phaul> I was hacking tho, well aware of what I was doing. I need to cheat the system in a challange
<apeiros> :-p ok
Cavallari has joined #ruby
<phaul> that's where I found that even the stdlib rdoc is not always aware of this
clemens3_ has quit [Remote host closed the connection]
fiachetti has joined #ruby
dr3w_ has quit [Read error: Connection reset by peer]
sanscoeur has quit [Remote host closed the connection]
cschneid_ has joined #ruby
synthroid has quit [Remote host closed the connection]
<Phrogz> :)
dr3w_ has joined #ruby
<phaul> or more precisely there is an implicit assumption that you don't hack ==, or statements in the documentation might not hold
alfiemax has quit [Remote host closed the connection]
<apeiros> hm, I actually found a case where the assumption breaks
<apeiros> or rather, remembered
memo1 has quit [Ping timeout: 265 seconds]
<apeiros> >> a = [Float::NAN]; a == a # note: `Float::NAN == Float::NAN` => false
<ruby[bot]> apeiros: # => true (https://eval.in/986472)
alfiemax has joined #ruby
<phaul> >> a = 1; def a.==(other) false; end; [a].include?(a)
<ruby[bot]> phaul: # => can't define singleton (TypeError) ...check link for more (https://eval.in/986473)
guille-moe has quit [Ping timeout: 264 seconds]
<phaul> >> a = 'x'; def a.==(other) false; end; [a].include?(a)
<ruby[bot]> phaul: # => true (https://eval.in/986474)
ellcs has joined #ruby
inerthia_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
s2013 has joined #ruby
cyberg has joined #ruby
guille-moe has joined #ruby
louvre06_ has quit [Quit: Leaving]
Strepsil_ has quit [Ping timeout: 240 seconds]
GodFather has joined #ruby
alfiemax has quit [Ping timeout: 256 seconds]
ogres has joined #ruby
ogres has quit [Client Quit]
safetypin has quit [Quit: ZZZzzz…]
<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)
<TomyWork> how do i translate a DateTime object to my local time zone?
justinmrkva has quit [Read error: Connection reset by peer]
justinmrkva_ has joined #ruby
justinmrkva_ is now known as justinmrkva
memo1 has joined #ruby
synthroid has joined #ruby
ams__ has joined #ruby
<TomyWork> or should i use Time instead?
<apeiros> TomyWork: datetime isn't timezone-aware.
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
<apeiros> >> require 'time'; Time.iso8601('2018-04-09T15:20:00Z').localtime.strftime("%F %T")
<ruby[bot]> apeiros: # => "2018-04-09 15:20:00" (https://eval.in/986477)
<apeiros> ah, well, that server is probably set to use utc
troys has joined #ruby
Danishman has joined #ruby
<TomyWork> oh, that's iso-8601?
<TomyWork> and well DateTime stores timezones :)
<TomyWork> but looks like it cant do very much with them
<TomyWork> alright this is looking good, gives me "2018-04-09 17:20:00"
<apeiros> oh, it now stores it at least? well, I guess that's a step?
<apeiros> rails has different tools btw.
KeyJoo has joined #ruby
ltt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mroutis has joined #ruby
safetypin has joined #ruby
tolerablyjake has joined #ruby
amatas has quit [Remote host closed the connection]
<TomyWork> it's a small sinatra script, not rails
ltt has joined #ruby
ellcs has quit [Ping timeout: 268 seconds]
ramfjord has joined #ruby
amatas has joined #ruby
cthulchu has joined #ruby
Asher has joined #ruby
Asher is now known as Guest65784
tomphp_ has joined #ruby
tomphp has quit [Ping timeout: 276 seconds]
dr3w_ has quit [Read error: Connection reset by peer]
Guest65784 has quit [Ping timeout: 264 seconds]
dr3w_ has joined #ruby
lelliott has quit [Remote host closed the connection]
cagomez has joined #ruby
cagomez has quit [Remote host closed the connection]
cam27 has joined #ruby
yohji has quit [Remote host closed the connection]
cagomez has joined #ruby
jcarl43 has joined #ruby
John_Ivan has quit [Ping timeout: 265 seconds]
<TomyWork> apeiros yay for good docs: it's actually "2018-04-09 15:55:58 UTC", not "2018-04-09T15:55:58Z"
<TomyWork> so i'm switching back to #parse
pastorinni has joined #ruby
amar has quit [Remote host closed the connection]
amar has joined #ruby
blackmesa has joined #ruby
alfiemax has joined #ruby
marxarelli|afk has quit [Quit: Textual IRC Client: www.textualapp.com]
marxarelli has joined #ruby
noobineer has joined #ruby
noobineer has quit [Remote host closed the connection]
ltt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
darkhanb has joined #ruby
ltt has joined #ruby
TomyWork has quit [Ping timeout: 240 seconds]
schneider has joined #ruby
noobineer has joined #ruby
vondruch has quit [Ping timeout: 240 seconds]
ltt has quit [Client Quit]
schneider has quit [Ping timeout: 240 seconds]
aufi has quit [Quit: Leaving]
erlend has quit [Ping timeout: 245 seconds]
stormpack has joined #ruby
erlend has joined #ruby
ramfjord has quit [Ping timeout: 245 seconds]
sepp2k has joined #ruby
jamesaxl has joined #ruby
guille-moe has quit [Ping timeout: 260 seconds]
ltt has joined #ruby
nowhereman_ has quit [Ping timeout: 256 seconds]
mikecmpb_ has quit [Quit: inabit. zz.]
alfiemax has quit [Remote host closed the connection]
Azure has quit [Read error: Connection reset by peer]
Azure has joined #ruby
n0m4d1c has joined #ruby
lelliott has joined #ruby
schneider has joined #ruby
blackmesa has quit [Quit: WeeChat 2.1]
karapetyan has quit [Remote host closed the connection]
cadillac_ has quit [Read error: Connection reset by peer]
n0m4d1c has quit [Read error: Connection reset by peer]
roshanavand has quit [Remote host closed the connection]
n0m4d1c has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cadillac_ has joined #ruby
stormpack_ has joined #ruby
TomyLobo has joined #ruby
stormpack_ has quit [Client Quit]
ghoti has quit [Remote host closed the connection]
sanscoeur has joined #ruby
Creatornator has joined #ruby
stormpack has quit [Ping timeout: 265 seconds]
safetypin has quit [Quit: ZZZzzz…]
s2013 has joined #ruby
ramfjord has joined #ruby
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ltt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ramfjord has quit [Ping timeout: 240 seconds]
Asher has joined #ruby
Yxhuvud has quit [Ping timeout: 255 seconds]
Beams has quit [Quit: .]
ramfjord has joined #ruby
schneider has quit [Ping timeout: 256 seconds]
amar has quit [Remote host closed the connection]
ramfjord has quit [Ping timeout: 260 seconds]
Creatornator has joined #ruby
amar has joined #ruby
ramfjord has joined #ruby
ltt has joined #ruby
amar has quit [Ping timeout: 260 seconds]
<sparr> Ruby 1.8, is attempting ''.to_sym the only way to trigger the "interning empty string" error?
nug has quit [Quit: ZNC - http://znc.in]
pd2000 has quit [Ping timeout: 265 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ltt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pd2000 has joined #ruby
schneider has joined #ruby
<apeiros> sparr: probably
<quuxman> how would I use rspec to test if a certain method is called, but eliminate the side effects of that call?
dviola has joined #ruby
<quuxman> I want to mock out the method and test that it was called
<havenwood> quuxman: use a mock?
Asher has quit [Ping timeout: 276 seconds]
andikr has quit [Remote host closed the connection]
tolerablyjake has joined #ruby
<havenwood> quuxman: Are you debating how to do the double or stub?
safetypin has joined #ruby
<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
<havenwood> I'm more familiar with Minitest mocks: https://gist.github.com/havenwood/84207afa092ce5d5a680
<quuxman> I have to use rspec for this
<havenwood> quuxman: This seems like a reasonable writeup: https://semaphoreci.com/community/tutorials/mocking-with-rspec-doubles-and-expectations
Asher has joined #ruby
<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
TomyLobo2 has joined #ruby
dr3w_ has joined #ruby
alfiemax has joined #ruby
TomyLobo has quit [Ping timeout: 276 seconds]
eckhardt has joined #ruby
t0rchy has joined #ruby
venmx has quit [Ping timeout: 255 seconds]
indiche has joined #ruby
<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) #?
t0rchh has quit [Ping timeout: 240 seconds]
<phaul> don't do that use let construct
<quuxman> what would that look like?
<phaul> let (:something) { double('blah') } ; it 'receives stuff' { expect something.to receive(:stuff) }
mikecmpbll has joined #ruby
<quuxman> but then how would the code being tested actually call the double? It uses the gobal reference
<phaul> ah, dependency injection :)
<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
<phaul> you could do something like that with the before and after hooks
karapetyan has joined #ruby
<quuxman> ah ok, thanks
k0mpa has quit [Ping timeout: 268 seconds]
<sparr> apeiros: thanks
duderonomy has joined #ruby
pd2000 has quit [Read error: Connection reset by peer]
amar has joined #ruby
<sparr> other than an explicit call to somestring.to_sym, what code might trigger an implicit string.to_sym?
Yxhuvud has joined #ruby
pd2000 has joined #ruby
duderonomy has quit [Client Quit]
rivalomega has quit [Remote host closed the connection]
mtkd has joined #ruby
suukim has quit [Quit: Konversation terminated!]
suutala_ has joined #ruby
rivalomega has joined #ruby
karapetyan has quit [Ping timeout: 260 seconds]
amar has quit [Remote host closed the connection]
amar has joined #ruby
s2013 has joined #ruby
dr3w__ has joined #ruby
troulouliou_div2 has joined #ruby
dr3w_ has quit [Ping timeout: 240 seconds]
rivalomega has quit [Ping timeout: 264 seconds]
memo1 has quit [Ping timeout: 260 seconds]
claudiuinberlin has joined #ruby
AgentVenom has quit [Quit: Textual IRC Client: www.textualapp.com]
drale2k_ has joined #ruby
rivalomega has joined #ruby
cam27 has quit [Quit: cam27]
<sparr> aha, there's also .intern ?
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #ruby
pd2000 has quit [Read error: Connection reset by peer]
despai has joined #ruby
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
pd2000 has joined #ruby
eckhardt has joined #ruby
Zaab1t has joined #ruby
Mike11 has joined #ruby
audy has joined #ruby
face has quit [Ping timeout: 240 seconds]
ramfjord has quit [Ping timeout: 245 seconds]
ramfjord has joined #ruby
face has joined #ruby
pd2000 has quit [Read error: Connection reset by peer]
pd2000 has joined #ruby
karapetyan has joined #ruby
ghoti has joined #ruby
pd2000 has quit [Max SendQ exceeded]
pd2000 has joined #ruby
pd2000 has quit [Max SendQ exceeded]
kapil___ has quit [Quit: Connection closed for inactivity]
pd2000 has joined #ruby
ramfjord has quit [Ping timeout: 255 seconds]
sameerynho has joined #ruby
ramfjord has joined #ruby
schneider has quit [Ping timeout: 245 seconds]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sauvin has quit [Read error: Connection reset by peer]
lelliott has quit [Remote host closed the connection]
Eiam has joined #ruby
<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
<Eiam> I want to know how long the original array is
alfiemax has quit [Remote host closed the connection]
<Eiam> and I don't want to store it in a value outside of the block
workmad3 has quit [Ping timeout: 255 seconds]
<phaul> you can hack it in the accumulator I guess, but it's ugly. why not store it in a variable?
<baweaver> Eiam: what exactly are you trying to do?
<baweaver> Because this sounds like a very specific solution you're seeking where a more general solution could be better
<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 /
<Eiam> but I don't want a trailing / or empty //
<Eiam> oh
<baweaver> join
<Eiam> join leaves a /
alfiemax has joined #ruby
<baweaver> join and sub/strip
<Eiam> ["a","b",""].join("/") ==> "a/b/"
<Eiam> middle missing gives "a//c"
<baweaver> >> ["a","b",""].join('/').rstrip('/')
<ruby[bot]> baweaver: # => wrong number of arguments (given 1, expected 0) (ArgumentError) ...check link for more (https://eval.in/986596)
<baweaver> Ah
<Eiam> guess i can remove the mfirst
<phaul> join in the reduce, but don't join if empty
<baweaver> >> ['a', '', 'c'].reject(&:empty?).join('/')
<ruby[bot]> baweaver: # => "a/c" (https://eval.in/986597)
<baweaver> Using reduce here isn't necessary and would make the solution far more complicated than it needs to be
<phaul> or that :)
<Eiam> meh, stupid nils
schneider has joined #ruby
erlend has quit [Ping timeout: 240 seconds]
<Eiam> wish we could conditionalize the (&:thing) without splitting it out
<baweaver> >> ['a', '', nil, 'c'].reject { |v| v.nil? || v.empty? }.join('/')
<ruby[bot]> baweaver: # => "a/c" (https://eval.in/986598)
<Eiam> .reject(&:empty? && &:nil?)
<quuxman> phaul: and add an after call too. Could I make the before run only before one "context" block in the test file?
<baweaver> technically you could compose them, but that's making things more complicated as well.
<baweaver> If you're in Rails land there's blank
<Eiam> yeah no rails. sort of drives me nuts that core ruby doesn't have .blank
<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
<Eiam> baweaver thanks. been a long time since I've written any code my brain is rusty
erlend has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
rivalomega has quit [Remote host closed the connection]
<phaul> Eiam: you didn't spec what happens with ['a', 'b/'] or is that not a valid input?
<Eiam> phaul:its not valid. its from an input CSV so each column is "a", "B"
<Eiam> but not each column has a value
mikecmpbll has quit [Quit: inabit. zz.]
pd2000 has quit [Quit: Leaving]
Axy has joined #ruby
alfiemax has quit [Ping timeout: 268 seconds]
Mia has quit [Ping timeout: 260 seconds]
John_Ivan has joined #ruby
venmx has joined #ruby
kapil___ has joined #ruby
schneider has joined #ruby
nielsk has quit [Ping timeout: 256 seconds]
suutala_ has quit [Quit: Konversation terminated!]
<baweaver> >> OR = -> *fns { -> o { fns.any? { |fn| fn[o] }}}; blank = OR[:nil?.to_proc, :empty?.to_proc]; ['a', '', nil, 'c'].reject(&blank) # Eiam :D
<ruby[bot]> baweaver: # => ["a", "c"] (https://eval.in/986612)
jrm has quit [Ping timeout: 265 seconds]
<baweaver> Hrm
<baweaver> If I gemified something like that, would it be of interest?
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<baweaver> I'd trim down the API quite a bit though
<Eiam> baweaver: loll
<Eiam> thats just cruel
<baweaver> Something.method_or(:nil?, :empty?) # Names are hard, I'll come up with one later
ruby-lang110 has joined #ruby
ruby-lang110 has quit [Client Quit]
schneider has quit [Ping timeout: 265 seconds]
<baweaver> May well refactor Izzy for it as it came close to that API already
<baweaver> ['a', '', nil, 'c'].reject(Izzy.or[:nil?, :empty?])
nielsk has joined #ruby
duderonomy has joined #ruby
<Eiam> its kind of like the blackhole stuff from avdi
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
<baweaver> M and Q are fun
<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
trautwein has joined #ruby
trautwein has quit [Client Quit]
trautwein has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<baweaver> Yeah, shoot, this sounds fun. Time to refactor Izzy to have more FP powers! :D
<baweaver> Will report back some time later tonight after my mad hackery
FastJack has quit [Ping timeout: 265 seconds]
mtkd has quit []
mtkd has joined #ruby
TinkerT has quit [Read error: Connection reset by peer]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
cagomez has quit [Remote host closed the connection]
eckhardt has quit [Ping timeout: 260 seconds]
s2013 has joined #ruby
FastJack has joined #ruby
<Phrogz> :)
jrm has joined #ruby
cagomez has joined #ruby
pastorinni has quit [Ping timeout: 240 seconds]
TinkerT has joined #ruby
tolerablyjake has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
despai has quit [Quit: ...]
trautwein has joined #ruby
eckhardt has joined #ruby
duderonomy has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
amatas has quit [Quit: amatas]
ramfjord has quit [Ping timeout: 260 seconds]
cagomez has quit [Ping timeout: 264 seconds]
despai has joined #ruby
rivalomega has joined #ruby
ramfjord has joined #ruby
duderonomy has quit [Client Quit]
despai has quit [Client Quit]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ramfjord has quit [Ping timeout: 240 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mtkd has quit []
amar has quit [Remote host closed the connection]
pragmatism has joined #ruby
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
trautwein has joined #ruby
SeepingN has joined #ruby
SeepingN has quit [Client Quit]
ramfjord has joined #ruby
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
trautwein has joined #ruby
bmurt has joined #ruby
trautwein has quit [Client Quit]
trautwein has joined #ruby
SeepingN has joined #ruby
shwouchk_ has quit [Quit: Connection closed for inactivity]
zapata_ has quit [Ping timeout: 256 seconds]
venmx has quit [Remote host closed the connection]
trautwein_ has joined #ruby
mtkd has joined #ruby
zapata_ has joined #ruby
trautwein_ has quit [Client Quit]
trautwein has quit [Client Quit]
trautwein has joined #ruby
mroutis has quit [Ping timeout: 256 seconds]
schneider has joined #ruby
cr3 has joined #ruby
imode has joined #ruby
<cr3> how can I instantiate a class inside a module that was defined in that module: module Foo; class Bar; end; BAR = Bar(); end
jecht has joined #ruby
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has joined #ruby
<audy> cr3: Foo::Bar()
schneider has quit [Ping timeout: 260 seconds]
<audy> ooh.. misread your q
Creatornator has joined #ruby
<Phrogz> >> module Foo; class Bar; end; BAR = Bar.new; end; Foo::BAR.class
<ruby[bot]> Phrogz: # => Foo::Bar (https://eval.in/986621)
<cr3> audy: by the way, I actually have Bar.new() and the error is pointing right after '=' with: syntax error, unexpected ':'
<Phrogz> cr3: Same as any other class instantiation, as long as you get the constant resolution correct to refer to it.
<Phrogz> cr3: As seen above, works for the bot.
<Phrogz> Maybe you should gist your actual code (as a simplified test case).
<cr3> Phrogz: thanks, the problem must be elsewhere. I'll have a closer look :(
ledestin has joined #ruby
nikivi has joined #ruby
cagomez has quit [Ping timeout: 276 seconds]
minimalism has joined #ruby
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
indiche has quit [Read error: Connection reset by peer]
indiche has joined #ruby
safetypin has quit [Quit: ZZZzzz…]
memo1 has joined #ruby
gix has quit [Ping timeout: 256 seconds]
TomyLobo2 has quit [Read error: Connection reset by peer]
halbbalda has quit [Ping timeout: 256 seconds]
TomyLobo2 has joined #ruby
halbbalda has joined #ruby
klaas has quit [Read error: Connection reset by peer]
TomyLobo3 has joined #ruby
shtirlic has quit [Ping timeout: 264 seconds]
claw has quit [Remote host closed the connection]
gix has joined #ruby
safetypin has joined #ruby
harrycs has joined #ruby
cagomez has joined #ruby
jinie has quit [Ping timeout: 264 seconds]
shtirlic has joined #ruby
Skarlso has quit [Ping timeout: 256 seconds]
sepp2k has quit [Read error: Connection reset by peer]
Burgestrand has joined #ruby
claw has joined #ruby
matled has quit [Remote host closed the connection]
sepp2k has joined #ruby
jinie has joined #ruby
TomyLobo2 has quit [Ping timeout: 255 seconds]
ledestin has quit [Quit: Textual IRC Client: www.textualapp.com]
TomyLobo has joined #ruby
Cybergeek has quit [Max SendQ exceeded]
ruby[bot] has quit [Ping timeout: 256 seconds]
Skarlso has joined #ruby
TomyLobo3 has quit [Ping timeout: 256 seconds]
gremax has quit [Ping timeout: 256 seconds]
Cybergeek has joined #ruby
mkaito has quit [Quit: ZNC - http://znc.in]
cagomez has quit [Ping timeout: 265 seconds]
nikivi has quit [Quit: ZNC 1.6.6 - http://znc.in]
TomyLobo has quit [Ping timeout: 256 seconds]
gremax has joined #ruby
hanmac has joined #ruby
matled has joined #ruby
schneider has joined #ruby
ramfjord has quit [Quit: Lost terminal]
orbyt_ has joined #ruby
s2013 has joined #ruby
Puffball has quit [Remote host closed the connection]
dr3w_ has joined #ruby
dr3w_ has quit [Client Quit]
schneider has quit [Ping timeout: 240 seconds]
bmurt has quit [Ping timeout: 268 seconds]
eckhardt has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
eckhardt_ has joined #ruby
cagomez has joined #ruby
eckhardt has quit [Ping timeout: 256 seconds]
superscott has joined #ruby
Zaab1t has quit [Quit: Zaab1t]
Burgestrand has quit [Quit: Closing time!]
dr3w_ has joined #ruby
troulouliou_div2 has quit [Ping timeout: 240 seconds]
Mike11 has quit [Quit: Leaving.]
despai has joined #ruby
jud has quit [Ping timeout: 256 seconds]
Burgestrand has joined #ruby
indiche has quit [Ping timeout: 260 seconds]
bmurt has joined #ruby
Burgestrand has quit [Client Quit]
mroutis has joined #ruby
n008f4g_ has joined #ruby
Burgestrand has joined #ruby
workmad3 has joined #ruby
ams__ has quit [Quit: Connection closed for inactivity]
_aeris_ has quit [Ping timeout: 268 seconds]
duderonomy has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
duderonomy has quit [Client Quit]
workmad3 has quit [Ping timeout: 240 seconds]
_aeris_ has joined #ruby
Psybur has quit [Ping timeout: 265 seconds]
jecht has quit [Quit: leaving the building]
mroutis has quit [Ping timeout: 256 seconds]
mroutis has joined #ruby
erlend has quit [Ping timeout: 276 seconds]
pastorinni has joined #ruby
erlend has joined #ruby
harrycs has quit [Ping timeout: 264 seconds]
ryzokuken has quit [Remote host closed the connection]
jeffreylevesque has quit [Ping timeout: 264 seconds]
troulouliou_div2 has joined #ruby
troulouliou_div2 has quit [Remote host closed the connection]
n0m4d1c has quit [Remote host closed the connection]
sammi`_ has quit [Quit: Lost terminal]
synthroid has quit []
kapil___ has quit [Quit: Connection closed for inactivity]
sammi` has joined #ruby
Sammichmaker has quit [Read error: Connection reset by peer]
mkaito has joined #ruby
mkaito has quit [Changing host]
mkaito has joined #ruby
troulouliou_div2 has joined #ruby
zautomata1 has quit [Quit: WeeChat 1.9.1]
tomphp_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zautomata has joined #ruby
zautomata has quit [Changing host]
zautomata has joined #ruby
nowhereman_ has joined #ruby
Sammichmaker has joined #ruby
Sammichmaker has joined #ruby
Sammichmaker has quit [Changing host]
skweek has quit [Read error: Connection reset by peer]
pastorinni has quit []
cyberg has quit [Ping timeout: 240 seconds]
jcalla has quit [Quit: Leaving]
ur5us has joined #ruby
pilne has joined #ruby
cyberg has joined #ruby
quobo has joined #ruby
tomphp has joined #ruby
dviola has quit [Quit: WeeChat 2.1]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ldnunes has quit [Quit: Leaving]
reber has quit [Remote host closed the connection]
Cavallari has quit [Quit: Cavallari]
safetypin has quit [Quit: ZZZzzz…]
superscott has quit []
clemens3 has joined #ruby
memo1 has quit [Ping timeout: 264 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hinbody has joined #ruby
Danishman has quit [Quit: KVIrc 4.9.3 Aria http://www.kvirc.net/]
Azure has quit [Read error: Connection reset by peer]
Azure has joined #ruby
chouhoulis has joined #ruby
memo1 has joined #ruby
Burgestrand has quit [Quit: Closing time!]
<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
chouhoul_ has quit [Ping timeout: 240 seconds]
<phaul> have you seen my gist why that upsets RSpec soubles?
<phaul> *doubles ^
mtkd has quit []
tcopeland has quit [Quit: tcopeland]
<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
<quuxman> I imagine it would when running the full test sweet
<quuxman> *suite
<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.
<phaul> I tried to demonstrate what not to do, and why
<quuxman> ah ok, so I should just forget about before and after, and do it for every test case
<quuxman> there are only 2 anyway
<phaul> there is before(:each), after(:each) that you should use for this.
<quuxman> but I don't want to do that, because there a _lot_ of tests in this describe block
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
<phaul> But setting up a mock is really cheap. and you don't really have a choice, you can reuse a mock
<phaul> *can't
<phaul> sigh, my typing is really bad sorry
<phaul> you cannot reuse the mock across examples
<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
Burgestrand has joined #ruby
<phaul> is there a sensible context block you can use for those 2 tests?
<phaul> put them in a context and do the before(:each) inside that context
<quuxman> aaah you can do that. Cool
<phaul> oh, yeah you can arbitrarily nest describes, and contexts
<quuxman> That's pretty nice how you can just add blocks that are basically comments (I'm pretty much completely new to Ruby)
<quuxman> but are also blocks and can contain things like before and after
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
<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.
<phaul> actually expect are only in it examples of course
<phaul> *holds your hand^
jeffreylevesque has joined #ruby
Creatornator has joined #ruby
cr3 has quit [Quit: leaving]
Cork has quit [Quit: .]
mooe has joined #ruby
n0m4d1c has joined #ruby
ElFerna has joined #ruby
Cork has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
John_Ivan has quit [Read error: Connection reset by peer]
guacamole has joined #ruby
guacamole has quit [Changing host]
guacamole has joined #ruby
plexigras has quit [Quit: WeeChat 2.0.1]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
\void has quit [Quit: So long, and thanks for all the fish.]
phaul has quit [Ping timeout: 256 seconds]
orbyt_ has joined #ruby
jamesaxl has quit [Quit: WeeChat 2.1]
zapata_ is now known as zapata
rivalomega has quit [Remote host closed the connection]
workmad3 has joined #ruby
rivalomega has joined #ruby
Creatornator has joined #ruby
workmad3 has quit [Ping timeout: 256 seconds]
rivalomega has quit [Remote host closed the connection]
rivalomega has joined #ruby
ur5us has quit [Read error: No route to host]
ur5us has joined #ruby
adjustingmaitai has quit [Read error: Connection reset by peer]
venmx has joined #ruby
tcopeland has joined #ruby
cadillac_ has quit [Ping timeout: 260 seconds]
cadillac_ has joined #ruby
ElFerna has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ElFerna has joined #ruby
ElFerna has quit [Client Quit]
troulouliou_div2 has quit [Remote host closed the connection]
mikecmpbll has joined #ruby
cschneid_ has quit [Remote host closed the connection]
duderonomy has joined #ruby
cschneid_ has joined #ruby
netherwolfe has quit [Ping timeout: 240 seconds]
graft has joined #ruby
eckhardt_ has quit [Quit: Textual IRC Client: www.textualapp.com]
cschnei__ has joined #ruby
s3nd1v0g1us has joined #ruby
s3nd1v0g1us has quit [Max SendQ exceeded]
duderonomy has quit [Client Quit]
cschneid_ has quit [Ping timeout: 265 seconds]
erlend has quit [Ping timeout: 245 seconds]
cschnei__ has quit [Ping timeout: 265 seconds]
erlend has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cadillac_ has joined #ruby
orbyt_ has joined #ruby
cadillac_ has quit [Ping timeout: 260 seconds]
cadillac_ has joined #ruby
yukai has joined #ruby
orbyt_ has quit [Client Quit]
ammar_ has quit [Ping timeout: 268 seconds]
marxarelli is now known as marxarelli|afk
Burgestrand has quit [Quit: Closing time!]
lelliott has joined #ruby
shinnya has joined #ruby
venmx has quit [Ping timeout: 240 seconds]
rwb has joined #ruby
n0m4d1c has quit [Remote host closed the connection]
rivalomega has quit [Remote host closed the connection]
n0m4d1c has joined #ruby
n008f4g_ has quit [Ping timeout: 256 seconds]
rivalomega has joined #ruby
minimalism has quit [Ping timeout: 276 seconds]
rivalome_ has joined #ruby
duderonomy has joined #ruby
lelliott has quit [Ping timeout: 240 seconds]
memo1 has quit [Ping timeout: 265 seconds]
rivalomega has quit [Ping timeout: 260 seconds]
rivalomega has joined #ruby
rivalome_ has quit [Ping timeout: 260 seconds]
minimalism has joined #ruby
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
n0m4d1c_ has joined #ruby
n0m4d1c_ has quit [Remote host closed the connection]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
minimalism has quit [Ping timeout: 256 seconds]
Yxhuvud has joined #ruby
n0m4d1c has quit [Ping timeout: 260 seconds]
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]