Class: QiitaMail::Selector::ScoredItem
- Inherits:
-
Object
- Object
- QiitaMail::Selector::ScoredItem
- Defined in:
- lib/qiita_mail/selector.rb
Instance Attribute Summary collapse
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
Instance Method Summary collapse
- #<=>(rhs) ⇒ Object
- #add_score(v) ⇒ Object
-
#initialize(item) ⇒ ScoredItem
constructor
A new instance of ScoredItem.
Constructor Details
#initialize(item) ⇒ ScoredItem
Returns a new instance of ScoredItem.
66 67 68 69 |
# File 'lib/qiita_mail/selector.rb', line 66 def initialize(item) @item = item @score = item.stock_count * 10 + item.comment_count * 20 end |
Instance Attribute Details
#item ⇒ Object (readonly)
Returns the value of attribute item.
63 64 65 |
# File 'lib/qiita_mail/selector.rb', line 63 def item @item end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
64 65 66 |
# File 'lib/qiita_mail/selector.rb', line 64 def score @score end |
Instance Method Details
#<=>(rhs) ⇒ Object
75 76 77 |
# File 'lib/qiita_mail/selector.rb', line 75 def <=>(rhs) self.score <=> rhs.score end |
#add_score(v) ⇒ Object
71 72 73 |
# File 'lib/qiita_mail/selector.rb', line 71 def add_score(v) @score += v end |