7stud2
(7stud --)
19 August 2013 19:20
1
The documentation of
Method#original_name(http://www.ruby-doc.org/core-2.0/Method.html#method-i-original_name )
I today read. Accordingly I tried the below example:
class Foo
def bar;end
end
foo = Foo.new
foo.method(:bar).original_name
# ~> -:5:in `<main>': undefined method `original_name' for #<Method:
Foo#bar> (NoMethodError)
But I am not getting,why the error comes out?
···
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
20 August 2013 07:54
3
I'd say since there's the tag [EXPERIMENTAL] in that description, it's
something which isn't supposed to be used yet.
You can see the original name of a method when you inspect it anyway, so
there's no need for original_name, or you could write your own by
parsing the inspection string.
···
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
20 August 2013 07:42
4
Hans Mackowiak wrote in post #1119150:
maybe your ruby is older than this?
@Hans I am using Ruby2.0.0-p0 in my Ubuntu13.04 system. It is very new
Ruby version..but why I am getting such issue?
···
#original_name is for difference an aliased method with an normal method
class A
def abc
end
alias xyz abc
end
A.instance_method(:abc) #=> #<UnboundMethod: A#abc>
A.instance_method(:xyz) #=> #<UnboundMethod: A#xyz(abc)>
--
Posted via http://www.ruby-forum.com/\ .