Sha256: 7aee5e72746c9fc28c47866f560a61f23deea970ba15a2c2887002a7613f298d

Contents?: true

Size: 663 Bytes

Versions: 3

Compression:

Stored size: 663 Bytes

Contents

class Object
  # Erlang block where you can register map erlang directives
  # Usage:
  #   erlang do
  #     with_node(:node0) do
  #       start
  #     end
  #   end
  def erlang parent=self, &block
    context_stack.push parent
    mapper = block ? ErlMapper.new(&block) : nil
    mappers << mapper
    context_stack.pop
    
    testing ? puts(mapper.realize(true)) : mapper.realize(false)  
  end
  
  def testing bool=false
    $testing ||= bool
  end
  
  def mappers
    $mappers ||= []
  end
  
  # Context stack so we can keep track of the context
  def context_stack
    @@context_stack ||= []
  end
  
  def parent
    @@context_stack.first
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
auser-skelerl-0.0.2 lib/skelerl/erlpers/core/object.rb
auser-skelerl-0.0.3 lib/skelerl/erlpers/core/object.rb
auser-skelerl-0.0.4 lib/skelerl/erlpers/core/object.rb