Class: Object

Inherits:
BasicObject
Defined in:
lib/symbiont.rb

Instance Method Summary collapse

Instance Method Details

#call_method_chain(method_chain, arg = nil) ⇒ Object



103
104
105
106
107
108
109
110
111
112
# File 'lib/symbiont.rb', line 103

def call_method_chain(method_chain, arg = nil)
  return self if method_chain.empty?
  method_chain.split('.').inject(self) do |o, m|
    if arg.nil?
      o.send(m.intern)
    else
      o.send(m.intern, arg)
    end
  end
end