Class: PLOS::Figure
Instance Attribute Summary collapse
- #caption ⇒ Object
- #graphic ⇒ Object
-
#id ⇒ Object
Returns the value of attribute id.
-
#label ⇒ Object
Returns the value of attribute label.
- #object ⇒ Object
-
#position ⇒ Object
Returns the value of attribute position.
Instance Method Summary collapse
-
#initialize(node) ⇒ Figure
constructor
A new instance of Figure.
Methods included from XmlHelpers
#nodes_to_hash, #parse_node, #tag_value
Constructor Details
#initialize(node) ⇒ Figure
Returns a new instance of Figure.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/plos/figure.rb', line 14 def initialize(node) self.id = node.attr("id") self.position = node.attr("position") self.label = tag_value(node, "label") caption_node = node.search("caption").first if caption_node self.caption[:title] = tag_value(caption_node, "title") self.caption[:body] = tag_value(caption_node, "p") end graphic_node = node.search("graphic").first if graphic_node mimetype = graphic_node.attr("mimetype") position = graphic_node.attr("position") link = graphic_node.attr("xlink:href") self.graphic[:mimetype] = mimetype if mimetype self.graphic[:position] = position if position self.graphic[:link] = link if link end object_node = node.search("object-id").first if object_node type = object_node.attr("pub-id-type") value = object_node.text self.object[:type] = type if type self.object[:value] = value if value end end |
Instance Attribute Details
#caption ⇒ Object
43 44 45 |
# File 'lib/plos/figure.rb', line 43 def caption @caption ||= {} end |
#graphic ⇒ Object
47 48 49 |
# File 'lib/plos/figure.rb', line 47 def graphic @graphic ||= {} end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/plos/figure.rb', line 7 def id @id end |
#label ⇒ Object
Returns the value of attribute label.
9 10 11 |
# File 'lib/plos/figure.rb', line 9 def label @label end |
#object ⇒ Object
51 52 53 |
# File 'lib/plos/figure.rb', line 51 def object @object ||= {} end |
#position ⇒ Object
Returns the value of attribute position.
8 9 10 |
# File 'lib/plos/figure.rb', line 8 def position @position end |