문제

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?

도움이 되었습니까?

해결책

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

다른 팁

There's also the encoding keyword: __ENCODING__:

puts __ENCODING__ # => UTF-8
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top