Class: Fabulator::Expr::RangeExpr
- Inherits:
-
BinExpr
- Object
- BinExpr
- Fabulator::Expr::RangeExpr
show all
- Defined in:
- lib/fabulator/expr/bin_expr.rb
Instance Method Summary
collapse
Methods inherited from BinExpr
#initialize, #run
Instance Method Details
#calculate(a, b) ⇒ Object
167
168
169
170
171
172
173
174
175
|
# File 'lib/fabulator/expr/bin_expr.rb', line 167
def calculate(a,b)
return nil if a.nil? || b.nil?
if a < b
r = (a.to_i .. b.to_i).to_a
else
r = (b.to_i .. a.to_i).to_a.reverse
end
return r
end
|
#expr_type(context) ⇒ Object
159
160
161
|
# File 'lib/fabulator/expr/bin_expr.rb', line 159
def expr_type(context)
[ FAB_NS, 'numeric' ]
end
|
#op ⇒ Object
155
156
157
|
# File 'lib/fabulator/expr/bin_expr.rb', line 155
def op
:range
end
|
#result_type(t) ⇒ Object
163
164
165
|
# File 'lib/fabulator/expr/bin_expr.rb', line 163
def result_type(t)
[ FAB_NS, 'numeric' ]
end
|