Sha256: 9dda4f1fd03291dc76500355d5e5770f6076bd49cf923f387324d501df8df5de

Contents?: true

Size: 430 Bytes

Versions: 15

Compression:

Stored size: 430 Bytes

Contents

# frozen_string_literal: true

require 'dry/schema/macros/key'

module Dry
  module Schema
    module Macros
      # A Key specialization used for keys that can be skipped
      #
      # @api private
      class Optional < Key
        # @api private
        def operation
          :then
        end

        # @api private
        def to_rule
          super unless trace.captures.empty?
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dry-schema-1.4.3 lib/dry/schema/macros/optional.rb
dry-schema-1.4.2 lib/dry/schema/macros/optional.rb
dry-schema-1.4.1 lib/dry/schema/macros/optional.rb
dry-schema-1.4.0 lib/dry/schema/macros/optional.rb
dry-schema-1.3.4 lib/dry/schema/macros/optional.rb
dry-schema-1.3.3 lib/dry/schema/macros/optional.rb
dry-schema-1.3.2 lib/dry/schema/macros/optional.rb
dry-schema-1.3.1 lib/dry/schema/macros/optional.rb
dry-schema-1.3.0 lib/dry/schema/macros/optional.rb
dry-schema-1.2.0 lib/dry/schema/macros/optional.rb
dry-schema-1.1.0 lib/dry/schema/macros/optional.rb
dry-schema-1.0.3 lib/dry/schema/macros/optional.rb
dry-schema-1.0.2 lib/dry/schema/macros/optional.rb
dry-schema-1.0.1 lib/dry/schema/macros/optional.rb
dry-schema-1.0.0 lib/dry/schema/macros/optional.rb