Module: LHS::Record::Configuration::ClassMethods
- Defined in:
- lib/lhs/concerns/record/configuration.rb
Instance Method Summary collapse
- #configuration(args) ⇒ Object
- #item_created_key ⇒ Object
- #item_key ⇒ Object
- #items_key ⇒ Object
- #limit_key(type = nil) ⇒ Object
-
#paginated ⇒ Object
Allows record to be configured as not paginated, as by default it’s considered paginated.
-
#pagination_key(type = nil) ⇒ Object
Key used for determine current page.
-
#pagination_strategy ⇒ Object
Strategy used for calculationg next pages and navigate pages.
- #total_key ⇒ Object
Instance Method Details
#configuration(args) ⇒ Object
13 14 15 |
# File 'lib/lhs/concerns/record/configuration.rb', line 13 def configuration(args) @configuration = args.freeze || {} end |
#item_created_key ⇒ Object
29 30 31 32 33 |
# File 'lib/lhs/concerns/record/configuration.rb', line 29 def item_created_key symbolize_unless_complex( @configuration.try(:[], :item_created_key) ) end |
#item_key ⇒ Object
17 18 19 20 21 |
# File 'lib/lhs/concerns/record/configuration.rb', line 17 def item_key symbolize_unless_complex( @configuration.try(:[], :item_key) || :item ) end |
#items_key ⇒ Object
23 24 25 26 27 |
# File 'lib/lhs/concerns/record/configuration.rb', line 23 def items_key symbolize_unless_complex( @configuration.try(:[], :items_key) || :items ) end |
#limit_key(type = nil) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/lhs/concerns/record/configuration.rb', line 35 def limit_key(type = nil) symbolize_unless_complex( pagination_parameter(@configuration.try(:[], :limit_key), type) || :limit ) end |
#paginated ⇒ Object
Allows record to be configured as not paginated, as by default it’s considered paginated
65 66 67 68 |
# File 'lib/lhs/concerns/record/configuration.rb', line 65 def paginated return true if @configuration.blank? @configuration.fetch(:paginated, true) end |
#pagination_key(type = nil) ⇒ Object
Key used for determine current page
49 50 51 52 53 54 |
# File 'lib/lhs/concerns/record/configuration.rb', line 49 def pagination_key(type = nil) symbolize_unless_complex( pagination_parameter(@configuration.try(:[], :pagination_key), type) || :offset ) end |
#pagination_strategy ⇒ Object
Strategy used for calculationg next pages and navigate pages
57 58 59 60 61 |
# File 'lib/lhs/concerns/record/configuration.rb', line 57 def pagination_strategy symbolize_unless_complex( @configuration.try(:[], :pagination_strategy) || :offset ) end |
#total_key ⇒ Object
42 43 44 45 46 |
# File 'lib/lhs/concerns/record/configuration.rb', line 42 def total_key symbolize_unless_complex( @configuration.try(:[], :total_key) || :total ) end |