Class: Bibliografia::Libro

Inherits:
Bibliografia show all
Defined in:
lib/Bibliografia/Bibliografia.rb

Instance Attribute Summary collapse

Attributes inherited from Bibliografia

#autor, #fecha_publicacion, #titulo

Instance Method Summary collapse

Methods inherited from Bibliografia

#<=>

Constructor Details

#initialize(titulo, &bloque) ⇒ Libro

Returns a new instance of Libro.



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

def initialize(titulo, &bloque)

             @autor = []
             @fecha_publicacion = []
             @titulo = titulo
             @edicion = []
             @volumen = []
             @lpublicacion = []
             @editor= []
             
      	if block_given?  
      if bloque.arity == 1
        yield self
      else
       instance_eval &bloque 
      end
 	end
 
             
end

Instance Attribute Details

#edicionObject

Returns the value of attribute edicion.



50
51
52
# File 'lib/Bibliografia/Bibliografia.rb', line 50

def edicion
  @edicion
end

#editorObject

Returns the value of attribute editor.



50
51
52
# File 'lib/Bibliografia/Bibliografia.rb', line 50

def editor
  @editor
end

#lpublicacionObject

Returns the value of attribute lpublicacion.



50
51
52
# File 'lib/Bibliografia/Bibliografia.rb', line 50

def lpublicacion
  @lpublicacion
end

#volumenObject

Returns the value of attribute volumen.



50
51
52
# File 'lib/Bibliografia/Bibliografia.rb', line 50

def volumen
  @volumen
end

Instance Method Details

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



72
73
74
75
76
# File 'lib/Bibliografia/Bibliografia.rb', line 72

def author(text, options = {})
	author= text
	author << " (#{options[:a_total]})" if options[:a_total]
	autor << author
end

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



78
79
80
81
82
83
# File 'lib/Bibliografia/Bibliografia.rb', line 78

def date(text, options = {})
	date= text
	date << " (#{options[:a_date]})" if options[:a_date]
	fecha_publicacion << date
	
end

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



109
110
111
112
113
# File 'lib/Bibliografia/Bibliografia.rb', line 109

def ed(text, options= {})
	ed= text
	ed << " (#{options[:a_ed]})" if options[:a_ed]
	editor << ed
end

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



91
92
93
94
95
# File 'lib/Bibliografia/Bibliografia.rb', line 91

def edition(text, options = {})
	edition= text
	edition << " (#{options[:n_editions]})" if options[:n_editions]
	edicion << edition
end

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



103
104
105
106
107
# File 'lib/Bibliografia/Bibliografia.rb', line 103

def place(text, options = {})
	place= text
	edition << " (#{options[:a_place]})" if options[:a_place]
	lpublicacion << place
end

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



85
86
87
88
89
# File 'lib/Bibliografia/Bibliografia.rb', line 85

def title(text, options = {})
	title= text
	title << " (#{options[:a_title]})" if options[:a_title]
	titulo << title
end

#to_sObject



115
116
117
118
119
120
# File 'lib/Bibliografia/Bibliografia.rb', line 115

def to_s()
	salida= titulo
	salida << ", #{autor.join(', ')}, #{fecha_publicacion.join(', ')}, #{edicion.join(', ')}, #{volumen.join(', ')}, #{lpublicacion.join(', ')}, #{editor.join(', ')}\n\n"
	
	salida
end

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



97
98
99
100
101
# File 'lib/Bibliografia/Bibliografia.rb', line 97

def vols(text, options = {})
	vols = text
	vols << " (#{options[:n_vols]})" if options[:n_vols]
	volumen << vols 
end