Class: DLinkedList::Libro

Inherits:
Referencia show all
Defined in:
lib/dLinkedList/dLinkedList.rb

Overview

Referencia de un libro.

Instance Attribute Summary collapse

Attributes inherited from Referencia

#autores, #fecha_publicacion, #titulo

Instance Method Summary collapse

Methods inherited from Referencia

#<=>

Constructor Details

#initialize(&block) ⇒ Libro

Inicializa la referencia al libro usando el DSL especificado en el bloque block.

Raises:

  • (ArgumentError)


95
96
97
98
# File 'lib/dLinkedList/dLinkedList.rb', line 95

def initialize(&block)
	instance_eval &block
	raise ArgumentError, "Debe haber al menos un autor" unless @autores.length > 0
end

Instance Attribute Details

#edicionObject (readonly)

Nº de edición.



88
89
90
# File 'lib/dLinkedList/dLinkedList.rb', line 88

def edicion
  @edicion
end

#editorialObject (readonly)

Editorial.



92
93
94
# File 'lib/dLinkedList/dLinkedList.rb', line 92

def editorial
  @editorial
end

#lugar_publicacionObject (readonly)

Lugar de publicación.



90
91
92
# File 'lib/dLinkedList/dLinkedList.rb', line 90

def lugar_publicacion
  @lugar_publicacion
end

Instance Method Details

#to_sObject

Devuelve una cadena con el contenido de la referencia al libro en formato APA.

Formato: Apellidos_Autor, Nombre_Autor [& Apellidos_Autor, Nombre_Autor…] (Fecha de publicación). Título. (edicion) Lugar de publicación: Editorial.



118
119
120
# File 'lib/dLinkedList/dLinkedList.rb', line 118

def to_s			
	return super << " (#{@edicion}ª edición) #{@lugar_publicacion}: #{@editorial}."
end