pennmarc 1.4.8 → 1.4.9

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: a51f4a4e365a774002e2dbddfa2d1ba72b37e7ed5b98c2b6ca7910e45c571568
4
- data.tar.gz: 795408a49a463709d3d0805ec5a66b58c822ee99630f9ed281583c2c954e23b4
3
+ metadata.gz: 2ee4c96f758d430badc9594ba3b31ad1abd2d8b5b92f80cd681fe4fbe053a21a
4
+ data.tar.gz: 0a28c912baed15e8e5e50256ebd61b7225af8724f1291c84ab5ac9d4a25f8006
5
5
  SHA512:
6
- metadata.gz: 64213422101fa26f03d675af34ffb5f0169b266c6173689516fb9a33120d3fca8c709392ccea842baf96ae08887c9aea238d542e932cf289428437fce7685df9
7
- data.tar.gz: b29c0fb8dd64d223b0749b1179286bd99d430e658d38e236cfed0747b96fc88dd9494c213ecd0c007c03a0bca03ea49a6ba61fce2eb59578e6c42cc337ee46e1
6
+ metadata.gz: 8afaa2eea826782c1390c6691ed32d9475a8263c7155239e820dcb0d1ed99bef861151b676f58cf006fa6999eb1dffb582700d74141167f9b44edfb65a99d249
7
+ data.tar.gz: c05fa58a6e4a3ba45ebb6844182c2dd938bd15f7dcd055a1a2a0ae212fac99fc7529724f691b8a8abcd6d37a41eab42f1491325860178f9bab675f9498c944ff
data/.rubocop.yml CHANGED
@@ -3,5 +3,16 @@ inherit_from: .rubocop_todo.yml
3
3
  inherit_gem:
4
4
  upennlib-rubocop: upennlib_rubocop_defaults.yml
5
5
 
6
+ plugins:
7
+ - rubocop-yard
8
+
9
+ YARD/MismatchName:
10
+ Description: 'Check @param and @option name and method parameters'
11
+ Enabled: true
12
+ VersionAdded: '0.3.0'
13
+ EnforcedStylePrototypeName: before
14
+ SupportedStylesPrototypeName:
15
+ - before
16
+
6
17
  Rails:
7
18
  Enabled: false
data/Gemfile CHANGED
@@ -8,6 +8,7 @@ gem 'library_stdnums', '~> 1.6'
8
8
  gem 'marc', '~> 1.2'
9
9
  gem 'nokogiri', '~> 1.15'
10
10
  gem 'rake', '~> 13.0'
11
+ gem 'rubocop-yard', require: false
11
12
  gem 'upennlib-rubocop', require: false
12
13
 
13
14
  group :test, :development do
data/Gemfile.lock CHANGED
@@ -127,6 +127,10 @@ GEM
127
127
  rubocop-rspec (3.9.0)
128
128
  lint_roller (~> 1.1)
129
129
  rubocop (~> 1.81)
130
+ rubocop-yard (1.1.0)
131
+ lint_roller
132
+ rubocop (~> 1.72)
133
+ yard
130
134
  ruby-progressbar (1.13.0)
131
135
  securerandom (0.4.1)
132
136
  simplecov (0.22.0)
@@ -171,6 +175,7 @@ DEPENDENCIES
171
175
  rackup
172
176
  rake (~> 13.0)
173
177
  rspec (~> 3.12)
178
+ rubocop-yard
174
179
  simplecov (~> 0.22)
175
180
  upennlib-rubocop
176
181
  yard
@@ -52,6 +52,7 @@ module PennMARC
52
52
  # theme to the 7xx fields but apply to serial records. Includes all subfield values except those in the
53
53
  # {SEARCH_EXCLUDED_SUBFIELDS} constant.
54
54
  # @param record [MARC::Record]
55
+ # @param relator_map [Hash]
55
56
  # @return [Array<String>] array of extended author/creator values for indexing
56
57
  def search_aux(record, relator_map: Mappers.relator)
57
58
  name_search_values record: record, tags: AUX_TAGS, relator_map: relator_map
@@ -62,6 +63,7 @@ module PennMARC
62
63
  # value except for those defined in the {DISPLAY_EXCLUDED_SUBFIELDS} constant. Then, appends any encoded relators
63
64
  # found in $4. If there are no valid encoded relators, uses the value found in $e.
64
65
  # @param record [MARC::Record]
66
+ # @param relator_map [Hash]
65
67
  # @return [Array<String>] array of author/creator values for display
66
68
  def show(record, relator_map: Mappers.relator)
67
69
  fields = record.fields(TAGS)
@@ -87,6 +89,7 @@ module PennMARC
87
89
 
88
90
  # Show more credited authors - both 100 field and 700 entries where the relator (codes e or 4) is author/aut
89
91
  # @param record [MARC::Record]
92
+ # @param relator_map [Hash]
90
93
  # @return [Array<String>] array of author/creator values for display
91
94
  def extended_show(record, relator_map: Mappers.relator)
