Project

General

Profile

Feature #6373

public #self

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

Status:
Closed
Priority:
Normal
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

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

Also available in: Atom PDF