[Ironruby-core] define_method behaves different than MRI

Ivan Porto Carrero ivan at flanders.co.nz
Sat Oct 10 12:41:11 EDT 2009


Hi

this used to work but now doesn't anymore


» ir
IronRuby 0.9.1.0 on .NET 2.0.50727.4927
Copyright (c) Microsoft Corporation. All rights reserved.

>>> class SomeClass
... define_method(:initialize) do |*args|
... puts args.join(", ")
... end
... end
=> #<Proc:0x0000056@(unknown):2>
>>> SomeClass.new 1, 4, 6, 3
:0: wrong number of arguments (4 for 0) (ArgumentError)

>>> exit
+ C:\dev
» irb
irb(main):001:0> class SomeClass
irb(main):002:1> define_method(:initialize) do |*args|
irb(main):003:2* puts args.join(", ")
irb(main):004:2> end
irb(main):005:1> end
=> #<Proc:0x0442490c@(irb):2>
irb(main):006:0> SomeClass.new 1, 4, 6, 3
1, 4, 6, 3
=> #<SomeClass:0x4416c08>
irb(main):007:0>
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091010/1972545f/attachment.html>


More information about the Ironruby-core mailing list