Sha256: 1a15cca7196b5b31fc5b22e9c01ee81a15c68e20da58b46b1bddf61672a8dacb
Contents?: true
Size: 994 Bytes
Versions: 4
Compression:
Stored size: 994 Bytes
Contents
module Findable class Configuration VALID_OPTIONS = [ :redis_options, :serializer, :seed_dir, :seed_file, ].freeze attr_accessor *VALID_OPTIONS def initialize reset end def configure yield self end def merge(params) self.dup.merge!(params) end def merge!(params) params.keys.each {|key| self.send("#{key}=", params[key]) } self end def reset self.redis_options = nil self.serializer = JSON self.seed_dir = defined?(Rails) ? Rails.root.join("db", "findable_seeds") : nil self.seed_file = defined?(Rails) ? Rails.root.join("db", "findable_seeds.rb") : nil end module Accessible def configure(options = {}, &block) config.merge!(options) unless options.empty? config.configure(&block) if block_given? end def config @_config ||= Configuration.new end end end extend Configuration::Accessible end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
findable-0.2.2 | lib/findable/configuration.rb |
findable-0.2.1 | lib/findable/configuration.rb |
findable-0.2.0 | lib/findable/configuration.rb |
findable-0.1.5 | lib/findable/configuration.rb |