Joel VanderWerf
8/30/2006 5:08:00 AM
Wes Gamble wrote:
> How does one use define_method to create a method that can take
> arguments?
>
> Is that possible?
>
> Wes
>
Use a block that has arguments:
irb(main):003:0> class << self; define_method :foo do |x, *y| p x, y;
end; end
=> #<Proc:0xb7ca3f20@(irb):3>
irb(main):004:0> foo 1,2,3
1
[2, 3]
=> nil
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407