Method: CloudMaker::Config#import
- Defined in:
- lib/cloud_maker/config.rb
#import(cloud_maker_config) ⇒ Object
Internal: Deep merges another CloudMaker::Config into this one giving precedence to all values set in this one. Arrays will be merged as imported_array.concat(current_array).uniq.
“–” can be used as a knockout prefix, ie. “–foo” will delete the key “foo” when an array is merged, or “–” will delete the entire existing contents of the array.
It should be noted that this is not reference safe, ie. objects within cloud_maker_config will end up referenced from this config object as well.
cloud_maker_config - The CloudMaker::Config to be imported
Returns nothing.
426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/cloud_maker/config.rb', line 426 def import(cloud_maker_config) [:options, :includes, :imports, :cloud_config, :extra_options].each do |key| key = key.to_sym #toss both of these into a hash because deep_merge only works on hashes cloud_maker_config_hash = {:value => cloud_maker_config.send(key)} self_hash = {:value => self.send(key)} self.send( :"#{key}=", cloud_maker_config_hash.deep_merge!( self_hash, :preserve_unmergeables => false, :knockout_prefix => '--' )[:value] ) end end |