Class: Achievements::DestroyService
- Inherits:
-
Object
- Object
- Achievements::DestroyService
- Defined in:
- app/services/achievements/destroy_service.rb
Instance Attribute Summary collapse
-
#achievement ⇒ Object
readonly
Returns the value of attribute achievement.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, achievement) ⇒ DestroyService
constructor
A new instance of DestroyService.
Constructor Details
#initialize(current_user, achievement) ⇒ DestroyService
Returns a new instance of DestroyService.
7 8 9 10 |
# File 'app/services/achievements/destroy_service.rb', line 7 def initialize(current_user, achievement) @current_user = current_user @achievement = achievement end |
Instance Attribute Details
#achievement ⇒ Object (readonly)
Returns the value of attribute achievement.
5 6 7 |
# File 'app/services/achievements/destroy_service.rb', line 5 def achievement @achievement end |
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
5 6 7 |
# File 'app/services/achievements/destroy_service.rb', line 5 def current_user @current_user end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 |
# File 'app/services/achievements/destroy_service.rb', line 12 def execute return unless allowed? achievement.delete ServiceResponse.success(payload: achievement) end |