Class: MonkeyPatch::MethodPatch
Direct Known Subclasses
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
The name of the method to be patched.
Attributes inherited from Patch
Instance Method Summary collapse
-
#initialize(method_name, &patch_def) ⇒ MethodPatch
constructor
:nodoc:.
Methods inherited from Patch
#&, #add_condition, #patch_class, #patch_instance, #to_a
Constructor Details
#initialize(method_name, &patch_def) ⇒ MethodPatch
:nodoc:
138 139 140 141 142 143 144 |
# File 'lib/monkeypatch.rb', line 138 def initialize(method_name, &patch_def) #:nodoc: super(&patch_def) @method_name = method_name.to_s unless Module.new(&patch_def).instance_methods(true) == [@method_name] raise ArgumentError, "&patch_def does not define the specified method" end end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
The name of the method to be patched
137 138 139 |
# File 'lib/monkeypatch.rb', line 137 def method_name @method_name end |