class BiblioRefs::ListAPA

Attributes

list[RW]

Public Class Methods

new(*nodo) click to toggle source

Constructor de la clase ListAPA

# File lib/biblio_refs/list_apa.rb, line 7
def initialize(*nodo)
  @list = BiblioRefs::List.new(*nodo)
  sort_list
end

Public Instance Methods

sort_list() click to toggle source

Método que ordena el atributo ‘list’ mediante la función ‘sort’

# File lib/biblio_refs/list_apa.rb, line 13
def sort_list
  array = @list.sort
  @list =  BiblioRefs::List.new(array[0])
  array.shift
  array.each do |ref|
    @list.push(ref)
  end
end
to_s() click to toggle source

Método que devuelve una cadena de carácteres formateada de los objetos de la clase ListAPA

# File lib/biblio_refs/list_apa.rb, line 23
def to_s
  class << @list
    def to_s
      aux = @head
      string = "Lista APA: "
      while aux[:next] do
        string += "#{aux[:value]}" + "\n\n"
        aux = aux[:next]
      end
      string += "#{aux[:value]}"
    end
  end
  @list.to_s
end