refining 0.0.1 → 0.0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/refining.rb +5 -5
- metadata +2 -2
data/lib/refining.rb
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
class Object
|
14
14
|
def refine_method (meth, &block)
|
15
|
-
return unless
|
15
|
+
return unless block
|
16
16
|
|
17
17
|
old = self.method(meth) rescue Proc.new {}
|
18
18
|
|
@@ -24,7 +24,7 @@ end
|
|
24
24
|
|
25
25
|
class Class
|
26
26
|
def refine_method (meth, &block)
|
27
|
-
return unless
|
27
|
+
return unless block
|
28
28
|
|
29
29
|
old = self.instance_method(meth) rescue Proc.new {}
|
30
30
|
|
@@ -33,13 +33,13 @@ class Class
|
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
36
|
-
def refine_class_method (meth)
|
37
|
-
return unless
|
36
|
+
def refine_class_method (meth, &block)
|
37
|
+
return unless block
|
38
38
|
|
39
39
|
old = self.method(meth) rescue Proc.new {}
|
40
40
|
|
41
41
|
define_singleton_method(meth) {|*args|
|
42
|
-
|
42
|
+
self.instance_exec((old.is_a?(Proc) ? old : old.bind(self)), *args, &block)
|
43
43
|
}
|
44
44
|
end
|
45
45
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refining
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.1
|
5
|
+
version: 0.0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- meh.
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-19 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description:
|