Class: Electronic
- Inherits:
-
Bibliography
- Object
- Bibliography
- Electronic
- Defined in:
- lib/biblio/magazine.rb
Instance Attribute Summary collapse
-
#date_access ⇒ Object
Returns the value of attribute date_access.
-
#editione ⇒ Object
Returns the value of attribute editione.
-
#electronic ⇒ Object
Returns the value of attribute electronic.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Bibliography
Instance Method Summary collapse
- #autor(text, options = {}) ⇒ Object
- #electronico(text, options = {}) ⇒ Object
- #fecha(text, options = {}) ⇒ Object
-
#initialize(title, &block) ⇒ Electronic
constructor
A new instance of Electronic.
- #to_s ⇒ Object
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. = [] 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_access ⇒ Object
Returns the value of attribute date_access.
3 4 5 |
# File 'lib/biblio/magazine.rb', line 3 def date_access @date_access end |
#editione ⇒ Object
Returns the value of attribute editione.
3 4 5 |
# File 'lib/biblio/magazine.rb', line 3 def editione @editione end |
#electronic ⇒ Object
Returns the value of attribute electronic.
3 4 5 |
# File 'lib/biblio/magazine.rb', line 3 def electronic @electronic end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/biblio/magazine.rb', line 3 def type @type end |
#url ⇒ Object
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, = {}) autor= text autor << "#{[:surname]}" if [:surname] autor << " #{[:name]}" if [:name] << 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, = {}) electronico = text electronico << "#{[:titulo]}" if [:titulo] electronico << " (#{[:edicion]})" if [:edicion] electronico << " [#{[:medio]}]" if [:medio] electronico << " #{[:url]}" if [:url] electronico << " [#{[:fecha_acceso]}]" if [: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, = {}) fecha = text fecha << "(#{[:amount]})" if [:amount] date << fecha end |
#to_s ⇒ Object
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 .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 |