Class: ElectricMonk::Config

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

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



35
36
37
# File 'lib/electric_monk.rb', line 35

def initialize(path)
  @config = TomlRB.load_file(path)
end

Instance Method Details

#projectsObject



43
44
45
46
47
48
49
50
51
# File 'lib/electric_monk.rb', line 43

def projects
  @config.fetch("projects").map do |name, attributes|
    Project.new(
      root: root,
      name: name,
      origin: attributes.fetch("origin")
    )
  end
end

#rootObject



39
40
41
# File 'lib/electric_monk.rb', line 39

def root
  @root ||= File.expand_path(@config.fetch("root"))
end