Class: Dentaku::AST::Negation
- Inherits:
-
Arithmetic
- Object
- Node
- Operation
- Arithmetic
- Dentaku::AST::Negation
- Defined in:
- lib/dentaku/ast/negation.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
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
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
4 5 6 |
# File 'lib/dentaku/ast/negation.rb', line 4 def node @node end |
Class Method Details
.arity ⇒ Object
27 28 29 |
# File 'lib/dentaku/ast/negation.rb', line 27 def self.arity 1 end |
.precedence ⇒ Object
35 36 37 |
# File 'lib/dentaku/ast/negation.rb', line 35 def self.precedence 40 end |
.right_associative? ⇒ Boolean
31 32 33 |
# File 'lib/dentaku/ast/negation.rb', line 31 def self.right_associative? true end |
Instance Method Details
#dependencies(context = {}) ⇒ Object
39 40 41 |
# File 'lib/dentaku/ast/negation.rb', line 39 def dependencies(context = {}) @node.dependencies(context) end |
#operator ⇒ Object
15 16 17 |
# File 'lib/dentaku/ast/negation.rb', line 15 def operator :* end |
#type ⇒ Object
23 24 25 |
# File 'lib/dentaku/ast/negation.rb', line 23 def type :numeric end |
#value(context = {}) ⇒ Object
19 20 21 |
# File 'lib/dentaku/ast/negation.rb', line 19 def value(context = {}) cast(@node.value(context)) * -1 end |