Class: Dentaku::AST::Negation
- Inherits:
-
Arithmetic
- Object
- Node
- Operation
- Arithmetic
- Dentaku::AST::Negation
- Defined in:
- lib/dentaku/ast/negation.rb
Instance Attribute Summary
Attributes inherited from Operation
Class Method Summary collapse
Instance Method Summary collapse
- #dependencies(context = {}) ⇒ Object
-
#initialize(node) ⇒ Negation
constructor
A new instance of Negation.
- #operator ⇒ Object
- #type ⇒ Object
- #value(context = {}) ⇒ Object
Methods inherited from Node
Constructor Details
Class Method Details
.arity ⇒ Object
25 26 27 |
# File 'lib/dentaku/ast/negation.rb', line 25 def self.arity 1 end |
.precedence ⇒ Object
33 34 35 |
# File 'lib/dentaku/ast/negation.rb', line 33 def self.precedence 40 end |
.right_associative? ⇒ Boolean
29 30 31 |
# File 'lib/dentaku/ast/negation.rb', line 29 def self.right_associative? true end |
Instance Method Details
#dependencies(context = {}) ⇒ Object
37 38 39 |
# File 'lib/dentaku/ast/negation.rb', line 37 def dependencies(context = {}) @node.dependencies(context) end |
#operator ⇒ Object
13 14 15 |
# File 'lib/dentaku/ast/negation.rb', line 13 def operator :* end |
#type ⇒ Object
21 22 23 |
# File 'lib/dentaku/ast/negation.rb', line 21 def type :numeric end |
#value(context = {}) ⇒ Object
17 18 19 |
# File 'lib/dentaku/ast/negation.rb', line 17 def value(context = {}) cast(@node.value(context)) * -1 end |