Class: Milestones::FindOrCreateService
- Inherits:
-
Object
- Object
- Milestones::FindOrCreateService
- Defined in:
- app/services/milestones/find_or_create_service.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#params ⇒ Object
Returns the value of attribute params.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, user, params = {}) ⇒ FindOrCreateService
constructor
A new instance of FindOrCreateService.
Constructor Details
#initialize(project, user, params = {}) ⇒ FindOrCreateService
Returns a new instance of FindOrCreateService.
7 8 9 10 11 |
# File 'app/services/milestones/find_or_create_service.rb', line 7 def initialize(project, user, params = {}) @project = project @current_user = user @params = params.dup end |
Instance Attribute Details
#current_user ⇒ Object
Returns the value of attribute current_user.
5 6 7 |
# File 'app/services/milestones/find_or_create_service.rb', line 5 def current_user @current_user end |
#params ⇒ Object
Returns the value of attribute params.
5 6 7 |
# File 'app/services/milestones/find_or_create_service.rb', line 5 def params @params end |
#project ⇒ Object
Returns the value of attribute project.
5 6 7 |
# File 'app/services/milestones/find_or_create_service.rb', line 5 def project @project end |
Instance Method Details
#execute ⇒ Object
13 14 15 |
# File 'app/services/milestones/find_or_create_service.rb', line 13 def execute find_milestone || create_milestone end |