Zeljko,
The arguments are a hash. Ruby implicitly creates a hash when they're sent
in. I'm not sure how it's not working for you. Try a simple example:
require 'test/unit'
class HashArgs < Test::Unit::TestCase
def test_args
implicit_hash(:foo => 'bar', :other_foo => 'other_bar')
end
def implicit_hash(args)
assert_equal('bar', args[:foo]) #this should pass
assert_equal('bar', args[:other_foo]) #should fail
end
end
Let me know what you get.
-Charley
On 2/8/07, Željko Filipin <[EMAIL PROTECTED]> wrote:
Hi Nathan,
Thanks, but now I see I was not clear enough. I did not want how click
method works (but, once more, thanks for your time). I wanted to know how
are this method arguments handled:
(:name => 'foo', :index => 2)
It would make sense to me if it is a hash
({:name => 'foo', :index => 2})
If I send ({:name => 'foo', :index => 2}) to a method called div I could
use it like this
div({:name => 'foo', :index => 2})
def div(properties)
puts properties[:name]
puts properties[:index]
end
I tried and tried, but could not use these arguments (:name => 'foo',
:index => 2) when I send it to a method.
--
Zeljko Filipin
zeljkofilipin.com
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general