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

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/object/resolve_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(object) ⇒ ResolveType

Returns a new instance of ResolveType.

Parameters:

  • object (Object)

    Can be any type.



27
28
29
# File 'lib/convenient_service/utils/object/resolve_type.rb', line 27

def initialize(object)
  @object = object
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



22
23
24
# File 'lib/convenient_service/utils/object/resolve_type.rb', line 22

def object
  @object
end

Instance Method Details

#call"class", ...

Returns:

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


34
35
36
37
38
39
40
41
42
43
# File 'lib/convenient_service/utils/object/resolve_type.rb', line 34

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