Class: Begin::Config

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

Overview

The root-level template configuration structure. A class representation of the template config file (.begin.yml)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tags) ⇒ Config

Returns a new instance of Config.



13
14
15
# File 'lib/begin/config.rb', line 13

def initialize(tags)
  @tags = tags
end

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



11
12
13
# File 'lib/begin/config.rb', line 11

def tags
  @tags
end

Class Method Details

.from_file(path) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/begin/config.rb', line 17

def self.from_file(path)
  if path.exists?
    config = YAML.load_file path
    tags = HashTag.from_config_hash(config)
    Config.new tags
  else
    {}
  end
end