Class: CursorPager::LimitRelation
- Inherits:
-
Object
- Object
- CursorPager::LimitRelation
- Defined in:
- lib/cursor_pager/limit_relation.rb
Overview
Applies first and last limits to a relation.
Instance Attribute Summary collapse
-
#base_relation ⇒ Object
readonly
Returns the value of attribute base_relation.
-
#first ⇒ Object
readonly
Returns the value of attribute first.
-
#last ⇒ Object
readonly
Returns the value of attribute last.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(base_relation, first, last) ⇒ LimitRelation
constructor
A new instance of LimitRelation.
Constructor Details
#initialize(base_relation, first, last) ⇒ LimitRelation
Returns a new instance of LimitRelation.
8 9 10 11 12 |
# File 'lib/cursor_pager/limit_relation.rb', line 8 def initialize(base_relation, first, last) @base_relation = base_relation @first = first @last = last end |
Instance Attribute Details
#base_relation ⇒ Object (readonly)
Returns the value of attribute base_relation.
6 7 8 |
# File 'lib/cursor_pager/limit_relation.rb', line 6 def base_relation @base_relation end |
#first ⇒ Object (readonly)
Returns the value of attribute first.
6 7 8 |
# File 'lib/cursor_pager/limit_relation.rb', line 6 def first @first end |
#last ⇒ Object (readonly)
Returns the value of attribute last.
6 7 8 |
# File 'lib/cursor_pager/limit_relation.rb', line 6 def last @last end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/cursor_pager/limit_relation.rb', line 14 def call relation = base_relation relation = apply_first(relation) if first.present? relation = apply_last(relation) if last.present? relation end |