Class: Uchi::Pagy::Console::Collection

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

Instance Method Summary collapse

Constructor Details

#initialize(arr = Array(1..1000)) ⇒ Collection

Returns a new instance of Collection.



22
23
24
25
# File 'lib/uchi/pagy/modules/console.rb', line 22

def initialize(arr = Array(1..1000))
  super
  @collection = clone
end

Instance Method Details

#countObject



29
# File 'lib/uchi/pagy/modules/console.rb', line 29

def count(*)      = size

#limit(value) ⇒ Object



28
# File 'lib/uchi/pagy/modules/console.rb', line 28

def limit(value)  = @collection[0, value]

#offset(value) ⇒ Object



27
# File 'lib/uchi/pagy/modules/console.rb', line 27

def offset(value) = tap { @collection = self[value..] }