Sha256: d839d232cbc9d809b03d90d40570c5f5a09dcf49283dc35a11a376317a7425dc

Contents?: true

Size: 746 Bytes

Versions: 20

Compression:

Stored size: 746 Bytes

Contents

module Brillo
  # Responsible for asserting that the config file is valid
  class Scrubber
    include Common

    attr_reader :config

    def initialize(config)
      parse_config(config)
    end

    def validate
      errors = Hash.new({}.freeze)
      klass_association_map.each do |klass, options|
        begin
          real_klass = deserialize_class(klass)
        rescue
          errors[klass][:name] = "No such class #{klass.camelize}, did you use the singular?"
        end
        begin
          tactic = options.fetch("tactic").to_sym
        rescue KeyError
          errors[klass][:tactic] "Tactic not specified"
        end
      end
    end

    def deserialize_class(klass)
      klass.camelize.constantize
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
brillo-2.1.0 lib/brillo/validator.rb
brillo-2.0.0 lib/brillo/validator.rb
brillo-2.0.0.rc4 lib/brillo/validator.rb
brillo-2.0.0.rc3 lib/brillo/validator.rb
brillo-2.0.0.rc2 lib/brillo/validator.rb
brillo-2.0.0.rc1 lib/brillo/validator.rb
brillo-1.3.1 lib/brillo/validator.rb
brillo-1.3.1.pre1 lib/brillo/validator.rb
brillo-1.3.0 lib/brillo/validator.rb
brillo-1.2.2 lib/brillo/validator.rb
brillo-1.2.1 lib/brillo/validator.rb
brillo-1.2.0 lib/brillo/validator.rb
brillo-1.1.4 lib/brillo/validator.rb
brillo-1.1.4.pre2 lib/brillo/validator.rb
brillo-1.1.4.pre1 lib/brillo/validator.rb
brillo-1.1.3 lib/brillo/validator.rb
brillo-1.1.2 lib/brillo/validator.rb
brillo-1.1.1 lib/brillo/validator.rb
brillo-1.1.0 lib/brillo/validator.rb
brillo-1.0.0 lib/brillo/validator.rb