Project

General

Profile

Actions

Feature #9778

closed

Bring shortcut methods to Hash

Feature #9778: Bring shortcut methods to Hash

Added by natesymer (Nathaniel Symer) over 11 years ago. Updated over 11 years ago.

Status:
Rejected
Target version:
[ruby-core:62179]

Description

My obsession with easy syntax annoys me when I see Hash#merge does not have a shortcut in the form of a mathematical operation (like - or +).

h_one = { :foo => "bar", :this => "that", :all => "nothing" }
h_two = { :foo => "this", :ruby => "awesome" }

# this isn't as pretty
h_one.merge(h_two)
  =>  { :foo => "this", :this => "that", :all => "nothing", :ruby => "awesome" }

# as this
h_one+h_two
  => { :foo => "this", :this => "that", :all => "nothing", :ruby => "awesome" }`

Why doesn't this exist in Ruby?


Related issues 1 (0 open1 closed)

Is duplicate of Ruby - Feature #6225: Hash#+Rejectedmatz (Yukihiro Matsumoto)Actions

Updated by bitsweat (Jeremy Daer) over 11 years ago Actions #1 [ruby-core:62181]

Hash#+ rejected in #6225. Also see #7739 for Hash#|.

Updated by nobu (Nobuyoshi Nakada) over 11 years ago Actions #2 [ruby-core:62182]

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) over 11 years ago Actions #3 [ruby-core:62183]

Updated by nobu (Nobuyoshi Nakada) over 11 years ago Actions #4 [ruby-core:62185]

Updated by nobu (Nobuyoshi Nakada) over 11 years ago Actions #5 [ruby-core:62187]

Updated by nobu (Nobuyoshi Nakada) over 11 years ago Actions #6 [ruby-core:62189]

  • Status changed from Open to Rejected
Actions

Also available in: PDF Atom