mpatch 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +2 -1
  3. data/lib/mpatch/module.rb +30 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09f45571e4ead5c5407a50275bcca9b13316b3b1
4
- data.tar.gz: 79afe3c73630cb5124c58967e9dafc790efa665c
3
+ metadata.gz: d53e38d15e8fec6a65e1e4288e91d8571af3006a
4
+ data.tar.gz: ccfc2130a2ddf29110613c64312c4b94485acde7
5
5
  SHA512:
6
- metadata.gz: e47dcb190075aab9e175dc9a02d3cc68d9d77a9a6785154541f8280f6959c2b8bda5468e0aaa5541c3b21b87668917056edb36942bfb1d811a229b6621078ac4
7
- data.tar.gz: 256612b44b53b3d28f8f2f69e7a01651a0c312cdd864e0aeac1fae56b21980ffa6fe080cf06e483066af53c88a9ed19693a86fab94b409fc2667bb5630b7caa2
6
+ metadata.gz: 05f488b571ecd8e8ea46440c034175b521bd50ab1d967310618ae7d14aa09b9a10bc1fd52041295887aee504b744692ee16f0611273e98119825e27bb9039af4
7
+ data.tar.gz: 283cf69482ad4927e4dbdf7c0c8f970e12266af23ef87481788ddcd740d25fff10928dc9cc72c18d6af48b99d43364599cbe2bf2d690c2580fa2fd05e2b7e05d
data/VERSION CHANGED
@@ -1 +1,2 @@
1
- 2.4.0
1
+ 2.5.0
2
+
data/lib/mpatch/module.rb CHANGED
@@ -58,6 +58,36 @@ module MPatch
58
58
  end
59
59
 
60
60
 
61
+ def alias_singleton_methods_from class_name, *sym_names
62
+
63
+ method_names= sym_names.map{|e|e.to_s}
64
+ method_names= class_name.singleton_methods if method_names.empty?
65
+
66
+ method_names.each do |sym_name|
67
+ self.define_singleton_method(sym_name) { |*args|
68
+
69
+ if class_name.method(sym_name).parameters.empty?
70
+ class_name.method(sym_name).call
71
+ else
72
+ class_name.method(sym_name).call *args
73
+ end
74
+
75
+ }
76
+ end
77
+
78
+ end
79
+
80
+ def alias_instance_methods_from class_name, *sym_names
81
+
82
+ method_names= sym_names.map{|e|e.to_s}
83
+ method_names= class_name.instance_methods if method_names.empty?
84
+
85
+ method_names.each do |sym_name|
86
+ self.__send__ :define_method, sym_name, class_name.instance_method(sym_name)
87
+ end
88
+
89
+ end
90
+
61
91
  end
62
92
 
63
93
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-07 00:00:00.000000000 Z
11
+ date: 2014-04-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a collection of my Ruby monkey patches for making easer to use
14
14
  the basic classes