oral by ruins - it's not what you're thinking!
Friday, March 29, 2013
method aliasing
It's possible to create aliases for methods in Ruby:
Now we can call either
say_hello
or
greet
and have the same results:
> h = Hello.new
=> #<Hello:0x9390ba8>
> h.say_hello
Hello!
=> nil
> h.greet
Hello!
=> nil
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment