Class: EacRubyUtils::Configs
- Includes:
- SimpleCache
- Defined in:
- lib/eac_ruby_utils/configs.rb,
lib/eac_ruby_utils/configs/base.rb,
lib/eac_ruby_utils/configs/file.rb
Defined Under Namespace
Constant Summary
Constants included from SimpleCache
SimpleCache::UNCACHED_METHOD_PATTERN
Instance Attribute Summary collapse
-
#configs_key ⇒ Object
readonly
Returns the value of attribute configs_key.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #[](entry_key) ⇒ Object
- #[]=(entry_key, entry_value) ⇒ Object
-
#initialize(configs_key, options = {}) ⇒ Configs
constructor
Valid options: [:storage_path].
- #read_entry(entry_key) ⇒ Object
- #write_entry(entry_key, entry_value) ⇒ Object
Methods included from SimpleCache
#method_missing, #reset_cache, #respond_to_missing?
Constructor Details
#initialize(configs_key, options = {}) ⇒ Configs
Valid options: [:storage_path]
17 18 19 20 21 |
# File 'lib/eac_ruby_utils/configs.rb', line 17 def initialize(configs_key, = {}) @configs_key = configs_key @options = .to_sym_keys_hash.freeze load end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class EacRubyUtils::SimpleCache
Instance Attribute Details
#configs_key ⇒ Object (readonly)
Returns the value of attribute configs_key.
14 15 16 |
# File 'lib/eac_ruby_utils/configs.rb', line 14 def configs_key @configs_key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'lib/eac_ruby_utils/configs.rb', line 14 def @options end |
Instance Method Details
#[](entry_key) ⇒ Object
37 38 39 |
# File 'lib/eac_ruby_utils/configs.rb', line 37 def [](entry_key) read_entry(entry_key) end |
#[]=(entry_key, entry_value) ⇒ Object
29 30 31 |
# File 'lib/eac_ruby_utils/configs.rb', line 29 def []=(entry_key, entry_value) write_entry(entry_key, entry_value) end |
#read_entry(entry_key) ⇒ Object
41 42 43 |
# File 'lib/eac_ruby_utils/configs.rb', line 41 def read_entry(entry_key) file.read(entry_key) end |
#write_entry(entry_key, entry_value) ⇒ Object
33 34 35 |
# File 'lib/eac_ruby_utils/configs.rb', line 33 def write_entry(entry_key, entry_value) file.write(entry_key, entry_value) end |