Sha256: 97eaed668b68c718af729b822c6d55af43b3700c27c9d616c66869633313cd01

Contents?: true

Size: 859 Bytes

Versions: 10

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

# @api private
# @since 0.20.0
class Qonfig::Validation::Validators::Composite
  # @param data_set [Qonfig::DataSet]
  # @return [void]
  #
  # @api private
  # @since 0.20.0
  def initialize(data_set)
    @data_set = data_set
    @validators = data_set.class.validators.dup
  end

  # @return [void]
  #
  # @api private
  # @since 0.20.0
  def validate!
    validators.each do |validator|
      validator.validate(data_set)
    end
  end

  # @return [Boolean]
  #
  # @api private
  # @since 0.20.0
  def valid?
    validate!
    true
  rescue Qonfig::ValidationError
    false
  end

  private

  # @return [Qonfig::DataSet]
  #
  # @api private
  # @since 0.20.0
  attr_reader :data_set

  # @return [Qonfig::Validation::Collections::InstanceCollection]
  #
  # @api private
  # @since 0.20.0
  attr_reader :validators
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
qonfig-0.28.0 lib/qonfig/validation/validators/composite.rb
qonfig-0.27.0 lib/qonfig/validation/validators/composite.rb
qonfig-0.26.0 lib/qonfig/validation/validators/composite.rb
qonfig-0.25.0 lib/qonfig/validation/validators/composite.rb
qonfig-0.24.1 lib/qonfig/validation/validators/composite.rb
qonfig-0.24.0 lib/qonfig/validation/validators/composite.rb
qonfig-0.23.0 lib/qonfig/validation/validators/composite.rb
qonfig-0.22.0 lib/qonfig/validation/validators/composite.rb
qonfig-0.21.0 lib/qonfig/validation/validators/composite.rb
qonfig-0.20.0 lib/qonfig/validation/validators/composite.rb