refining 0.0.2 → 0.0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/refining.rb +5 -5
  2. metadata +3 -2
data/lib/refining.rb CHANGED
@@ -10,14 +10,14 @@
10
10
  # 0. You just DO WHAT THE FUCK YOU WANT TO.
11
11
  #++
12
12
 
13
- class Class
13
+ class Module
14
14
  def refine_method (meth, &block)
15
15
  return unless block
16
16
 
17
- old = self.instance_method(meth) rescue Proc.new {}
17
+ old = instance_method(meth) rescue proc {}
18
18
 
19
19
  define_method(meth) {|*args|
20
- self.instance_exec((old.is_a?(Proc) ? old : old.bind(self)), *args, &block)
20
+ instance_exec((old.is_a?(UnboundMethod) ? old.bind(self) : old), *args, &block)
21
21
  }
22
22
  end
23
23
 
@@ -25,11 +25,11 @@ class Class
25
25
  class << self
26
26
  self
27
27
  end.refine_method meth, &block
28
- end
28
+ end; alias refine_module_method refine_class_method
29
29
  end
30
30
 
31
31
  class Object
32
- def refine_method (meth, &block)
32
+ def refine_instance_method (meth, &block)
33
33
  class << self
34
34
  self
35
35
  end.refine_method meth, &block
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refining
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 67
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 2
10
- version: 0.0.2
10
+ - 2
11
+ version: 0.0.2.2
11
12
  platform: ruby
12
13
  authors:
13
14
  - meh.