laaron has quit [Remote host closed the connection]
mikecmpbll has quit [Quit: inabit. zz.]
laaron has joined #ruby
venmx has quit [Ping timeout: 272 seconds]
clemens3 has joined #ruby
tdy3 has joined #ruby
tdy3 has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
elphe has joined #ruby
uplime has quit [Ping timeout: 272 seconds]
szulak_ has joined #ruby
al2o3-cr has quit [Ping timeout: 246 seconds]
venmx has joined #ruby
al2o3-cr has joined #ruby
marz_d`ghostman has quit [Quit: Page closed]
al2o3-cr has quit [Ping timeout: 246 seconds]
al2o3-cr has joined #ruby
cd has quit [Quit: cd]
venmx has quit [Ping timeout: 250 seconds]
dellavg_ has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
esrse has quit [Ping timeout: 245 seconds]
Inline has quit [Quit: Leaving]
sonofentropy has quit [Quit: sonofentropy]
al2o3-cr has quit [Read error: Connection reset by peer]
AJA4350 has joined #ruby
al2o3-cr has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
conta has quit [Remote host closed the connection]
Nicmavr has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
elphe has quit [Ping timeout: 250 seconds]
kapil____ has joined #ruby
_whitelogger has joined #ruby
donofrio has quit [Remote host closed the connection]
lightstalker has quit [Ping timeout: 246 seconds]
elphe has joined #ruby
Inline has joined #ruby
laaron has quit [Remote host closed the connection]
laaron- has joined #ruby
uplime has joined #ruby
vonfry has quit [Quit: WeeChat 2.3]
uplime has quit [Ping timeout: 272 seconds]
m0w has joined #ruby
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
venmx has joined #ruby
cschneid has joined #ruby
sonofentropy has joined #ruby
uplime has joined #ruby
uplime has quit [Ping timeout: 246 seconds]
mostlybadfly has joined #ruby
tdy3 has joined #ruby
tdy3 has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
cschneid has quit [Ping timeout: 240 seconds]
laaron- has quit [Remote host closed the connection]
laaron has joined #ruby
ellcs has joined #ruby
ellcs has quit [Ping timeout: 252 seconds]
Guest44017 has quit [Ping timeout: 252 seconds]
uplime has joined #ruby
troulouliou_div2 has joined #ruby
varesa has quit [Ping timeout: 272 seconds]
ellcs has joined #ruby
venmx has quit [Ping timeout: 268 seconds]
varesa has joined #ruby
Mike11 has joined #ruby
bmurt has joined #ruby
masterasia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has quit [Client Quit]
masterasia has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
masterasia has quit [Client Quit]
szulak_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
polishdub has joined #ruby
cschneid has joined #ruby
sonofentropy has quit [Quit: sonofentropy]
sonofentropy has joined #ruby
eldritch has quit [Ping timeout: 245 seconds]
r3dc0d3r has quit [Ping timeout: 245 seconds]
leonthemisfit has quit [Ping timeout: 245 seconds]
neuraload has joined #ruby
r3dc0d3r has joined #ruby
donofrio has joined #ruby
szulak_ has joined #ruby
laaron has quit [Remote host closed the connection]
eldritch has joined #ruby
eldritch has quit [Max SendQ exceeded]
leonthemisfit has joined #ruby
gix has joined #ruby
eldritch has joined #ruby
eldritch has quit [Max SendQ exceeded]
laaron has joined #ruby
ellcs has quit [Ping timeout: 268 seconds]
donofrio has quit [Ping timeout: 268 seconds]
eldritch has joined #ruby
donofrio has joined #ruby
masterasia has joined #ruby
cschneid has quit [Ping timeout: 244 seconds]
donofrio has quit [Ping timeout: 245 seconds]
szulak_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rapture has joined #ruby
ellcs has joined #ruby
donofrio has joined #ruby
szulak_ has joined #ruby
donofrio has quit [Ping timeout: 246 seconds]
supergeek has joined #ruby
ellcs has quit [Ping timeout: 268 seconds]
<mspo>
so I asked this already but didn't understand the answer. Is there a way to explicitly a method without arguments? like foo() but with foo(nil) or similar
<phaul>
you mean explicitly call a method? yes parens force the parser to take it as a method name even if a local var exist with the same name
<phaul>
foo(nil) is different though, that pases 1 argument with value nil
<marz_d`ghostman>
phaul: Ah, thanks. Also, how do I access instance methods inside at_exit blocks? I placed an at_exit block that I would like to email me if $ERROR_INFO
<phaul>
baweaver: oh you mean if one wants left associative parens then they should explicitly do that. That makes sense, i was confused I thought you added some more trickery to force order.
<baweaver>
Nope, not without hacking the everloving heck out of the parser :P
ellcs has quit [Ping timeout: 252 seconds]
<baweaver>
I feel like at_exit should not be used in a module, but as a supervisor
armyriad has joined #ruby
<baweaver>
I doubt it works as an instance method even if included.
ellcs has joined #ruby
<marz_d`ghostman>
baweaver: What do you mean as a supervisor?
<rubydoc>
# => #<Proc:0x00005612ec70e090@-e:2> ...check link for more (https://carc.in/#/r/5v54)
<phaul>
I'm not sure what I've done :)
<phaul>
ah, nm I'm tired Im not even calling f..
venmx has joined #ruby
<phaul>
marz_d`ghostman: send_mail is an instance method of notification. you I think use it as a class method, but I'm not sure what self is in at_exit. Does it work if you extend instead of include?
sarink has joined #ruby
<phaul>
&>> at_exit { puts self }
<rubydoc>
# => #<Proc:0x000055fac510cc80@-e:2> ...check link for more (https://carc.in/#/r/5v55)
<phaul>
&>> at_exit { puts self }; class X; exit; end
<phaul>
so it seems, that self is what self was at the definition of the block. Doesn't matter where it exits. So just try extend.
donofrio has joined #ruby
elphe has quit [Ping timeout: 246 seconds]
za1b1tsu_ has joined #ruby
tdy3 has joined #ruby
hutch has joined #ruby
<marz_d`ghostman>
phaul: It gets triggered via Manager.new.run though hence I'm inlcuding it to make it available as an intance method rather than a class metho
<marz_d`ghostman>
phaul: thanks for the recommendation, I'll double check.
za1b1tsu has quit [Ping timeout: 268 seconds]
sgen_ has joined #ruby
<phaul>
&>> class X; at_exit { puts self }; end; 'is it main, or is it X?'
kapil____ has quit [Quit: Connection closed for inactivity]
mikecmpbll has joined #ruby
cschneid has joined #ruby
SeepingN has joined #ruby
za1b1tsu has quit [Remote host closed the connection]
<cthu|>
how do I properly check if a["b"]["c"] exists?
cschneid has quit [Ping timeout: 272 seconds]
<cthu|>
oh, we can do if "b" in a
<cthu|>
even better, hash.key?(some_key)
orbyt_ has joined #ruby
ellcs has quit [Ping timeout: 260 seconds]
comet23 has joined #ruby
cuthbert has quit [Ping timeout: 246 seconds]
polishdub has quit [Quit: leaving]
donofrio has quit [Ping timeout: 245 seconds]
Mike11 has joined #ruby
<bathtub_shark>
cthu|: a[:b].nil? will also work
tdy has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
tdy has joined #ruby
<phaul>
bathtub_shark: careful. :b is a symbol. cthu| used string keys. Also one can store nil? in a hash, which then fails to make a distinction between it's there but nil or it's not there at all
<bathtub_shark>
phaul: the latter is a fair point
<bathtub_shark>
i mean, the former is too, but the latter is something i forgot to consider
moei has quit [Quit: Leaving...]
* bathtub_shark
maybe has some minor refactoring to do.
tiff has joined #ruby
hiroaki has quit [Ping timeout: 246 seconds]
quipa_ has quit [Remote host closed the connection]
quipa_ has joined #ruby
GodFather has quit [Ping timeout: 250 seconds]
jottr has quit [Ping timeout: 244 seconds]
quipa_ has quit [Max SendQ exceeded]
quipa_ has joined #ruby
<cthu|>
thanks
<cthu|>
another question
<cthu|>
I know that overriding existing functions in existing classes is bad
<cthu|>
what about adding new functions to existing classes?
<cthu|>
like self.color(string, color) in String
<cthu|>
so that I could do something like puts("This test has failed".color("red"))
<phaul>
inheritance in itself in most cases is bad. But we can include, refine, prepend
<phaul>
Also inheritance is only bad because it enforces that what you create is obeying every contract that the thing obeyed you inherited from. If that's fine then inheritance is fine. But 99.9% of cases ppl yust break contracts. and that's why its mostly bad
<cthu|>
what do you mean by contracts?
<phaul>
contracts here means the external interface (public methods) to something plus their promise on their behaviour.
<phaul>
I give you an example.
<phaul>
(JimW's example) Rake::FileList used to inherit Array. That means that a filelist is in every respect an Array. Yes, from one angle it can be indexed, FileLists concatenated etc. But is it really an Array? Can it do #transpose ? Can it store arbitrary types? etc.
<cthu|>
oh so there's no match?
<cthu|>
if it extends array, it must obey
<cthu|>
I don't even know how you can extend a class in a way that doesn't imply implementation of all public methods of the superclass
<cthu|>
unless you override them
<cthu|>
can you?
<phaul>
by extending you mean inheritance?
<cthu|>
yes
<cthu|>
I mean I haven't tried extending of anything in Ruby yet, but I did a lot of it in Java
<cthu|>
but Java has a lot more strict OOP structure.
<phaul>
If you don't do anything the subclass inherits methods from the super class. the method lookup just walks up the inheritance chain until it finds a class that implements it
<phaul>
even ruby core at the very inner core breaks contracts sometimes...
<phaul>
Module is a superclass of Class. yet try to include a class somewhere ..
<phaul>
(including is somehting that works for Modules but not for Classes)
m0w has joined #ruby
<phaul>
&>> class X; end; class Y; include X; end;
<rubydoc>
# => wrong argument type Class (expected Module) (TypeError) (https://carc.in/#/r/5v7n)
<phaul>
so that's a breakage of Liskov substitution in a way
reber has quit [Remote host closed the connection]
elphe has joined #ruby
cschneid has joined #ruby
Mike11 has quit [Quit: Leaving.]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]