Class: EacRubyUtils::Configs
- Inherits:
-
Object
show all
- Includes:
- SimpleCache
- Defined in:
- lib/eac_ruby_utils/configs.rb,
lib/eac_ruby_utils/configs/file.rb
Defined Under Namespace
Classes: File
Constant Summary
Constants included
from SimpleCache
SimpleCache::UNCACHED_METHOD_PATTERN
Instance Attribute Summary collapse
Instance Method Summary
collapse
#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, options = {})
@configs_key = configs_key
@options = 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
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
|
Returns the value of attribute options.
14
15
16
|
# File 'lib/eac_ruby_utils/configs.rb', line 14
def options
@options
end
|
Instance Method Details
#[](entry_key) ⇒ Object
43
44
45
|
# File 'lib/eac_ruby_utils/configs.rb', line 43
def [](entry_key)
read_entry(entry_key)
end
|
#[]=(entry_key, entry_value) ⇒ Object
35
36
37
|
# File 'lib/eac_ruby_utils/configs.rb', line 35
def []=(entry_key, entry_value)
write_entry(entry_key, entry_value)
end
|
#autosave? ⇒ Boolean
51
52
53
|
# File 'lib/eac_ruby_utils/configs.rb', line 51
def autosave?
file.autosave?
end
|
23
24
25
|
# File 'lib/eac_ruby_utils/configs.rb', line 23
def clear
file.clear
end
|
31
32
33
|
# File 'lib/eac_ruby_utils/configs.rb', line 31
def load
file.load
end
|
#read_entry(entry_key) ⇒ Object
47
48
49
|
# File 'lib/eac_ruby_utils/configs.rb', line 47
def read_entry(entry_key)
file.read(entry_key)
end
|
27
28
29
|
# File 'lib/eac_ruby_utils/configs.rb', line 27
def save
file.save
end
|
#write_entry(entry_key, entry_value) ⇒ Object
39
40
41
|
# File 'lib/eac_ruby_utils/configs.rb', line 39
def write_entry(entry_key, entry_value)
file.write(entry_key, entry_value)
end
|