Class: Milestones::FindOrCreateService

Inherits:
Object
  • Object
show all
Defined in:
app/services/milestones/find_or_create_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_userObject

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

#paramsObject

Returns the value of attribute params.



5
6
7
# File 'app/services/milestones/find_or_create_service.rb', line 5

def params
  @params
end

#projectObject

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

#executeObject



13
14
15
# File 'app/services/milestones/find_or_create_service.rb', line 13

def execute
  find_milestone || create_milestone
end