def in a class definition (where self is the class) creates an instance
method.
class Class1
def method1
end
end
Class1.new.method1
but if instance evaled on Class1, creates a singleton method.
Class1.instance_eval do
def method2
end
end
should there perhaps be an exception for classes (for non classes a
singleton method is the only option), where an unqualified def would
create an instance method, same as in class definition?
···
--
Posted via http://www.ruby-forum.com/.