class Cita
Public Class Methods
new() { |self| ... }
click to toggle source
# File lib/biblio/cita.rb, line 3 def initialize @lista = List.new yield self if block_given? end
Public Instance Methods
citar(referencia)
click to toggle source
# File lib/biblio/cita.rb, line 8 def citar(referencia) raise ArgumentError, "La referencia debe ser del tipo Referencia" unless referencia.is_a?(Referencia) @lista.push_back(referencia) aux = @lista.sort @lista.clear aux.each do |n| @lista.push_back(n) end end
clear()
click to toggle source
# File lib/biblio/cita.rb, line 19 def clear @lista.clear end
to_s()
click to toggle source
# File lib/biblio/cita.rb, line 23 def to_s salida = "" @lista.each do |n| salida = salida + n.to_s + "\n" end salida end