Class: Ruby::Aggregate
Instance Attribute Summary
#parent
Instance Method Summary
collapse
Methods inherited from Node
#<=>, #all_nodes, #column, #length, #nodes, #row
included, #to_node
#has_token?, #has_type?, #has_value?, #is_instance_of?, #left_of?, #matches?, #position?, #right_of?, #select
#context, #filename, #line, #lines, #src
included, #root, #root?
Instance Method Details
#position(prolog = false) ⇒ Object
5
6
7
8
9
|
# File 'lib/ruby/aggregate.rb', line 5
def position(prolog = false)
nodes = self.nodes
nodes.unshift(self.prolog) if prolog
nodes.compact.each { |n| return n.position.dup if n } && nil
end
|
#position=(position) ⇒ Object
11
12
13
|
# File 'lib/ruby/aggregate.rb', line 11
def position=(position)
nodes.each { |n| return n.position = position if n }
end
|
15
16
17
|
# File 'lib/ruby/aggregate.rb', line 15
def prolog
nodes.each { |n| return n.prolog if n } && nil
end
|
#prolog=(prolog) ⇒ Object
19
20
21
|
# File 'lib/ruby/aggregate.rb', line 19
def prolog=(prolog)
nodes.each { |n| return n.prolog = prolog if n }
end
|
#to_ruby(prolog = false) ⇒ Object
23
24
25
26
|
# File 'lib/ruby/aggregate.rb', line 23
def to_ruby(prolog = false)
nodes = self.nodes.compact
(nodes.shift.try(:to_ruby, prolog) || '') + nodes.map { |node| node.to_ruby(true) }.join
end
|