Class: APA

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bibliogem/APA.rb

Instance Method Summary (collapse)

Constructor Details

- (APA) initialize

Returns a new instance of APA



6
7
8
# File 'lib/bibliogem/APA.rb', line 6

def initialize
	@lista = Lista.new()
end

Instance Method Details

- (Object) each



18
19
20
# File 'lib/bibliogem/APA.rb', line 18

def each
	@lista.each{|x| yield x}
end

- (Object) insertar(x)

Raises:

  • (ArgumentError)


9
10
11
12
13
# File 'lib/bibliogem/APA.rb', line 9

def insertar x
	raise ArgumentError, "No es referencia" unless x.kind_of?(Referencia)
	@lista.push_final(x)
	@lista.ordenar
end

- (Object) to_s



21
22
23
24
25
26
27
28
# File 'lib/bibliogem/APA.rb', line 21

def to_s
	resultado=""
	@lista.each do|x|
		resultado << x.to_s
		resultado << "\n"
	end
	return resultado
end

- (Object) valor_inicial



14
15
16
17
# File 'lib/bibliogem/APA.rb', line 14

def valor_inicial
	n = @lista.nodo_inicial
	return n[:valor]
end