Class: Pagy::Console::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/pagy/modules/console.rb

Instance Method Summary collapse

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

#countObject



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..] }