Class: Wor::Paginate::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/wor/paginate/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter, options = {}) ⇒ Formatter

Returns a new instance of Formatter.



6
7
8
9
# File 'lib/wor/paginate/formatter.rb', line 6

def initialize(adapter, options = {})
  @adapter = adapter
  @options = options
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



4
5
6
# File 'lib/wor/paginate/formatter.rb', line 4

def adapter
  @adapter
end

#contentObject

Returns the value of attribute content.



4
5
6
# File 'lib/wor/paginate/formatter.rb', line 4

def content
  @content
end

#formatterObject

Returns the value of attribute formatter.



4
5
6
# File 'lib/wor/paginate/formatter.rb', line 4

def formatter
  @formatter
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/wor/paginate/formatter.rb', line 4

def options
  @options
end

Instance Method Details

#formatObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/wor/paginate/formatter.rb', line 11

def format
  {
    page: serialized_content,
    count: count,
    total_pages: total_pages,
    total_count: total_count,
    current_page: current_page,
    next_page: next_page
  }
end