Module: SearchKit::Configuration
- Included in:
- SearchKit
- Defined in:
- lib/search_kit/configuration.rb
Instance Method Summary collapse
- #config ⇒ Object
- #configure {|config| ... } ⇒ Object
- #fetch(key) ⇒ Object
- #set_config(key, value) ⇒ Object
- #show_config(key) ⇒ Object
Instance Method Details
#config ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/search_kit/configuration.rb', line 12 def config return @config if @config root = UserConfig.new(".search-kit") yaml = root['config.yml'] config = OpenStruct.new yaml.each { |key, value| config.send("#{key}=", value) } @config = config end |
#configure {|config| ... } ⇒ Object
8 9 10 |
# File 'lib/search_kit/configuration.rb', line 8 def configure yield(config) if block_given? end |
#fetch(key) ⇒ Object
35 36 37 |
# File 'lib/search_kit/configuration.rb', line 35 def fetch(key) ENV.fetch(key, show_config(key.downcase) || default(key.to_sym)) end |