Module: BlockChainable

Defined in:
lib/block_chainable.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/block_chainable.rb', line 26

def self.included(klass)
  klass.extend(ClassMethods)
  
  Object.class_eval <<-EOS
    def #{klass}(*args,&block)
      #{klass}.start(*args,&block)
    end
  EOS
end

Instance Method Details

#chain_respond_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
39
40
41
# File 'lib/block_chainable.rb', line 36

def chain_respond_to?(name)
  self.respond_to?(name) || 
  (@__parent && 
  (@__parent.respond_to?(name) || 
  (@__parent.respond_to?(:chain_respond_to?) && @__parent.chain_respond_to?(name))))
end