Sha256: 29a71ef7d0d54b7d57cb05cab64ece00035942a1698676a22d862cc6b8d17dca

Contents?: true

Size: 735 Bytes

Versions: 4

Compression:

Stored size: 735 Bytes

Contents

# frozen_string_literal: true

module Config
  module DryValidationRequirements
    VERSIONS = ['~> 1.0', '>= 1.0.0'].freeze

    def self.load_dry_validation!
      return if defined?(@load_dry_validation)

      begin
        require 'dry/validation/version'
        version = Gem::Version.new(Dry::Validation::VERSION)
        unless VERSIONS.all? { |req| Gem::Requirement.new(req).satisfied_by?(version) }
          raise LoadError
        end
      rescue LoadError
        raise ::Config::Error, 'Could not find a dry-validation version' \
          ' matching requirements' \
          " (#{VERSIONS.map(&:inspect) * ','})"
      end

      require 'dry/validation'
      @load_dry_validation = true
      nil
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
config-5.5.2 lib/config/dry_validation_requirements.rb
config-5.5.1 lib/config/dry_validation_requirements.rb
config-5.4.0 lib/config/dry_validation_requirements.rb
config-5.3.0 lib/config/dry_validation_requirements.rb