Class: Dentaku::AST::Modulo
Instance Attribute Summary
Attributes inherited from Operation
#left, #right
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Arithmetic
#initialize, #type
Methods inherited from Operation
#dependencies, #initialize, right_associative?
Methods inherited from Node
arity, #dependencies
Class Method Details
.precedence ⇒ Object
136
137
138
|
# File 'lib/dentaku/ast/arithmetic.rb', line 136
def self.precedence
20
end
|
Instance Method Details
#operator ⇒ Object
132
133
134
|
# File 'lib/dentaku/ast/arithmetic.rb', line 132
def operator
:%
end
|
#percent? ⇒ Boolean
120
121
122
|
# File 'lib/dentaku/ast/arithmetic.rb', line 120
def percent?
left.nil?
end
|
#valid_left? ⇒ Boolean
140
141
142
|
# File 'lib/dentaku/ast/arithmetic.rb', line 140
def valid_left?
valid_node?(left) || left.nil?
end
|
#value(context = {}) ⇒ Object
124
125
126
127
128
129
130
|
# File 'lib/dentaku/ast/arithmetic.rb', line 124
def value(context={})
if percent?
cast(right.value(context)) * 0.01
else
super
end
end
|