Skip to content

Commit

Permalink
Move mods parsing local
Browse files Browse the repository at this point in the history
This will allow us to decouple purl_fetcher-client from the front-end (e.g. view_component, auto-link).
  • Loading branch information
jcoyne committed Apr 19, 2024
1 parent 67e610b commit c8e53a5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/models/purl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ def public_xml
end

def smods_rec
public_xml_record.stanford_mods
@smods_rec ||= Stanford::Mods::Record.new.tap do |smods_rec|
smods_rec.from_str(public_xml_record.mods.to_s)
end
end

delegate :mods_display, to: :public_xml_record
def mods_display
@mods_display ||= ModsDisplay::HTML.new(smods_rec)
end

def collections
@collections ||= public_xml_record.collections.map do |record|
Expand Down

0 comments on commit c8e53a5

Please sign in to comment.