lib/rubydora/audit_trail.rb in rubydora-1.8.1 vs lib/rubydora/audit_trail.rb in rubydora-1.9.0

- old
+ new

@@ -3,33 +3,33 @@ def audit_trail(pid) FedoraAuditTrail.new(object_xml(pid: pid)) end private - + AT_NS = {'audit' => 'info:fedora/fedora-system:def/audit#'} FOXML_NS = {'foxml' => 'info:fedora/fedora-system:def/foxml#'} AT_XPATH = '/foxml:digitalObject/foxml:datastream[@ID = "AUDIT"]/descendant::audit:auditTrail' - + class FedoraAuditTrail def initialize(object_xml) - @ng_xml = Nokogiri::XML(object_xml).xpath(AT_XPATH, FOXML_NS.merge(AT_NS)) + @ng_xml = Nokogiri::XML(object_xml).xpath(AT_XPATH, FOXML_NS.merge(AT_NS)) end def records - if !@records + unless @records @records = [] - @ng_xml.xpath('.//audit:record', AT_NS).each do |node| + @ng_xml.xpath('.//audit:record', AT_NS).each do |node| @records << FedoraAuditRecord.new(node) end end @records end def to_xml @ng_xml.to_xml end end - + class FedoraAuditRecord def initialize(node) @record = node end def id @@ -51,8 +51,8 @@ @record.at_xpath('audit:date', AT_NS).text end def justification @record.at_xpath('audit:justification', AT_NS).text end - end + end end