Class: Moodwall::ConfigFile
- Inherits:
-
Object
- Object
- Moodwall::ConfigFile
- Defined in:
- lib/moodwall/config_file.rb
Constant Summary collapse
- DIRECTORY =
"#{ Dir.home }/.config/moodwall".freeze
- FILE =
"config.yml".freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize ⇒ ConfigFile
constructor
A new instance of ConfigFile.
Constructor Details
#initialize ⇒ ConfigFile
Returns a new instance of ConfigFile.
11 12 13 14 15 |
# File 'lib/moodwall/config_file.rb', line 11 def initialize @path = File.join(DIRECTORY, FILE) create_directory && prepare_file @data = YAML.safe_load(File.read(path)) || {} end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/moodwall/config_file.rb', line 9 def data @data end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/moodwall/config_file.rb', line 9 def path @path end |