Class: Electronic

Inherits:
Bibliography show all
Defined in:
lib/biblio/magazine.rb

Instance Attribute Summary collapse

Attributes inherited from Bibliography

#author, #date, #title

Instance Method Summary collapse

Methods inherited from Bibliography

#<=>, #==

Constructor Details

#initialize(title, &block) ⇒ Electronic

Returns a new instance of Electronic.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/biblio/magazine.rb', line 5

def initialize(title, &block)
    
    self.author = []
    self.title = title
    self.date = []
    self.url = []
    self.editione = []
    self.type = []
    self.date_access = []
    self.electronic = []
    
    
    if block_given?  
    if block.arity == 1
    yield self
    else
    instance_eval &block 
    end
    end
end

Instance Attribute Details

#date_accessObject

Returns the value of attribute date_access.



3
4
5
# File 'lib/biblio/magazine.rb', line 3

def date_access
  @date_access
end

#editioneObject

Returns the value of attribute editione.



3
4
5
# File 'lib/biblio/magazine.rb', line 3

def editione
  @editione
end

#electronicObject

Returns the value of attribute electronic.



3
4
5
# File 'lib/biblio/magazine.rb', line 3

def electronic
  @electronic
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/biblio/magazine.rb', line 3

def type
  @type
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/biblio/magazine.rb', line 3

def url
  @url
end

Instance Method Details

#autor(text, options = {}) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/biblio/magazine.rb', line 26

def autor(text, options = {})
autor= text
autor << "#{options[:surname]}" if options[:surname]
 autor << " #{options[:name]}" if options[:name]

author << autor
end

#electronico(text, options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/biblio/magazine.rb', line 41

def electronico(text, options = {})
electronico = text
electronico << "#{options[:titulo]}" if options[:titulo]
electronico << " (#{options[:edicion]})" if options[:edicion]
electronico << " [#{options[:medio]}]" if options[:medio]
electronico << " #{options[:url]}" if options[:url]
electronico << " [#{options[:fecha_acceso]}]" if options[:fecha_acceso]

electronic  << electronico
end

#fecha(text, options = {}) ⇒ Object



34
35
36
37
38
39
# File 'lib/biblio/magazine.rb', line 34

def fecha(text, options = {})
fecha = text
fecha << "(#{options[:amount]})" if options[:amount]

date << fecha
end

#to_sObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/biblio/magazine.rb', line 52

def to_s
   


formato = "\nDocumento electronico 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 << "#{ (date)}."
end

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

output

end