92
95
  fields = record.fields(TAGS + %w[700 710])
@@ -231,6 +234,7 @@ module PennMARC
231
234
  # @note ported from get_conference_values
232
235
  # @todo what is ǂi for?
233
236
  # @param record [MARC::Record]
237
+ # @param relator_map [Hash]
234
238
  # @return [Array<String>] array of conference values
235
239
  def conference_detail_show(record, relator_map: Mappers.relator)
236
240
  conferences = record.fields(%w[111 711]).filter_map do |field|
@@ -462,6 +466,7 @@ module PennMARC
462
466
  # values other than $0, $4, $5, $6, $8, $e, $j, and $w to create conference value. We join subfields $e and $w to
463
467
  # determine the subunit value. We append any relators, preferring those defined in $4 and using $j as a fallback.
464
468
  # @param field [MARC::Field]
469
+ # @param relator_map [Hash]
465
470
  # @return [String]
466
471
  def parse_conference_detail_show_value(field, relator_map: Mappers.relator)
467
472
  conf = if subfield_undefined? field, 'i'
@@ -12,6 +12,7 @@ module PennMARC
12
12
  # Publication and/or Volume Designation).
13
13
  # https://www.loc.gov/marc/bibliographic/bd250.html
14
14
  # @param record [MARC::Record]
15
+ # @param with_alternate [Boolean]
15
16
  # @return [Array<String>] array of editions and their alternates
16
17
  def show(record, with_alternate: true)
17
18
  editions = record.fields('250').map do |field|
@@ -7,7 +7,7 @@ module PennMARC
7
7
  # Represent a Electronic inventory entry - simple because the subfield specification is identical across
8
8
  # entries returned by the API and Alma Publishing enrichment
9
9
  class Electronic < Base
10
- # @return [Hash{Symbol->Unknown}]
10
+ # @return [Hash{Symbol=>Unknown}]
11
11
  def to_h
