Class: Ribbon::Intercom::Utils::MethodChain
- Inherits:
-
Object
- Object
- Ribbon::Intercom::Utils::MethodChain
- Defined in:
- lib/ribbon/intercom/utils/method_chain.rb
Class Method Summary collapse
Instance Method Summary collapse
- #end ⇒ Object
-
#initialize(&block) ⇒ MethodChain
constructor
A new instance of MethodChain.
-
#meth ⇒ Object
Need to override all public instance methods so they can be captured correctly.
Constructor Details
#initialize(&block) ⇒ MethodChain
Returns a new instance of MethodChain.
18 19 20 |
# File 'lib/ribbon/intercom/utils/method_chain.rb', line 18 def initialize(&block) @_end_block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object (private)
28 29 30 |
# File 'lib/ribbon/intercom/utils/method_chain.rb', line 28 def method_missing(meth, *args, &block) _add_method(meth, *args) end |
Class Method Details
.begin(&block) ⇒ Object
5 6 7 |
# File 'lib/ribbon/intercom/utils/method_chain.rb', line 5 def begin(&block) new(&block) end |
Instance Method Details
#end ⇒ Object
22 23 24 |
# File 'lib/ribbon/intercom/utils/method_chain.rb', line 22 def end @_end_block.call(@_methods) end |
#meth ⇒ Object
Need to override all public instance methods so they can be captured correctly.
12 13 14 15 16 |
# File 'lib/ribbon/intercom/utils/method_chain.rb', line 12 public_instance_methods.each { |meth| define_method(meth) { |*args| _add_method(meth, *args) } } |