1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-26 23:24:38 +01:00
liquid/values/range.go
2017-07-27 18:11:37 -04:00

18 lines
381 B
Go

package values
// 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 }