Class: Inventory::Author

Inherits:
Object
  • Object
show all
Defined in:
lib/inventory-1.0/author.rb

Overview

An author of the project stored in the list of Authors in the inventory.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, email) ⇒ Author

Sets up a new author NAME that can be contacted at EMAIL.

Parameters:

  • name (String)
  • email (String)


9
10
11
# File 'lib/inventory-1.0/author.rb', line 9

def initialize(name, email)
  @name, @email = name, email
end

Instance Attribute Details

#emailString (readonly)

Returns The email address of the author.

Returns:

  • (String)

    The email address of the author



23
24
25
# File 'lib/inventory-1.0/author.rb', line 23

def email
  @email
end

#nameString (readonly)

Returns The name of the author.

Returns:

  • (String)

    The name of the author



20
21
22
# File 'lib/inventory-1.0/author.rb', line 20

def name
  @name
end

Instance Method Details

#to_sString

Returns The #name and #email of the author on the “‘name <email>`” format.

Returns:

  • (String)

    The #name and #email of the author on the “‘name <email>`” format



15
16
17
# File 'lib/inventory-1.0/author.rb', line 15

def to_s
  '%s <%s>' % [name, email]
end