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.



16
17
18
19
20
# File 'lib/etcher/loaders/yaml.rb', line 16

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

Instance Method Details

#callObject



22
23
24
25
26
27
28
# File 'lib/etcher/loaders/yaml.rb', line 22

def call
  load
rescue Errno::ENOENT, TypeError then debug_invalid_path
rescue Psych::AliasesNotEnabled then alias_failure
rescue Psych::DisallowedClass => error then disallowed_failure error
rescue Psych::SyntaxError => error then syntax_failure error
end