Class: Coradoc::Element::Bibliography
- Defined in:
- lib/coradoc/element/bibliography.rb
Instance Attribute Summary collapse
-
#entries ⇒ Object
Returns the value of attribute entries.
-
#id ⇒ Object
Returns the value of attribute id.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Bibliography
constructor
A new instance of Bibliography.
- #to_adoc ⇒ Object
Methods inherited from Base
#children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(options = {}) ⇒ Bibliography
Returns a new instance of Bibliography.
6 7 8 9 10 11 |
# File 'lib/coradoc/element/bibliography.rb', line 6 def initialize( = {}) @id = .fetch(:id, nil) @anchor = @id.nil? ? nil : Inline::Anchor.new(@id) @title = .fetch(:title, nil) @entries = .fetch(:entries,nil) end |
Instance Attribute Details
#entries ⇒ Object
Returns the value of attribute entries.
4 5 6 |
# File 'lib/coradoc/element/bibliography.rb', line 4 def entries @entries end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/coradoc/element/bibliography.rb', line 4 def id @id end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/coradoc/element/bibliography.rb', line 4 def title @title end |
Instance Method Details
#to_adoc ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/coradoc/element/bibliography.rb', line 13 def to_adoc adoc = "#{gen_anchor}\n" adoc << "[bibliography]" adoc << "== #{@title}\n\n" @entries.each do |entry| adoc << "#{entry.to_adoc}\n" end adoc end |