Class: Stats::UserStats

Inherits:
Object
  • Object
show all
Defined in:
app/models/stats/user_stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ UserStats


5
6
7
# File 'app/models/stats/user_stats.rb', line 5

def initialize(user)
  @user = user
end

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user


4
5
6
# File 'app/models/stats/user_stats.rb', line 4

def user
  @user
end

Instance Method Details

#actionsObject


9
10
11
# File 'app/models/stats/user_stats.rb', line 9

def actions
  @actions ||= Stats::Actions.new(user)
end

#contextsObject


21
22
23
# File 'app/models/stats/user_stats.rb', line 21

def contexts
  @contexts ||= Stats::Contexts.new(user)
end

#projectsObject


17
18
19
# File 'app/models/stats/user_stats.rb', line 17

def projects
  @projects ||= Stats::Projects.new(user)
end

#tag_cloudObject


25
26
27
28
29
30
31
# File 'app/models/stats/user_stats.rb', line 25

def tag_cloud
  unless @tag_cloud
    tags = Stats::TagCloudQuery.new(user).result
    @tag_cloud = Stats::TagCloud.new(tags)
  end
  @tag_cloud
end

#tag_cloud_90daysObject


33
34
35
36
37
38
39
40
# File 'app/models/stats/user_stats.rb', line 33

def tag_cloud_90days
  unless @tag_cloud_90days
    cutoff = 3.months.ago.beginning_of_day
    tags = Stats::TagCloudQuery.new(user, cutoff).result
    @tag_cloud_90days = Stats::TagCloud.new(tags)
  end
  @tag_cloud_90days
end

#totalsObject


13
14
15
# File 'app/models/stats/user_stats.rb', line 13

def totals
  @totals ||= Stats::Totals.new(user)
end