Class: Bosh::Deployer::MicroboshSettings

Inherits:
RecursiveOpenStruct
  • Object
show all
Defined in:
lib/bosh-deployer/microbosh_settings.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#filepathObject (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