Module: HamdownCore::Ast::HasChildren

Included in:
Element, HamlComment, HtmlComment, HtmlList, Root, Script, SilentScript
Defined in:
lib/hamdown_core/ast.rb

Instance Method Summary collapse

Instance Method Details

#<<(ast) ⇒ Object



11
12
13
# File 'lib/hamdown_core/ast.rb', line 11

def <<(ast)
  self.children << ast
end

#initializeObject



6
7
8
9
# File 'lib/hamdown_core/ast.rb', line 6

def initialize(*)
  super
  self.children ||= []
end

#to_hObject



15
16
17
# File 'lib/hamdown_core/ast.rb', line 15

def to_h
  super.merge(children: children.map(&:to_h))
end