Class: ConvenientService::Utils::Module::GetOwnConst
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Module::GetOwnConst
- Defined in:
- lib/convenient_service/utils/module/get_own_const.rb
Instance Attribute Summary collapse
-
#const_name ⇒ Object
readonly
Returns the value of attribute const_name.
-
#mod ⇒ Object
readonly
Returns the value of attribute mod.
Instance Method Summary collapse
-
#call ⇒ Object
Value of own const.
- #initialize(mod, const_name) ⇒ void constructor
Methods inherited from Support::Command
Constructor Details
#initialize(mod, const_name) ⇒ void
45 46 47 48 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 45 def initialize(mod, const_name) @mod = mod @const_name = const_name end |
Instance Attribute Details
#const_name ⇒ Object (readonly)
Returns the value of attribute const_name.
38 39 40 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 38 def const_name @const_name end |
#mod ⇒ Object (readonly)
Returns the value of attribute mod.
32 33 34 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 32 def mod @mod end |
Instance Method Details
#call ⇒ Object
Returns Value of own const. Can be any type.
53 54 55 56 57 58 59 60 61 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 53 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 |