Sha256: 933087bb4f6c6786981bc37f17ea7ca75d6b5e6abce47e70d60f33e53efb820d

Contents?: true

Size: 794 Bytes

Versions: 10

Compression:

Stored size: 794 Bytes

Contents

class Lono::Template::Strategy::Dsl::Builder::Section::Resource
  # Moves the property to the top-level attributes *destructively*
  class PropertyMover
    def initialize(resource, logical_id, properties)
      @resource, @logical_id, @properties = resource, logical_id, properties
    end

    def move!
      %w[Condition DeletionPolicy DependsOn].each do |attribute_name|
        # Account for camelize, underscore, String, and Symbol
        move(attribute_name.to_sym)
        move(attribute_name.camelize.to_sym)
        move(attribute_name)
        move(attribute_name.camelize)
      end
    end

    def move(attribute_name)
      attribute_value = @properties.delete(attribute_name)
      @resource[@logical_id][attribute_name] = attribute_value if attribute_value
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.5.1 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.5.0 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.11 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.10 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.9 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.8 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.7 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.6 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.5 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb