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.
55 56 57 |
# File 'lib/geared_pagination/portions/portion_at_cursor.rb', line 55 def initialize(scope, orders) @scope, @orders = scope, orders end |
Instance Attribute Details
#orders ⇒ Object (readonly)
Returns the value of attribute orders.
53 54 55 |
# File 'lib/geared_pagination/portions/portion_at_cursor.rb', line 53 def orders @orders end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
53 54 55 |
# File 'lib/geared_pagination/portions/portion_at_cursor.rb', line 53 def scope @scope end |
Instance Method Details
#from(cursor) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/geared_pagination/portions/portion_at_cursor.rb', line 59 def from(cursor) if condition = condition_on(cursor) scope.where(condition) else scope.all end end |