Class: MarkMapper::Pagination::Collection

Inherits:
Array show all
Extended by:
Forwardable
Defined in:
lib/mark_mapper/pagination/collection.rb

Instance Method Summary collapse

Methods included from Extensions::Array

#_mark_mapper_deep_copy_

Constructor Details

#initialize(records, paginator) ⇒ Collection

Returns a new instance of Collection.


15
16
17
18
# File 'lib/mark_mapper/pagination/collection.rb', line 15

def initialize(records, paginator)
  replace records
  @paginator = paginator
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object


20
21
22
# File 'lib/mark_mapper/pagination/collection.rb', line 20

def method_missing(method, *args)
  @query.send method, *args
end

Instance Method Details

#paginator(p = nil) ⇒ Object

Public


25
26
27
28
29
# File 'lib/mark_mapper/pagination/collection.rb', line 25

def paginator(p=nil)
  return @paginator if p.nil?
  @paginator = p
  self
end