Module: Riml::Visitable

Constant Summary collapse

EMPTY_CHILDREN =
[].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Walkable

#child_after, #child_previous_to, #each, #index_by_children, #index_by_member, #insert_after, #insert_before, #next, #previous, #remove, #replace_with

Instance Attribute Details

#compiled_outputObject



19
20
21
# File 'lib/riml/nodes.rb', line 19

def compiled_output
  @compiled_output ||= ''
end

#force_newlineObject

Returns the value of attribute force_newline.



14
15
16
# File 'lib/riml/nodes.rb', line 14

def force_newline
  @force_newline
end

#parent_nodeObject Also known as: parent

Returns the value of attribute parent_node.



14
15
16
# File 'lib/riml/nodes.rb', line 14

def parent_node
  @parent_node
end

#parser_infoObject

Returns the value of attribute parser_info.



14
15
16
# File 'lib/riml/nodes.rb', line 14

def parser_info
  @parser_info
end

#scopeObject

Returns the value of attribute scope.



14
15
16
# File 'lib/riml/nodes.rb', line 14

def scope
  @scope
end

Instance Method Details

#accept(visitor) ⇒ Object



10
11
12
# File 'lib/riml/nodes.rb', line 10

def accept(visitor)
  visitor.visit(self)
end

#childrenObject



25
26
27
# File 'lib/riml/nodes.rb', line 25

def children
  EMPTY_CHILDREN
end

#force_newline_if_child_call_node?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/riml/nodes.rb', line 41

def force_newline_if_child_call_node?
  true
end

#location_infoObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/riml/nodes.rb', line 29

def location_info
  n = self
  while n != nil && !n.parser_info
    n = n.parent
  end
  if n.nil?
    return Constants::UNKNOWN_LOCATION_INFO
  end
  filename = parser_info[:filename] || Constants::COMPILED_STRING_LOCATION
  "#{filename}:#{parser_info[:lineno]}"
end