Class: Bibliografia
- Inherits:
-
Object
- Object
- Bibliografia
- Includes:
- Comparable
- Defined in:
- lib/referencia/clase.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#autor ⇒ Object
Returns the value of attribute autor.
-
#fecha ⇒ Object
Returns the value of attribute fecha.
-
#titulo ⇒ Object
Returns the value of attribute titulo.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #autores(autor) ⇒ Object
- #fecha_publicacion(fecha) ⇒ Object
-
#initialize(titulo, &bloque) ⇒ Bibliografia
constructor
A new instance of Bibliografia.
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
#autor ⇒ Object
Returns the value of attribute autor.
5 6 7 |
# File 'lib/referencia/clase.rb', line 5 def autor @autor end |
#fecha ⇒ Object
Returns the value of attribute fecha.
5 6 7 |
# File 'lib/referencia/clase.rb', line 5 def fecha @fecha end |
#titulo ⇒ Object
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 |