On Oct 26, 9:29=A0pm, Macario Ortega <maca... / gmail.com> wrote:
> Hi, I've written a small gem to pass named arguments to an existing
> method using ruby2ruby. Here's the usage:
>
> require 'named_arguments'
>
> class Example
> =A0 def instance_method(uno =3D 1, dos =3D 2, tres =3D 3, cuatro =3D 4)
> =A0 =A0 [uno, dos, tres, cuatro]
> =A0 end
>
> =A0 def another_instance_method( a =3D :a, b =3D :b, c =3D :c)
> =A0 =A0 [a,b,c]
> =A0 end
>
> =A0 named_args_for :instance_method, :another_instance_method
>
> =A0 class << self
> =A0 =A0 def class_method(uno =3D 1, dos =3D 2, tres =3D 3, cuatro =3D 4)
> =A0 =A0 =A0 [uno, dos, tres, cuatro]
> =A0 =A0 end
> =A0 =A0 named_args_for :class_method
> =A0 end
> end
>
> Example.new.instance_method( :one, :dos =3D> :two, :tres =3D> :three )
> =3D> [:one,:two,:three,4]
>
> Example.new.another_instance_method
> =3D> [:a,:b,:c]
>
> Example.class_method( :dos =3D> :b, :cuatro =3D> :d )
> =3D> [1,:b,2,:d]
>
> http://github.com/maca/namedarguments/tree/master/
> --
> Posted viahttp://www.ruby-forum.com/.

Hm, using your example with named_arguments 0.0.5 I get:

undefined method `named_args_for' for Example:Class (NoMethodError)

Regards,

Dan