Class: IcAgent::Ast::Nodes::NamedNode

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/ic_agent/ast/nodes/named_nodes.rb

Instance Method Summary collapse

Instance Method Details

#elements_to_sObject



19
20
21
# File 'lib/ic_agent/ast/nodes/named_nodes.rb', line 19

def elements_to_s
  elements.map(&:to_s).join("\n")
end

#source_contentObject



23
24
25
# File 'lib/ic_agent/ast/nodes/named_nodes.rb', line 23

def source_content
  self.text_value.strip
end

#titleObject



7
8
9
# File 'lib/ic_agent/ast/nodes/named_nodes.rb', line 7

def title
  :named_node
end

#to_arrayObject



11
12
13
# File 'lib/ic_agent/ast/nodes/named_nodes.rb', line 11

def to_array
  [title] + elements.map(&:to_array)
end

#to_sObject



15
16
17
# File 'lib/ic_agent/ast/nodes/named_nodes.rb', line 15

def to_s
  "#{title.to_s.upcase} #{elements_to_s}"
end