I love how in Ruby doing class DoesStuffService def call(x, y) # ... end end is good design but if you do def do_stuff(x, y) end you're a monster
-
-
Replying to @sgrif
Problem with second one is that it's adding the function to Object's instance_methods. So monkey patching + no namespacing. It's good for scripts, but iffy for apps and shouldn't be done in a lib. The first one actually has this problem, too, but it's added to Object's constants.
2 replies 0 retweets 1 like -
Replying to @josh_cheek
Miss Dada 🏳️⚧️ Retweeted Miss Dada 🏳️⚧️
https://twitter.com/sgrif/status/1089978068767145984 … Granted, access patterns are different too. `def foo; end` makes `http://x.foo ` work for any `x`, `class Foo; end` doesn't make `X::Foo` for any module (in recent versions of Ruby, it did until ~2.3 I think)
Miss Dada 🏳️⚧️ added,
1 reply 0 retweets 1 like -
Replying to @sgrif
lol, we're on the same page ^_^ Also, you're right about that behaviour changing:pic.twitter.com/JW2rd4vph1
1 reply 0 retweets 0 likes -
Replying to @josh_cheek @sgrif
Guess I could have just done `ruby -e 'p IO::IO'`
1 reply 0 retweets 0 likes
:trollface: def ioception self::IO.send(:ioception) rescue NameError => e self end IO.send(:ioception)
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.