From: David Masover Date: 2010-08-15T03:58:15+09:00 Subject: Re: hash-style parameters On Saturday, August 14, 2010 01:23:21 pm Terry Michaels wrote: > Some function calls I've seen, like in Shoes, look like so: > > para "Paragraph Text", :style => "this", :whatever => "that" > > How do I define a function call so that can take one "normal" parameter > and then an unknown number of key/value pairs? You could answer your own question by looking at the source of the program doing this -- and I'd suggest it for anything you want to learn more about. For this case, remember that this basically becomes: para("Paragraph Text", {:style => "this", :whatever => "that"}) And of course, there's no reason those literals need to be there -- you could just do this: text = "Paragraph Text" hash = {:style => "this", :whatever => "that"} para(text, hash) So, it should be clear that this is what you want: def para text, options There is one catch, though -- you said "unknown number", which could be zero, so you need a default value: def para text, options={}