class Umwelt::Node::Build
Attributes
tree[R]
Public Class Methods
new(tree)
click to toggle source
# File lib/umwelt/node/build.rb, line 8 def initialize(tree) @tree = tree end
Public Instance Methods
call(frag)
click to toggle source
# File lib/umwelt/node/build.rb, line 12 def call(frag) node_klass(frag.kind).new(attributes(frag)) end
Private Instance Methods
attributes(frag)
click to toggle source
# File lib/umwelt/node/build.rb, line 20 def attributes(frag) frag .to_h .slice(:id, :abstract_id, :context_id, :body, :note) .merge(tree: tree) end
node_klass(kind)
click to toggle source
# File lib/umwelt/node/build.rb, line 27 def node_klass(kind) Umwelt::Node.const_get classify(kind) end