map_by_method 0.5.0 → 0.6.0
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/CHANGELOG +4 -0
- data/lib/map_by_method/version.rb +1 -1
- data/lib/map_by_method.rb +3 -9
- data/test/map_by_method_test.rb +0 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
data/lib/map_by_method.rb
CHANGED
@@ -19,7 +19,9 @@ module MapByMethod
|
|
19
19
|
result.first :
|
20
20
|
result.transpose
|
21
21
|
end
|
22
|
-
|
22
|
+
method_name = method.to_s
|
23
|
+
@@support_singularize ||= method_name.methods.include? "singularize"
|
24
|
+
return self.map {|item| item.send method_name.singularize.to_sym} if @@support_singularize
|
23
25
|
rescue NoMethodError
|
24
26
|
nil
|
25
27
|
end
|
@@ -29,12 +31,4 @@ module MapByMethod
|
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
32
|
-
unless String.instance_methods.include? "singularize"
|
33
|
-
class String
|
34
|
-
def singularize
|
35
|
-
self.gsub(/e?s\Z/,'')
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
34
|
Array.send :include, MapByMethod
|
data/test/map_by_method_test.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: map_by_method
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.6.0
|
7
|
+
date: 2006-12-21 00:00:00 +11:00
|
8
8
|
summary: Replacement for Symbol.to_proc which is much cleaner and prettier
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -32,11 +32,11 @@ files:
|
|
32
32
|
- CHANGELOG
|
33
33
|
- Rakefile
|
34
34
|
- test/all_tests.rb
|
35
|
+
- test/test_helper.rb
|
35
36
|
- test/map_by_method_test.rb
|
36
37
|
- test/multiple_methods_test.rb
|
37
|
-
- test/test_helper.rb
|
38
|
-
- lib/map_by_method
|
39
38
|
- lib/map_by_method.rb
|
39
|
+
- lib/map_by_method
|
40
40
|
- lib/map_by_method/version.rb
|
41
41
|
test_files: []
|
42
42
|
|