Class: Delicious::Link
- Inherits:
-
Object
- Object
- Delicious::Link
- Defined in:
- lib/delicious.rb
Overview
Collector Class end #############
Instance Attribute Summary collapse
-
#people ⇒ Object
readonly
Returns the value of attribute people.
-
#posted_by ⇒ Object
readonly
Returns the value of attribute posted_by.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#<=>(link) ⇒ Object
Comparator method.
- #equal?(link) ⇒ Boolean
-
#initialize(text, url, posted_by, people, tags) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(text, url, posted_by, people, tags) ⇒ Link
Returns a new instance of Link.
103 104 105 106 107 108 109 |
# File 'lib/delicious.rb', line 103 def initialize(text, url, posted_by, people, ) @text = text @url = url @posted_by = posted_by @people = people @tags = end |
Instance Attribute Details
#people ⇒ Object (readonly)
Returns the value of attribute people.
101 102 103 |
# File 'lib/delicious.rb', line 101 def people @people end |
#posted_by ⇒ Object (readonly)
Returns the value of attribute posted_by.
101 102 103 |
# File 'lib/delicious.rb', line 101 def posted_by @posted_by end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
101 102 103 |
# File 'lib/delicious.rb', line 101 def @tags end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
101 102 103 |
# File 'lib/delicious.rb', line 101 def text @text end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
101 102 103 |
# File 'lib/delicious.rb', line 101 def url @url end |
Instance Method Details
#<=>(link) ⇒ Object
Comparator method. The links should be ordered by the number of people that saved them.
112 113 114 115 116 117 118 119 |
# File 'lib/delicious.rb', line 112 def <=> (link) if @people > link.people return 1 elsif @people < link.people return -1 end 0 end |
#equal?(link) ⇒ Boolean
121 122 123 |
# File 'lib/delicious.rb', line 121 def equal?(link) link.url == @url end |