Sha256: 51c3e9250251ddf9e04b4b8aad9dc6df8ed14f3ee0d35da67a55e23e5692a4ab

Contents?: true

Size: 430 Bytes

Versions: 23

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

23 entries across 23 versions & 1 rubygems

Version Path
dry-schema-1.10.6 lib/dry/schema/macros/optional.rb
dry-schema-1.10.5 lib/dry/schema/macros/optional.rb
dry-schema-1.10.4 lib/dry/schema/macros/optional.rb
dry-schema-1.10.3 lib/dry/schema/macros/optional.rb
dry-schema-1.10.2 lib/dry/schema/macros/optional.rb
dry-schema-1.10.1 lib/dry/schema/macros/optional.rb
dry-schema-1.9.3 lib/dry/schema/macros/optional.rb
dry-schema-1.9.2 lib/dry/schema/macros/optional.rb
dry-schema-1.9.1 lib/dry/schema/macros/optional.rb
dry-schema-1.9.0 lib/dry/schema/macros/optional.rb
dry-schema-1.8.0 lib/dry/schema/macros/optional.rb
dry-schema-1.7.1 lib/dry/schema/macros/optional.rb
dry-schema-1.7.0 lib/dry/schema/macros/optional.rb
dry-schema-1.6.2 lib/dry/schema/macros/optional.rb
dry-schema-1.6.1 lib/dry/schema/macros/optional.rb
dry-schema-1.6.0 lib/dry/schema/macros/optional.rb
dry-schema-1.5.6 lib/dry/schema/macros/optional.rb
dry-schema-1.5.5 lib/dry/schema/macros/optional.rb
dry-schema-1.5.4 lib/dry/schema/macros/optional.rb
dry-schema-1.5.3 lib/dry/schema/macros/optional.rb