12
12
  { portfolio_id: field[mapper::ELEC_PORTFOLIO_ID],
13
13
  url: field[mapper::ELEC_SERVICE_URL],
@@ -25,7 +25,7 @@ module PennMARC
25
25
  field[mapper::PHYS_PRIORITY]
26
26
  end
27
27
 
28
- # @return [Hash{Symbol->Unknown}]
28
+ # @return [Hash{Symbol=>Unknown}]
29
29
  def to_h
30
30
  { holding_id: field[mapper::PHYS_HOLDING_ID],
31
31
  location_name: field[mapper::PHYS_LOCATION_NAME],
@@ -68,7 +68,7 @@ module PennMARC
68
68
  # Determine enriched marc location tag, location code subfield, and call number subfield,
69
69
  # giving priority to using 'itm', 'AVA', or 'hld' fields.
70
70
  # @param record [MARC::Record]
71
- # @return [Hash<String, String>] containing location tag and subfield code
71
+ # @return [Hash{String => String}] containing location tag and subfield code
72
72
  # - `:tag` (String): The enriched marc location tag
73
73
  # - `:location_code_sf` (String): The subfield code where location code is stored
74
74
  # - `:call_num_sf` (String): The subfield code where call number is stored
@@ -1602,6 +1602,10 @@ vetewellrm:
1602
1602
  - Veterinary
1603
1603
  - 'Veterinary: Atwood Library (Campus)'
1604
1604
  display: 'Veterinary: Atwood Library (Campus)- Wellness Room'
1605
+ vpcgcdisp:
1606
+ specific_location: Van Pelt - Global Collections Book Display
1607
+ library: Van Pelt-Dietrich Library Center
1608
+ display: Van Pelt - Global Collections Book Display -- First Floor
1605
1609
  vpexhibits:
1606
1610
  specific location: Van Pelt - Exhibits and Events
1607
1611
  library: Van Pelt-Dietrich Library Center
@@ -13,6 +13,7 @@ module PennMARC
13
13
  class Parser
14
14
  # Allow calls to `respond_to?` on parser instances to respond accurately by checking helper classes
15
15
  # @param name [String, Symbol]
16
+ # @param include_private [Boolean]
16
17
  # @return [Boolean]
17
18
  def respond_to_missing?(name, include_private = false)
18
19
  helper, method_name = parse_call(name)
@@ -41,7 +41,7 @@ module PennMARC
41
41
  end
42
42
  end
43
43
 
44
- # @return [Array[Array]]
44
+ # @return [Array<Array>]
45
45
  def factors
46
46
  FACTORS
47
47
  end
data/lib/pennmarc/util.rb CHANGED
@@ -38,7 +38,7 @@ module PennMARC
38
38
  # returns true if field has a value that matches
39
39
  # passed-in regex and passed in subfield
40
40
  # @param field [MARC::DataField]
41
- # @param subfield [String|Integer|Symbol]
41
+ # @param subfield [String, Integer, Symbol]
42
42
  # @param regex [Regexp]
43
43
  # @return [Boolean, nil]
44
44
  def subfield_value?(field, subfield, regex)
@@ -48,7 +48,7 @@ module PennMARC
48
48
  # returns true if field has no value that matches
49
49
  # passed-in regex and passed in subfield
50
50
  # @param field [MARC::DataField]
51
- # @param subfield [String|Integer|Symbol]
51
+ # @param subfield [String, Integer, Symbol]
52
52
  # @param regex [Regexp]
53
53
  # @return [Boolean, nil]
54
54
  def no_subfield_value_matches?(field, subfield, regex)
@@ -57,7 +57,7 @@ module PennMARC
57
57
 
58
58
  # returns true if a given field has a given subfield value in a given array
59
59
  # @param field [MARC::DataField]
60
- # @param subfield [String|Integer|Symbol]
60
+ # @param subfield [String, Integer, Symbol]
61
61
  # @param array [Array]
62
62
  # @return [Boolean]
63
63
  def subfield_value_in?(field, subfield, array)
@@ -65,8 +65,8 @@ module PennMARC
65
65
  end
66
66
 
67
67
  # returns true if a given field does not have a given subfield value in a given array
68
- # @param field [MARC:DataField]
69
- # @param subfield [String|Integer|Symbol]
68
+ # @param field [MARC::DataField]
69
+ # @param subfield [String, Integer, Symbol]
70
70
  # @param array [Array]
71
71
  # @return [Boolean]
72
72
  def subfield_value_not_in?(field, subfield, array)
@@ -89,7 +89,7 @@ module PennMARC
89
89
 
90
90
  # Check if a field has a given subfield defined
91
91
  # @param field [MARC::DataField]
92
- # @param subfield [String|Symbol|Integer]
92
+ # @param subfield [String, Symbol, Integer]
93
93
  # @return [Boolean]
94
94
  def subfield_defined?(field, subfield)
95
95
  field.any? { |sf| sf.code == subfield.to_s }
@@ -97,7 +97,7 @@ module PennMARC
97
97
 
98
98
  # Check if a field does not have a given subfield defined
99
99
  # @param field [MARC::DataField]
100
- # @param subfield [String|Symbol|Integer]
100
+ # @param subfield [String, Symbol, Integer]
101
101
  # @return [Boolean]
102
102
  def subfield_undefined?(field, subfield)
103
103
  field.none? { |sf| sf.code == subfield.to_s }
@@ -105,7 +105,7 @@ module PennMARC
105
105
 
106
106
  # Gets all subfield values for a subfield in a given field
107
107
  # @param field [MARC::DataField]
108
- # @param subfield [String|Symbol] as a string or symbol
108
+ # @param subfield [String, Symbol] as a string or symbol
109
109
  # @return [Array] subfield values for given subfield code
110
110
  def subfield_values(field, subfield)
111
111
  field.filter_map do |sf|
@@ -183,7 +183,7 @@ module PennMARC
183
183
  # passed-in block from 880 datafield that has a particular subfield 6 value.
184
184
  # See: https://www.loc.gov/marc/bibliographic/bd880.html
185
185
  # @param record [MARC::Record]
186
- # @param subfield6_value [String|Array] either a string to look for in sub6 or an array of them
186
+ # @param subfield6_value [String, Array] either a string to look for in sub6 or an array of them
187
187
  # @param selector [Proc] takes a subfield as argument, returns a boolean
188
188
  # @return [Array] array of linked alternates
189
189
  def linked_alternate(record, subfield6_value, &selector)
@@ -198,7 +198,7 @@ module PennMARC
198
198
  # from 880 datafield that has a particular subfield 6 value. We exclude 6 because
199
199
  # that value is the linkage ID itself and 8 because... IDK
200
200
  # @param record [MARC::Record]
201
- # @param subfield6_value [String|Array] either a string to look for in sub6 or an array of them
201
+ # @param subfield6_value [String, Array] either a string to look for in sub6 or an array of them
202
202
  # @return [Array] array of linked alternates without 8 or 6 values
203
203
  def linked_alternate_not_6_or_8(record, subfield6_value)
204
204
  excluded_subfields = %w[6 8]
@@ -319,7 +319,7 @@ module PennMARC
319
319
  # {https://www.loc.gov/marc/bibliographic/bd111.html 111}, {https://www.loc.gov/marc/bibliographic/bd411.html 411},
320
320
  # {https://www.loc.gov/marc/bibliographic/bd611.html 611}, {https://www.loc.gov/marc/bibliographic/bd711.html 711},
321
321
  # {https://www.loc.gov/marc/bibliographic/bd811.html 811}
322
- # @param field [MARC:Field]
322
+ # @param field [MARC::Field]
323
323
  # @return [String (frozen)]
324
324
  def relator_term_subfield(field)
325
325
  field_or_its_linked_alternate?(field, %w[111 411 611 711 811]) ? 'j' : 'e'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PennMARC
4
- VERSION = '1.4.8'
4
+ VERSION = '1.4.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pennmarc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.8
4
+ version: 1.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Kanning
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2026-07-24 00:00:00.000000000 Z
15
+ date: 2026-09-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport