rmtools 2.1.0 → 2.1.1
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.
@@ -63,14 +63,11 @@ private
|
|
63
63
|
# 2. Most latency is given by #method_missing, but which are factor of #__send__?
|
64
64
|
def method_missing(method, *args, &block)
|
65
65
|
if match = (meth = method.to_s).match(@@iterators_pattern)
|
66
|
-
iterator, meth = match[1]
|
66
|
+
iterator, meth = match[1], match[2]
|
67
|
+
iterator.sub!(/^((?:ever|an)y|no(?:ne)?)$/, '\1?')
|
68
|
+
iterator = iterator.to_sym
|
67
69
|
|
68
70
|
begin
|
69
|
-
case iterator
|
70
|
-
when :every then iterator = :every?
|
71
|
-
when :no then iterator = :no?
|
72
|
-
end
|
73
|
-
|
74
71
|
return case iterator
|
75
72
|
when :sum, :sort_along_by; __send__(iterator, args.shift) {|i| i.__send__ meth, *args, &block}
|
76
73
|
when :find_by, :select_by, :reject_by, :partition_by; __send__(iterator, meth, *args)
|
@@ -108,7 +105,7 @@ private
|
|
108
105
|
|
109
106
|
end # << self
|
110
107
|
|
111
|
-
add_iterator_name(instance_methods.grep(/_by$/)+%w{every no which select reject partition find_all find sum foldr foldl fold count rand_by})
|
108
|
+
add_iterator_name(instance_methods.grep(/_by$/)+%w{every any no none which select reject partition find_all find sum foldr foldl fold count rand_by})
|
112
109
|
|
113
110
|
# Benchmark 2:
|
114
111
|
#
|
@@ -227,11 +224,9 @@ private
|
|
227
224
|
# # += 6% of time
|
228
225
|
def method_missing(method, *args, &block)
|
229
226
|
if match = (meth = method.to_s).match(@@iterators_pattern)
|
230
|
-
iterator, meth = match[1]
|
231
|
-
|
232
|
-
|
233
|
-
when :no then iterator = :no?
|
234
|
-
end
|
227
|
+
iterator, meth = match[1], match[2]
|
228
|
+
iterator.sub!(/^((?:ever|an)y|no(?:ne)?)$/, '\1?')
|
229
|
+
iterator = iterator.to_sym
|
235
230
|
|
236
231
|
case iterator
|
237
232
|
when :sum, :sort_along_by
|
data/lib/rmtools/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmtools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|