Module: ModsDisplay::ModelExtension

Defined in:
lib/mods_display/model_extension.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/mods_display/model_extension.rb', line 3

def self.included(base)
  base.extend ClassMethods
  base.class_eval do
    def mods_display_xml
      xml = self.class.mods_xml_source.call(self)
      return if xml.nil?
      mods = Stanford::Mods::Record.new
      mods.from_str(xml, false)
      mods
    end
  end
end