Module: Juicer::Chainable::ClassMethods
- Defined in:
- lib/juicer/chainable.rb
Instance Method Summary collapse
-
#chain_method(method) ⇒ Object
Sets up a method for chaining.
Instance Method Details
#chain_method(method) ⇒ Object
Sets up a method for chaining
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/juicer/chainable.rb', line 91 def chain_method(method) original_method = "execute_#{method}".to_sym alias_method original_method, method self.class_eval <<-RUBY def #{method}(*args, &block) @_abort_chain = false #{original_method}(*args, &block) next_in_chain.#{method}(*args, &block) if !@_abort_chain && next_in_chain @_abort_chain = false end RUBY end |