Module: Durt::Configurable
- Included in:
- Project
- Defined in:
- lib/durt/configurable.rb
Constant Summary collapse
- STORE_FILE_NAME =
'.durt.yml'
- STORE_FILE_PATH =
File.("~/#{STORE_FILE_NAME}")
Instance Method Summary collapse
- #config ⇒ Object
- #config!(value) ⇒ Object
- #config? ⇒ Boolean
- #config_key ⇒ Object
- #config_store ⇒ Object
Instance Method Details
#config ⇒ Object
10 11 12 13 14 |
# File 'lib/durt/configurable.rb', line 10 def config config_store.transaction do config_store[config_key] end end |
#config!(value) ⇒ Object
16 17 18 19 20 |
# File 'lib/durt/configurable.rb', line 16 def config!(value) config_store.transaction do config_store[config_key] = value end end |
#config? ⇒ Boolean
22 23 24 |
# File 'lib/durt/configurable.rb', line 22 def config? !config.nil? end |
#config_key ⇒ Object
26 27 28 |
# File 'lib/durt/configurable.rb', line 26 def config_key raise NotImplementedError end |
#config_store ⇒ Object
30 31 32 |
# File 'lib/durt/configurable.rb', line 30 def config_store @config_store ||= YAML::Store.new(STORE_FILE_PATH) end |