Class: Estreet::UnaryExpression
- Inherits:
-
Expression
- Object
- Node
- Expression
- Estreet::UnaryExpression
- Defined in:
- lib/estreet/unary_expression.rb
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(operator, argument) ⇒ UnaryExpression
constructor
A new instance of UnaryExpression.
Methods inherited from Expression
#[], #call, coerce, #property, #to_expression, #to_statement
Methods inherited from Node
Constructor Details
#initialize(operator, argument) ⇒ UnaryExpression
Returns a new instance of UnaryExpression.
3 4 5 6 7 8 |
# File 'lib/estreet/unary_expression.rb', line 3 def initialize(operator, argument) Estreet.assert_valid_operator(UNARY_OPERATORS, operator) @operator = operator @argument = argument.to_expression end |
Instance Method Details
#attributes ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/estreet/unary_expression.rb', line 10 def attributes super.merge( operator: @operator, argument: @argument, prefix: true # TODO: when is it false? ) end |