Project

General

Profile

Actions

Feature #6373

closed

public #self

Added by trans (Thomas Sawyer) almost 12 years ago. Updated over 8 years ago.

Status:
Closed
Target version:
-
[ruby-core:44704]

Description

This was recently suggested to me as an extension:

class Object
  # An identity method that provides access to an object's 'self'.
  #
  # Example:
  #   [1,2,3,4,5,1,2,2,3].group_by(&:identity)
  #   #=> {1=>[1, 1], 2=>[2, 2, 2], 3=>[3, 3], 4=>[4], 5=>[5]}
  #
  def identity
    self
  end
end

First, is such a method commonly useful enough to warrant existence?

Second, it makes me wonder if #self should be a public method in general.


Files

self.pdf (77.8 KB) self.pdf marcandre (Marc-Andre Lafortune), 08/31/2013 06:59 AM
itself.diff (1.87 KB) itself.diff rafaelfranca (Rafael França), 08/01/2014 06:22 PM

Related issues 1 (1 open0 closed)

Related to Ruby master - Feature #6817: Partial applicationOpenmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0