Class: Geostats::Views::FoundsByCacheType
- Defined in:
- lib/geostats/views/founds_by_cache_type.rb
Constant Summary collapse
- HEIGHT =
400
Instance Method Summary collapse
- #founds_by_cache_type ⇒ Object
-
#initialize ⇒ FoundsByCacheType
constructor
A new instance of FoundsByCacheType.
Constructor Details
#initialize ⇒ FoundsByCacheType
Returns a new instance of FoundsByCacheType.
6 7 8 9 10 11 |
# File 'lib/geostats/views/founds_by_cache_type.rb', line 6 def initialize @founds = Stats.founds_by_cache_type .select { |a| a[1] > 0 } .sort { |a, b| b[1] <=> a[1] } @factor = HEIGHT.to_f / @founds.first[1].to_f end |
Instance Method Details
#founds_by_cache_type ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/geostats/views/founds_by_cache_type.rb', line 13 def founds_by_cache_type @founds.map do |type, count| { :height => [1, count * @factor].max, :founds => count, :name => type.name } end end |