Class: GearedPagination::PortionAtCursor::Selection

Inherits:
Object
  • Object
show all
Defined in:
lib/geared_pagination/portions/portion_at_cursor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#ordersObject (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

#scopeObject (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