Module: OntologyUnited::Stack::Delegate

Included in:
DSL::BaseDSL
Defined in:
lib/ontology-united/stack.rb

Instance Method Summary collapse

Instance Method Details

#delegate_stack_to(method_name = nil, &block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/ontology-united/stack.rb', line 17

def delegate_stack_to(method_name=nil, &block)
  action = ->(stack_operation) do
    ->() do
      block.call(self).send(stack_operation)
    end
  end
  define_method :stack, &action[:stack]
  define_method :current, &action[:current]
  define_method :parent, &action[:parent]
end