class APA

Attributes

arg[RW]
flag[RW]
list[RW]

Public Class Methods

new(arg,flag) click to toggle source
# File lib/biblio/apa.rb, line 9
def initialize(arg,flag)
  
  @arg = arg  
  @flag = flag
  
  
end

Public Instance Methods

insertar(arg) click to toggle source
# File lib/biblio/apa.rb, line 18
def insertar(arg)
@list = List.new()
@list.insert_multi(arg)
end
to_s() click to toggle source
# 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