Class: Coradoc::Element::Header

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, options = {}) ⇒ Header

Returns a new instance of Header.



6
7
8
9
10
# File 'lib/coradoc/element/header.rb', line 6

def initialize(title, options = {})
  @title = title
  @author = options.fetch(:author, nil)
  @revision = options.fetch(:revision, nil)
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



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

def author
  @author
end

#revisionObject (readonly)

Returns the value of attribute revision.



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

def revision
  @revision
end

#titleObject (readonly)

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



12
13
14
15
16
17
# File 'lib/coradoc/element/header.rb', line 12

def to_adoc
  adoc = "= #{title}\n"
  adoc << @author.to_adoc if @author
  adoc << @revision.to_adoc if @revision
  adoc
end