Class: Riml::ForNode
- Inherits:
-
Struct
- Object
- Struct
- Riml::ForNode
- Includes:
- Indentable, Visitable, Walkable
- Defined in:
- lib/nodes.rb
Overview
for variable in someFunction(1,2,3)
echo variable
end
OR
for variable in [1,2,3]
echo variable
end
Constant Summary
Constants included from Visitable
Visitable::DESCENDANT_OF_REGEX
Instance Attribute Summary collapse
-
#expressions ⇒ Object
Returns the value of attribute expressions.
-
#in_expression ⇒ Object
Returns the value of attribute in_expression.
-
#variable ⇒ Object
(also: #for_variable)
Returns the value of attribute variable.
Attributes included from Visitable
#compiled_output, #force_newline, #parent_node, #scope
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
Methods included from Indentable
Methods included from Visitable
#accept, #method_missing, #respond_to?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Riml::Visitable
Instance Attribute Details
#expressions ⇒ Object
Returns the value of attribute expressions
846 847 848 |
# File 'lib/nodes.rb', line 846 def expressions @expressions end |
#in_expression ⇒ Object
Returns the value of attribute in_expression
846 847 848 |
# File 'lib/nodes.rb', line 846 def in_expression @in_expression end |
#variable ⇒ Object Also known as: for_variable
Returns the value of attribute variable
846 847 848 |
# File 'lib/nodes.rb', line 846 def variable @variable end |
Instance Method Details
#children ⇒ Object
869 870 871 |
# File 'lib/nodes.rb', line 869 def children [variable, in_expression, expressions] end |
#for_node_variable_names ⇒ Object
857 858 859 860 861 862 863 |
# File 'lib/nodes.rb', line 857 def for_node_variable_names if ListNode === variable variable.value.map(&:name) else [variable] end end |
#to_scope ⇒ Object
865 866 867 |
# File 'lib/nodes.rb', line 865 def to_scope ScopeNode.new.tap {|s| s.for_node_variable_names += for_node_variable_names} end |
#variables ⇒ Object
853 854 855 |
# File 'lib/nodes.rb', line 853 def variables variable if ListNode === variable end |