Class: ConvenientService::Utils::Object::DuckClass

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

Overview

TODO: A better name.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(object) ⇒ DuckClass

Returns a new instance of DuckClass.

Parameters:

  • object (Object)

    Can be any type.



99
100
101
# File 'lib/convenient_service/utils/object/duck_class.rb', line 99

def initialize(object)
  @object = object
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



94
95
96
# File 'lib/convenient_service/utils/object/duck_class.rb', line 94

def object
  @object
end

Instance Method Details

#callClass

Returns:



106
107
108
# File 'lib/convenient_service/utils/object/duck_class.rb', line 106

def call
  object.is_a?(::Module) ? object.singleton_class : object.class
end