Class: FlexibleFeeds::PopularityCalculator

Inherits:
Object
  • Object
show all
Defined in:
lib/flexible_feeds/popularity_calculator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nObject

Returns the value of attribute n.



4
5
6
# File 'lib/flexible_feeds/popularity_calculator.rb', line 4

def n
  @n
end

#posObject

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_popularityObject



10
11
12
13
# File 'lib/flexible_feeds/popularity_calculator.rb', line 10

def get_popularity
  return 0 if n == 0
  dividend / divisor
end