Class: Listaa::Autor

Inherits:
Object
  • Object
show all
Defined in:
lib/Lista/Autor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#apellidoObject (readonly)

Returns the value of attribute apellido.



3
4
5
# File 'lib/Lista/Autor.rb', line 3

def apellido
  @apellido
end

#nombreObject (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_sObject



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