Class: Pagy::Console::Collection
- Inherits:
-
Array
- Object
- Array
- Pagy::Console::Collection
- Defined in:
- lib/pagy/modules/console.rb
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(arr = Array(1..1000)) ⇒ Collection
constructor
A new instance of Collection.
- #limit(value) ⇒ Object
- #offset(value) ⇒ Object
Constructor Details
#initialize(arr = Array(1..1000)) ⇒ Collection
Returns a new instance of Collection.
7 8 9 10 |
# File 'lib/pagy/modules/console.rb', line 7 def initialize(arr = Array(1..1000)) super @collection = clone end |
Instance Method Details
#count ⇒ Object
14 |
# File 'lib/pagy/modules/console.rb', line 14 def count(*) = size |
#limit(value) ⇒ Object
13 |
# File 'lib/pagy/modules/console.rb', line 13 def limit(value) = @collection[0, value] |
#offset(value) ⇒ Object
12 |
# File 'lib/pagy/modules/console.rb', line 12 def offset(value) = tap { @collection = self[value..] } |