Class: Conductor::Config
- Inherits:
-
Object
- Object
- Conductor::Config
- Defined in:
- lib/conductor/config.rb
Overview
Configuration methods
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Configuration.
-
#config_file ⇒ Object
writeonly
Config file path.
-
#tracks ⇒ Object
readonly
Tracks element.
Instance Method Summary collapse
- #configure ⇒ Object
-
#initialize ⇒ Config
constructor
Instantiate a configuration.
Constructor Details
#initialize ⇒ Config
Instantiate a configuration
18 19 20 |
# File 'lib/conductor/config.rb', line 18 def initialize @config_file = File.("~/.config/conductor/tracks.yaml") end |
Instance Attribute Details
#config ⇒ Object (readonly)
Configuration
7 8 9 |
# File 'lib/conductor/config.rb', line 7 def config @config end |
#config_file=(value) ⇒ Object (writeonly)
Config file path
11 12 13 |
# File 'lib/conductor/config.rb', line 11 def config_file=(value) @config_file = value end |
#tracks ⇒ Object (readonly)
Tracks element
9 10 11 |
# File 'lib/conductor/config.rb', line 9 def tracks @tracks end |
Instance Method Details
#configure ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/conductor/config.rb', line 22 def configure res = create_config(@config_file) return false unless res @config ||= YAML.safe_load(IO.read(@config_file)) @tracks = @config["tracks"].symbolize_keys return true end |