Question

I know there is __FILE__, __LINE__, and __send__.

From the Delegator class there are __getobj__ and __setobj__.

Is there any other useful "strange" double underscore goodness present in the Ruby standard library?

Was it helpful?

Solution

This is a complete list for Ruby 2.1:

From delegate:

  • __getobj__ (Delegator)
  • __setobj__ (Delegator)
  • __getobj__ (SimpleDelegator)
  • __setobj__ (SimpleDelegator)

From drb:

  • __drbref
  • __drburi

From irb:

  • __evaluate__
  • __exit__

From tk:

  • All the methods start with a double underscore

OTHER TIPS

There's also the encoding keyword: __ENCODING__:

puts __ENCODING__ # => UTF-8
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top