rumonade 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +4 -1
- data/Gemfile +1 -1
- data/HISTORY.md +5 -0
- data/MIT-LICENSE.txt +1 -1
- data/README.md +14 -1
- data/lib/rumonade/array.rb +3 -2
- data/lib/rumonade/monad.rb +1 -1
- data/lib/rumonade/version.rb +1 -1
- data/rumonade.gemspec +13 -14
- data/test/array_test.rb +12 -12
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bfe306570f7e0616a3ae08a5283a6f6db17e726
|
4
|
+
data.tar.gz: a9de2ac173af08286ad18be105681e8e22532ce1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96b09ba53d0ec654f0753c45fd44081ac8379d9e42f533f1d59dddcb893c93f543d01aa95c390d355819e9adad39300cb97fbee7d389a07959bf9113296da6f4
|
7
|
+
data.tar.gz: 909e553d3204030ecd888253583d3e56092cd86cf91025edf0e255095613a341239972fad9f325ec7386b1f04431d24fed8ed88aeb7b54ee211e44222bc0e99a
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.1.2
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/HISTORY.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# HISTORY
|
2
2
|
|
3
|
+
## v0.4.4 (Aug 5, 2015)
|
4
|
+
|
5
|
+
- Fix: don't replace Array#flatten, as it breaks Rails 3 (see #8)
|
6
|
+
- See full list @ https://github.com/ms-ati/rumonade/compare/v0.4.3...v0.4.4
|
7
|
+
|
3
8
|
## v0.4.3 (Aug 27, 2013)
|
4
9
|
|
5
10
|
- Fix: prevent Array#flatten from attempting to flatten Hash (thanks @moser!)
|
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# NOTICE: Re-thinking is happening...
|
2
|
+
|
3
|
+
Scala has evolved quite a bit since this project began in 2011, and mainstream Ruby usage
|
4
|
+
has evolved as well.
|
5
|
+
|
6
|
+
In the branch [experimental-0.5](https://github.com/ms-ati/rumonade/tree/experimental-0.5),
|
7
|
+
new things are going to be tried.
|
8
|
+
|
9
|
+
If you're interested in sharing your ideas, join the [mailing list](http://groups.google.com/group/rumonade).
|
10
|
+
|
11
|
+
---------------------------------------
|
12
|
+
|
1
13
|
# [Rumonade](https://rubygems.org/gems/rumonade)
|
2
14
|
|
3
15
|
[![Gem Version](https://badge.fury.io/rb/rumonade.png)](http://badge.fury.io/rb/rumonade)
|
@@ -6,6 +18,7 @@
|
|
6
18
|
[![Code Climate](https://codeclimate.com/github/ms-ati/rumonade.png)](https://codeclimate.com/github/ms-ati/rumonade)
|
7
19
|
[![Coverage Status](https://coveralls.io/repos/ms-ati/rumonade/badge.png)](https://coveralls.io/r/ms-ati/rumonade)
|
8
20
|
|
21
|
+
|
9
22
|
*_Project_*: [github](http://github.com/ms-ati/rumonade)
|
10
23
|
|
11
24
|
*_Documentation_*: [rubydoc.info](http://rubydoc.info/gems/rumonade/frames)
|
@@ -146,6 +159,6 @@ The priorities for Rumonade are:
|
|
146
159
|
|
147
160
|
Option, Either, Array, and Hash are already usable.
|
148
161
|
|
149
|
-
<b><em>Supported Ruby versions</em></b>: MRI 1.9.
|
162
|
+
<b><em>Supported Ruby versions</em></b>: MRI 2.0.0, 1.9.3, 1.9.2, JRuby in 1.9 mode, and Rubinius in 1.9 mode.
|
150
163
|
|
151
164
|
Please try it out, and let me know what you think! Suggestions are always welcome.
|
data/lib/rumonade/array.rb
CHANGED
@@ -14,8 +14,9 @@ module Rumonade
|
|
14
14
|
end
|
15
15
|
|
16
16
|
module InstanceMethods
|
17
|
-
# Preserve native +map+
|
18
|
-
|
17
|
+
# Preserve native +map+ and +flat_map+ methods for performance,
|
18
|
+
# and +flatten+ to support Rails (see issue #8)
|
19
|
+
METHODS_TO_REPLACE_WITH_MONAD = []
|
19
20
|
|
20
21
|
def bind(lam = nil, &blk)
|
21
22
|
inject(self.class.empty) { |arr, elt| arr + (lam || blk).call(elt).to_a }
|
data/lib/rumonade/monad.rb
CHANGED
@@ -52,7 +52,7 @@ module Rumonade
|
|
52
52
|
# NOTE: normally aliased as +flatten+ when +Monad+ is mixed into a class
|
53
53
|
#
|
54
54
|
# @example
|
55
|
-
# [Some(Some(1)), Some(Some(None))], [None]].
|
55
|
+
# [Some(Some(1)), Some(Some(None))], [None]].flatten_with_monad
|
56
56
|
# #=> [1]
|
57
57
|
#
|
58
58
|
def flatten_with_monad(depth=nil)
|
data/lib/rumonade/version.rb
CHANGED
data/rumonade.gemspec
CHANGED
@@ -1,25 +1,24 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'rumonade/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
6
|
+
s.name = 'rumonade'
|
7
7
|
s.version = Rumonade::VERSION
|
8
|
-
s.authors = [
|
9
|
-
s.email = [
|
10
|
-
s.homepage =
|
11
|
-
s.summary =
|
12
|
-
s.description =
|
13
|
-
|
14
|
-
s.rubyforge_project = "rumonade"
|
8
|
+
s.authors = ['Marc Siegel']
|
9
|
+
s.email = ['marc@usainnov.com']
|
10
|
+
s.homepage = 'http://github.com/ms-ati/rumonade'
|
11
|
+
s.summary = 'A Scala-inspired Monad library for Ruby'
|
12
|
+
s.description = 'A Scala-inspired Monad library for Ruby, aiming to share the most common idioms for folks working in both languages. Includes Option, Array, etc.'
|
13
|
+
s.license = 'MIT'
|
15
14
|
|
16
15
|
s.files = `git ls-files`.split("\n")
|
17
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = [
|
18
|
+
s.require_paths = ['lib']
|
20
19
|
|
21
20
|
# specify any dependencies here; for example:
|
22
|
-
s.add_development_dependency
|
23
|
-
s.add_development_dependency
|
24
|
-
s.add_development_dependency
|
21
|
+
s.add_development_dependency 'test-unit'
|
22
|
+
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'coveralls'
|
25
24
|
end
|
data/test/array_test.rb
CHANGED
@@ -41,24 +41,24 @@ class ArrayTest < Test::Unit::TestCase
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_flatten_behaves_correctly
|
44
|
-
assert_equal [0, 1, 2, 3, 4], [0, [1], [[2]], [[[3]]], [[[[4]]]]].
|
45
|
-
assert_equal [1, 2], [None, Some(1), Some(Some(2))].
|
46
|
-
assert_equal [], [Some(Some(Some(None)))].
|
44
|
+
assert_equal [0, 1, 2, 3, 4], [0, [1], [[2]], [[[3]]], [[[[4]]]]].flatten_with_monad
|
45
|
+
assert_equal [1, 2], [None, Some(1), Some(Some(2))].flatten_with_monad
|
46
|
+
assert_equal [], [Some(Some(Some(None)))].flatten_with_monad
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_flatten_with_argument_behaves_correctly
|
50
|
-
assert_equal [0, 1, [2], [[3]], [[[4]]]], [0, [1], [[2]], [[[3]]], [[[[4]]]]].
|
51
|
-
assert_equal [0, 1, 2, [3], [[4]]], [0, [1], [[2]], [[[3]]], [[[[4]]]]].
|
52
|
-
assert_equal [0, 1, 2, 3, [4]], [0, [1], [[2]], [[[3]]], [[[[4]]]]].
|
53
|
-
assert_equal [0, 1, 2, 3, 4], [0, [1], [[2]], [[[3]]], [[[[4]]]]].
|
54
|
-
assert_equal [Some(Some(1)), Some(Some(None)), [None]], [Some(Some(1)), Some(Some(None)), [None]].
|
55
|
-
assert_equal [Some(1), Some(None), None], [Some(Some(1)), Some(Some(None)), [None]].
|
56
|
-
assert_equal [1, None], [Some(Some(1)), Some(Some(None)), [None]].
|
57
|
-
assert_equal [1], [Some(Some(1)), Some(Some(None)), [None]].
|
50
|
+
assert_equal [0, 1, [2], [[3]], [[[4]]]], [0, [1], [[2]], [[[3]]], [[[[4]]]]].flatten_with_monad(1)
|
51
|
+
assert_equal [0, 1, 2, [3], [[4]]], [0, [1], [[2]], [[[3]]], [[[[4]]]]].flatten_with_monad(2)
|
52
|
+
assert_equal [0, 1, 2, 3, [4]], [0, [1], [[2]], [[[3]]], [[[[4]]]]].flatten_with_monad(3)
|
53
|
+
assert_equal [0, 1, 2, 3, 4], [0, [1], [[2]], [[[3]]], [[[[4]]]]].flatten_with_monad(4)
|
54
|
+
assert_equal [Some(Some(1)), Some(Some(None)), [None]], [Some(Some(1)), Some(Some(None)), [None]].flatten_with_monad(0)
|
55
|
+
assert_equal [Some(1), Some(None), None], [Some(Some(1)), Some(Some(None)), [None]].flatten_with_monad(1)
|
56
|
+
assert_equal [1, None], [Some(Some(1)), Some(Some(None)), [None]].flatten_with_monad(2)
|
57
|
+
assert_equal [1], [Some(Some(1)), Some(Some(None)), [None]].flatten_with_monad(3)
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_flatten_does_not_break_default_ruby_behaviour_with_nested_hash
|
61
61
|
arr = [ { 'thou' => 'shalt', 'not touch' => 'hashes' }, ', seriously!' ]
|
62
|
-
assert_equal arr, arr.
|
62
|
+
assert_equal arr, arr.flatten_with_monad
|
63
63
|
end
|
64
64
|
end
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rumonade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Siegel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: coveralls
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: A Scala-inspired Monad library for Ruby, aiming to share the most common
|
@@ -60,11 +60,11 @@ executables: []
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
-
- .coveralls.yml
|
64
|
-
- .gitignore
|
65
|
-
- .ruby-gemset
|
66
|
-
- .ruby-version
|
67
|
-
- .travis.yml
|
63
|
+
- ".coveralls.yml"
|
64
|
+
- ".gitignore"
|
65
|
+
- ".ruby-gemset"
|
66
|
+
- ".ruby-version"
|
67
|
+
- ".travis.yml"
|
68
68
|
- Gemfile
|
69
69
|
- HISTORY.md
|
70
70
|
- MIT-LICENSE.txt
|
@@ -89,7 +89,8 @@ files:
|
|
89
89
|
- test/option_test.rb
|
90
90
|
- test/test_helper.rb
|
91
91
|
homepage: http://github.com/ms-ati/rumonade
|
92
|
-
licenses:
|
92
|
+
licenses:
|
93
|
+
- MIT
|
93
94
|
metadata: {}
|
94
95
|
post_install_message:
|
95
96
|
rdoc_options: []
|
@@ -97,17 +98,17 @@ require_paths:
|
|
97
98
|
- lib
|
98
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
100
|
requirements:
|
100
|
-
- -
|
101
|
+
- - ">="
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
version: '0'
|
103
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
105
|
requirements:
|
105
|
-
- -
|
106
|
+
- - ">="
|
106
107
|
- !ruby/object:Gem::Version
|
107
108
|
version: '0'
|
108
109
|
requirements: []
|
109
|
-
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.2.2
|
111
112
|
signing_key:
|
112
113
|
specification_version: 4
|
113
114
|
summary: A Scala-inspired Monad library for Ruby
|