mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
26 lines
No EOL
445 B
Ruby
26 lines
No EOL
445 B
Ruby
module ActiveRelation
|
|
class Range < Compound
|
|
attr_reader :range
|
|
|
|
def initialize(relation, range)
|
|
@relation, @range = relation, range
|
|
end
|
|
|
|
def ==(other)
|
|
relation == other.relation and
|
|
range == other.range
|
|
end
|
|
|
|
def limit
|
|
range.end - range.begin + 1
|
|
end
|
|
|
|
def offset
|
|
range.begin
|
|
end
|
|
|
|
def descend(&block)
|
|
Range.new(relation.descend(&block), range)
|
|
end
|
|
end
|
|
end |