class Umwelt::Node::Base

Public Instance Methods

ancestry() click to toggle source
# File lib/umwelt/node.rb, line 15
def ancestry
  if context_id
    context.ancestry << self
  else
    [self]
  end
end
context() click to toggle source
# File lib/umwelt/node.rb, line 23
def context
  tree.node(context_id)
end
label() click to toggle source
# File lib/umwelt/node.rb, line 27
def label
  self.class.name.split('::').last.to_sym
end
semantic(semantic_name) click to toggle source
# File lib/umwelt/node.rb, line 11
def semantic(semantic_name)
  semantic_klass(semantic_name).new(node: self)
end
semantics() click to toggle source
# File lib/umwelt/node.rb, line 7
def semantics
  [:Plain]
end

Private Instance Methods

semantic_klass(semantic_name) click to toggle source

Umwelt::Node::Space.new.semantic_klass(semantic)

> Umwelt::Semantic::Plain::Space

# File lib/umwelt/node.rb, line 35
def semantic_klass(semantic_name)
  [semantic_name, label]
    .reduce(Umwelt::Semantic) do |klass, name|
    klass.const_get name
  end
end