stanford-mods 3.3.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/stanford-mods/concerns/origin_info.rb +6 -6
- data/lib/stanford-mods/version.rb +1 -1
- data/spec/origin_info_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33e5860d1c199fb9d7da0e55e49ccad107ee9438fd2b21f80008bdfb4a807ee5
|
4
|
+
data.tar.gz: 86a3a03dab961a6717f5bd96ca9f603aff70114549f38dda13ef2743b1d3543b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdb0d00f24950da177f470afd6339aa36e4dc6db460e4746b3321a9bad91202ff8becffbecf9875271a43f039a3a71d91c1c3e9c76bd1eaa2a202fdb61c2d5a9
|
7
|
+
data.tar.gz: 331d43a66da3c06ea5a3312043db2e15c90edbe2166cc2b1f3d0c48b02088885274e18cc78b314132bd359431a5a0da69261d89bd55c5b24114f7c3cd7fa8ffc
|
@@ -16,8 +16,8 @@ module Stanford
|
|
16
16
|
# @param [Boolean] ignore_approximate true if approximate dates (per qualifier attribute) should be ignored; false if approximate dates should be included
|
17
17
|
# @return [Integer] publication year as an Integer
|
18
18
|
# @note for sorting: 5 BCE => -5; 666 BCE => -666
|
19
|
-
def pub_year_int(ignore_approximate: false)
|
20
|
-
date = earliest_preferred_date(ignore_approximate: ignore_approximate)
|
19
|
+
def pub_year_int(fields = [:dateIssued, :dateCreated, :dateCaptured], ignore_approximate: false)
|
20
|
+
date = earliest_preferred_date(fields: fields, ignore_approximate: ignore_approximate)
|
21
21
|
|
22
22
|
return unless date
|
23
23
|
|
@@ -41,8 +41,8 @@ module Stanford
|
|
41
41
|
# @return [String] single String containing publication year for lexical sorting
|
42
42
|
# @note for string sorting 5 BCE = -5 => -995; 6 BCE => -994, so 6 BCE sorts before 5 BCE
|
43
43
|
# @deprecated use pub_year_int
|
44
|
-
def pub_year_sort_str(ignore_approximate: false)
|
45
|
-
earliest_preferred_date(ignore_approximate: ignore_approximate)&.sort_key
|
44
|
+
def pub_year_sort_str(fields = [:dateIssued, :dateCreated, :dateCaptured], ignore_approximate: false)
|
45
|
+
earliest_preferred_date(fields: fields, ignore_approximate: ignore_approximate)&.sort_key
|
46
46
|
end
|
47
47
|
|
48
48
|
# return a single string intended for display of pub year (or year range)
|
@@ -50,8 +50,8 @@ module Stanford
|
|
50
50
|
# @param [Array<Symbol>] fields array of field types to use to look for dates.
|
51
51
|
# @param [Boolean] ignore_approximate true if approximate dates (per qualifier attribute)
|
52
52
|
# should be ignored; false if approximate dates should be included
|
53
|
-
def pub_year_display_str(ignore_approximate: false)
|
54
|
-
earliest_preferred_date(ignore_approximate: ignore_approximate)&.decoded_value(allowed_precisions: [:year, :decade, :century], ignore_unparseable: true, display_original_text: false)
|
53
|
+
def pub_year_display_str(fields = [:dateIssued, :dateCreated, :dateCaptured], ignore_approximate: false)
|
54
|
+
earliest_preferred_date(fields: fields, ignore_approximate: ignore_approximate)&.decoded_value(allowed_precisions: [:year, :decade, :century], ignore_unparseable: true, display_original_text: false)
|
55
55
|
end
|
56
56
|
|
57
57
|
# @return [Array<Stanford::Mods::Imprint>] array of imprint objects
|
data/spec/origin_info_spec.rb
CHANGED
@@ -100,6 +100,12 @@ describe "computations from /originInfo field" do
|
|
100
100
|
it 'returns the year from the preferred field type regardless of the keyDate' do
|
101
101
|
expect(record.pub_year_display_str).to eq '1800'
|
102
102
|
end
|
103
|
+
|
104
|
+
context 'with field filters' do
|
105
|
+
it 'returns the year from the requested field' do
|
106
|
+
expect(record.pub_year_display_str([:dateCreated])).to eq '1900'
|
107
|
+
end
|
108
|
+
end
|
103
109
|
end
|
104
110
|
|
105
111
|
context 'when it has multiple dates' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stanford-mods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mods
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
|
-
rubygems_version: 3.3.
|
217
|
+
rubygems_version: 3.3.26
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: Stanford specific wrangling of MODS metadata
|