Class: GearedPagination::PortionAtCursor::Selection
- Inherits:
-
Object
- Object
- GearedPagination::PortionAtCursor::Selection
- Defined in:
- lib/geared_pagination/portions/portion_at_cursor.rb
Instance Attribute Summary collapse
-
#orders ⇒ Object
readonly
Returns the value of attribute orders.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #from(cursor) ⇒ Object
-
#initialize(scope, orders) ⇒ Selection
constructor
A new instance of Selection.
Constructor Details
#initialize(scope, orders) ⇒ Selection
Returns a new instance of Selection.
52 53 54 |
# File 'lib/geared_pagination/portions/portion_at_cursor.rb', line 52 def initialize(scope, orders) @scope, @orders = scope, orders end |
Instance Attribute Details
#orders ⇒ Object (readonly)
Returns the value of attribute orders.
50 51 52 |
# File 'lib/geared_pagination/portions/portion_at_cursor.rb', line 50 def orders @orders end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
50 51 52 |
# File 'lib/geared_pagination/portions/portion_at_cursor.rb', line 50 def scope @scope end |
Instance Method Details
#from(cursor) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/geared_pagination/portions/portion_at_cursor.rb', line 56 def from(cursor) if condition = condition_on(cursor) scope.where(condition) else scope.all end end |