Class: APA

Inherits:
Object
  • Object
show all
Defined in:
lib/biblio/apa.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg, flag) ⇒ APA

Returns a new instance of APA.



9
10
11
12
13
14
15
# File 'lib/biblio/apa.rb', line 9

def initialize(arg,flag)
  
  @arg = arg  
  @flag = flag
  
  
end

Instance Attribute Details

#argObject

Returns the value of attribute arg.



5
6
7
# File 'lib/biblio/apa.rb', line 5

def arg
  @arg
end

#flagObject

Returns the value of attribute flag.



5
6
7
# File 'lib/biblio/apa.rb', line 5

def flag
  @flag
end

#listObject

Returns the value of attribute list.



5
6
7
# File 'lib/biblio/apa.rb', line 5

def list
  @list
end

Instance Method Details

#insertar(arg) ⇒ Object



18
19
20
21
# File 'lib/biblio/apa.rb', line 18

def insertar(arg)
@list = List.new()
@list.insert_multi(arg)
end

#to_sObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/biblio/apa.rb', line 24

def to_s 
   
    if @flag == 1    
   
   i = 0
   author = ""
   
   if (@arg.author.count == 1)
       
        author = "#{@arg.author[i]}"
       
   else
   while i < @arg.author.count
   
   if i != @arg.author.count-1
       author = author + "#{@arg.author[i]} & "
   else
       author= author + "#{@arg.author[i]}"
   end
    i= i + 1

   end
   end
   "#{author}. (#{@arg.date}). #{@arg.title} (#{@arg.edition}). #{@arg.editorial}"
 
elsif @flag == 2

 "#{@arg.author}. (#{@arg.date}). #{@arg.title}. #{@arg.newspaper}, #{@arg.pages}"
 
elsif @flag == 3
   
    j = 0
   author2 = ""
   
   if (@arg.author.count == 1)
       
        author2 = "#{@arg.author[j]}"
       
   else
   while j < @arg.author.count
   
   if j != @arg.author.count-1
       author2 = author2 + "#{@arg.author[j]} & "
   else
       author2= author2 + "#{@arg.author[j]}"
   end
    j= j + 1

   end
   end
   
   if @arg.url == " " and @arg.editione == " "
       
   "#{author2}. (#{@arg.date}). #{@arg.title} [#{@arg.type}]" 
   
   elsif @arg.url == " "
    
    "#{author}. (#{@arg.date}). #{@arg.title} (#{@arg.editione}). [#{@arg.type}]" 
    
    elsif @arg.editione == " "
  
   "#{author}. (#{@arg.date}). #{@arg.title}  [#{@arg.type}] Disponible en: #{@arg.url} [#{@arg.date_access}]."    
   
   
   else
   "#{author2}. (#{@arg.date}). #{@arg.title} (#{@arg.editione}). [#{@arg.type}] Disponible en: #{@arg.url} [#{@arg.date_access}]."
   
   end

    end
    
end