Class: Bosh::Cli::JobPropertyCollection

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of JobPropertyCollection.

Parameters:

  • job_builder (JobBuilder)

    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



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cli/job_property_collection.rb', line 12

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

  @job_properties = deep_copy(job_properties || {})
  merge(@job_properties, deep_copy(global_properties))

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

  resolve_mappings
  filter_properties
end

Instance Method Details

#eachObject



25
26
27
# File 'lib/cli/job_property_collection.rb', line 25

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)



30
31
32
# File 'lib/cli/job_property_collection.rb', line 30

def to_hash
  @properties
end