Re: Create a method with name, containing illegal characters
- From: Phrogz <phrogz@xxxxxxx>
- Date: Wed, 31 Oct 2007 06:54:55 -0700
On Oct 31, 7:34 am, kylichuku <Kirill.Isha...@xxxxxxxxx> wrote:
I need to create a method with name, that contains '-' character. Is
it possible, and if the answer is "yes", how can I do it?
lim2:~ phrogz$ irb
irb(main):001:0> class Foo
irb(main):002:1> define_method("a-b") do
irb(main):003:2* puts "What a strange need!"
irb(main):004:2> end
irb(main):005:1> end
=> #<Proc:0x00354328@(irb):2>
irb(main):006:0> f = Foo.new
=> #<Foo:0x34f454>
irb(main):007:0> f.a-b
NoMethodError: undefined method `a' for #<Foo:0x34f454>
from (irb):7
from :0
irb(main):008:0> f.send( "a-b" )
What a strange need!
.
- Follow-Ups:
- Re: Create a method with name, containing illegal characters
- From: Robert Dober
- Re: Create a method with name, containing illegal characters
- References:
- Create a method with name, containing illegal characters
- From: kylichuku
- Create a method with name, containing illegal characters
- Prev by Date: Re: Can we define data types explicitly?
- Next by Date: Re: Create a method with name, containing illegal characters
- Previous by thread: Create a method with name, containing illegal characters
- Next by thread: Re: Create a method with name, containing illegal characters
- Index(es):
Relevant Pages
|