Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/core_ext/object.rb
Overview
Extends Ruby's own Object class with method #respond_to_missing? for Ruby < 1.9.2
Instance Method Summary collapse
-
#respond_to?(symbol, include_private = false) ⇒ Boolean
Returns
trueif obj responds to the given method. -
#respond_to_missing?(symbol, include_private = false) ⇒ Boolean
Hook method to return whether the obj can respond to id method or not.
Instance Method Details
#respond_to?(symbol, include_private = false) ⇒ Boolean
Returns true if obj responds to the given method. Private methods
are included in the search only if the optional second parameter
evaluates to true.
If the method is not implemented, as Process.fork on Windows,
File.lchmod on GNU/Linux, etc., false is returned.
If the method is not defined, respond_to_missing? method is called and the result is returned.
26 27 28 |
# File 'lib/core_ext/object.rb', line 26 def respond_to?(symbol, include_private = false) super || respond_to_missing?(symbol, include_private) end |
#respond_to_missing?(symbol, include_private = false) ⇒ Boolean
Hook method to return whether the obj can respond to id method or not.
38 39 40 |
# File 'lib/core_ext/object.rb', line 38 def respond_to_missing?(symbol, include_private = false) false end |