Class: Moodwall::ConfigFile

Inherits:
Object
  • Object
show all
Defined in:
lib/moodwall/config_file.rb

Constant Summary collapse

DIRECTORY =
"#{ Dir.home }/.config/moodwall".freeze
FILE =
"config.yml".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfigFile

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

#dataObject (readonly)

Returns the value of attribute data.



9
10
11
# File 'lib/moodwall/config_file.rb', line 9

def data
  @data
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/moodwall/config_file.rb', line 9

def path
  @path
end