Class: Packwerk::FolderPrivacy::Validator

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Validator
Defined in:
lib/packwerk/folder_privacy/validator.rb

Constant Summary collapse

Result =
Packwerk::Validator::Result

Instance Method Summary collapse

Instance Method Details

#call(package_set, configuration) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/packwerk/folder_privacy/validator.rb', line 13

def call(package_set, configuration)
  results = T.let([], T::Array[Result])

  package_manifests_settings_for(configuration, 'enforce_folder_privacy').each do |config, setting|
    next if setting.nil?

    next if [TrueClass, FalseClass].include?(setting.class) || setting == 'strict'

    results << Result.new(
      ok: false,
      error_value: "\tInvalid 'enforce_folder_privacy' option: #{setting.inspect} in #{config.inspect}"
    )
  end

  merge_results(results, separator: "\n---\n")
end

#permitted_keysObject



31
32
33
# File 'lib/packwerk/folder_privacy/validator.rb', line 31

def permitted_keys
  %w[enforce_folder_privacy]
end