Sha256: d4c35ec4e4fd09199c50e80f0cc2940d6652cbfeb321fc169c0a925833909b06

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

module Dry
  module Types
    module Options
      attr_reader :options

      attr_reader :meta

      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: data) : @meta
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-types-0.7.1 lib/dry/types/options.rb
dry-types-0.7.0 lib/dry/types/options.rb