Class: Bosh::Cli::JobPropertyCollection

Inherits:
Object
  • Object
show all
Includes:
Template::PropertyHelper, Enumerable
Defined in:
lib/cli/job_property_collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(job, global_properties, job_properties, mappings) ⇒ JobPropertyCollection

Returns a new instance of JobPropertyCollection

Parameters:

  • job (Bosh::Cli::Resources::Job)

    Which job this property collection is for

  • global_properties (Hash)

    Globally defined properties

  • job_properties (Hash)

    Properties defined for this job only

  • mappings (Hash)

    Property mappings for this job


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cli/job_property_collection.rb', line 15

def initialize(job, global_properties, job_properties, mappings)
  @job = job

  @job_properties = Bosh::Common::DeepCopy.copy(job_properties || {})
  merge(@job_properties, Bosh::Common::DeepCopy.copy(global_properties))

  @mappings = mappings || {}
  @properties = []

  resolve_mappings
  filter_properties
end

Instance Method Details

#eachObject


28
29
30
# File 'lib/cli/job_property_collection.rb', line 28

def each
  @properties.each { |property| yield property }
end

#to_hashHash

Returns Property hash (keys are property name components)

Returns:

  • (Hash)

    Property hash (keys are property name components)


33
34
35
# File 'lib/cli/job_property_collection.rb', line 33

def to_hash
  @properties
end