class Lono::Template::Strategy::Dsl::Builder::Section::Resource::PropertyMover

Moves the property to the top-level attributes destructively

Public Class Methods

new(resource, logical_id, properties) click to toggle source
# File lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb, line 4
def initialize(resource, logical_id, properties)
  @resource, @logical_id, @properties = resource, logical_id, properties
end

Public Instance Methods

move(attribute_name) click to toggle source
# File lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb, line 18
def move(attribute_name)
  attribute_value = @properties.delete(attribute_name)
  @resource[@logical_id][attribute_name] = attribute_value if attribute_value
end
move!() click to toggle source
# File lib/lono/template/strategy/dsl/builder/section/resource/property_mover.rb, line 8
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