refining 0.0.5 → 0.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/refining.rb +4 -4
- metadata +1 -1
data/lib/refining.rb
CHANGED
@@ -24,7 +24,7 @@ class Object
|
|
24
24
|
end
|
25
25
|
|
26
26
|
what.send :define_method, meth do |*args, &blk|
|
27
|
-
return if
|
27
|
+
return if instance_variable_defined?(:@__refining_defined__) && [:method_added, :singleton_method_added].member?(meth)
|
28
28
|
|
29
29
|
@__refining_defined__ = true
|
30
30
|
what.send(:define_method, 'temporary method for refining', &block)
|
@@ -32,7 +32,7 @@ class Object
|
|
32
32
|
target.send('temporary method for refining', old.is_a?(UnboundMethod) ? old.bind(self) : old, *args, &blk).tap {
|
33
33
|
what.send(:undef_method, 'temporary method for refining') rescue nil
|
34
34
|
|
35
|
-
|
35
|
+
remove_instance_variable(:@__refining_defined__) rescue nil
|
36
36
|
}
|
37
37
|
end
|
38
38
|
}
|
@@ -47,7 +47,7 @@ class Module
|
|
47
47
|
old ||= proc {}
|
48
48
|
|
49
49
|
define_method(meth) {|*args, &blk|
|
50
|
-
return if
|
50
|
+
return if instance_variable_defined?(:@__refining_defined__) && [:method_added, :singleton_method_added].member?(meth)
|
51
51
|
|
52
52
|
what = class << self
|
53
53
|
self
|
@@ -59,7 +59,7 @@ class Module
|
|
59
59
|
send('temporary method for refining', old.is_a?(UnboundMethod) ? old.bind(self) : old, *args, &blk).tap {
|
60
60
|
what.send(:undef_method, 'temporary method for refining') rescue nil
|
61
61
|
|
62
|
-
|
62
|
+
remove_instance_variable(:@__refining_defined__) rescue nil
|
63
63
|
}
|
64
64
|
}
|
65
65
|
}
|