Class: ConvenientService::Utils::Object::ClampClass Private
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Object::ClampClass
- Defined in:
- lib/convenient_service/utils/object/clamp_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.
Note:
Name is inspired by Comparable#clamp.
Returns class when object is a class, module when object is a module or object's class.
Instance Attribute Summary collapse
- #object ⇒ Object readonly private
Instance Method Summary collapse
- #call ⇒ Class private
- #initialize(object) ⇒ void constructor private
Methods inherited from Support::Command
Constructor Details
#initialize(object) ⇒ 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.
72 73 74 |
# File 'lib/convenient_service/utils/object/clamp_class.rb', line 72 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.
66 67 68 |
# File 'lib/convenient_service/utils/object/clamp_class.rb', line 66 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.
79 80 81 |
# File 'lib/convenient_service/utils/object/clamp_class.rb', line 79 def call object.is_a?(::Module) ? object : object.class end |