Sha256: c6fa0fe472bf0b39f19f5724a84c01e860251435566b93064ee2261f3a39f477

Contents?: true

Size: 1014 Bytes

Versions: 24

Compression:

Stored size: 1014 Bytes

Contents

module SimpleDeploy
  module Misc
    class AttributeMerger

      def merge(args)
        @attributes   = args[:attributes]
        @config       = SimpleDeploy.config
        @environment  = args[:environment]
        @input_stacks = args[:input_stacks]
        @template     = args[:template]

        combine_provided_and_mapped_attributes
      end

      private

      def combine_provided_and_mapped_attributes
        @attributes + mapped_attributes_not_provided
      end

      def mapped_attributes
        mapper.map_outputs_from_stacks :stacks   => @input_stacks,
                                       :template => @template
      end

      def mapped_attributes_not_provided
        mapped_attributes.reject do |a|
          provided_attribute_keys.include? a.keys.first
        end
      end

      def provided_attribute_keys
        @attributes.map {|a| a.keys.first}
      end

      def mapper
        @om ||= Stack::OutputMapper.new :environment => @environment
      end

    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
simple_deploy-0.10.2 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.10.1 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.10.0 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.10.0.beta.3 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.10.0.beta.2 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.10.0.beta.1 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.9.2 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.9.1 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.9.0 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.8.2 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.8.2.beta1 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.8.1.beta1 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.8.0 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.7.8 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.7.7 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.7.7.beta.1 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.7.6 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.7.6.beta.6 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.7.6.beta.5 lib/simple_deploy/misc/attribute_merger.rb
simple_deploy-0.7.6.beta.3 lib/simple_deploy/misc/attribute_merger.rb