Keep in mind that you can execute the syntax when you do not consider the hash characters {} if the hash parameter is the last parameter of the function. So you can do what Allin did, and it will work. Also
def login_success(name, hsh) puts "User #{name} logged in with #{hsh[:some_hash_key]}" end
And you can call him
login_success "username", :time => Time.now, :some_hash_key => "some text"
But if the hash is not the last parameter, you must surround the hash elements with {}.
scottd Feb 24 '09 at 20:54 2009-02-24 20:54
source share