Class: Highscore::Keyword
- Inherits:
-
Object
- Object
- Highscore::Keyword
- Defined in:
- lib/highscore/keyword.rb
Overview
keywords read from the content
Instance Attribute Summary collapse
-
#percent ⇒ Object
Returns the value of attribute percent.
-
#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
#percent ⇒ Object
Returns the value of attribute percent.
6 7 8 |
# File 'lib/highscore/keyword.rb', line 6 def percent @percent end |
#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
27 28 29 |
# File 'lib/highscore/keyword.rb', line 27 def <=>(other) other.weight <=> @weight end |
#to_s ⇒ Object
get the string
34 35 36 |
# File 'lib/highscore/keyword.rb', line 34 def to_s @text end |