Class: References::Magazine

Inherits:
Reference show all
Defined in:
lib/references/magazine.rb

Instance Attribute Summary

Attributes inherited from Reference

#authors, #datee

Instance Method Summary collapse

Methods inherited from Reference

#<=>, #author, #cantidadAuthors, #cantidadIsbn, #cantidadSeries, #date, #editorial, #hasDate, #hasEdition, #hasEditionnumber, #hasTitle, #prettyOutput, #title

Constructor Details

#initialize(&block) ⇒ Magazine

Returns a new instance of Magazine.



6
7
8
9
# File 'lib/references/magazine.rb', line 6

def initialize(&block)
  instance_eval &block
  @title = @title.split(" ").map { |x| if x.length >= 4 then x[0].upcase + x[1..-1] end }.join(" ")
end

Instance Method Details

#formatAPAString

Format book reference to APA standard

Returns:

  • (String)

    format output



20
21
22
23
24
25
# File 'lib/references/magazine.rb', line 20

def formatAPA
  (prettyOutput(@authors.map { |x| x.to_s }) + "(" + @datee.year.to_s + ") " + @title +
   "\n\t(" + @edition.to_s + ") " +
   "(" + @editionnumber.to_s + ") " +
   @issbn.join(", "))
end

#issbn(issbn) ⇒ Object



11
12
13
14
15
16
# File 'lib/references/magazine.rb', line 11

def issbn(issbn)
  if @issbn.nil?
    @issbn = []
  end
  @issbn << issbn
end