Please take a look at some exemplary code first.
class MailTruck
instance_eval <<-EOS
define_method(:hello1) {puts "hello1"}
EOS
define_method(:hello2) {puts "hello2"}
instance_eval <<-EOS
def hello3
puts "hello3"
end
EOS
def hello4
puts "hello4"
end
end
hello1 and hello2 are instance methods.
hello3 is a class method.
hello4 is a instance method.
Why hello1 and hello2 are same, but hello3 and hello4 are different?
It seems a little inconsistent . Somebody can give a clear explanation?
Thanks in advance.
uncutstone
--
Posted via http://www.ruby-forum.com/.