/trunk/Examples/ruby/hashargs/runme.rb
Ruby | 26 lines | 17 code | 5 blank | 4 comment | 0 complexity | 1be6e4dbe12497134240a0819054aaf7 MD5 | raw file
1require 'example' 2 3include Example 4 5# Pass arguments in as one or more key-value pairs 6setVitalStats("Fred", 7 'age' => 42, 8 'weight' => 270 9 ) 10 11# The order doesn't matter 12setVitalStats("Sally", 13 'age' => 29, 14 'weight' => 115, 15 'height' => 72 16 ) 17 18# Can also pass a hash directly 19params = { 20 'ears' => 2, 21 'eyes' => 2 22} 23setVitalStats("Bob", params) 24 25# An empty hash is fine too 26setVitalStats("Joe", {})