Class: ConvenientService::Utils::Method::Remove Private

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/method/remove.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.

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

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.

Parameters:

  • method (Symbol, String)
  • klass (Class)
  • public (Boolean) (defaults to: true)
  • protected (Boolean) (defaults to: true)
  • private (Boolean) (defaults to: false)

Since:

  • 1.0.0



54
55
56
57
58
59
60
# File 'lib/convenient_service/utils/method/remove.rb', line 54

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

#klassObject (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.

Since:

  • 1.0.0



22
23
24
# File 'lib/convenient_service/utils/method/remove.rb', line 22

def klass
  @klass
end

#methodObject (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.

Since:

  • 1.0.0



16
17
18
# File 'lib/convenient_service/utils/method/remove.rb', line 16

def method
  @method
end

#privateObject (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.

Since:

  • 1.0.0



40
41
42
# File 'lib/convenient_service/utils/method/remove.rb', line 40

def private
  @private
end

#protectedObject (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.

Since:

  • 1.0.0



34
35
36
# File 'lib/convenient_service/utils/method/remove.rb', line 34

def protected
  @protected
end

#publicObject (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.

Since:

  • 1.0.0



28
29
30
# File 'lib/convenient_service/utils/method/remove.rb', line 28

def public
  @public
end

Instance Method Details

#callClass

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:

Since:

  • 1.0.0



69
70
71
72
73
# File 'lib/convenient_service/utils/method/remove.rb', line 69

def call
  return unless Utils::Method.defined?(method, klass, public: public, protected: protected, private: private)

  klass.remove_method method
end