Class: Convection::Model::Template::Resource::ListProperty

Inherits:
Property
  • Object
show all
Defined in:
lib/convection/model/template/resource.rb

Overview

A List Property

Instance Attribute Summary

Attributes inherited from Property

#default, #equal_to, #immutable, #kind_of, #name, #property_name, #regex, #required, #transform

Instance Method Summary collapse

Methods inherited from Property

create, #initialize

Constructor Details

This class inherits a constructor from Convection::Model::Template::Resource::Property

Instance Method Details

#attach(resource) ⇒ Object



233
234
235
236
237
238
239
240
241
242
# File 'lib/convection/model/template/resource.rb', line 233

def attach(resource)
  definition = self ## Expose to resource instance closure

  resource.attach_method(definition.name) do |*values|
    properties[definition.property_name].set(values.flatten) unless values.empty?

    ## Return the list
    properties[definition.property_name].value
  end
end

#instance(resource) ⇒ Object



244
245
246
# File 'lib/convection/model/template/resource.rb', line 244

def instance(resource)
  ListPropertyInstance.new(resource, self)
end