Sha256: 66b1ce0d28ee83e593b3a69977506f009131baf169d82d4ba07a814c1354ac61

Contents?: true

Size: 482 Bytes

Versions: 4

Compression:

Stored size: 482 Bytes

Contents

# frozen_string_literal: true

require 'stanford-mods'

##
# A convenience object for parsing and rendering MODS
module ModsDisplay
  class Record
    attr_reader :xml

    def initialize(xml)
      @xml = xml
    end

    def mods_record
      return if xml.nil?
      @mods_record ||= Stanford::Mods::Record.new.tap { |mods| mods.from_str(xml, false) }
    end

    def mods_display_html
      return unless mods_record

      ModsDisplay::HTML.new(mods_record)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mods_display-1.0.0.alpha4 app/models/mods_display/record.rb
mods_display-1.0.0.alpha3 app/models/mods_display/record.rb
mods_display-1.0.0.alpha2 app/models/mods_display/record.rb
mods_display-1.0.0.alpha1 app/models/mods_display/record.rb