Class: Coradoc::Element::Header

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/element/header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  @title = title
  @author = options.fetch(:author, nil)
  @revision = options.fetch(:revision, nil)
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



4
5
6
# File 'lib/coradoc/element/header.rb', line 4

def author
  @author
end

#revisionObject

Returns the value of attribute revision.



4
5
6
# File 'lib/coradoc/element/header.rb', line 4

def revision
  @revision
end

#titleObject

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_adocObject



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