harold 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f0c669ead3b29951907de99683b9f405976519a2df862162089bd1ecd7acac1
4
- data.tar.gz: 82373aa580155a2e0bd5662bfa4c0529a0007b2e58b5c911e851a5d93d5b7e31
3
+ metadata.gz: 380c80ab77490e9a3819d7b346d8451c48e3e27455042fa14fc4c53038d600d5
4
+ data.tar.gz: b791c14f0aecc59dc7144a932ef5c88859f63f139ff2c458714cdfeeba7bd98e
5
5
  SHA512:
6
- metadata.gz: b67d813a4fd9657c34977ddc79f917661a8ecc891d8f78c0d5ab1780279d0d12bdbd2130c5c20736ef859ebe235d96c4c9524f62d475c2fd2b3e5875b456eef0
7
- data.tar.gz: 41e25bce01afa0fddaebea9c5be3a9a55896bde26697f7a85c1c5f538f98b57d597b23e79c4e327ddd3af23a22ab5a5be381ea82a3fd605dbf7c5c408fd2610d
6
+ metadata.gz: 8ee85fe9dcf4c133e8e8eb80ebb81564e523cb81c63ecc44edb72363e54537623ff2763f107e329434ca2958ac7bdb81e586cc6d52cbd35fb4ed0eb10d2b0b59
7
+ data.tar.gz: b91ab3efced6adced5fdd11d1f7755cd0d9f815e9d6c6d1355fc5c36a722c1c15e8ee1cb9c7672e63a2a41d82b8d8e077b0ff8e4478328e3b1c78caac87be509
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- harold (0.1.0)
4
+ harold (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'harold'
6
- spec.version = '0.1.0'
6
+ spec.version = '0.1.1'
7
7
  spec.authors = ['grdw']
8
8
  spec.email = ['gerard@wetransfer.com']
9
9
 
@@ -24,14 +24,20 @@ module Harold
24
24
  # The result of this method are all the id's of operations which
25
25
  # have been added 'or' updated. All items which are added/updated
26
26
  # 'and' afterwards deleted will be non-present in this list.
27
+ # If an operation has been updated and afterards deleted, both
28
+ # operations will be returned.
27
29
  def useful_items(operations)
28
- operations.each_with_object(Set.new) do |op, items|
29
- if op.type == :delete && items.include?(op.id)
30
- items.delete(op.id)
30
+ items = Hash.new { |hash, key| hash[key] = [] }
31
+
32
+ operations.each do |operation|
33
+ if operation.type == :delete && items[operation.id].include?(:add)
34
+ items.delete(operation.id)
31
35
  else
32
- items.add(op.id)
36
+ items[operation.id] << operation.type
33
37
  end
34
38
  end
39
+
40
+ items.keys
35
41
  end
36
42
  end
37
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - grdw
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-11 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,7 +80,7 @@ metadata:
80
80
  homepage_uri: https://github.com/wetransfer/harold
81
81
  source_code_uri: https://github.com/wetransfer/harold
82
82
  changelog_uri: https://github.com/wetransfer/harold/CHANGELOG.md
83
- post_install_message:
83
+ post_install_message:
84
84
  rdoc_options: []
85
85
  require_paths:
86
86
  - lib
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubygems_version: 3.1.2
99
- signing_key:
99
+ signing_key:
100
100
  specification_version: 4
101
101
  summary: Helpers for collaborative environments
102
102
  test_files: []