class Bosh::Cli::ManifestWarnings

Constants

WARNING_MESSAGES

Attributes

manifest[R]

Public Class Methods

new(manifest) click to toggle source
# File lib/cli/manifest_warnings.rb, line 10
def initialize(manifest)
  @manifest = manifest
end

Public Instance Methods

report() click to toggle source
# File lib/cli/manifest_warnings.rb, line 14
def report
  WARNING_MESSAGES.each do |keypath, warning|
    say(warning.make_yellow) if keypath_exists?(manifest, keypath.split('.'))
  end
end

Private Instance Methods

keypath_exists?(config, keypath) click to toggle source
# File lib/cli/manifest_warnings.rb, line 24
def keypath_exists?(config, keypath)
  case
    when keypath.empty?
      true

    when keypath.first == '[]'
      config.is_a?(Array) && config.any? { |element| keypath_exists?(element, keypath[1..-1]) }

    when config.respond_to?(:has_key?) && config.has_key?(keypath.first)
      keypath_exists?(config[keypath.first], keypath[1..-1])
  end
end