Class: Bibliography

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/biblio/biblio.rb

Direct Known Subclasses

Article, Book, Electronic

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(autor, title, date, editorial) ⇒ Bibliography

Returns a new instance of Bibliography.



9
10
11
12
13
# File 'lib/biblio/biblio.rb', line 9

def initialize (autor,title,date,editorial)
    @author = autor 
    @title = title
    @date = date
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



5
6
7
# File 'lib/biblio/biblio.rb', line 5

def author
  @author
end

#dateObject

Returns the value of attribute date.



5
6
7
# File 'lib/biblio/biblio.rb', line 5

def date
  @date
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/biblio/biblio.rb', line 5

def title
  @title
end

Instance Method Details

#<=>(other) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/biblio/biblio.rb', line 15

def <=>(other)
     
    if (@author != other.author)
    @author <=> other.author
    elsif(@date != other.date)
    @date <=> other.date
    else
    @title <=> other.title
    end
     
end

#==(other) ⇒ Object



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

def ==(other)
    
    @title == other.title
    
end