Class: ParamsReady::Pagination::AbstractKeysets

Inherits:
Object
  • Object
show all
Defined in:
lib/params_ready/pagination/keysets.rb

Direct Known Subclasses

AfterKeysets, BeforeKeysets

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keysets, &block) ⇒ AbstractKeysets

Returns a new instance of AbstractKeysets.



6
7
8
9
# File 'lib/params_ready/pagination/keysets.rb', line 6

def initialize(keysets, &block)
  @keysets = keysets
  @transform = block
end

Instance Attribute Details

#keysetsObject (readonly)

Returns the value of attribute keysets.



4
5
6
# File 'lib/params_ready/pagination/keysets.rb', line 4

def keysets
  @keysets
end

Instance Method Details

#lengthObject



11
12
13
# File 'lib/params_ready/pagination/keysets.rb', line 11

def length
  @keysets.length
end

#transform(raw) ⇒ Object



15
16
17
18
# File 'lib/params_ready/pagination/keysets.rb', line 15

def transform(raw)
  return raw if @transform.nil?
  @transform.call(raw)
end