Class: Bibliografia

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/referencia/clase.rb

Direct Known Subclasses

Electronico, Libro, Revista

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(titulo, &bloque) ⇒ Bibliografia

Returns a new instance of Bibliografia.



7
8
9
10
# File 'lib/referencia/clase.rb', line 7

def initialize(titulo, &bloque)
    self.titulo = titulo
    instance_eval &bloque if block_given?
end

Instance Attribute Details

#autorObject

Returns the value of attribute autor.



5
6
7
# File 'lib/referencia/clase.rb', line 5

def autor
  @autor
end

#fechaObject

Returns the value of attribute fecha.



5
6
7
# File 'lib/referencia/clase.rb', line 5

def fecha
  @fecha
end

#tituloObject

Returns the value of attribute titulo.



5
6
7
# File 'lib/referencia/clase.rb', line 5

def titulo
  @titulo
end

Instance Method Details

#<=>(other) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/referencia/clase.rb', line 12

def <=> (other)
    if @autor == other.autor
        @titulo <=> other.titulo
    else
        @autor <=> other.autor
    end
end

#autores(autor) ⇒ Object



24
25
26
27
# File 'lib/referencia/clase.rb', line 24

def autores(autor)
    @autor = []
    @autor << autor
end

#fecha_publicacion(fecha) ⇒ Object



20
21
22
# File 'lib/referencia/clase.rb', line 20

def fecha_publicacion(fecha)
    @fecha = fecha
end