Class: DeployKey

Inherits:
Key
  • Object
show all
Defined in:
app/models/deploy_key.rb

Overview

Schema Information

Table name: keys

id          :integer          not null, primary key
user_id     :integer
created_at  :datetime
updated_at  :datetime
key         :text
title       :string
type        :string
fingerprint :string
public      :boolean          default(FALSE), not null

Instance Method Summary collapse

Methods inherited from Key

#add_to_shell, #notify_user, #post_create_hook, #post_destroy_hook, #projects, #publishable_key, #remove_from_shell, #shell_id, #strip_white_space

Instance Method Details

#almost_orphaned?Boolean

Returns:

  • (Boolean)

31
32
33
# File 'app/models/deploy_key.rb', line 31

def almost_orphaned?
  self.deploy_keys_projects.length == 1
end

#destroyed_when_orphaned?Boolean

Returns:

  • (Boolean)

35
36
37
# File 'app/models/deploy_key.rb', line 35

def destroyed_when_orphaned?
  self.private?
end

#orphaned?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'app/models/deploy_key.rb', line 27

def orphaned?
  self.deploy_keys_projects.length == 0
end

#private?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'app/models/deploy_key.rb', line 23

def private?
  !public?
end