From: dblack@... Date: 2007-08-10T08:53:20+09:00 Subject: Re: define_method with default parameters Hi -- On Fri, 10 Aug 2007, Daniel DeLorme wrote: > Emmanuel Oga wrote: >> how can i use define_method to assign default parameters? >> >> I want to do this: >> >> a_helper_module.module_eval do >> define_method(:method_name) do |parameter, parameter2= "default"| >> puts parameter >> puts parameter2 >> end >> end > > Why don't you just use the regular "def"? Am I missing something? In this particular example you could, but the issue of defaults for block parameters is still a real one, for #define_method and other cases. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)