briskly 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/briskly/store.rb +4 -5
- data/lib/briskly/version.rb +1 -1
- data/spec/spec_helper.rb +0 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc09fb91d10b8b72f768bdda7498d3b245ecb4c4
|
4
|
+
data.tar.gz: a643a2fbb0bc19a203baf9e267377e66b730c889
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b95555fac955a3aa13adafb120ac63dfedd561d585bb9dedadbd53484fb1c91cb0dfd26f31b18c8df2f50c2d791215f8ddfe1ef1bc1a1a5532765d65f7cbdc18
|
7
|
+
data.tar.gz: 738eb8736657105116025df1e2403ead482eeb6e8f311c479918a34e66bc7e29ade269bf6572f64a7e3c7461c3c63dafee1390c82b085e8ce0d10ac585607ba1
|
data/Gemfile.lock
CHANGED
data/lib/briskly/store.rb
CHANGED
@@ -9,12 +9,11 @@ class Briskly::Store
|
|
9
9
|
def initialize(key)
|
10
10
|
@key = key
|
11
11
|
@store = Trie.new
|
12
|
-
@elements = {}
|
13
12
|
end
|
14
13
|
|
15
14
|
def with(values)
|
16
15
|
@store = Trie.new
|
17
|
-
|
16
|
+
elements = {}
|
18
17
|
|
19
18
|
values.each_with_index do |value, index|
|
20
19
|
|
@@ -28,15 +27,15 @@ class Briskly::Store
|
|
28
27
|
# We need to make sure we keep the index
|
29
28
|
# and in order to avoid loops always order
|
30
29
|
# the array after each insertion
|
31
|
-
|
32
|
-
|
30
|
+
elements[normalised] ||= []
|
31
|
+
elements[normalised].push([element, index])
|
33
32
|
.sort! { |a,b| a[1] <=> b[1] }
|
34
33
|
end
|
35
34
|
|
36
35
|
end
|
37
36
|
|
38
37
|
|
39
|
-
|
38
|
+
elements.each do |key, values|
|
40
39
|
@store.add key, values
|
41
40
|
end
|
42
41
|
end
|
data/lib/briskly/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -2,8 +2,6 @@ require 'pry'
|
|
2
2
|
|
3
3
|
RSpec.configure do |config|
|
4
4
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
5
|
-
config.run_all_when_everything_filtered = true
|
6
|
-
config.filter_run :focus
|
7
5
|
|
8
6
|
# Run specs in random order to surface order dependencies. If you find an
|
9
7
|
# order dependency and want to debug it, you can fix the order by providing
|