Class: Capistrano::Campout::Sources::YAMLSource

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano-campout/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ YAMLSource

Returns a new instance of YAMLSource.



19
20
21
# File 'lib/capistrano-campout/options.rb', line 19

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



17
18
19
# File 'lib/capistrano-campout/options.rb', line 17

def path
  @path
end

Instance Method Details

#loadObject

returns a config hash from the YML file



24
25
26
27
28
29
# File 'lib/capistrano-campout/options.rb', line 24

def load
  if @path and File.exists?(@path.to_s)
    result = YAML.load(IO.read(@path.to_s))
  end
  result || {}
end