Class: Corundum::ConfigurationStore
- Inherits:
-
Object
- Object
- Corundum::ConfigurationStore
- Defined in:
- lib/corundum/configuration_store.rb
Instance Attribute Summary collapse
-
#loaded ⇒ Object
readonly
Returns the value of attribute loaded.
Instance Method Summary collapse
-
#initialize ⇒ ConfigurationStore
constructor
A new instance of ConfigurationStore.
- #register_search_path(from_file) ⇒ Object
Constructor Details
#initialize ⇒ ConfigurationStore
Returns a new instance of ConfigurationStore.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/corundum/configuration_store.rb', line 5 def initialize @valise = Valise::Set.define do rw "~/.corundum" rw "/usr/share/corundum" rw "/etc/corundum" ro from_here("default_configuration") handle "preferences.yaml", :yaml, :hash_merge end @loaded ||= Hash.new{|h,k| h[k] = @valise.find(k).contents} end |
Instance Attribute Details
#loaded ⇒ Object (readonly)
Returns the value of attribute loaded.
18 19 20 |
# File 'lib/corundum/configuration_store.rb', line 18 def loaded @loaded end |
Instance Method Details
#register_search_path(from_file) ⇒ Object
20 21 22 23 24 |
# File 'lib/corundum/configuration_store.rb', line 20 def register_search_path(from_file) directory = File::dirname(from_file) @valise.prepend_search_root(Valise::SearchRoot.new(directory)) loaded.clear end |