Class: Coradoc::Element::Author

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first_name, last_name, email, middle_name = nil) ⇒ Author

Returns a new instance of Author.



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

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 (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

Instance Method Details

#to_adocObject



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

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