1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-26 23:24:38 +01:00
liquid/evaluator/range.go
2017-07-13 23:46:12 -04:00

18 lines
384 B
Go

package evaluator
// A Range is the range of integers from b to e inclusive.
type Range struct {
b, e int
}
// NewRange returns a new Range
func NewRange(b, e int) Range {
return Range{b, e}
}
// Len is in the iteration interface
func (r Range) Len() int { return r.e + 1 - r.b }
// Index is in the iteration interface
func (r Range) Index(i int) interface{} { return r.b + i }