Sha256: e5e17b66bd7dc8d9dd7a043792a67f5ab81d331650c99824e8ee0aa5c45747d5

Contents?: true

Size: 367 Bytes

Versions: 3

Compression:

Stored size: 367 Bytes

Contents

require 'ostruct'

class OpenStruct

  # Insert/update hash data on the fly.
  #
  #   o = OpenStruct.new
  #   o.merge!(:a => 2)
  #   o.a  #=> 2
  #
  def merge!(other)
    raise TypeError, "can't modify frozen #{self.class}", caller(1) if self.frozen?
    ##other = other.to_hash #to_h?
    for k,v in other
      @table[k.to_sym] = v
    end
    self
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/standard/facets/ostruct/merge.rb
facets-3.1.0 lib/standard/facets/ostruct/merge.rb
facets-3.0.0 lib/standard/facets/ostruct/merge.rb