Class: ConvenientService::Utils::Method::Defined Private
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Method::Defined
- Defined in:
- lib/convenient_service/utils/method/defined.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.
Constant Summary collapse
- METHOD_DEFINED_CHECKERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ public: ->(klass, method) { klass.public_method_defined?(method) }, protected: ->(klass, method) { klass.protected_method_defined?(method) }, private: ->(klass, method) { klass.private_method_defined?(method) } }
Instance Attribute Summary collapse
- #klass ⇒ Object readonly private
- #method ⇒ Object readonly private
- #private ⇒ Object readonly private
- #protected ⇒ Object readonly private
- #public ⇒ Object readonly private
Instance Method Summary collapse
- #call ⇒ void private
- #initialize(method, klass, public: true, protected: true, private: false) ⇒ void constructor private
- #method_defined?(visibility) ⇒ Boolean private
- #selected_visibilities ⇒ Array<Symbol> private
Methods inherited from Support::Command
Constructor Details
#initialize(method, klass, public: true, protected: true, private: false) ⇒ 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.
60 61 62 63 64 65 66 |
# File 'lib/convenient_service/utils/method/defined.rb', line 60 def initialize(method, klass, public: true, protected: true, private: false) @method = method.to_s @klass = klass @public = public @protected = protected @private = private end |
Instance Attribute Details
#klass ⇒ 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.
28 29 30 |
# File 'lib/convenient_service/utils/method/defined.rb', line 28 def klass @klass end |
#method ⇒ 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.
22 23 24 |
# File 'lib/convenient_service/utils/method/defined.rb', line 22 def method @method end |
#private ⇒ 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.
46 47 48 |
# File 'lib/convenient_service/utils/method/defined.rb', line 46 def private @private end |
#protected ⇒ 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.
40 41 42 |
# File 'lib/convenient_service/utils/method/defined.rb', line 40 def protected @protected end |
#public ⇒ 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.
34 35 36 |
# File 'lib/convenient_service/utils/method/defined.rb', line 34 def public @public end |
Instance Method Details
#call ⇒ 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.
This method returns an undefined value.
71 72 73 74 75 |
# File 'lib/convenient_service/utils/method/defined.rb', line 71 def call return false if selected_visibilities.none? selected_visibilities.any? { |visibility| method_defined?(visibility) } end |
#method_defined?(visibility) ⇒ Boolean
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.
92 93 94 |
# File 'lib/convenient_service/utils/method/defined.rb', line 92 def method_defined?(visibility) METHOD_DEFINED_CHECKERS[visibility].call(klass, method) end |
#selected_visibilities ⇒ Array<Symbol>
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.
84 85 86 |
# File 'lib/convenient_service/utils/method/defined.rb', line 84 def selected_visibilities @selected_visibilities ||= {public: public, protected: protected, private: private}.keep_if { |_, should_be_checked| should_be_checked }.keys end |