Class: Listaa::Autor
- Inherits:
-
Object
- Object
- Listaa::Autor
- Defined in:
- lib/Lista/Autor.rb
Instance Attribute Summary (collapse)
-
- (Object) apellido
readonly
Returns the value of attribute apellido.
-
- (Object) nombre
readonly
Returns the value of attribute nombre.
Instance Method Summary (collapse)
-
- (Autor) initialize(nombre, apellido)
constructor
A new instance of Autor.
- - (Object) to_s
Constructor Details
- (Autor) initialize(nombre, apellido)
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
- (Object) apellido (readonly)
Returns the value of attribute apellido
3 4 5 |
# File 'lib/Lista/Autor.rb', line 3 def apellido @apellido end |
- (Object) nombre (readonly)
Returns the value of attribute nombre
3 4 5 |
# File 'lib/Lista/Autor.rb', line 3 def nombre @nombre end |
Instance Method Details
- (Object) to_s
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 |