Class: Luoma::RangeLiteral
- Inherits:
-
Expression
- Object
- Expression
- Luoma::RangeLiteral
- Defined in:
- lib/luoma/expression.rb,
sig/luoma/expression.rbs
Instance Attribute Summary
Attributes inherited from Expression
Instance Method Summary collapse
-
#children ⇒ ::Array[_Traversable]
() -> Array.
-
#evaluate(context) ⇒ Object
(RenderContext) -> untyped.
-
#initialize(token, start, stop) ⇒ RangeLiteral
constructor
(t_token, Expression, Expression) -> void.
-
#to_s ⇒ ::String
() -> String.
Methods inherited from Expression
Constructor Details
#initialize(token, start, stop) ⇒ RangeLiteral
(t_token, Expression, Expression) -> void
877 878 879 880 881 882 |
# File 'lib/luoma/expression.rb', line 877 def initialize(token, start, stop) super(token) @start = start @stop = stop @span = Luoma.span(start.token, stop.token) end |
Instance Method Details
#children ⇒ ::Array[_Traversable]
() -> Array
315 316 317 |
# File 'sig/luoma/expression.rbs', line 315 def children [@start, @stop] end |
#evaluate(context) ⇒ Object
(RenderContext) -> untyped
885 886 887 888 889 |
# File 'lib/luoma/expression.rb', line 885 def evaluate(context) start = context.env.to_i(@start.evaluate(context), context, default: 0) stop = context.env.to_i(@stop.evaluate(context), context, default: 0) RangeDrop.new(start, stop) end |
#to_s ⇒ ::String
() -> String
896 897 898 |
# File 'lib/luoma/expression.rb', line 896 def to_s "(#{@start}..#{@stop})" end |