Project

General

Profile

Actions

Feature #15896

closed

Symbol#+

Added by zeus (Zeus 81) almost 5 years ago. Updated almost 5 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:92939]

Description

I've made this today

class Symbol
  @@cache_add = Hash.new {|h1,k1| h1[k1] = Hash.new {|h2,k2| h2[k2] = :"#{k1}#{k2}"}}
  def +(s) @@cache_add[self][s] end
end

:abc + :def
# => :abcdef

I thought it was so awesome it should become standard.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0