2008/4/30, Phillip Gawlowski <cmdjackryan / googlemail.com>:

>  Untested, and probably highly inelegant:
>
>  def param key, value
>  ~  @params["#{key.to_sym}"] = value
>  end
>
>  Should produce:
>
>  | object.params my_key, 'my value'
>  => @params[:my_key] => 'my value'
>
>  While not the interface you desire, it is the output you want.

Yes, that exactly what I do, but I don't like it, since it's not
intuitive. In fact I call the method "set_param(name, value)". But it
makes the code look like Java.. brrrrr.... XD


>  | object.param 'key' => 'value'
>  => @params['key'] => 'value'
>
>
>  You could sexy that up with Hash#merge:
>
>  def param(options = {})
>  ~  @params = @params.merge options
>  end
>
>  (probably more efficient than the first variant, too.)

Interesting, and thanks for the useful link. :)


-- 
IƱaki Baz Castillo
<ibc / aliax.net>