Here is the foo class
class Foo def initialize(&block) instance_eval(&block) if block end def bar(hash) @bar = hash end end
why is this syntax error
foo = Foo.new do bar {:param1=>'value1', :param2=>"value2"} end
The syntax error that gives me this is SyntaxError: unexpected ',', expecting '}' bar {:param1=>'value1',:param2=>'value2'}
What is the correct way to use the hash inside instance_eval, as in the example above. I really need to pass the hash to the method inside instance_eval
source share