Sha256: 1df967469dcf1cbd821a30276a258f09b0f677e8fb692d72ea23434993f8476e

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

# @api private
# @since 0.13.0
class Qonfig::Validator::Basic
  # @return [String, Symbol, NilClass]
  #
  # @api private
  # @since 0.13.0
  attr_reader :setting_key_matcher

  # @return [Boolean]
  #
  # @api private
  # @since 0.17.0
  attr_reader :strict

  # @param setting_key_matcher [Qonfig::Settings::KeyMatcher, NilClass]
  # @param strict [Boolean]
  # @return [void]
  #
  # @api private
  # @since 0.13.0
  def initialize(setting_key_matcher, strict)
    @setting_key_matcher = setting_key_matcher
    @strict = strict
  end

  # @param data_set [Qonfig::DataSet]
  # @return [Boolean]
  #
  # @api private
  # @since 0.13.0
  def validate(data_set)
    setting_key_provided? ? validate_concrete(data_set) : validate_full(data_set)
  end

  private

  # @return [Boolean]
  #
  # @api private
  # @since 0.13.0
  def setting_key_provided?
    !setting_key_matcher.nil?
  end

  # @param data_set [Qonfig::DataSet]
  # @return [Any]
  #
  # @api private
  # @since 0.13.0
  def validate_full(data_set); end

  # @param data_set [Qonfig::DataSet]
  # @return [Any]
  #
  # @api private
  # @since 0.13.0
  def validate_concrete(data_set); end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qonfig-0.19.1 lib/qonfig/validator/basic.rb
qonfig-0.19.0 lib/qonfig/validator/basic.rb
qonfig-0.18.1 lib/qonfig/validator/basic.rb
qonfig-0.18.0 lib/qonfig/validator/basic.rb
qonfig-0.17.0 lib/qonfig/validator/basic.rb