Class: Bosh::Director::Models::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/models/package.rb

Instance Method Summary collapse

Instance Method Details

#dependency_setSet<String>

Returns A set of package names this package depends on.

Returns:

  • (Set<String>)

    A set of package names this package depends on



10
11
12
13
14
# File 'lib/bosh/director/models/package.rb', line 10

def dependency_set
  json = self.dependency_set_json

  ::Set.new(json ? JSON.parse(json) : nil)
end

#dependency_set=(deps) ⇒ Object



16
17
18
# File 'lib/bosh/director/models/package.rb', line 16

def dependency_set=(deps)
  self.dependency_set_json = JSON.generate(deps.to_a)
end

#descObject



30
31
32
# File 'lib/bosh/director/models/package.rb', line 30

def desc
  "#{name}/#{version}"
end

#validateObject



20
21
22
23
24
25
26
27
28
# File 'lib/bosh/director/models/package.rb', line 20

def validate
  if !sha1.nil? || !blobstore_id.nil?
    validates_presence [:sha1, :blobstore_id]
  end

  validates_presence [:release_id, :name, :version]
  validates_unique [:release_id, :name, :version]
  validates_format VALID_ID, [:name, :version]
end