class SmartListing::Configuration

Constants

DEFAULTS
DEFAULT_PAGE_SIZES

Attributes

options[R]

Public Class Methods

new() click to toggle source
# File lib/smart_listing/config.rb, line 106
def initialize
  @options = {}
end

Public Instance Methods

classes(key) click to toggle source
# File lib/smart_listing/config.rb, line 123
def classes key
  @options[:constants].try(:[], :classes).try(:[], key) || DEFAULTS[:constants][:classes][key]
end
constants(key, value = nil) click to toggle source
# File lib/smart_listing/config.rb, line 114
def constants key, value = nil
  if value && !value.empty?
    @options[:constants] ||= {}
    @options[:constants][key] ||= {}
    @options[:constants][key].merge!(value)
  end
  @options[:constants].try(:[], key) || DEFAULTS[:constants][key]
end
data_attributes(key) click to toggle source
# File lib/smart_listing/config.rb, line 127
def data_attributes key
  @options[:constants].try(:[], :data_attributes).try(:[], key) || DEFAULTS[:constants][:data_attributes][key]
end
dump() click to toggle source
# File lib/smart_listing/config.rb, line 151
def dump
  DEFAULTS.deep_merge(@options)
end
dump_json() click to toggle source
# File lib/smart_listing/config.rb, line 155
def dump_json
  dump.to_json
end
element_templates(key) click to toggle source
# File lib/smart_listing/config.rb, line 135
def element_templates key
  @options[:constants].try(:[], :element_templates).try(:[], key) || DEFAULTS[:constants][:element_templates][key]
end
global_options(value = nil) click to toggle source
# File lib/smart_listing/config.rb, line 139
def global_options value = nil
  if value && !value.empty?
    @options[:global_options] ||= {}
    @options[:global_options].merge!(value)
  end
  !@options[:global_options] ? DEFAULTS[:global_options] : DEFAULTS[:global_options].deep_merge(@options[:global_options])
end
method_missing(sym, *args, &block) click to toggle source
# File lib/smart_listing/config.rb, line 110
def method_missing(sym, *args, &block)
  @options[sym] = *args
end
selectors(key) click to toggle source
# File lib/smart_listing/config.rb, line 131
def selectors key
  @options[:constants].try(:[], :selectors).try(:[], key) || DEFAULTS[:constants][:selectors][key]
end
to_json() click to toggle source
# File lib/smart_listing/config.rb, line 147
def to_json
  @options.to_json
end