Class: DeployNotification

Inherits:
Object
  • Object
show all
Defined in:
app/mailers/deploy_notification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deploy) ⇒ DeployNotification

Returns a new instance of DeployNotification.



3
4
5
6
7
# File 'app/mailers/deploy_notification.rb', line 3

def initialize(deploy)
  @deploy = deploy
  @deployer = deploy.deployer
  @maintainers = deploy.project.maintainers
end

Instance Attribute Details

#deployObject (readonly)

Returns the value of attribute deploy.



9
10
11
# File 'app/mailers/deploy_notification.rb', line 9

def deploy
  @deploy
end

#deployerObject (readonly)

Returns the value of attribute deployer.



9
10
11
# File 'app/mailers/deploy_notification.rb', line 9

def deployer
  @deployer
end

#maintainersObject (readonly)

Returns the value of attribute maintainers.



9
10
11
# File 'app/mailers/deploy_notification.rb', line 9

def maintainers
  @maintainers
end

Instance Method Details

#deliver!Object



11
12
13
14
15
16
17
18
19
20
21
# File 'app/mailers/deploy_notification.rb', line 11

def deliver!
  messages = maintainers.map do |maintainer|
    ProjectNotification.maintainer_of_deploy(maintainer, deploy).deliver!
  end

  if we_know_who_triggered_the_deploy and it_wasnt_a_maintainer
    messages << ProjectNotification.maintainer_of_deploy(deployer, deploy).deliver!
  end

  messages
end