Class: ApiPagination::Configuration
- Inherits:
-
Object
- Object
- ApiPagination::Configuration
- Defined in:
- lib/api-pagination/configuration.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#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.
-
#response_formats ⇒ Object
Returns the value of attribute response_formats.
-
#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.
19 20 21 22 23 24 25 26 |
# File 'lib/api-pagination/configuration.rb', line 19 def initialize @total_header = 'Total' @per_page_header = 'Per-Page' @page_header = nil @include_total = true @base_url = nil @response_formats = [:json, :xml] end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
11 12 13 |
# File 'lib/api-pagination/configuration.rb', line 11 def base_url @base_url end |
#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 |
#response_formats ⇒ Object
Returns the value of attribute response_formats.
13 14 15 |
# File 'lib/api-pagination/configuration.rb', line 13 def response_formats @response_formats 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
15 16 17 |
# File 'lib/api-pagination/configuration.rb', line 15 def configure(&block) yield self end |
#paginator ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/api-pagination/configuration.rb', line 55 def paginator if instance_variable_defined? :@paginator @paginator else set_paginator end end |
#paginator=(paginator) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/api-pagination/configuration.rb', line 63 def paginator=(paginator) case paginator.to_sym when :pagy use_pagy when :kaminari use_kaminari when :will_paginate use_will_paginate else raise StandardError, "Unknown paginator: #{paginator}" end end |