class Kubes::Compiler::Strategy::Erb

Public Class Methods

new(options={}) click to toggle source
Calls superclass method Kubes::Compiler::Strategy::Base::new
# File lib/kubes/compiler/strategy/erb.rb, line 10
def initialize(options={})
  super
  # For ERB scope is in this same Strategy::Erb class
  # For DSL scope is within the each for the Resource classes. IE: kubes/compile/dsl/core/base.rb
  load_runtime_helpers
end

Public Instance Methods

render_result(path) click to toggle source
# File lib/kubes/compiler/strategy/erb.rb, line 17
def render_result(path)
  return unless File.exist?(path)

  yaml = RenderMePretty.result(path, context: self)
  result = yaml_load(path, yaml)
  # in case of blank yaml doc a Boolean false is returned. else Hash or Array is returned
  %w[Array Hash].include?(result.class.to_s) ? result : {}
end
yaml_load(path, yaml) click to toggle source
# File lib/kubes/compiler/strategy/erb.rb, line 26
def yaml_load(path, yaml)
  YAML.load(yaml)
rescue Psych::SyntaxError
  YamlError.new(path, yaml).show
  exit 1
end