Class: Pedicab::RANK::Rank
- Inherits:
-
Object
- Object
- Pedicab::RANK::Rank
- Defined in:
- lib/pedicab/rank.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #<<(i) ⇒ Object
- #[](k) ⇒ Object
-
#initialize(k) ⇒ Rank
constructor
A new instance of Rank.
Constructor Details
#initialize(k) ⇒ Rank
77 78 79 80 |
# File 'lib/pedicab/rank.rb', line 77 def initialize k @id = k @data = [] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
76 77 78 |
# File 'lib/pedicab/rank.rb', line 76 def data @data end |
Instance Method Details
#<<(i) ⇒ Object
81 82 83 |
# File 'lib/pedicab/rank.rb', line 81 def << i @data << i end |
#[](k) ⇒ Object
84 85 86 |
# File 'lib/pedicab/rank.rb', line 84 def [] k KNN.new(@data.to_a).rank(@id, k, 5) end |