class Object
Reopen the core Object
class to add {#identify} to all objects.
Public Instance Methods
Source
# File lib/core_ext/object.rb, line 37 def identify(...) ObjectIdentifier.(self, ...) end
Data.define(:a, :b, :c)[1, “2”, :“3”].identify(:a, :b, :c, class: “Data”) # => “Data[a:1, b:"2", c::"3"]”
1.identify(:to_s) # => “Integer” nil.identify # => “[no objects]”
%w(1 2).identify(:to_i, :to_f) # => “String[to_i:1, to_f:1.0], String[to_i:2, to_f:2.0]”
(1..10).to_a.identify(:to_f, limit: 2) # => “Integer, Integer, … (8 more)”