Class: ModsDisplay::Record

Inherits:
Object
  • Object
show all
Defined in:
app/models/mods_display/record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Record

Returns a new instance of Record.



11
12
13
# File 'app/models/mods_display/record.rb', line 11

def initialize(xml)
  @xml = xml
end

Instance Attribute Details

#xmlObject (readonly)

Returns the value of attribute xml.



9
10
11
# File 'app/models/mods_display/record.rb', line 9

def xml
  @xml
end

Instance Method Details

#mods_display_htmlObject



21
22
23
24
25
# File 'app/models/mods_display/record.rb', line 21

def mods_display_html
  return unless mods_record

  ModsDisplay::HTML.new(mods_record)
end

#mods_recordObject



15
16
17
18
19
# File 'app/models/mods_display/record.rb', line 15

def mods_record
  return if xml.nil?

  @mods_record ||= Stanford::Mods::Record.new.tap { |mods| mods.from_str(xml) }
end