rkh-chainable 0.0.2 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +10 -0
- metadata +13 -4
data/README.rdoc
CHANGED
@@ -50,6 +50,12 @@ Example:
|
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
53
|
+
|
54
|
+
# or chain multiple methods at once
|
55
|
+
chain_method :foo, :bar do
|
56
|
+
super.to_s
|
57
|
+
end
|
58
|
+
|
53
59
|
end
|
54
60
|
|
55
61
|
f = Foo.new
|
@@ -66,6 +72,10 @@ Of course you can do this with any class (or module):
|
|
66
72
|
end
|
67
73
|
end
|
68
74
|
|
75
|
+
Note that there is a speed advantage when using chain_method without a block
|
76
|
+
and doing a "def", since chain_method will use define_method if a block is
|
77
|
+
given, which produces slower methods (but makes the method a real closure).
|
78
|
+
|
69
79
|
== Benchmark
|
70
80
|
chain_method tends do produce slightly faster methods than alias_method_chain:
|
71
81
|
user system total real
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rkh-chainable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ruby2ruby
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
16
25
|
description: never use alias_method_chain, again
|
17
26
|
email: konstantin.mailinglists@googlemail.com
|
18
27
|
executables: []
|