Class: Figroll::Config
- Inherits:
-
Object
- Object
- Figroll::Config
- Defined in:
- lib/figroll/config.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #load_file(config_file) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
7 8 9 |
# File 'lib/figroll/config.rb', line 7 def initialize reset end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/figroll/config.rb', line 5 def data @data end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
5 6 7 |
# File 'lib/figroll/config.rb', line 5 def environment @environment end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
5 6 7 |
# File 'lib/figroll/config.rb', line 5 def required @required end |
Instance Method Details
#load_file(config_file) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/figroll/config.rb', line 11 def load_file(config_file) return unless File.exists?(config_file) file_data = YAML.load_file(config_file) || {} # set up required keys file_data['required'] ||= [] file_data['required'].each do |key| required.push(Figroll.normalize(key)) end # load up the environment-specific data file_data['environments'] ||= {} @data = file_data['environments'][environment] || {} end |