class Kontena::Cli::Stacks::YAML::FileLoader

Public Class Methods

is_file?(parent) click to toggle source
# File lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb, line 10
def self.is_file?(parent)
  parent.is_a?(FileLoader)
end
match?(source, parent = nil) click to toggle source
# File lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb, line 6
def self.match?(source, parent = nil)
  ::File.exist?(with_context(source, parent))
end
new(*args) click to toggle source
# File lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb, line 22
def initialize(*args)
  super
  @source = self.class.with_context(@source, @parent)
end
with_context(source, parent = nil) click to toggle source
# File lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb, line 14
def self.with_context(source, parent = nil)
  if is_file?(parent)
    File.join(File.dirname(parent.source),  source)
  else
    File.absolute_path(source)
  end
end

Public Instance Methods

origin() click to toggle source
# File lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb, line 31
def origin
  "file"
end
read_content() click to toggle source
# File lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb, line 27
def read_content
  ::File.read(source)
end
registry() click to toggle source
# File lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb, line 35
def registry
  "file://"
end