Method: MaRuKu::MDElement#initialize

Defined in:
lib/maruku/element.rb

#initialize(node_type = :unset, children = [], meta = {}, al = nil) ⇒ MDElement



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/maruku/element.rb', line 51

def initialize(node_type = :unset, children = [], meta = {}, al = nil)
  self.children = children
  self.node_type = node_type
  self.attributes = {}

  # Define a new accessor on the singleton class for this instance
  # for each metadata key
  meta.each do |symbol, value|
    class << self
      self
    end.send(:attr_accessor, symbol)

    self.send("#{symbol}=", value)
  end

  self.al = al || AttributeList.new
  self.meta_priv = meta
end