Module: WeightedListRank::Item
- Defined in:
- lib/weighted_list_rank/item.rb
Instance Method Summary collapse
-
#id ⇒ Integer, String
Returns the unique identifier of the item.
-
#position ⇒ Integer
Returns the position of the item within its list.
-
#score_penalty ⇒ Float, NilClass
Returns the score penalty of the item.
Instance Method Details
#id ⇒ Integer, String
Returns the unique identifier of the item. Must be implemented by including class.
11 12 13 |
# File 'lib/weighted_list_rank/item.rb', line 11 def id raise NotImplementedError, "Implement this method to return the item's unique identifier" end |
#position ⇒ Integer
Returns the position of the item within its list. Must be implemented by including class.
5 6 7 |
# File 'lib/weighted_list_rank/item.rb', line 5 def position raise NotImplementedError, "Implement this method to return the item's position" end |
#score_penalty ⇒ Float, NilClass
Returns the score penalty of the item. Can be overridden by the including class.
17 18 19 |
# File 'lib/weighted_list_rank/item.rb', line 17 def score_penalty nil end |