Class: Estreet::AssignmentExpression
- Inherits:
-
Expression
- Object
- Node
- Expression
- Estreet::AssignmentExpression
- Defined in:
- lib/estreet/assignment_expression.rb
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(left, right, operator = "=") ⇒ AssignmentExpression
constructor
A new instance of AssignmentExpression.
Methods inherited from Expression
#[], #call, coerce, #property, #to_expression, #to_statement
Methods inherited from Node
Constructor Details
#initialize(left, right, operator = "=") ⇒ AssignmentExpression
Returns a new instance of AssignmentExpression.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/estreet/assignment_expression.rb', line 3 def initialize(left, right, operator="=") # TODO: InvalidOperatorError Estreet.assert_valid_operator(ASSIGNMENT_OPERATORS, operator) @op = operator @right = right.to_expression @left = if left.respond_to? :to_pattern left.to_pattern else # left.to_expression # TODO: Test this! Expression.coerce(left) end end |
Instance Method Details
#attributes ⇒ Object
18 19 20 |
# File 'lib/estreet/assignment_expression.rb', line 18 def attributes super.merge(operator: @op, left: @left, right: @right) end |