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
40 41 42 43 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 40 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.
33 34 35 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 33 def const_name @const_name end |
#mod ⇒ Object (readonly)
Returns the value of attribute mod.
27 28 29 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 27 def mod @mod end |
Instance Method Details
#call ⇒ Object
Returns Value of own const. Can be any type.
48 49 50 51 52 53 54 55 56 |
# File 'lib/convenient_service/utils/module/get_own_const.rb', line 48 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 |