Class: RefBiblio::Libro
- Inherits:
-
Referencia
- Object
- Referencia
- RefBiblio::Libro
- Defined in:
- lib/refBiblio/referencia.rb
Instance Attribute Summary collapse
Attributes inherited from Referencia
#autor, #editorial, #publicacion, #titulo
Instance Method Summary collapse
-
#initialize(&block) ⇒ Libro
constructor
A new instance of Libro.
-
#to_s ⇒ Object
Cadena de caracteres de la referencia del libro formateado.
Methods inherited from Referencia
#<=>, #get_autor, #get_editorial, #get_publicacion, #get_titulo
Constructor Details
#initialize(&block) ⇒ Libro
Returns a new instance of Libro.
122 123 124 125 126 127 128 129 130 |
# File 'lib/refBiblio/referencia.rb', line 122 def initialize(&block) if block_given? if block.arity == 1 yield self else instance_eval &block end end end |
Instance Attribute Details
#edicion(edicion) ⇒ Object
121 122 123 |
# File 'lib/refBiblio/referencia.rb', line 121 def edicion @edicion end |
#volumen(volumen) ⇒ Object
121 122 123 |
# File 'lib/refBiblio/referencia.rb', line 121 def volumen @volumen end |
Instance Method Details
#to_s ⇒ Object
Returns Cadena de caracteres de la referencia del libro formateado.
146 147 148 149 |
# File 'lib/refBiblio/referencia.rb', line 146 def to_s string="" string << @autor << " (" << Date::MONTHNAMES[get_publicacion.month] << " " << get_publicacion.day.to_s << ", " << get_publicacion.year.to_s << "). " << @titulo << " (" << @edicion.to_s << ") (" << @volumen.to_s << "). " << @editorial << "." end |