Class: ConvenientService::Utils::Object::DuckClass Private
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Object::DuckClass
- Defined in:
- lib/convenient_service/utils/object/duck_class.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.
Converts an object to a "duck" class in terms of Module#method_defined? or Module#define_method.
Instance Attribute Summary collapse
- #object ⇒ Object readonly private
Instance Method Summary collapse
- #call ⇒ Class private
-
#initialize(object) ⇒ DuckClass
constructor
private
A new instance of DuckClass.
Methods inherited from Support::Command
Constructor Details
#initialize(object) ⇒ DuckClass
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 DuckClass.
107 108 109 |
# File 'lib/convenient_service/utils/object/duck_class.rb', line 107 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (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.
102 103 104 |
# File 'lib/convenient_service/utils/object/duck_class.rb', line 102 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.
114 115 116 |
# File 'lib/convenient_service/utils/object/duck_class.rb', line 114 def call object.is_a?(::Module) ? object.singleton_class : object.class end |