samvera-nesting_indexer 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/samvera/nesting_indexer.rb +4 -0
- data/lib/samvera/nesting_indexer/adapters/abstract_adapter.rb +6 -2
- data/lib/samvera/nesting_indexer/adapters/in_memory_adapter.rb +9 -5
- data/lib/samvera/nesting_indexer/adapters/interface_behavior_spec.rb +4 -4
- data/lib/samvera/nesting_indexer/relationship_reindexer.rb +1 -1
- data/lib/samvera/nesting_indexer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0be21dd61b9f5f3d6b6ccad2c1b1ed80716eae2d
|
4
|
+
data.tar.gz: 892250b2ba5c0928c1ff2dc2f70e8ccce4e66540
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8bb638efe4d51cedc36e480512d7cbd7745deae8391a9eee6a08edc948c2e2894abd6669fba9015ad1e2bbebb3389d34784966fa5c7b9829f7e1bf2fc84fbf1
|
7
|
+
data.tar.gz: 7880f1c9bff81f31f6fe1d503cb1786c533e6cb1be06878de92a9930695f5d2d77bc8dcc39dfdbf1d0d8b371df36b2c27096e12ea07590899075cbdf3d1e6be4
|
@@ -33,9 +33,13 @@ module Samvera
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# @api public
|
36
|
-
# @
|
36
|
+
# @see README.md
|
37
|
+
# @param id [String]
|
38
|
+
# @param parent_ids [Array<String>]
|
39
|
+
# @param ancestors [Array<String>]
|
40
|
+
# @param pathnames [Array<String>]
|
37
41
|
# @return Hash - the attributes written to the indexing layer
|
38
|
-
def self.write_document_attributes_to_index_layer(
|
42
|
+
def self.write_document_attributes_to_index_layer(id:, parent_ids:, ancestors:, pathnames:)
|
39
43
|
raise NotImplementedError
|
40
44
|
end
|
41
45
|
end
|
@@ -47,10 +47,14 @@ module Samvera
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# @api public
|
50
|
-
# @
|
50
|
+
# @see README.md
|
51
|
+
# @param id [String]
|
52
|
+
# @param parent_ids [Array<String>]
|
53
|
+
# @param ancestors [Array<String>]
|
54
|
+
# @param pathnames [Array<String>]
|
51
55
|
# @return Hash - the attributes written to the indexing layer
|
52
|
-
def self.write_document_attributes_to_index_layer(
|
53
|
-
Index.write_document(
|
56
|
+
def self.write_document_attributes_to_index_layer(id:, parent_ids:, ancestors:, pathnames:)
|
57
|
+
Index.write_document(id: id, parent_ids: parent_ids, ancestors: ancestors, pathnames: pathnames)
|
54
58
|
end
|
55
59
|
|
56
60
|
# @api private
|
@@ -108,8 +112,8 @@ module Samvera
|
|
108
112
|
MemoryStorage.clear_cache!
|
109
113
|
end
|
110
114
|
|
111
|
-
def self.write_document(
|
112
|
-
Documents::PreservationDocument.new(
|
115
|
+
def self.write_document(**kargs)
|
116
|
+
Documents::PreservationDocument.new(**kargs).tap do |doc|
|
113
117
|
MemoryStorage.write(doc)
|
114
118
|
end
|
115
119
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
if defined?(RSpec)
|
2
2
|
RSpec.shared_examples 'a Samvera::NestingIndexer::Adapter' do
|
3
|
-
let(:required_keyword_parameters) { ->(method) { method.parameters.select { |type, _kwarg| type == :keyreq }.map(&:last) } }
|
4
|
-
let(:required_parameters) { ->(method) { method.parameters.select { |type, _kwarg| type == :keyreq || type == :req }.map(&:last) } }
|
5
|
-
let(:block_parameter_extracter) { ->(method) { method.parameters.select { |type, _kwarg| type == :block }.map(&:last) } }
|
3
|
+
let(:required_keyword_parameters) { ->(method) { method.parameters.select { |type, _kwarg| type == :keyreq }.map(&:last).sort } }
|
4
|
+
let(:required_parameters) { ->(method) { method.parameters.select { |type, _kwarg| type == :keyreq || type == :req }.map(&:last).sort } }
|
5
|
+
let(:block_parameter_extracter) { ->(method) { method.parameters.select { |type, _kwarg| type == :block }.map(&:last).sort } }
|
6
6
|
|
7
7
|
describe '.find_preservation_document_by' do
|
8
8
|
subject { described_class.method(:find_preservation_document_by) }
|
@@ -68,7 +68,7 @@ if defined?(RSpec)
|
|
68
68
|
subject { described_class.method(:write_document_attributes_to_index_layer) }
|
69
69
|
|
70
70
|
it 'requires the :attributes keyword (and does not require any others)' do
|
71
|
-
expect(required_keyword_parameters.call(subject)).to eq(
|
71
|
+
expect(required_keyword_parameters.call(subject)).to eq(%i(ancestors id parent_ids pathnames))
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'does not require any other parameters (besides :attributes)' do
|
@@ -72,7 +72,7 @@ module Samvera
|
|
72
72
|
raise Exceptions::CycleDetectionError, id if index_document.maximum_nesting_depth <= 0
|
73
73
|
preservation_document = adapter.find_preservation_document_by(id: index_document.id)
|
74
74
|
parent_ids_and_path_and_ancestors = parent_ids_and_path_and_ancestors_for(preservation_document)
|
75
|
-
adapter.write_document_attributes_to_index_layer(
|
75
|
+
adapter.write_document_attributes_to_index_layer(**parent_ids_and_path_and_ancestors)
|
76
76
|
end
|
77
77
|
|
78
78
|
def parent_ids_and_path_and_ancestors_for(preservation_document)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: samvera-nesting_indexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|