sqed 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/lib/sqed/extractor.rb +5 -2
- data/lib/sqed/result.rb +8 -0
- data/lib/sqed/version.rb +1 -1
- data/spec/lib/sqed/extractor_spec.rb +15 -0
- 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: 15b9a6f76959bb89b1fbfbb521ec81418044e429
|
4
|
+
data.tar.gz: 9207ef009d4ef1c3ec0b286152a254ac5d5efd29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f1ab07c22d9651c0ec758c11e26e070ca9a6771089c6c0b6f27cb3cf3297c07e0052bd5d27db2ff7e622422fed9c5181072ef52eff244660280b008cb33f177
|
7
|
+
data.tar.gz: 97dee84567edca8f41a0ab193d0ccc577a637ba8cdf293d60c62df6b152d09ff0d08a0e7a61d4cddae4e487db403222c4827c46083ba15603169a8acb47f00f9
|
data/lib/sqed/extractor.rb
CHANGED
@@ -27,10 +27,13 @@ class Sqed::Extractor
|
|
27
27
|
def result
|
28
28
|
r = Sqed::Result.new()
|
29
29
|
|
30
|
+
r.sections = metadata_map.values.sort
|
31
|
+
|
30
32
|
# assign the images to the result
|
31
33
|
boundaries.each do |section_index, coords|
|
32
|
-
|
33
|
-
r.send(
|
34
|
+
section_type = metadata_map[section_index]
|
35
|
+
r.send("#{section_type}_image=", extract_image(coords))
|
36
|
+
r.boundary_coordinates[section_type] = coords
|
34
37
|
end
|
35
38
|
|
36
39
|
# assign the metadata to the result
|
data/lib/sqed/result.rb
CHANGED
@@ -7,10 +7,18 @@ class Sqed::Result
|
|
7
7
|
attr_accessor "#{k}_image".to_sym
|
8
8
|
attr_accessor k
|
9
9
|
end
|
10
|
+
|
11
|
+
# a hash with section_type => [ ]
|
12
|
+
attr_accessor :boundary_coordinates
|
13
|
+
|
14
|
+
# an array of section type
|
15
|
+
attr_accessor :sections
|
10
16
|
|
11
17
|
def initialize
|
18
|
+
@boundary_coordinates = {}
|
12
19
|
SqedConfig::LAYOUT_SECTION_TYPES.each do |k|
|
13
20
|
send("#{k}=", {})
|
21
|
+
@boundary_coordinates[k] = [nil, nil, nil, nil]
|
14
22
|
end
|
15
23
|
end
|
16
24
|
|
data/lib/sqed/version.rb
CHANGED
@@ -49,6 +49,21 @@ describe Sqed::Extractor do
|
|
49
49
|
specify '#result is populated with text' do
|
50
50
|
expect(r.text_for(:identifier)).to match('000085067')
|
51
51
|
end
|
52
|
+
|
53
|
+
specify '#sections is populated with section_types' do
|
54
|
+
expect(r.sections).to eq( [ :identifier, :image_registration, :nothing, :specimen ] )
|
55
|
+
end
|
56
|
+
|
57
|
+
specify '#boundary_coordinates is populated with coordinates' do
|
58
|
+
metadata_map.values.each do |section_type|
|
59
|
+
(0..3).each do |i|
|
60
|
+
expect(r.boundary_coordinates[section_type][i]).to be_truthy
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
52
67
|
end
|
53
68
|
|
54
69
|
end
|