class Article

Attributes

magazine[RW]
newspaper[RW]
pages[RW]

Public Class Methods

new(title) { |self| ... } click to toggle source
# File lib/biblio/article.rb, line 5
def initialize(title, &block)
    
    self.author = []
    self.title = []
    self.date = []
    self.newspaper = []
    self.pages = []
    self.magazine = []
    
    if block_given?  
    if block.arity == 1
    yield self
    else
    instance_eval &block 
    end
    end
end

Public Instance Methods

autor(text, options = {}) click to toggle source
# File lib/biblio/article.rb, line 23
def autor(text, options = {})
autor= text
autor << "#{options[:surname]}" if options[:surname]
 autor << " #{options[:name]}" if options[:name]

author << autor
end
fecha(text, options = {}) click to toggle source
# File lib/biblio/article.rb, line 31
def fecha(text, options = {})
fecha = text
fecha << "(#{options[:amount]})" if options[:amount]

date << fecha
end
revista(text, options = {}) click to toggle source
# File lib/biblio/article.rb, line 38
def revista(text, options = {})
revista = text
revista << "#{options[:titulo]}" if options[:titulo]
revista << " #{options[:periodico]}" if options[:periodico]
revista << " #{options[:paginas]}" if options[:paginas]
magazine << revista
end
to_s() click to toggle source
# File lib/biblio/article.rb, line 47
def to_s
   


formato = "\nRevista en Formato APA:\n"
output = formato  

author.each_with_index do |instruction, index|
output << "\t#{instruction}"
end
 date.each_with_index do | date, index |
output << "\n\t#{(date)}"
end

 magazine.each_with_index do | magazine, index |
output << "\n\t#{magazine}"
end

output

end