> pizza = Pizza.new :crust_thickness => :really_thick, > :toppings => [:pepperoni, :ham] looks like a hash, if you ask me... so what the extra keyword for ?? On Fri, 28 Oct 2005 19:27:03 +0200, Daniel Schierbeck <daniel.schierbeck / gmail.com> wrote: > Hugh Sasse wrote: >> # A factory method >> def create_pizza(t=[:pepperoni, :ham] named :toppings, >> c=[:thin] named :crust_thickness) >> imaginate(:pizza_factory).make_me(c,t) # [1] >> end >> nice short vars for codeing, then # My toppings for today >> mt=[:ham, :cheese, :pineapple] >> pizza = create_pizza(mt named :toppings) >> > > Looks interesting... I still think this is better, though > > class Pizza > def initialize(named toppings, named crust_thickness = :thin) > @toppings = toppings > @crust_thickness = crust_thickness > end > end > > pizza = Pizza.new :crust_thickness => :really_thick, > :toppings => [:pepperoni, :ham] > > > Cheers, > Daniel >