Class: RTFM::AuthorsSection

Inherits:
Object
  • Object
show all
Defined in:
lib/rtfm/sections/authors.rb

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ AuthorsSection

Returns a new instance of AuthorsSection.

Yields:

  • (_self)

Yield Parameters:



3
4
5
6
# File 'lib/rtfm/sections/authors.rb', line 3

def initialize
  @authors = []
  yield self if block_given?
end

Instance Method Details

#add_author(name, email = nil) ⇒ Object Also known as: author, add



7
8
9
# File 'lib/rtfm/sections/authors.rb', line 7

def add_author(name, email = nil)
  @authors << {:name => name, :email => email}
end

#to_groffObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/rtfm/sections/authors.rb', line 13

def to_groff
  GroffString.groffify do |out|
    out.section "authors"
    @authors.each do |author|
      args = ["\"#{author[:name]}\""]
      if author[:email] then args << "Aq" << author[:email] end
      out.An *args
    end
  end
end