Sha256: 8a8045c9fb494e0ae9c6637586e1e8493120f8f035ffc03390fb0e1848d6a353
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
class Lono::Builder::Dsl::Syntax::Core::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 # AWS Docs: Resource attribute reference # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-product-attribute-reference.html def move! %w[ Condition CreationPolicy DeletionPolicy DependsOn Metadata UpdatePolicy UpdateReplacePolicy ].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
4 entries across 4 versions & 1 rubygems