cocina_display 2.8.0 → 2.9.1

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: 3df5706e3f8104dd1cc652c4ee19ea21236218847f9bf2e32ab5491d65a3dad2
4
- data.tar.gz: 86c08d24675be82192a0dd0785a1e8b81d4fd39e9204ee9cedf73692d0e6c6f1
3
+ metadata.gz: d8a84bc81bc105293d760eda67315d31a9cc253e73e7a92953d1bfd6a4705eea
4
+ data.tar.gz: 73acf3b8a4553b3651322fb9b3c3d005386bccc571cf0e52a4b6b726ad110248
5
5
  SHA512:
6
- metadata.gz: 9458cdb077aa6afc8e8296d7a4a5b645be98547c627fbef38912d6ff9ca3e640ee32ed80bb57c438d6b6adaf1a1ece6a09a22b62cfbfda8bcef8a1063eaddf1c
7
- data.tar.gz: 00fcafcf934cfeafd181884b6577a22de4422b9d9f3c1627476513911fe9a8e4fd9120a2a4f26b81ceada07c1e481985b1953745034b11e7c96e4b78f906dd02
6
+ metadata.gz: 0440fd1e3ce299e2c3d705ea7285b7048c2cb6dccf63158987476f9ece9f79ffb7739f80b4bde364a697b121af4d1c94c14d6ffdb06f7fffd1a8901afea835b4
7
+ data.tar.gz: 8472cf7f3bd82637a2979cd5995157c22ef832ff388e905c4e24bb94d000e3c99f3e151f63dbab7c75fc2d5aa22970a51d8a754ba75c4b3c136db063084ca6f5
@@ -60,14 +60,6 @@ module CocinaDisplay
60
60
  cocina_doc["type"]&.delete_prefix("https://cocina.sul.stanford.edu/models/")
61
61
  end
62
62
 
63
- # Primary processing label for the object.
64
- # @note For public Cocina fetched via PURL, this is generated at publish time from the title. It will have the same value as #display_title.
65
- # @see https://github.com/sul-dlss/cocina_display/issues/205#issuecomment-3781393715
66
- # @return [String, nil]
67
- def label
68
- cocina_doc["label"]
69
- end
70
-
71
63
  # True if the object is a collection.
72
64
  # @return [Boolean]
73
65
  def collection?
@@ -191,7 +191,7 @@ module CocinaDisplay
191
191
  # Is the object a digital resource without a more specific resource type?
192
192
  # @return [Boolean]
193
193
  def digital_only?
194
- resource_type_values.all?("digital")
194
+ resource_type_values.present? && resource_type_values.all?("digital")
195
195
  end
196
196
 
197
197
  # Map a MODS or LC resource type to SearchWorks format value(s).
@@ -26,6 +26,10 @@ module CocinaDisplay
26
26
  primary_title&.display_title
27
27
  end
28
28
 
29
+ # SDR no longer populates a label field with pregenerated titles; this
30
+ # alias is provided for backwards compatibility.
31
+ alias_method :label, :display_title
32
+
29
33
  # A string value for sorting by title that sorts missing values last.
30
34
  # If there are multiple primary titles, uses the first.
31
35
  # @see CocinaDisplay::Title#sort_title
@@ -76,7 +76,7 @@ module CocinaDisplay
76
76
  # @return [String, nil]
77
77
  # @example "author, editor, publisher"
78
78
  def display_role
79
- roles.map(&:to_s).join(", ") if role?
79
+ roles.join(", ") if role?
80
80
  end
81
81
 
82
82
  # The primary display name for the contributor as a string.
@@ -11,7 +11,7 @@ module CocinaDisplay
11
11
  # For self-deposit resource types, the flat value comprises primary and any subtypes.
12
12
  # @return [String]
13
13
  def flat_value
14
- return super unless stanford_self_deposit?
14
+ return super unless stanford_self_deposit? && structured?
15
15
  return primary_type unless subtypes.any?
16
16
 
17
17
  "#{primary_type} (#{subtypes.join(", ")})"
@@ -32,6 +32,12 @@ module CocinaDisplay
32
32
 
33
33
  private
34
34
 
35
+ # Is this a structured resource type?
36
+ # @return [Boolean]
37
+ def structured?
38
+ cocina.key?("structuredValue")
39
+ end
40
+
35
41
  # @return [String]
36
42
  def source
37
43
  cocina.dig("source", "value")
@@ -46,7 +52,7 @@ module CocinaDisplay
46
52
  # The primary type, if this is a structured self-deposit resource type.
47
53
  # @return [String, nil]
48
54
  def primary_type
49
- type_components["type"].first
55
+ type_components["type"].first if structured?
50
56
  end
51
57
 
52
58
  # The subtypes, if this is a structured self-deposit resource type.
@@ -2,5 +2,5 @@
2
2
 
3
3
  # :nodoc:
4
4
  module CocinaDisplay
5
- VERSION = "2.8.0" # :nodoc:
5
+ VERSION = "2.9.1" # :nodoc:
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocina_display
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Budak
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-07-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: janeway-jsonpath
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  - !ruby/object:Gem::Version
327
327
  version: '0'
328
328
  requirements: []
329
- rubygems_version: 4.0.6
329
+ rubygems_version: 3.6.2
330
330
  specification_version: 4
331
331
  summary: Helpers for rendering Cocina metadata
332
332
  test_files: []