Sha256: f403f6c4871d23a469a46c77f4bcc3a1915a76b655e7d5c4bd16c6dc99e97c5c

Contents?: true

Size: 857 Bytes

Versions: 4

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true

require 'dry/core/extensions'

require 'dry/schema/constants'
require 'dry/schema/dsl'
require 'dry/schema/params'
require 'dry/schema/json'

module Dry
  module Schema
    extend Dry::Core::Extensions

    # Define a schema
    #
    # @return [Processor]
    #
    # @api public
    def self.define(**options, &block)
      DSL.new(options, &block).call
    end

    # Define a param schema
    #
    # @return [Params]
    #
    # @api public
    def self.Params(**options, &block)
      define(**options, processor_type: Params, &block)
    end
    singleton_class.send(:alias_method, :Form, :Params)

    # Define a JSON schema
    #
    # @return [JSON]
    #
    # @api public
    def self.JSON(**options, &block)
      define(**options, processor_type: JSON, &block)
    end
  end
end

require 'dry/schema/extensions'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-schema-0.6.0 lib/dry/schema.rb
dry-schema-0.5.1 lib/dry/schema.rb
dry-schema-0.5.0 lib/dry/schema.rb
dry-schema-0.4.0 lib/dry/schema.rb