Sha256: cbe843aa342bb7e416290aca5e00af43a586f87e45966bd3297ebe68e3d14c9b

Contents?: true

Size: 843 Bytes

Versions: 19

Compression:

Stored size: 843 Bytes

Contents

module Dry
  module Mutations
    class Schema < ::Dry::Validation::Schema
      @@discarded = []

      MESSAGES_FILE = (::File.join __dir__, '..', '..', '..', 'config', 'messages.yml').freeze
      CONFIGURATOR = ->(config) do
        config.messages_file = MESSAGES_FILE
        config.hash_type = :symbolized
        config.input_processor = :sanitizer if config.input_processor == :noop
        config.predicates = ::Dry::Mutations::Predicates
        this = is_a?(::Dry::Validation::Schema) ? self : singleton_class
        config.registry = ::Dry::Validation::PredicateRegistry[this, config.predicates]
      end

      configure(&CONFIGURATOR)

      def discarded
        @@discarded
      end

      def discarded?
        discarded.empty?
      end

      def discarded! value
        discarded << value
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
dry-mutations-1.6.0 lib/dry/mutations/schema.rb
dry-mutations-1.5.7 lib/dry/mutations/schema.rb
dry-mutations-1.5.6 lib/dry/mutations/schema.rb
dry-mutations-1.5.5 lib/dry/mutations/schema.rb
dry-mutations-1.5.4 lib/dry/mutations/schema.rb
dry-mutations-1.5.3 lib/dry/mutations/schema.rb
dry-mutations-1.5.2 lib/dry/mutations/schema.rb
dry-mutations-1.5.1 lib/dry/mutations/schema.rb
dry-mutations-1.5.0 lib/dry/mutations/schema.rb
dry-mutations-1.3.6 lib/dry/mutations/schema.rb
dry-mutations-1.3.5 lib/dry/mutations/schema.rb
dry-mutations-1.3.4 lib/dry/mutations/schema.rb
dry-mutations-1.3.3 lib/dry/mutations/schema.rb
dry-mutations-1.3.2 lib/dry/mutations/schema.rb
dry-mutations-1.3.1 lib/dry/mutations/schema.rb
dry-mutations-1.1.3 lib/dry/mutations/schema.rb
dry-mutations-1.1.1 lib/dry/mutations/schema.rb
dry-mutations-1.1.0 lib/dry/mutations/schema.rb
dry-mutations-1.0.0 lib/dry/mutations/schema.rb