Class: Orcid::Work::XmlParser
- Inherits:
-
Object
- Object
- Orcid::Work::XmlParser
- 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
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(xml) ⇒ XmlParser
constructor
A new instance of XmlParser.
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
#xml ⇒ Object (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
#call ⇒ Object
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 |