Class: Listaa::Autor
- Inherits:
-
Object
- Object
- Listaa::Autor
- Defined in:
- lib/Lista/Autor.rb
Instance Attribute Summary collapse
-
#apellido ⇒ Object
readonly
Returns the value of attribute apellido.
-
#nombre ⇒ Object
readonly
Returns the value of attribute nombre.
Instance Method Summary collapse
-
#initialize(nombre, apellido) ⇒ Autor
constructor
A new instance of Autor.
- #to_s ⇒ Object
Constructor Details
#initialize(nombre, apellido) ⇒ Autor
Returns a new instance of Autor.
4 5 6 7 |
# File 'lib/Lista/Autor.rb', line 4 def initialize(nombre,apellido) @nombre = nombre @apellido = apellido end |
Instance Attribute Details
#apellido ⇒ Object (readonly)
Returns the value of attribute apellido.
3 4 5 |
# File 'lib/Lista/Autor.rb', line 3 def apellido @apellido end |
#nombre ⇒ Object (readonly)
Returns the value of attribute nombre.
3 4 5 |
# File 'lib/Lista/Autor.rb', line 3 def nombre @nombre end |
Instance Method Details
#to_s ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/Lista/Autor.rb', line 8 def to_s () f="" @apellido.collect { |x| f=f+x.to_s+" "} f=f+", " @nombre.collect { |x| f=f+x[0]+". "} f end |