Class: Puppet::Pops::Binder::Config::BinderConfigChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/pops/binder/config/binder_config_checker.rb

Overview

Validates the consistency of a Binder::BinderConfig

Instance Method Summary collapse

Constructor Details

#initialize(diagnostics) ⇒ BinderConfigChecker

Create an instance with a diagnostic producer that will receive the result during validation



8
9
10
11
12
13
# File 'lib/puppet/pops/binder/config/binder_config_checker.rb', line 8

def initialize(diagnostics)
  @diagnostics = diagnostics
  t = Puppet::Pops::Types
  @type_calculator = t::TypeCalculator.new()
  @array_of_string_type = t::TypeFactory.array_of(t::TypeFactory.string())
end

Instance Method Details

#validate(data, config_file) ⇒ Object

Validate the consistency of the given data. Diagnostics will be emitted to the DiagnosticProducer that was set when this checker was created



22
23
24
25
26
27
28
29
30
# File 'lib/puppet/pops/binder/config/binder_config_checker.rb', line 22

def validate(data, config_file)
  @unique_layer_names = Set.new()

  if data.is_a?(Hash)
    check_top_level(data, config_file)
  else
    accept(Issues::CONFIG_IS_NOT_HASH, config_file)
  end
end