Sha256: 4524e6751f9caf0dd59ef200f98c648c8820e92a28a9c49d979488cad263f666

Contents?: true

Size: 462 Bytes

Versions: 5

Compression:

Stored size: 462 Bytes

Contents

# frozen_string_literal: true

module Confset
  module Validation
    module Schema
      # Assigns schema configuration option
      def schema=(value)
        @schema = value
      end

      def schema(&block)
        if block_given?
          # Delay require until optional schema validation is requested
          require "dry-validation"
          @schema = Dry::Schema.define(&block)
        else
          @schema
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
confset-1.1.0 lib/confset/validation/schema.rb
confset-1.0.3 lib/confset/validation/schema.rb
confset-1.0.2 lib/confset/validation/schema.rb
confset-1.0.1 lib/confset/validation/schema.rb
confset-1.0.0 lib/confset/validation/schema.rb