Issue #6225 has been updated by trans (Thomas Sawyer).


@jacksonwillis #<< makes sense as an alias for #update, not #merge. However I use Hash#<< with this meaning:

  def <<(array)
    raise if array.size != 2
    self[array.first] = array.last
  end

There are historical reasons for that definition. But the two can be combined:

  def <<(object)
    case object
    when Array
      raise if object.size != 2
      self[object.first] = object.last
    else
      update(object)
    end
  end

----------------------------------------
Feature #6225: Hash#+
https://bugs.ruby-lang.org/issues/6225#change-25857

Author: trans (Thomas Sawyer)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 2.0.0


Strings and Arrays can be combined with #+. I don't see any reason not to allow Hashes to do so as well.

  class Hash
    alias :+ :merge
  end



-- 
http://bugs.ruby-lang.org/