Class: Listaa::Autor

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

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