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
15 16 17 |
# File 'lib/lhs/concerns/record/configuration.rb', line 15 def configuration(args) @configuration = args.freeze || {} end |
#item_created_key ⇒ Object
31 32 33 34 35 |
# File 'lib/lhs/concerns/record/configuration.rb', line 31 def item_created_key symbolize_unless_complex( @configuration.try(:[], :item_created_key) ) end |
#item_key ⇒ Object
19 20 21 22 23 |
# File 'lib/lhs/concerns/record/configuration.rb', line 19 def item_key symbolize_unless_complex( @configuration.try(:[], :item_key) || :item ) end |
#items_key ⇒ Object
25 26 27 28 29 |
# File 'lib/lhs/concerns/record/configuration.rb', line 25 def items_key symbolize_unless_complex( @configuration.try(:[], :items_key) || :items ) end |
#limit_key(type = nil) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/lhs/concerns/record/configuration.rb', line 37 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
67 68 69 70 |
# File 'lib/lhs/concerns/record/configuration.rb', line 67 def paginated return true if @configuration.blank? @configuration.fetch(:paginated, true) end |
#pagination_key(type = nil) ⇒ Object
Key used for determine current page
51 52 53 54 55 56 |
# File 'lib/lhs/concerns/record/configuration.rb', line 51 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
59 60 61 62 63 |
# File 'lib/lhs/concerns/record/configuration.rb', line 59 def pagination_strategy symbolize_unless_complex( @configuration.try(:[], :pagination_strategy) || :offset ) end |
#total_key ⇒ Object
44 45 46 47 48 |
# File 'lib/lhs/concerns/record/configuration.rb', line 44 def total_key symbolize_unless_complex( @configuration.try(:[], :total_key) || :total ) end |