Class: ConvenientService::Utils::Object::ResolveType Private

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/object/resolve_type.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:

Common usage.

ConvenientService::Utils::Object::ResolveType.call("foo")
# => "instance"

ConvenientService::Utils::Object::ResolveType.call(Array)
# => "class"

ConvenientService::Utils::Object::ResolveType.call(Kernel)
# => "module"

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(object) ⇒ ResolveType

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 a new instance of ResolveType.

Parameters:

  • object (Object)

    Can be any type.

Since:

  • 1.0.0



34
35
36
# File 'lib/convenient_service/utils/object/resolve_type.rb', line 34

def initialize(object)
  @object = object
end

Instance Attribute Details

#objectObject (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



29
30
31
# File 'lib/convenient_service/utils/object/resolve_type.rb', line 29

def object
  @object
end

Instance Method Details

#call"class", ...

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:

  • ("class", "module", "instance")

Since:

  • 1.0.0



41
42
43
44
45
46
47
48
49
50
# File 'lib/convenient_service/utils/object/resolve_type.rb', line 41

def call
  case object
  when ::Class
    "class"
  when ::Module
    "module"
  else
    "instance"
  end
end