On Thu, Aug 28, 2003 at 05:13:37PM +0900, Dan Doel wrote: > Berger, Daniel wrote: > > >It's been discussed on RubyGarden to some degree. See > > > >http://www.rubygarden.org/ruby?KeywordArguments > > > Thanks for the link, but it doesn't seem to answer my question at all > (which was about > passing a block to #eval and such). :) Hal introduced the following technique in his presentation at the Euruko (http://hypermetrics.com/rubyhacker/euruko03/rubyesque/slide7.html) class A attr_writer :foo def initialize yield self class << self; private :foo; end end end to avoid leaving accessors after instantiation. You could generalize this as follows: def foo s = Struct.new(:param1, :param2, :etc) yield s # do things with s.param1, s.param2, s.etc end foo do |p| p.param1 = :bla p.param2 = "foo" p.etc = ['bar', 'baz'] end -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Sorry. I just realized this sentance makes no sense :) -- Ian Main