Module: Delegated
- Included in:
- Mustang, Mustang::V8::Array, Mustang::V8::Date, Mustang::V8::External, Mustang::V8::Integer, Mustang::V8::Number, Mustang::V8::Object, Mustang::V8::Regexp, Mustang::V8::String
- Defined in:
- lib/mustang/support/delegated.rb
Overview
Delegates all missing methods to object specified by #delegate
method.
Instance Method Summary collapse
-
#method_missing(meth, *args, &block) ⇒ Object
:nodoc:.
- #old_method_missing ⇒ Object
- #old_respond_to? ⇒ Object
-
#respond_to?(meth) ⇒ Boolean
:nodoc:.
-
#to_s ⇒ Object
:nodoc:.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
:nodoc:
6 7 8 9 10 11 12 |
# File 'lib/mustang/support/delegated.rb', line 6 def method_missing(meth, *args, &block) # :nodoc: if (old_respond_to?(:delegate) && delegate.respond_to?(meth)) delegate.send(meth, *args, &block) else old_method_missing(meth, *args, &block) end end |
Instance Method Details
#old_method_missing ⇒ Object
3 |
# File 'lib/mustang/support/delegated.rb', line 3 alias_method :old_method_missing, :method_missing |
#old_respond_to? ⇒ Object
4 |
# File 'lib/mustang/support/delegated.rb', line 4 alias_method :old_respond_to?, :respond_to? |
#respond_to?(meth) ⇒ Boolean
:nodoc:
14 15 16 17 18 19 20 |
# File 'lib/mustang/support/delegated.rb', line 14 def respond_to?(meth) # :nodoc: if (old_respond_to?(:delegate)) delegate.respond_to?(meth) or old_respond_to?(meth) else old_respond_to?(meth) end end |
#to_s ⇒ Object
:nodoc:
22 23 24 |
# File 'lib/mustang/support/delegated.rb', line 22 def to_s # :nodoc: delegate.to_s end |