Class: Bosh::Deployer::MicroboshSettings
- Inherits:
-
RecursiveOpenStruct
- Object
- RecursiveOpenStruct
- Bosh::Deployer::MicroboshSettings
- Defined in:
- lib/bosh-deployer/microbosh_settings.rb
Instance Attribute Summary collapse
-
#filepath ⇒ Object
readonly
Returns the value of attribute filepath.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(h = nil, args = {}) ⇒ MicroboshSettings
constructor
A new instance of MicroboshSettings.
Constructor Details
#initialize(h = nil, args = {}) ⇒ MicroboshSettings
Returns a new instance of MicroboshSettings.
7 8 9 10 11 12 13 14 15 |
# File 'lib/bosh-deployer/microbosh_settings.rb', line 7 def initialize(h=nil, args={}) if h && h.is_a?(String) @filepath ||= h super(YAML.load_file(filepath)) if File.exists?(filepath) else @filepath ||= '~/.bootstrap/settings.yml' super(h, args) end end |
Instance Attribute Details
#filepath ⇒ Object (readonly)
Returns the value of attribute filepath.
5 6 7 |
# File 'lib/bosh-deployer/microbosh_settings.rb', line 5 def filepath @filepath end |
Class Method Details
.load(filepath = nil) ⇒ Object
17 18 19 20 21 |
# File 'lib/bosh-deployer/microbosh_settings.rb', line 17 def self.load(filepath = nil) new(filepath).tap do |settings| return unless settings.to_a end end |