Class: Forger::Config

Inherits:
Base
  • Object
show all
Includes:
Template
Defined in:
lib/forger/config.rb

Constant Summary collapse

@@data =
nil

Constants inherited from Base

Base::BUILD_ROOT, Base::SCRIPTS_INFO_PATH

Instance Method Summary collapse

Methods included from Template

#context

Methods inherited from Base

#derandomize, #randomize

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



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

def initialize(options={})
  super
  @path = options[:path] || "#{Forger.root}/config/#{Forger.env}.yml"
end

Instance Method Details

#dataObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/forger/config.rb', line 14

def data
  return @@data if @@data

  text = RenderMePretty.result(@path, context: context)
  @@data = YAML.load(text)
rescue Errno::ENOENT => e
  puts e.message
  puts "The #{@path} does not exist. Please double check that it exists."
  exit
end