cocina_display 2.4.0 → 2.5.0
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/structural.rb +13 -2
- data/lib/cocina_display/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b15ae80346f651c784e00b9816ba3ebd6f218adbc2b7a2d16967f7acf45342a7
|
|
4
|
+
data.tar.gz: 25787267b855ec6eeb746c8a380185adbef5368a266b682c62fece9d6f6fc482
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92c26cb2591f000a3bb9e5e88c1afcdf67eeaf0c2f9eb8816fe2f3cdd6fff6a0c500464f28c7f78e1a7bbabfd5adba17f9ba837ce2f8b4fcbf5898d9eaa12c90
|
|
7
|
+
data.tar.gz: f719a4a177460eecb13272c76bc669bc6546b0a0a30271108a998d055a4036d3fc442a07279e11d3e0baa79df340e40c2ba838b5e76752cffa09f21fafd02933
|
|
@@ -20,14 +20,25 @@ module CocinaDisplay
|
|
|
20
20
|
|
|
21
21
|
# Structured data for all individual files in the object.
|
|
22
22
|
# Traverses nested FileSet structure to return a flattened array.
|
|
23
|
+
# Optionally filter by filename or MIME type regex, or by role.
|
|
24
|
+
# Filters are combined with AND logic (all must match).
|
|
25
|
+
# @param filename [String, nil] Regular expression to match against filenames.
|
|
26
|
+
# @param mime_type [String, nil] Regular expression to match against MIME types.
|
|
27
|
+
# @param use [String, nil] Usage type to match against (e.g., "thumbnail").
|
|
23
28
|
# @return [Array<CocinaDisplay::Structural::File>]
|
|
24
29
|
# @example
|
|
25
30
|
# record.files.each do |file|
|
|
26
31
|
# puts file.filename #=> "image1.jpg"
|
|
27
32
|
# puts file.size #=> 123456
|
|
28
33
|
# end
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
# @example Filter to only thumbnail JP2 files
|
|
35
|
+
# record.files(filename: /\.jp2$/, use: "thumbnail")
|
|
36
|
+
def files(filename: nil, mime_type: nil, use: nil)
|
|
37
|
+
results = filesets.flat_map(&:files)
|
|
38
|
+
results.filter! { |file| file.filename =~ filename } if filename
|
|
39
|
+
results.filter! { |file| file.mime_type =~ mime_type } if mime_type
|
|
40
|
+
results.filter! { |file| file.use == use } if use
|
|
41
|
+
results
|
|
31
42
|
end
|
|
32
43
|
|
|
33
44
|
# All unique MIME types of files in this object.
|
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.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Budak
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-05-13 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: janeway-jsonpath
|