Class: Jats::Article
- Inherits:
-
Object
- Object
- Jats::Article
- Defined in:
- lib/jats/article.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#xml ⇒ Object
Returns the value of attribute xml.
Class Method Summary collapse
Instance Method Summary collapse
- #add_node(node) ⇒ Object
- #add_to_outline(node) ⇒ Object
-
#initialize(xml = nil) ⇒ Article
constructor
A new instance of Article.
- #parse ⇒ Object
- #parse_back ⇒ Object
Methods included from Body
#nodes, #parse_body, #parse_fig, #parse_p, #parse_sec
Methods included from Front
#parse_article_categories, #parse_article_id, #parse_contrib_group, #parse_front, #parse_history, #parse_kwd_group, #parse_pub_date, #parse_title_group
Constructor Details
#initialize(xml = nil) ⇒ Article
Returns a new instance of Article.
12 13 14 15 16 17 |
# File 'lib/jats/article.rb', line 12 def initialize(xml=nil) @xml = xml @doc = { properties: {} } @doc[:nodes] = {} @doc[:views] = { content: [] } end |
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
6 7 8 |
# File 'lib/jats/article.rb', line 6 def doc @doc end |
#xml ⇒ Object
Returns the value of attribute xml.
6 7 8 |
# File 'lib/jats/article.rb', line 6 def xml @xml end |
Class Method Details
.from_xml(xml) ⇒ Object
8 9 10 |
# File 'lib/jats/article.rb', line 8 def self.from_xml(xml) new(xml).parse end |
Instance Method Details
#add_node(node) ⇒ Object
23 24 25 |
# File 'lib/jats/article.rb', line 23 def add_node(node) doc[:nodes].merge!(node.to_hash) end |
#add_to_outline(node) ⇒ Object
19 20 21 |
# File 'lib/jats/article.rb', line 19 def add_to_outline(node) doc[:views][:content] << node.name end |
#parse ⇒ Object
31 32 33 34 35 36 |
# File 'lib/jats/article.rb', line 31 def parse parse_front parse_body parse_back doc end |
#parse_back ⇒ Object
27 28 29 |
# File 'lib/jats/article.rb', line 27 def parse_back # TODO implement end |