Class: Construi::Config::Global
- Inherits:
-
Object
- Object
- Construi::Config::Global
- Includes:
- Environment
- Defined in:
- lib/construi/config.rb
Instance Attribute Summary collapse
-
#yaml ⇒ Object
readonly
Returns the value of attribute yaml.
Instance Method Summary collapse
- #env ⇒ Object
-
#initialize(yaml) ⇒ Global
constructor
A new instance of Global.
- #target(target) ⇒ Object
Methods included from Environment
Methods included from Files
Methods included from Image
#build, #image, #image_configured, #image_configured?
Constructor Details
#initialize(yaml) ⇒ Global
Returns a new instance of Global.
72 73 74 |
# File 'lib/construi/config.rb', line 72 def initialize(yaml) @yaml = yaml end |
Instance Attribute Details
#yaml ⇒ Object (readonly)
Returns the value of attribute yaml.
70 71 72 |
# File 'lib/construi/config.rb', line 70 def yaml @yaml end |
Instance Method Details
#env ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/construi/config.rb', line 76 def env return [] if yaml['environment'].nil? yaml['environment'].reduce([]) do |acc, e| key = e.partition('=').first value = e.partition('=').last value = ENV[key] if value.empty? acc << "#{key}=#{value}" unless value.nil? or value.empty? acc end end |
#target(target) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/construi/config.rb', line 90 def target(target) targets = yaml['targets'] return nil if targets.nil? return Target.new yaml['targets'][target], self end |