rumonade 0.4.1 → 0.4.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/HISTORY.md +5 -0
- data/lib/rumonade/array.rb +1 -4
- data/lib/rumonade/version.rb +1 -1
- data/test/array_test.rb +2 -1
- metadata +1 -1
data/HISTORY.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# HISTORY
|
2
2
|
|
3
|
+
## v0.4.2 (May 9, 2013)
|
4
|
+
|
5
|
+
- revert change which confused Array#map with Array#flat_map
|
6
|
+
- See full list @ https://github.com/ms-ati/rumonade/compare/v0.4.1...v0.4.2
|
7
|
+
|
3
8
|
## v0.4.1 (May 9, 2013)
|
4
9
|
|
5
10
|
- fixed behavior of #flatten called with optional depth parameter
|
data/lib/rumonade/array.rb
CHANGED
@@ -18,10 +18,7 @@ module Rumonade
|
|
18
18
|
METHODS_TO_REPLACE_WITH_MONAD = Monad::DEFAULT_METHODS_TO_REPLACE_WITH_MONAD - [:map]
|
19
19
|
|
20
20
|
def bind(lam = nil, &blk)
|
21
|
-
inject(self.class.empty)
|
22
|
-
res = (lam || blk).call(elt)
|
23
|
-
arr + (res.respond_to?(:to_a) ? res.to_a : [res])
|
24
|
-
end
|
21
|
+
inject(self.class.empty) { |arr, elt| arr + (lam || blk).call(elt).to_a }
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
data/lib/rumonade/version.rb
CHANGED
data/test/array_test.rb
CHANGED
@@ -24,11 +24,12 @@ class ArrayTest < Test::Unit::TestCase
|
|
24
24
|
|
25
25
|
def test_flat_map_behaves_correctly
|
26
26
|
assert_equal ["FOO", "BAR"], ["foo", "bar"].flat_map { |s| [s.upcase] }
|
27
|
-
assert_equal [2, 4, 6], [1, 2, 3].flat_map { |i| i * 2 }
|
27
|
+
assert_equal [2, 4, 6], [1, 2, 3].flat_map { |i| [i * 2] }
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_map_behaves_correctly
|
31
31
|
assert_equal ["FOO", "BAR"], ["foo", "bar"].map { |s| s.upcase }
|
32
|
+
assert_equal [2, 4, 6], [1, 2, 3].map { |i| i * 2 }
|
32
33
|
end
|
33
34
|
|
34
35
|
def test_shallow_flatten_behaves_correctly
|