Sha256: 8e5b81efab1da2c45cabe1422b7b4aa1343404bb85926e67d71191c663f55a40

Contents?: true

Size: 397 Bytes

Versions: 9

Compression:

Stored size: 397 Bytes

Contents

# frozen_string_literal: true

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

9 entries across 9 versions & 1 rubygems

Version Path
dry-schema-1.13.3 lib/dry/schema/macros/optional.rb
dry-schema-1.13.2 lib/dry/schema/macros/optional.rb
dry-schema-1.13.1 lib/dry/schema/macros/optional.rb
dry-schema-1.13.0 lib/dry/schema/macros/optional.rb
dry-schema-1.12.0 lib/dry/schema/macros/optional.rb
dry-schema-1.11.3 lib/dry/schema/macros/optional.rb
dry-schema-1.11.2 lib/dry/schema/macros/optional.rb
dry-schema-1.11.1 lib/dry/schema/macros/optional.rb
dry-schema-1.11.0 lib/dry/schema/macros/optional.rb