<o0x1eef>
That usually opens the singleton class of a Class or Module. The instance methods that follow become singleton methods. In other words it is another way to define class methods. :)
markong has joined #ruby
schne1der has quit [Ping timeout: 276 seconds]
<rapha>
oh damn, that's COOL! thank you for explaining :)
<o0x1eef>
Not gonna lie I usually avoid it because it adds an extra layer of indentation compared to 'def self.foo'
<havenwood>
rapha: Another way to think of the sugar, is you can do `obj = Object.new` then `def obj.meaning = 42` or `class << obj` then `def meaning = 42` and `end` and it's the same thing.
<havenwood>
Or `obj.singleton_class.class_eval { def meaning = 42 }` if you prefer, but you mostly see the former two in actual uses where `self` is the class name and you get either `def self.thing` or `class << self` and `def thing`.
jmcantrell has joined #ruby
<The_Camel>
counters in chinese are killing me.
<The_Camel>
"This man is wearing one hat" becomes "This man one is wearing hat."
<The_Camel>
that "man one" doesn't refer to "one man". the "one" is part of the "wearing hat"
<The_Camel>
e.g "one hat"
<The_Camel>
"This man (one is wearing) hat."
<The_Camel>
And they claim chinese is a SVO language. I call bullshit. There's a lot of constructs that behave SOV.
<The_Camel>
Siiiiiiiiggggggh...... Fuck.
<The_Camel>
Technically speaking, if there was a は in chinese, it'd make the most sense, which would show that SVO is utter nonsense.
<The_Camel>
seems the japanese added the "unspoken" rule to grammar
<The_Camel>
"This one man は one wearing, is hat."
<The_Camel>
would make A LOT MORE sense.
<The_Camel>
e.g the REAL chinese, instead of looking like this:
<The_Camel>
这个男人戴着帽子。
<The_Camel>
would benefit a lot if it looked like this:
<The_Camel>
这个男人は戴着帽子。
<The_Camel>
:P
<The_Camel>
The lack of は in chinese seriously messes with my head.
<The_Camel>
+1 for the japanese for coming up with it.
<The_Camel>
===========
markong has quit [Ping timeout: 276 seconds]
<The_Camel>
"To wear" also changes depending on what is worn.
<The_Camel>
shoes? 穿着. hat? 戴着. shirt? i forgot.
blacknova has quit [Quit: Connection closed for inactivity]
pastelowl has joined #ruby
fantazo has joined #ruby
jmcantrell has quit [Ping timeout: 248 seconds]
user71 has quit [Quit: Leaving]
fantazo has quit [Quit: Lost terminal]
infinityfye has quit [Read error: Connection reset by peer]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
Linux_Kerio has quit [Ping timeout: 244 seconds]
markong has joined #ruby
jmcantrell has joined #ruby
<o0x1eef>
TIL the Python 'for' statement can have an else clause that is entered when the for loop does not exit early via break. Weird :D