invoking proc with instance_eval with arguments
- by dorelal
I know this works
proc = Proc.new do
puts self.hi + ' world'
end
class Usa
def hi
"Hello!"
end
end
Usa.new.instance_eval &proc
However I want to pass arguments to proc. So I tried this which does not work. Can anyone help me make following work.
proc = Proc.new do |greeting|
puts self.hi + gretting
end
class Usa
def hi
"Hello!"
end
end
Usa.new.instance_eval &proc, 'world' # does not work
Usa.new.instance_eval &proc('world') # does not work