Sha256: b12909d02eff1130182d09c53b580019137b173ac4edc2ca09e87fa302aa2531
Contents?: true
Size: 946 Bytes
Versions: 1
Compression:
Stored size: 946 Bytes
Contents
module Findable class Configuration VALID_OPTIONS = [ :redis_options, :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.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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
findable-0.1.4 | lib/findable/configuration.rb |