Class: Listaa::Bibliografia

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/Lista/Bibliografia.rb

Direct Known Subclasses

DocumentoE, Libro, Revista

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Bibliografia) initialize(nombre = "Sin título")

Returns a new instance of Bibliografia



6
7
8
9
10
11
12
13
14
# File 'lib/Lista/Bibliografia.rb', line 6

def initialize(nombre = "Sin título") 
    @Author = []
    @Title = nombre
    @Serie = nil
    @Editorial = "Editorial sin definir"
    @Edicion = 0
    @Fecha_Publication = "01-ENE-1901"
    @Tipo = nil
end

Instance Attribute Details

- (Object) Author (readonly)

Returns the value of attribute Author



4
5
6
# File 'lib/Lista/Bibliografia.rb', line 4

def Author
  @Author
end

- (Object) Edicion (readonly)

Returns the value of attribute Edicion



4
5
6
# File 'lib/Lista/Bibliografia.rb', line 4

def Edicion
  @Edicion
end

- (Object) Editorial (readonly)

Returns the value of attribute Editorial



4
5
6
# File 'lib/Lista/Bibliografia.rb', line 4

def Editorial
  @Editorial
end

- (Object) Fecha_Publication (readonly)

Returns the value of attribute Fecha_Publication



5
6
7
# File 'lib/Lista/Bibliografia.rb', line 5

def Fecha_Publication
  @Fecha_Publication
end

- (Object) Serie (readonly)

Returns the value of attribute Serie



4
5
6
# File 'lib/Lista/Bibliografia.rb', line 4

def Serie
  @Serie
end

- (Object) Title (readonly)

Returns the value of attribute Title



4
5
6
# File 'lib/Lista/Bibliografia.rb', line 4

def Title
  @Title
end

Instance Method Details

- (Object) <=>(o)



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/Lista/Bibliografia.rb', line 54

def <=> (o)  
    if autorTo_s!=o.autorTo_s
        autorTo_s <=> o.autorTo_s
    else
        if(o.Fecha_Publication[7..10] > @Fecha_Publication[7..10])
            -1
        else
            1
        end
    end
end

- (Object) add_author(name, apellido)



16
17
18
19
20
21
22
23
# File 'lib/Lista/Bibliografia.rb', line 16

def add_author(name,apellido)
    if(@Author == nil)
        @Author = []
        @Author[0] = Listaa::Autor.new(name,apellido)
    else
        @Author << Listaa::Autor.new(name,apellido)
    end
end

- (Object) add_editorial(name)



33
34
35
# File 'lib/Lista/Bibliografia.rb', line 33

def add_editorial(name)
    @Editorial = name
end

- (Object) add_serie(name)



29
30
31
# File 'lib/Lista/Bibliografia.rb', line 29

def add_serie(name)
    @Serie = name
end

- (Object) add_title(name)



25
26
27
# File 'lib/Lista/Bibliografia.rb', line 25

def add_title(name)
    @Title = name
end

- (Object) autor(apellido, nombre)



76
77
78
# File 'lib/Lista/Bibliografia.rb', line 76

def autor(apellido,nombre)
    @Author << Listaa::Autor.new([nombre],[apellido])
end

- (Object) autorTo_s



66
67
68
69
70
71
72
73
74
# File 'lib/Lista/Bibliografia.rb', line 66

def autorTo_s
    f=""
    if(@Author.count>1)
        @Author.collect { |x| f=f+x.to_s+" & "}
    else
        @Author.collect { |x| f=f+x.to_s}
    end
    f
end

- (Object) edicion(edi)



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

def edicion(edi)
    @Edicion = edi
end

- (Object) editorial(edi)



80
81
82
# File 'lib/Lista/Bibliografia.rb', line 80

def editorial(edi)
    @Editorial = edi
end

- (Object) fecha(fech)



84
85
86
# File 'lib/Lista/Bibliografia.rb', line 84

def fecha(fech)
    @Fecha_Publication = fech
end

- (Object) get_formato



45
46
47
48
# File 'lib/Lista/Bibliografia.rb', line 45

def get_formato
    a = @Author.join(", ") +"\n"+@Title.to_s+"\n"+@Serie.to_s+
    "; "+@Edicion.to_s+" edition ("+@Fecha_Publication.to_s+")\n"
end

- (Object) get_tipo



50
51
52
# File 'lib/Lista/Bibliografia.rb', line 50

def get_tipo
    @Tipo    
end

- (Object) set_edicion(num)



37
38
39
# File 'lib/Lista/Bibliografia.rb', line 37

def set_edicion(num)
    @Edicion = num
end

- (Object) set_publication(fech)



41
42
43
# File 'lib/Lista/Bibliografia.rb', line 41

def set_publication(fech)
    @Fecha_Publication = fech
end