Class: Users::KeysCountService
- Inherits:
-
BaseCountService
- Object
- BaseCountService
- Users::KeysCountService
- Defined in:
- app/services/users/keys_count_service.rb
Overview
Service class for getting the number of SSH keys that belong to a user.
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #cache_key ⇒ Object
-
#initialize(user) ⇒ KeysCountService
constructor
user - The User for which to get the number of SSH keys.
- #raw? ⇒ Boolean
- #relation_for_count ⇒ Object
Methods inherited from BaseCountService
#cache_options, #count, #count_stored?, #delete_cache, #refresh_cache, #uncached_count, #update_cache_for_key
Constructor Details
#initialize(user) ⇒ KeysCountService
user - The User for which to get the number of SSH keys.
9 10 11 |
# File 'app/services/users/keys_count_service.rb', line 9 def initialize(user) @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'app/services/users/keys_count_service.rb', line 6 def user @user end |
Instance Method Details
#cache_key ⇒ Object
23 24 25 |
# File 'app/services/users/keys_count_service.rb', line 23 def cache_key "users/key-count-service/#{user.id}" end |
#raw? ⇒ Boolean
17 18 19 20 21 |
# File 'app/services/users/keys_count_service.rb', line 17 def raw? # Since we're storing simple integers we don't need all of the additional # Marshal data Rails includes by default. true end |
#relation_for_count ⇒ Object
13 14 15 |
# File 'app/services/users/keys_count_service.rb', line 13 def relation_for_count user.keys.auth end |