totally_lazy 0.1.38 → 0.1.39

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzhhOTY5ZjhkZmY5MGM3MjE0ZDlkYjU3ZTA3ZTZlNmZkYjYyNzBjMA==
4
+ ZTdiYjU3ZThkMTM1MWExMzVkMGVjNWE2N2M3MGQ5YmMxNGFkNjkyOA==
5
5
  data.tar.gz: !binary |-
6
- MDkzYjVmNDQ3ZDhkNjViM2ZjOTA1ZDYyOTFkOGY4ZDk5MWZmY2M4Nw==
6
+ MzQzMTM1ZGI1NTNlMGRhMWJkOGE5YzNjMzA2OGQ0NGM1MGYwNjI1ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OThkYTQ5OGRmNDlkNDFlYTYxOTU4NmE2YWJmYWJiNTVmMmZjMjY2M2UxNzVi
10
- NTA5ZWY4ODE2MzI2YWY3MmFkMTFhOGJlOGZiYTc0ZDVmOTAzMThkNWI0Mzll
11
- OWI1YWY4MDk3YTFlZjM1ZjhhOTVlYmFjNTFjNGEwY2ViNmM5N2U=
9
+ OTA0MjRhMjJkYTk3ZGZiNDk4ZTY1MzI1ZTNkOGNmYWViNTczNGRlZWE3ZWU0
10
+ ZjQzZjM1MzZiZmE0YWQwYzNiNTI3MGZhZDQzMWFhOWU5NWYxYzc4ODNmYzY2
11
+ ZTFhNGYzNGRkZGNlNmM3MWQzMjBjNmFiNzMyY2I3ZTM2MGIyNDM=
12
12
  data.tar.gz: !binary |-
13
- NTljZWYyYzNkYzFhN2RmNWIwOWU0ZDYxYTY5YWJlY2ZkNzE3MmY3MTA0NTUx
14
- NjUwN2JkMTg4MmIwMTA4M2Y2YzVjZTViOWU5MDFhNDhmMjkxNTU5Y2Q1YmNh
15
- Mjg4NDEzNzJmNDU0ZWQ5MThjODg4OGNjMjIzOTkzZmNhNzdkNTM=
13
+ MDcwMWRmOGNmZDRjOTQ3OWUwN2Q5Y2Y2YjY1ZmI5Mzg5ZTk4YTFlMTE3ZDcy
14
+ M2Y3M2FjY2FmYzNlMjRlYmI3MjIwOTg4NTczNjM4MjMzNjM3MzczYmMwMTA3
15
+ NmI2MWM5MDhjNzllZTBiN2U1ZTNjY2EwNmI2YTI3NDJiYjM3NzM=
@@ -0,0 +1,6 @@
1
+ module Maps
2
+ private
3
+ def merge(sequence_of_maps)
4
+ sequence_of_maps.fold({}){|a,b| a.merge(b) }
5
+ end
6
+ end
data/lib/totally_lazy.rb CHANGED
@@ -2,6 +2,7 @@ require_relative 'totally_lazy/comparators'
2
2
  require_relative 'totally_lazy/either'
3
3
  require_relative 'totally_lazy/enumerators'
4
4
  require_relative 'totally_lazy/functions'
5
+ require_relative 'totally_lazy/maps'
5
6
  require_relative 'totally_lazy/numbers'
6
7
  require_relative 'totally_lazy/option'
7
8
  require_relative 'totally_lazy/pair'
@@ -13,6 +14,7 @@ include Comparators
13
14
  include Eithers
14
15
  include Enumerators
15
16
  include Functions
17
+ include Maps
16
18
  include Numbers
17
19
  include Options
18
20
  include Pairs
@@ -0,0 +1,9 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe 'Maps' do
4
+ it 'should allow maps to be merged' do
5
+ expect(merge(empty)).to eq({})
6
+ expect(merge(sequence({1 => 2}, {3 => 4, 5 => 6}))).to eq({1 => 2, 3 => 4, 5 => 6})
7
+ expect(merge(sequence({1 => 2, 3 => 3}, {3 => 4, 5 => 6}))).to eq({1 => 2, 3 => 4, 5 => 6})
8
+ end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totally_lazy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.38
4
+ version: 0.1.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raymond Barlow
@@ -160,6 +160,7 @@ files:
160
160
  - lib/totally_lazy/enumerators.rb
161
161
  - lib/totally_lazy/functions.rb
162
162
  - lib/totally_lazy/lambda_block.rb
163
+ - lib/totally_lazy/maps.rb
163
164
  - lib/totally_lazy/numbers.rb
164
165
  - lib/totally_lazy/option.rb
165
166
  - lib/totally_lazy/pair.rb
@@ -169,6 +170,7 @@ files:
169
170
  - readme.md
170
171
  - spec/spec_helper.rb
171
172
  - spec/totally_lazy/either_spec.rb
173
+ - spec/totally_lazy/maps_spec.rb
172
174
  - spec/totally_lazy/option_spec.rb
173
175
  - spec/totally_lazy/sequence_spec.rb
174
176
  - totally_lazy.iml