Class: Jats::Heading

Inherits:
Node
  • Object
show all
Defined in:
lib/jats/heading.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



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

def attributes
  { content: content, level: level }
end

#contentObject



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

def content
  xml.css('> title').text
end

#levelObject



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

def level
  xml.ancestors('sec').size + 1
end