Class: ConvenientService::Utils::Module::GetOwnConst Private
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Module::GetOwnConst
- Defined in:
- lib/convenient_service/utils/module/get_own_const.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.
Returns constant defined directly in mod.
Instance Attribute Summary collapse
- #const_name ⇒ Object readonly private
- #mod ⇒ Object readonly private
Instance Method Summary collapse
-
#call ⇒ Object
private
Value of own const.
- #initialize(mod, const_name) ⇒ void constructor private
Methods inherited from Support::Command
Constructor Details
#initialize(mod, const_name) ⇒ 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.
50 51 52 53 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 50 def initialize(mod, const_name) @mod = mod @const_name = const_name end |
Instance Attribute Details
#const_name ⇒ 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.
43 44 45 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 43 def const_name @const_name end |
#mod ⇒ 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.
37 38 39 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 37 def mod @mod end |
Instance Method Details
#call ⇒ Object
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 Value of own const. Can be any type.
58 59 60 61 62 63 64 65 66 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 58 def call ## # NOTE: > If `inherit` is `false`, the lookup only checks the constants in the receiver: # https://ruby-doc.org/core-3.0.0/Module.html#method-i-const_defined-3F # return unless mod.const_defined?(const_name, false) mod.const_get(const_name, false) end |