class Convection::Model::Template::ResourceProperty

Base class for {docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-product-property-reference.html Resource Property Types}

Attributes

exist[R]
exist?[R]
properties[R]
template[R]

Resource Property Instance Methods

Public Class Methods

attach_method(name, &block) click to toggle source
# File lib/convection/model/template/resource_property.rb, line 16
def attach_method(name, &block)
  define_method(name, &block)
end
new(parent) click to toggle source
# File lib/convection/model/template/resource_property.rb, line 31
def initialize(parent)
  @template = parent.template
  @exist = false

  ## Instantiate properties
  @properties = Model::Collection.new
  resource = self
  resource.class.properties.each do |_, property|
    @properties[property.property_name] = property.instance(resource)
  end
end
properties() click to toggle source
# File lib/convection/model/template/resource_property.rb, line 7
def properties
  @properties ||= {}
end
property(accesor, property_name, options = {}) click to toggle source
# File lib/convection/model/template/resource_property.rb, line 11
def property(accesor, property_name, options = {})
  properties[accesor] = Resource::Property.create(accesor, property_name, options)
  properties[accesor].attach(self)
end

Public Instance Methods

property(key, *value) click to toggle source
# File lib/convection/model/template/resource_property.rb, line 43
def property(key, *value)
  return properties[key].value if value.empty?

  ## Define a property instance on the fly
  properties[key] = ScalarPropertyInstance.new(self) unless properties.include?(key)
  properties[key].set(*value)
end
render() click to toggle source
# File lib/convection/model/template/resource_property.rb, line 51
def render
  properties.map(true, &:render)
end