Class: ApiPagination::Configuration
- Inherits:
-
Object
- Object
- ApiPagination::Configuration
- Defined in:
- lib/api-pagination/configuration.rb
Instance Attribute Summary collapse
-
#include_total ⇒ Object
Returns the value of attribute include_total.
-
#page_header ⇒ Object
Returns the value of attribute page_header.
-
#per_page_header ⇒ Object
Returns the value of attribute per_page_header.
-
#total_header ⇒ Object
Returns the value of attribute total_header.
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #paginator ⇒ Object
- #paginator=(paginator) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 |
# File 'lib/api-pagination/configuration.rb', line 15 def initialize @total_header = 'Total' @per_page_header = 'Per-Page' @page_header = nil @include_total = true end |
Instance Attribute Details
#include_total ⇒ Object
Returns the value of attribute include_total.
9 10 11 |
# File 'lib/api-pagination/configuration.rb', line 9 def include_total @include_total end |
#page_header ⇒ Object
Returns the value of attribute page_header.
7 8 9 |
# File 'lib/api-pagination/configuration.rb', line 7 def page_header @page_header end |
#per_page_header ⇒ Object
Returns the value of attribute per_page_header.
5 6 7 |
# File 'lib/api-pagination/configuration.rb', line 5 def per_page_header @per_page_header end |
#total_header ⇒ Object
Returns the value of attribute total_header.
3 4 5 |
# File 'lib/api-pagination/configuration.rb', line 3 def total_header @total_header end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
11 12 13 |
# File 'lib/api-pagination/configuration.rb', line 11 def configure(&block) yield self end |
#paginator ⇒ Object
49 50 51 |
# File 'lib/api-pagination/configuration.rb', line 49 def paginator @paginator || set_paginator end |
#paginator=(paginator) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/api-pagination/configuration.rb', line 53 def paginator=(paginator) case paginator.to_sym when :kaminari use_kaminari when :will_paginate use_will_paginate else raise StandardError, "Unknown paginator: #{paginator}" end end |