Class: Riml::Nodes
- Inherits:
-
Struct
- Object
- Struct
- Riml::Nodes
- Defined in:
- lib/nodes.rb
Overview
Collection of nodes each one representing an expression.
Direct Known Subclasses
Constant Summary
Constants included from Visitable
Visitable::DESCENDANT_OF_REGEX
Instance Attribute Summary collapse
-
#nodes ⇒ Object
Returns the value of attribute nodes.
Attributes included from Visitable
#compiled_output, #force_newline, #parent_node, #scope
Instance Method Summary collapse
- #<<(node) ⇒ Object
- #[](idx) ⇒ Object
- #children ⇒ Object
- #concat(list_of_nodes) ⇒ Object
-
#method_missing(method, *args, &block) ⇒ Object
forward missing methods to ‘nodes` array.
- #respond_to?(method, include_private = false) ⇒ Boolean
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
Methods included from Visitable
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
forward missing methods to ‘nodes` array
181 182 183 184 185 186 187 |
# File 'lib/nodes.rb', line 181 def method_missing(method, *args, &block) if nodes.respond_to?(method) nodes.send(method, *args, &block) else super end end |
Instance Attribute Details
#nodes ⇒ Object
Returns the value of attribute nodes
162 163 164 |
# File 'lib/nodes.rb', line 162 def nodes @nodes end |
Instance Method Details
#<<(node) ⇒ Object
166 167 168 169 |
# File 'lib/nodes.rb', line 166 def <<(node) nodes << node self end |
#[](idx) ⇒ Object
171 172 173 |
# File 'lib/nodes.rb', line 171 def [](idx) nodes[idx] end |
#children ⇒ Object
193 194 195 |
# File 'lib/nodes.rb', line 193 def children nodes end |
#concat(list_of_nodes) ⇒ Object
175 176 177 178 |
# File 'lib/nodes.rb', line 175 def concat(list_of_nodes) nodes.concat(list_of_nodes) self end |
#respond_to?(method, include_private = false) ⇒ Boolean
189 190 191 |
# File 'lib/nodes.rb', line 189 def respond_to?(method, include_private = false) super || nodes.respond_to?(method, include_private) end |