Class: Scorecard::Point
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Scorecard::Point
- Defined in:
- app/models/scorecard/point.rb
Class Method Summary collapse
- .for_context(context) ⇒ Object
- .for_gameable(gameable) ⇒ Object
- .for_raw_gameable(gameable_type, gameable_id) ⇒ Object
- .for_timeframe(timeframe) ⇒ Object
- .for_user(user) ⇒ Object
- .for_user_in_timeframe(context, user, timeframe) ⇒ Object
Class Method Details
.for_context(context) ⇒ Object
21 22 23 |
# File 'app/models/scorecard/point.rb', line 21 def self.for_context(context) where context: context end |
.for_gameable(gameable) ⇒ Object
29 30 31 |
# File 'app/models/scorecard/point.rb', line 29 def self.for_gameable(gameable) where gameable_id: gameable.id, gameable_type: gameable.class.name end |
.for_raw_gameable(gameable_type, gameable_id) ⇒ Object
33 34 35 |
# File 'app/models/scorecard/point.rb', line 33 def self.for_raw_gameable(gameable_type, gameable_id) where gameable_id: gameable_id, gameable_type: gameable_type end |
.for_timeframe(timeframe) ⇒ Object
37 38 39 |
# File 'app/models/scorecard/point.rb', line 37 def self.for_timeframe(timeframe) where created_at: timeframe end |
.for_user(user) ⇒ Object
25 26 27 |
# File 'app/models/scorecard/point.rb', line 25 def self.for_user(user) where user_id: user.id, user_type: user.class.name end |
.for_user_in_timeframe(context, user, timeframe) ⇒ Object
41 42 43 |
# File 'app/models/scorecard/point.rb', line 41 def self.for_user_in_timeframe(context, user, timeframe) for_context(context).for_user(user).for_timeframe(timeframe) end |