Class: ConvenientService::Utils::Module::GetOwnInstanceMethod
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Module::GetOwnInstanceMethod
- Includes:
- Support::FiniteLoop
- Defined in:
- lib/convenient_service/utils/module/get_own_instance_method.rb
Constant Summary
Constants included from Support::FiniteLoop
Support::FiniteLoop::MAX_ITERATION_COUNT
Instance Attribute Summary collapse
-
#max_iteration_count ⇒ Object
readonly
Returns the value of attribute max_iteration_count.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#mod ⇒ Object
readonly
Returns the value of attribute mod.
-
#private ⇒ Object
readonly
Returns the value of attribute private.
Instance Method Summary collapse
- #call ⇒ UnboundMethod?
- #initialize(mod, method_name, private: false, max_iteration_count: Support::FiniteLoop::MAX_ITERATION_COUNT) ⇒ void constructor
Methods inherited from Support::Command
Constructor Details
#initialize(mod, method_name, private: false, max_iteration_count: Support::FiniteLoop::MAX_ITERATION_COUNT) ⇒ void
40 41 42 43 44 45 |
# File 'lib/convenient_service/utils/module/get_own_instance_method.rb', line 40 def initialize(mod, method_name, private: false, max_iteration_count: Support::FiniteLoop::MAX_ITERATION_COUNT) @mod = mod @method_name = method_name @private = private @max_iteration_count = max_iteration_count end |
Instance Attribute Details
#max_iteration_count ⇒ Object (readonly)
Returns the value of attribute max_iteration_count.
31 32 33 |
# File 'lib/convenient_service/utils/module/get_own_instance_method.rb', line 31 def max_iteration_count @max_iteration_count end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
19 20 21 |
# File 'lib/convenient_service/utils/module/get_own_instance_method.rb', line 19 def method_name @method_name end |
#mod ⇒ Object (readonly)
Returns the value of attribute mod.
13 14 15 |
# File 'lib/convenient_service/utils/module/get_own_instance_method.rb', line 13 def mod @mod end |
#private ⇒ Object (readonly)
Returns the value of attribute private.
25 26 27 |
# File 'lib/convenient_service/utils/module/get_own_instance_method.rb', line 25 def private @private end |
Instance Method Details
#call ⇒ UnboundMethod?
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/convenient_service/utils/module/get_own_instance_method.rb', line 50 def call method = mod.instance_method(method_name) if has_own_instance_method? ## # TODO: Warn if exceeded. # finite_loop do break if method.nil? break if method.owner == mod method = method.super_method end method end |