Class: CursorPager::SliceRelation
- Inherits:
-
Object
- Object
- CursorPager::SliceRelation
- Defined in:
- lib/cursor_pager/slice_relation.rb
Overview
Applies after and before cursors to a relation.
Instance Attribute Summary collapse
-
#after_values ⇒ Object
readonly
Returns the value of attribute after_values.
-
#base_relation ⇒ Object
readonly
Returns the value of attribute base_relation.
-
#before_values ⇒ Object
readonly
Returns the value of attribute before_values.
-
#order_values ⇒ Object
readonly
Returns the value of attribute order_values.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(base_relation, order_values, after_values, before_values) ⇒ SliceRelation
constructor
A new instance of SliceRelation.
Constructor Details
#initialize(base_relation, order_values, after_values, before_values) ⇒ SliceRelation
Returns a new instance of SliceRelation.
8 9 10 11 12 13 |
# File 'lib/cursor_pager/slice_relation.rb', line 8 def initialize(base_relation, order_values, after_values, before_values) @base_relation = base_relation @order_values = order_values @after_values = after_values @before_values = before_values end |
Instance Attribute Details
#after_values ⇒ Object (readonly)
Returns the value of attribute after_values.
6 7 8 |
# File 'lib/cursor_pager/slice_relation.rb', line 6 def after_values @after_values end |
#base_relation ⇒ Object (readonly)
Returns the value of attribute base_relation.
6 7 8 |
# File 'lib/cursor_pager/slice_relation.rb', line 6 def base_relation @base_relation end |
#before_values ⇒ Object (readonly)
Returns the value of attribute before_values.
6 7 8 |
# File 'lib/cursor_pager/slice_relation.rb', line 6 def before_values @before_values end |
#order_values ⇒ Object (readonly)
Returns the value of attribute order_values.
6 7 8 |
# File 'lib/cursor_pager/slice_relation.rb', line 6 def order_values @order_values end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/cursor_pager/slice_relation.rb', line 15 def call relation = base_relation relation = apply_after(relation) relation = apply_before(relation) relation end |