I have two questions:
f_1
belong to the metaclass anonymous class?f_2
belong to the anonymous class?related to the following code:
car = "car"
class << car
def self.f_1
puts "f_1"
end
def f_2
puts "f_2"
end
end
Well, terminology is frangible, but FWIW I would say your class wasn't really an anonymous class. As for belonging, both of these methods only exist in the car object.
I'll be honest and admit that I'm a little vague about the difference between a class method and an instance method when the class is defined against an individual object like this -- I would guess that if there is any difference, it will be an obscure one that will make your code much harder to read ;)
Update: You might find this helpful, if you've not seen it before. (Personally, it makes my head hurt, but everyone's different...)