Class: FlexibleFeeds::PopularityCalculator
- Inherits:
-
Object
- Object
- FlexibleFeeds::PopularityCalculator
- Defined in:
- lib/flexible_feeds/popularity_calculator.rb
Instance Attribute Summary collapse
-
#n ⇒ Object
Returns the value of attribute n.
-
#pos ⇒ Object
Returns the value of attribute pos.
Instance Method Summary collapse
- #get_popularity ⇒ Object
-
#initialize(pos, n) ⇒ PopularityCalculator
constructor
A new instance of PopularityCalculator.
Constructor Details
#initialize(pos, n) ⇒ PopularityCalculator
Returns a new instance of PopularityCalculator.
5 6 7 8 |
# File 'lib/flexible_feeds/popularity_calculator.rb', line 5 def initialize(pos, n) @pos = pos @n = n end |
Instance Attribute Details
#n ⇒ Object
Returns the value of attribute n.
4 5 6 |
# File 'lib/flexible_feeds/popularity_calculator.rb', line 4 def n @n end |
#pos ⇒ Object
Returns the value of attribute pos.
4 5 6 |
# File 'lib/flexible_feeds/popularity_calculator.rb', line 4 def pos @pos end |
Instance Method Details
#get_popularity ⇒ Object
10 11 12 13 |
# File 'lib/flexible_feeds/popularity_calculator.rb', line 10 def get_popularity return 0 if n == 0 dividend / divisor end |