aboutsummaryrefslogblamecommitdiffstats
path: root/lib/active_relation/relations/range.rb
blob: 7f120ab9e5798757fcc067c54469ef3fcecf5bb5 (plain) (tree)
1
2
3
4
5
6
7
8
9
                     







                                         

                                    







                                 
       



                                        

     
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 qualify
      Range.new(relation.qualify, range)
    end
  end
end