Class: Serverkit::Loaders::BaseLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/serverkit/loaders/base_loader.rb

Direct Known Subclasses

RecipeLoader, VariablesLoader

Constant Summary collapse

YAML_EXTNAMES =
[".yaml", ".yml"].freeze

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ BaseLoader

Returns a new instance of BaseLoader.

Parameters:

  • path (String)


14
15
16
# File 'lib/serverkit/loaders/base_loader.rb', line 14

def initialize(path)
  @path = path
end

Instance Method Details

#loadObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/serverkit/loaders/base_loader.rb', line 18

def load
  if !pathname.exist?
    raise Errors::NonExistentPathError, pathname
  elsif has_directory_path?
    load_from_directory
  elsif has_erb_path?
    load_from_erb
  else
    load_from_data
  end
end