Class: Coradoc::Element::Author

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/element/author.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(first_name, last_name, email, middle_name = nil) ⇒ Author

Returns a new instance of Author.



8
9
10
11
12
13
# File 'lib/coradoc/element/author.rb', line 8

def initialize(first_name, last_name, email, middle_name = nil)
  @first_name = first_name
  @last_name = last_name
  @email = email
  @middle_name = middle_name
end

Instance Attribute Details

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

Instance Method Details

#to_adocObject



15
16
17
18
19
20
21
# File 'lib/coradoc/element/author.rb', line 15

def to_adoc
  adoc = "#{@first_name}"
  adoc << " #{@middle_name}" if @middle_name
  adoc << " #{@last_name.to_s}"
  adoc << " <#{@email}>\n" if @email
  adoc
end