Class: Jats::Figure

Inherits:
Node
  • Object
show all
Defined in:
lib/jats/figure.rb

Instance Attribute Summary

Attributes inherited from Node

#index, #xml

Instance Method Summary collapse

Methods inherited from Node

from_xml, index_for, #initialize, #name, reset_indices, #to_hash, #type

Constructor Details

This class inherits a constructor from Jats::Node

Instance Method Details

#attributesObject



22
23
24
# File 'lib/jats/figure.rb', line 22

def attributes
  { doi: doi, label: label, url: url, caption: caption }
end

#captionObject



15
16
17
18
19
20
# File 'lib/jats/figure.rb', line 15

def caption
  { 
    title: xml.css('caption title').text,
    content: xml.css('caption p').text
  }
end

#doiObject



3
4
5
# File 'lib/jats/figure.rb', line 3

def doi
  xml.css('object-id[pub-id-type="doi"]').text
end

#labelObject



7
8
9
# File 'lib/jats/figure.rb', line 7

def label
  xml.css('label').text
end

#urlObject



11
12
13
# File 'lib/jats/figure.rb', line 11

def url
  xml.css('graphic')[0]['xlink:href']
end