L
LAMBEAU Bernard
Could someone explain why the following code does not work?
... and sorry because I guess it's something stupid that I didn't catch in Ruby.
a = Object.new.instance_eval do
@names = ["you", "me"]
end
def a.say_hello
puts "Hello: " << @names.inspect
end
a.say_hello
the code prints Hello: nil
thx
blambeau
... and sorry because I guess it's something stupid that I didn't catch in Ruby.
a = Object.new.instance_eval do
@names = ["you", "me"]
end
def a.say_hello
puts "Hello: " << @names.inspect
end
a.say_hello
the code prints Hello: nil
thx
blambeau