Class: Etcher::Loaders::YAML

Inherits:
Object
  • Object
show all
Defined in:
lib/etcher/loaders/yaml.rb

Overview

Loads a YAML configuration.

Instance Method Summary collapse

Constructor Details

#initialize(path, fallback: Core::EMPTY_HASH, logger: LOGGER) ⇒ YAML

Returns a new instance of YAML.



13
14
15
16
17
# File 'lib/etcher/loaders/yaml.rb', line 13

def initialize path, fallback: Core::EMPTY_HASH, logger: LOGGER
  @path = path
  @fallback = fallback
  @logger = logger
end

Instance Method Details

#callObject



19
20
21
22
23
24
25
# File 'lib/etcher/loaders/yaml.rb', line 19

def call
  load
rescue TypeError, Errno::ENOENT
  debug_and_fallback "Invalid path: #{path_info}. Using fallback."
rescue Psych::Exception => error
  debug_and_fallback "#{error.message}. Path: #{path_info}. Using fallback."
end