Module: Konfig
- Defined in:
- lib/konfig.rb,
lib/konfig/store.rb,
lib/konfig/adapter.rb,
lib/konfig/helpers.rb,
lib/konfig/evaluator.rb,
lib/konfig/rails/railtie.rb,
lib/konfig/child_class_manager.rb,
lib/konfig/rails/adapters/smtp_adapter.rb,
lib/konfig/rails/adapters/asset_expansion_adapter.rb
Overview
Provides a global accessor for configuration. ie. Konfig
Defined Under Namespace
Modules: ChildClassManager, Helpers Classes: Adapter, AssetExpansionAdapter, Evaluator, InitializeKonfig, SmtpAdapter, Store
Class Method Summary collapse
-
.[](key) ⇒ Object
Hash-style access to data.
- .default_store ⇒ Object
- .inspect ⇒ Object
-
.load_directory(path) ⇒ Object
Creates a default store and loads a directory into it.
-
.path ⇒ String
Returns the path where config files are located.
Class Method Details
.[](key) ⇒ Object
Hash-style access to data
23 24 25 26 27 28 |
# File 'lib/konfig.rb', line 23 def self.[](key) if !@default_store raise "Konfig default store not set. Call Konfig.load(path) to set one." end @default_store[key] end |
.default_store ⇒ Object
34 35 36 |
# File 'lib/konfig.rb', line 34 def self.default_store @default_store end |
.inspect ⇒ Object
30 31 32 |
# File 'lib/konfig.rb', line 30 def self.inspect (@default_store || self).inspect end |
.load_directory(path) ⇒ Object
Creates a default store and loads a directory into it
16 17 18 19 |
# File 'lib/konfig.rb', line 16 def self.load_directory(path) @default_store ||= Konfig::Store.new @default_store.load_directory(path) end |
.path ⇒ String
Returns the path where config files are located
8 9 10 |
# File 'lib/konfig/rails/railtie.rb', line 8 def self.path @path = File.join(Rails.root, "config", "settings") end |