cocina_display 1.4.0 → 1.4.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 +4 -4
- data/lib/cocina_display/concerns/forms.rb +32 -32
- data/lib/cocina_display/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 19034929abb6dce0d501ff7ce3f898f5edbd10fa95bcd3b1acb80b91a3eed238
|
|
4
|
+
data.tar.gz: ed95d7744cc46312653b1d661d18bf60cf8d10a8c355c6cde937ea921086b4c9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b4627ef8e75add721d28c80bd7fec72ad5a894435b75eefab82d31b6b099a2f857022e249d4fbf16b5a0dd9dadf2baaf428fd7e4ad724c5485e4712b03fa280
|
|
7
|
+
data.tar.gz: 29f3d16fabefb67e82a7e6b9c8b47df42a24715818ac3b872df8a9bf2736afcb1c0cb1773fec0113a70ee51f8eeda99aa546db304174186c8eb549e00deddb0b
|
|
@@ -105,8 +105,6 @@ module CocinaDisplay
|
|
|
105
105
|
genres.include?("Dataset")
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
-
private
|
|
109
|
-
|
|
110
108
|
# Collapses all nested form values into an array of {Form} objects.
|
|
111
109
|
# Preserves resource type without flattening, since it can be structured.
|
|
112
110
|
# @return [Array<Form>]
|
|
@@ -147,6 +145,38 @@ module CocinaDisplay
|
|
|
147
145
|
all_forms.filter { |form| ["reformatting quality", "media type"].include?(form.type) }
|
|
148
146
|
end
|
|
149
147
|
|
|
148
|
+
# All resource types forms, as {ResourceType}s.
|
|
149
|
+
# @return [Array<ResourceType>]
|
|
150
|
+
def all_resource_types
|
|
151
|
+
all_forms.filter { |form| form.is_a?(CocinaDisplay::Forms::ResourceType) }
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# {ResourceType} objects that are Stanford self-deposit resource types.
|
|
155
|
+
# @return [Array<ResourceType>]
|
|
156
|
+
def self_deposit_resource_types
|
|
157
|
+
all_resource_types.filter { |resource_type| resource_type.stanford_self_deposit? }
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Display values of all resource types.
|
|
161
|
+
# @return [Array<String>]
|
|
162
|
+
def resource_type_values
|
|
163
|
+
all_resource_types.map(&:to_s).uniq
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Issuance terms for a work, drawn from the event notes.
|
|
167
|
+
# @return [Array<String>]
|
|
168
|
+
def issuance_terms
|
|
169
|
+
events.flat_map(&:notes).filter { |note| note.type == "issuance" }.map { |note| note.to_s.downcase }.uniq
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Frequency terms for a periodical, drawn from the event notes.
|
|
173
|
+
# @return [Array<String>]
|
|
174
|
+
def frequency
|
|
175
|
+
events.flat_map(&:notes).filter { |note| note.type == "frequency" }.map { |note| note.to_s.downcase }.uniq
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
private
|
|
179
|
+
|
|
150
180
|
# Map a resource type to SearchWorks format value(s).
|
|
151
181
|
# @param resource_type [String] The resource type to map.
|
|
152
182
|
# @return [Array<String>]
|
|
@@ -186,36 +216,6 @@ module CocinaDisplay
|
|
|
186
216
|
|
|
187
217
|
values.compact_blank
|
|
188
218
|
end
|
|
189
|
-
|
|
190
|
-
# All resource types forms, as {ResourceType}s.
|
|
191
|
-
# @return [Array<ResourceType>]
|
|
192
|
-
def all_resource_types
|
|
193
|
-
all_forms.filter { |form| form.is_a?(CocinaDisplay::Forms::ResourceType) }
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
# {ResourceType} objects that are Stanford self-deposit resource types.
|
|
197
|
-
# @return [Array<ResourceType>]
|
|
198
|
-
def self_deposit_resource_types
|
|
199
|
-
all_resource_types.filter { |resource_type| resource_type.stanford_self_deposit? }
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
# Display values of all resource types.
|
|
203
|
-
# @return [Array<String>]
|
|
204
|
-
def resource_type_values
|
|
205
|
-
all_resource_types.map(&:to_s).uniq
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
# Issuance terms for a work, drawn from the event notes.
|
|
209
|
-
# @return [Array<String>]
|
|
210
|
-
def issuance_terms
|
|
211
|
-
events.flat_map(&:notes).filter { |note| note.type == "issuance" }.map { |note| note.to_s.downcase }.uniq
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
# Frequency terms for a periodical, drawn from the event notes.
|
|
215
|
-
# @return [Array<String>]
|
|
216
|
-
def frequency
|
|
217
|
-
events.flat_map(&:notes).filter { |note| note.type == "frequency" }.map { |note| note.to_s.downcase }.uniq
|
|
218
|
-
end
|
|
219
219
|
end
|
|
220
220
|
end
|
|
221
221
|
end
|