On Mon, Apr 16, 2007 at 02:27:56PM +0900, gaurav bagga wrote: > the method was--> > > def doThing var1,var2 > html_options #already defined the basic things needed for functionality > in this hash > end > > I made changes within the method --> > > def doThing var1,var2 > html_options.merge! :onclick => yield if block_given? > end > > so calling it doThing("one","two") {"methodCalledOnClick()"} did the trick > other people were happy using it doThing "one","two" Another way is to have an optional argument: def doThing(var1, var2, opts={}) html_options.merge!(opts) end or: def doThing(var1, var2, opts=nil) html_options.merge!(opts) if opts end