Sha256: 1d6836786fd8e37ae1af76c70d82a2c5972d577fb7ba6247269410a0b7c572af

Contents?: true

Size: 780 Bytes

Versions: 19

Compression:

Stored size: 780 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[depends_on condition].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

19 entries across 19 versions & 1 rubygems

Version Path
lono-7.4.4 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.3 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.2 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.1 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.4.0 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.3.2 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.3.1 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.3.0 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.2.3 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.2.2 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.2.1 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.2.0 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.1.0 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.0.5 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.0.4 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.0.3 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.0.2 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.0.1 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb
lono-7.0.0 lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb