Class: Yt::Collections::ViewerPercentages

Inherits:
Base
  • Object
show all
Defined in:
lib/yt/collections/viewer_percentages.rb

Instance Method Summary collapse

Methods inherited from Base

#includes, #initialize, of, #where

Methods included from Actions::List

#first!

Constructor Details

This class inherits a constructor from Yt::Collections::Base

Instance Method Details

#allObject



8
9
10
11
12
13
14
# File 'lib/yt/collections/viewer_percentages.rb', line 8

def all
  Hash.new{|h,k| h[k] = Hash.new{|h,k| h[k] = Hash.new 0.0}}.tap do |hash|
    each do |item|
      hash[item.id][item.gender][item.age_range] = item.value
    end
  end
end