Class: Orcid::Work::XmlParser

Inherits:
Object
  • Object
show all
Defined in:
app/models/orcid/work/xml_parser.rb

Overview

Responsible for taking an Orcid Work and extracting the value/text from the document and reifying an Orcid::Work object.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ XmlParser

Returns a new instance of XmlParser.



11
12
13
# File 'app/models/orcid/work/xml_parser.rb', line 11

def initialize(xml)
  @xml = xml
end

Instance Attribute Details

#xmlObject (readonly)

Returns the value of attribute xml.



10
11
12
# File 'app/models/orcid/work/xml_parser.rb', line 10

def xml
  @xml
end

Class Method Details

.call(xml) ⇒ Object



6
7
8
# File 'app/models/orcid/work/xml_parser.rb', line 6

def self.call(xml)
  new(xml).call
end

Instance Method Details

#callObject



15
16
17
18
19
# File 'app/models/orcid/work/xml_parser.rb', line 15

def call
  document.css('orcid-works orcid-work').map do |node|
    transform(node)
  end
end