Sha256: 0ffb8c3265f6578f8fe5071eeaef6a65b0ef989c6ae138c02c7dc90e083a864d

Contents?: true

Size: 452 Bytes

Versions: 1

Compression:

Stored size: 452 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: @meta.merge(data)) : @meta
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-types-0.7.2 lib/dry/types/options.rb