Class: ConvenientService::Utils::Class::DisplayName Private

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/class/display_name.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Examples:

Usual class.

ConvenientService::Utils::Class::DisplayName.call(String)
# => "String"

Anonymous class.

ConvenientService::Utils::Class::DisplayName.call(Сlass.new)
# => "AnonymousClass(#76940)"

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(klass) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Since:

  • 1.0.0



35
36
37
# File 'lib/convenient_service/utils/class/display_name.rb', line 35

def initialize(klass)
  @klass = klass
end

Instance Attribute Details

#klassObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0



27
28
29
# File 'lib/convenient_service/utils/class/display_name.rb', line 27

def klass
  @klass
end

Instance Method Details

#callString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

Since:

  • 1.0.0



48
49
50
# File 'lib/convenient_service/utils/class/display_name.rb', line 48

def call
  klass.name || "AnonymousClass(##{klass.object_id})"
end