Class: Biblio
Direct Known Subclasses
Instance Attribute Summary collapse
-
#autor ⇒ Object
Returns the value of attribute autor.
-
#fecha ⇒ Object
Returns the value of attribute fecha.
-
#titulo ⇒ Object
Returns the value of attribute titulo.
Instance Method Summary collapse
- #<=>(anOther) ⇒ Object
- #author(name, options = {}) ⇒ Object
- #date(name, options = {}) ⇒ Object
-
#initialize(titulo, &block) ⇒ Biblio
constructor
A new instance of Biblio.
- #to_s ⇒ Object
Constructor Details
#initialize(titulo, &block) ⇒ Biblio
Returns a new instance of Biblio.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bibliografia/biblio.rb', line 7 def initialize(titulo, &block) self.titulo = titulo self.autor = [] self.fecha = [] if block_given? if block.arity == 1 yield self else instance_eval &block end end end |
Instance Attribute Details
#autor ⇒ Object
Returns the value of attribute autor.
5 6 7 |
# File 'lib/bibliografia/biblio.rb', line 5 def autor @autor end |
#fecha ⇒ Object
Returns the value of attribute fecha.
5 6 7 |
# File 'lib/bibliografia/biblio.rb', line 5 def fecha @fecha end |
#titulo ⇒ Object
Returns the value of attribute titulo.
5 6 7 |
# File 'lib/bibliografia/biblio.rb', line 5 def titulo @titulo end |
Instance Method Details
#<=>(anOther) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bibliografia/biblio.rb', line 33 def <=>(anOther) if((@autor <=> anOther.autor) == 0) if((@fecha <=> anOther.fecha)==0) @titulo <=> anOther.titulo else @fecha <=> anOther.fecha end else @autor <=> anOther.autor end end |
#author(name, options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/bibliografia/biblio.rb', line 28 def (name, = {}) = name autor << end |
#date(name, options = {}) ⇒ Object
22 23 24 25 26 |
# File 'lib/bibliografia/biblio.rb', line 22 def date(name, = {}) date = name fecha << date end |
#to_s ⇒ Object
48 49 50 |
# File 'lib/bibliografia/biblio.rb', line 48 def to_s() end |