08 Apr '14, 11am

TIL about __callee__ in Ruby.

__callee__ and __method__ both return symbol when originally defined, not current There has been some indication that __callee__ is intended to return the symbol with which the method was actually invoked, whereas __method__ returns name with which the method was originally defined, but __callee__ actually behaves identically to __method__ in Ruby 1.9.1 1.9.2, and 1.9.3. This distinction is meaningful, because methods can be aliased after they are created. In Ruby 1.8.7, it was possible (though) not convenient to get the name of the method as actually invoked, by calling another method that extracts the name from caller .first. Even that hack no longer works in Ruby 1.9 though, since it will return the originally defined method name as well.

Full article: http://apidock.com/ruby/Kernel/__callee__

Tweets

totally confused but must read this again and again | Ruby Classes

totally confused but must read this again and a...

rubylearning.com 08 Apr '14, 6am

# p029dog.rb # define class Dog class Dog def initialize(breed, name) # Instance variables @breed = breed @name = name end...

A Guide to Choosing the Best Gems for Your Ruby...

rubyflow.com 08 Apr '14, 2pm

A Guide to Choosing the Best Gems for Your Ruby Project Posted by justinweiss on April 08, 2014 — 0 comments If you need s...