mpatch 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +2 -1
- data/lib/mpatch/module.rb +30 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d53e38d15e8fec6a65e1e4288e91d8571af3006a
|
4
|
+
data.tar.gz: ccfc2130a2ddf29110613c64312c4b94485acde7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05f488b571ecd8e8ea46440c034175b521bd50ab1d967310618ae7d14aa09b9a10bc1fd52041295887aee504b744692ee16f0611273e98119825e27bb9039af4
|
7
|
+
data.tar.gz: 283cf69482ad4927e4dbdf7c0c8f970e12266af23ef87481788ddcd740d25fff10928dc9cc72c18d6af48b99d43364599cbe2bf2d690c2580fa2fd05e2b7e05d
|
data/VERSION
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
2.
|
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
|
+
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-
|
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
|