Skip to content

Commit

Permalink
Move primary method to the resource level
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Nov 17, 2023
1 parent 1a83f2f commit 91691bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/embed/purl/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ def size

# @return [ResourceFile]
def primary_file
files.find(&:primary?)
files.find { |file| primary_types.include?(file.mimetype) }
end

def primary_types
@primary_types ||= Array(Settings.primary_mimetypes[type])
end

# @return [ResourceFile]
Expand Down

0 comments on commit 91691bb

Please sign in to comment.