Class: Conductor::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/conductor/config.rb

Overview

Configuration methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Instantiate a configuration



18
19
20
# File 'lib/conductor/config.rb', line 18

def initialize
  @config_file = File.expand_path("~/.config/conductor/tracks.yaml")
end

Instance Attribute Details

#configObject (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

#tracksObject (readonly)

Tracks element



9
10
11
# File 'lib/conductor/config.rb', line 9

def tracks
  @tracks
end

Instance Method Details

#configureObject



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