Sha256: d28325d341344df0a1322819e17662a4ed4c78665e6fdc414371bec29da71cec

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 Bytes

Contents

require 'dry/schema/macros/value'

module Dry
  module Schema
    module Macros
      # Macro used to prepend `:filled?` predicate
      #
      # @api public
      class Filled < Value
        def call(*args, &block)
          if args.include?(:empty?)
            raise ::Dry::Schema::InvalidSchemaError, "Using filled with empty? predicate is invalid"
          end

          if args.include?(:filled?)
            raise ::Dry::Schema::InvalidSchemaError, "Using filled with filled? is redundant"
          end

          value(:filled?, *args, &block)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-schema-0.1.1 lib/dry/schema/macros/filled.rb
dry-schema-0.1.0 lib/dry/schema/macros/filled.rb