Sha256: 35464e8c9576abb69c7d340eae77d0ea641b079c33dbd470b2f5f5a17acca571
Contents?: true
Size: 929 Bytes
Versions: 3
Compression:
Stored size: 929 Bytes
Contents
require 'active_support' class LHS::Record # Allows configuring endpoints # like which keys are used for the items, offset, total etc. module Configuration extend ActiveSupport::Concern mattr_accessor :configuration module ClassMethods def configuration(args) @configuration = args.freeze || {} end def items_key @configuration.try(:[], :items_key) || :items end def limit_key @configuration.try(:[], :limit_key) || :limit end def total_key @configuration.try(:[], :total_key) || :total end # Key used for determine current page def pagination_key @configuration.try(:[], :pagination_key) || :offset end # Strategy used for calculationg next pages and navigate pages def pagination_strategy @configuration.try(:[], :pagination_strategy) || :offset end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lhs-4.2.0 | lib/lhs/concerns/record/configuration.rb |
lhs-4.1.0 | lib/lhs/concerns/record/configuration.rb |
lhs-4.0.0 | lib/lhs/concerns/record/configuration.rb |