Class: Highscore::Keyword
- Inherits:
-
Object
- Object
- Highscore::Keyword
- Defined in:
- lib/highscore/keyword.rb
Overview
keywords read from the content
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
sort keywords.
-
#initialize(text, weight) ⇒ Keyword
constructor
init a keyword.
-
#to_s ⇒ Object
get the string.
Constructor Details
#initialize(text, weight) ⇒ Keyword
init a keyword
12 13 14 15 |
# File 'lib/highscore/keyword.rb', line 12 def initialize(text, weight) @text = text @weight = weight.to_f end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/highscore/keyword.rb', line 6 def text @text end |
#weight ⇒ Object
Returns the value of attribute weight.
6 7 8 |
# File 'lib/highscore/keyword.rb', line 6 def weight @weight end |
Instance Method Details
#<=>(other) ⇒ Object
sort keywords
20 21 22 |
# File 'lib/highscore/keyword.rb', line 20 def <=>(other) other.weight <=> @weight end |
#to_s ⇒ Object
get the string
27 28 29 |
# File 'lib/highscore/keyword.rb', line 27 def to_s @text end |