Class: Wor::Paginate::Formatters::Base
- Inherits:
-
Object
- Object
- Wor::Paginate::Formatters::Base
- Includes:
- Utils::UriHelper
- Defined in:
- lib/wor/paginate/formatters/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#content ⇒ Object
Returns the value of attribute content.
-
#formatter ⇒ Object
Returns the value of attribute formatter.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#format ⇒ Object
rubocop: disable Metrics/MethodLength.
-
#initialize(adapter, options = {}) ⇒ Base
constructor
A new instance of Base.
Methods included from Utils::UriHelper
query_params, replace_query_params
Constructor Details
#initialize(adapter, options = {}) ⇒ Base
Returns a new instance of Base.
10 11 12 13 |
# File 'lib/wor/paginate/formatters/base.rb', line 10 def initialize(adapter, = {}) @adapter = adapter @options = end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
8 9 10 |
# File 'lib/wor/paginate/formatters/base.rb', line 8 def adapter @adapter end |
#content ⇒ Object
Returns the value of attribute content.
8 9 10 |
# File 'lib/wor/paginate/formatters/base.rb', line 8 def content @content end |
#formatter ⇒ Object
Returns the value of attribute formatter.
8 9 10 |
# File 'lib/wor/paginate/formatters/base.rb', line 8 def formatter @formatter end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/wor/paginate/formatters/base.rb', line 8 def @options end |
Instance Method Details
#format ⇒ Object
rubocop: disable Metrics/MethodLength
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/wor/paginate/formatters/base.rb', line 15 def format # rubocop: disable Metrics/MethodLength { page: serialized_content, count: count, total_pages: total_pages, total_count: [:total_count] || total_count, current_page: current_page, previous_page: previous_page, next_page: next_page, next_page_url: page_url(next_page), previous_page_url: page_url(previous_page) } end |