Sha256: da13b939091d5c464c09b41fb1988db112603153c9ad7c66e74b33edbf336262

Contents?: true

Size: 300 Bytes

Versions: 4

Compression:

Stored size: 300 Bytes

Contents

# frozen_string_literal: true

module Refinements
  module Structs
    refine Struct do
      def merge **attributes
        dup.merge! attributes
      end

      def merge! **attributes
        to_h.merge(attributes).each { |key, value| self[key] = value }
        self
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refinements-7.17.0 lib/refinements/structs.rb
refinements-7.16.0 lib/refinements/structs.rb
refinements-7.15.1 lib/refinements/structs.rb
refinements-7.15.0 lib/refinements/structs.rb