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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9c63c6699eef72da80bbf9e15d892248dfc21a7550588aac09843ef26d1869f
4
- data.tar.gz: f820451452017ec653c4eabd48d19cb23a36fcfafbad814272dd26c9cc9b9d42
3
+ metadata.gz: 33e5860d1c199fb9d7da0e55e49ccad107ee9438fd2b21f80008bdfb4a807ee5
4
+ data.tar.gz: 86a3a03dab961a6717f5bd96ca9f603aff70114549f38dda13ef2743b1d3543b
5
5
  SHA512:
6
- metadata.gz: '0817296bebb438d882509919ff0b6fb2ec0e1accd71b379209f3b3b5f4cbd684d8208d8aab7ff3ce5f745860c4331af9098afadb5d066bd406016625c63d3701'
7
- data.tar.gz: 4ed8b47a3186c3f241d2b543358138c71bea5f7128fc483e1d78117af1224b75db1fb4524763c726b011f414524b7d732a54096dd07d38a909c13a05116cc3ca
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
@@ -1,6 +1,6 @@
1
1
  module Stanford
2
2
  module Mods
3
3
  # this is the Ruby Gem version
4
- VERSION = '3.3.0'.freeze
4
+ VERSION = '3.3.2'.freeze
5
5
  end
6
6
  end
@@ -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.0
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: 2022-08-02 00:00:00.000000000 Z
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.7
217
+ rubygems_version: 3.3.26
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: Stanford specific wrangling of MODS metadata