N
Nicolas Rassat
Hi
I'm doing some gnome/ruby stuff and I wonder how instance method's
argument like {:a => "a", :b => "b"} can be used. Such argument are
used, for example, in Gnome::CanvasLine.new and seems to set instance
variables.
I didn't succeed to use such hash argument. The only way I got is by
using {a => "a", b => "b"} with a code like
Class Foo
def set(hash)
hash.each {|k,v| self.instance_variable_set(k,v)}
end
end
Can you explain me how {:a => "a", :b => "b"} should be handled?
Thanks
Nico
I'm doing some gnome/ruby stuff and I wonder how instance method's
argument like {:a => "a", :b => "b"} can be used. Such argument are
used, for example, in Gnome::CanvasLine.new and seems to set instance
variables.
I didn't succeed to use such hash argument. The only way I got is by
using {a => "a", b => "b"} with a code like
Class Foo
def set(hash)
hash.each {|k,v| self.instance_variable_set(k,v)}
end
end
Can you explain me how {:a => "a", :b => "b"} should be handled?
Thanks
Nico