Class: Riml::ForNode
- Inherits:
-
Struct
- Object
- Struct
- Riml::ForNode
- Includes:
- Indentable, Visitable
- Defined in:
- lib/riml/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
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, #parser_info, #scope
Instance Method Summary collapse
Methods included from Indentable
Methods included from Visitable
#accept, #force_newline_if_child_call_node?, #location_info
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
#expressions ⇒ Object
Returns the value of attribute expressions
858 859 860 |
# File 'lib/riml/nodes.rb', line 858 def expressions @expressions end |
#in_expression ⇒ Object
Returns the value of attribute in_expression
858 859 860 |
# File 'lib/riml/nodes.rb', line 858 def in_expression @in_expression end |
#variable ⇒ Object Also known as: for_variable
Returns the value of attribute variable
858 859 860 |
# File 'lib/riml/nodes.rb', line 858 def variable @variable end |
Instance Method Details
#children ⇒ Object
884 885 886 |
# File 'lib/riml/nodes.rb', line 884 def children [variable, in_expression, expressions] end |
#for_node_variable_names ⇒ Object
868 869 870 871 872 873 874 |
# File 'lib/riml/nodes.rb', line 868 def for_node_variable_names if ListNode === variable variable.value.map(&:name) else [variable.name] end end |
#to_scope ⇒ Object
876 877 878 879 880 881 882 |
# File 'lib/riml/nodes.rb', line 876 def to_scope ScopeNode.new.tap do |s| s.for_node_variable_names += for_node_variable_names s.argument_variable_names = (self.scope && self.scope.argument_variable_names) s.function = (self.scope && self.scope.function) || nil end end |
#variables ⇒ Object
864 865 866 |
# File 'lib/riml/nodes.rb', line 864 def variables variable if ListNode === variable end |