Sha256: 26834a8b8417c9eea5205da9eb0a5b64b1bc1b4ef7aa30177c8c55ce36b89019

Contents?: true

Size: 426 Bytes

Versions: 3

Compression:

Stored size: 426 Bytes

Contents

module Dry
  module Types
    module Options
      attr_reader :options

      def initialize(*args, **options)
        @__args__ = args
        @options = options
        @meta = options.fetch(:meta, {})
      end

      def with(new_options)
        self.class.new(*@__args__, options.merge(new_options))
      end

      def meta(data = nil)
        data ? with(meta: @meta.merge(data)) : @meta
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-types-0.9.2 lib/dry/types/options.rb
dry-types-0.9.1 lib/dry/types/options.rb
dry-types-0.9.0 lib/dry/types/options.rb