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
# File 'app/services/milestones/find_or_create_service.rb', line 7

def initialize(project, user, params = {})
  @project, @current_user, @params = project, user, 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


11
12
13
# File 'app/services/milestones/find_or_create_service.rb', line 11

def execute
  find_milestone || create_milestone
end