Class: Coradoc::Element::Header
- Defined in:
- lib/coradoc/element/header.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#revision ⇒ Object
Returns the value of attribute revision.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title, options = {}) ⇒ Header
constructor
A new instance of Header.
- #to_adoc ⇒ Object
Methods inherited from Base
#children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(title, options = {}) ⇒ Header
Returns a new instance of Header.
8 9 10 11 12 |
# File 'lib/coradoc/element/header.rb', line 8 def initialize(title, = {}) @title = title @author = .fetch(:author, nil) @revision = .fetch(:revision, nil) end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
4 5 6 |
# File 'lib/coradoc/element/header.rb', line 4 def @author end |
#revision ⇒ Object
Returns the value of attribute revision.
4 5 6 |
# File 'lib/coradoc/element/header.rb', line 4 def revision @revision end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/coradoc/element/header.rb', line 4 def title @title end |
Instance Method Details
#to_adoc ⇒ Object
14 15 16 17 18 19 |
# File 'lib/coradoc/element/header.rb', line 14 def to_adoc adoc = "= #{@title}\n" adoc << @author.to_adoc if @author adoc << @revision.to_adoc if @revision adoc end |