fieldhand 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/fieldhand/record.rb +2 -2
- data/spec/fieldhand/record_spec.rb +5 -15
- 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: 52d3d4940c27abdd47bf06f7ad49f46e742a6e92
|
4
|
+
data.tar.gz: 22510d14c27a88f49529a36f6f6e901674073ece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd40718309d4404942fc03fe278121d3bb9bdbba21c0c632fa9e5770fe6b38dbcac55725cb121730ce851ddb03711e98996a00b0746cdc82a6747aa4b8e6708b
|
7
|
+
data.tar.gz: 665247958faacf0cf52fe06884b3642918b1a34185babf4947f527733827a18e7345b5ce273b9297d2cb1ef9791a26e52baa3c7a707e26fa47831f2f8028b6a9
|
data/README.md
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
|
3
3
|
A Ruby library for harvesting metadata from [OAI-PMH](https://www.openarchives.org/OAI/openarchivesprotocol.html) repositories.
|
4
4
|
|
5
|
-
**Current version:** 0.
|
5
|
+
**Current version:** 0.7.0
|
6
6
|
**Supported Ruby versions:** 1.8.7, 1.9.2, 1.9.3, 2.0, 2.1, 2.2
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
10
|
```
|
11
|
-
gem install fieldhand -v '~> 0.
|
11
|
+
gem install fieldhand -v '~> 0.7'
|
12
12
|
```
|
13
13
|
|
14
14
|
Or, in your `Gemfile`:
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
gem 'fieldhand', '~> 0.
|
17
|
+
gem 'fieldhand', '~> 0.7'
|
18
18
|
```
|
19
19
|
|
20
20
|
## Usage
|
data/lib/fieldhand/record.rb
CHANGED
@@ -47,14 +47,14 @@ module Fieldhand
|
|
47
47
|
|
48
48
|
# Return this whole item as a string
|
49
49
|
def to_xml
|
50
|
-
Ox.dump(element, :encoding => 'utf-8')
|
50
|
+
Ox.dump(element, :encoding => 'utf-8', :indent => -1)
|
51
51
|
end
|
52
52
|
|
53
53
|
# Return the single manifestation of the metadata of this item as a string, if present.
|
54
54
|
#
|
55
55
|
# As metadata can be in any format, Fieldhand does not attempt to parse it but leave that to the user.
|
56
56
|
def metadata
|
57
|
-
@metadata ||= element.locate('metadata[0]').map { |metadata| Ox.dump(metadata, :encoding => 'utf-8') }.first
|
57
|
+
@metadata ||= element.locate('metadata[0]').map { |metadata| Ox.dump(metadata, :encoding => 'utf-8', :indent => -1) }.first
|
58
58
|
end
|
59
59
|
|
60
60
|
# Return any about elements describing the metadata of this record as an array of strings.
|
@@ -33,14 +33,14 @@ module Fieldhand
|
|
33
33
|
element = ::Ox.parse('<record><metadata>Foo</metadata></record>')
|
34
34
|
record = described_class.new(element)
|
35
35
|
|
36
|
-
expect(record.metadata).to eq("
|
36
|
+
expect(record.metadata).to eq("<metadata>Foo</metadata>\n")
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'returns the metadata with unicode characters as a string' do
|
40
40
|
element = ::Ox.parse('<record><metadata>ψFooϨ</metadata></record>')
|
41
41
|
record = described_class.new(element)
|
42
42
|
|
43
|
-
expect(record.metadata).to eq("
|
43
|
+
expect(record.metadata).to eq("<metadata>ψFooϨ</metadata>\n")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -49,31 +49,21 @@ module Fieldhand
|
|
49
49
|
element = ::Ox.parse('<record/>')
|
50
50
|
record = described_class.new(element)
|
51
51
|
|
52
|
-
expect(record.to_xml).to eq("
|
52
|
+
expect(record.to_xml).to eq("<record/>\n")
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'returns the whole element as a string' do
|
56
56
|
element = ::Ox.parse("<record><metadata>Foo</metadata></record>")
|
57
57
|
record = described_class.new(element)
|
58
58
|
|
59
|
-
expect(record.to_xml).to eq(
|
60
|
-
|
61
|
-
<record>
|
62
|
-
<metadata>Foo</metadata>
|
63
|
-
</record>
|
64
|
-
XML
|
59
|
+
expect(record.to_xml).to eq("<record><metadata>Foo</metadata></record>\n")
|
65
60
|
end
|
66
61
|
|
67
62
|
it 'returns the whole element with unicode characters as a string' do
|
68
63
|
element = ::Ox.parse("<record><metadata>ψFooϨ</metadata></record>")
|
69
64
|
record = described_class.new(element)
|
70
65
|
|
71
|
-
expect(record.to_xml).to eq(
|
72
|
-
|
73
|
-
<record>
|
74
|
-
<metadata>ψFooϨ</metadata>
|
75
|
-
</record>
|
76
|
-
XML
|
66
|
+
expect(record.to_xml).to eq("<record><metadata>ψFooϨ</metadata></record>\n")
|
77
67
|
end
|
78
68
|
end
|
79
69
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fieldhand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Mucur
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-07-
|
13
|
+
date: 2017-07-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ox
|