Class: Convection::Model::Template::ResourceCollection

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
DSL::Helpers, DSL::Template::Resource, Mixin::Conditional
Defined in:
lib/convection/model/template/resource_collection.rb

Overview

A collection of different Resources.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixin::Conditional

#condition, #render_condition

Methods included from DSL::Template::Resource

attach_resource, attach_resource_collection, resource_collection_dsl_methods, resource_dsl_methods

Methods included from DSL::Helpers

#camel_case, included, method_name, #screaming_snake_case, #snake_case

Methods included from DSL::IntrinsicFunctions

#base64, #find_in_map, #fn_and, #fn_equals, #fn_if, #fn_import_value, #fn_not, #fn_or, #fn_ref, #fn_sub, #get_att, #get_azs, #join, #select

Constructor Details

#initialize(name, parent, &definition) ⇒ ResourceCollection

Returns a new instance of ResourceCollection.



27
28
29
30
31
32
# File 'lib/convection/model/template/resource_collection.rb', line 27

def initialize(name, parent, &definition)
  @definition = definition
  @name = name
  @parent = parent
  @template = parent.template
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/convection/model/template/resource_collection.rb', line 15

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



16
17
18
# File 'lib/convection/model/template/resource_collection.rb', line 16

def parent
  @parent
end

#templateObject (readonly)

Returns the value of attribute template.



17
18
19
# File 'lib/convection/model/template/resource_collection.rb', line 17

def template
  @template
end

Class Method Details

.attach_to_dsl(dsl_name) ⇒ Object



22
23
24
# File 'lib/convection/model/template/resource_collection.rb', line 22

def attach_to_dsl(dsl_name)
  DSL::Template::Resource.attach_resource_collection(dsl_name, self)
end

Instance Method Details

#executeObject

Note:

This method is in place to be overriden by subclasses.



35
36
# File 'lib/convection/model/template/resource_collection.rb', line 35

def execute
end

#resourcesObject



42
43
44
# File 'lib/convection/model/template/resource_collection.rb', line 42

def resources
  @resources ||= Convection::Model::Collection.new
end

#run_definitionObject



38
39
40
# File 'lib/convection/model/template/resource_collection.rb', line 38

def run_definition
  instance_exec(&@definition) if @definition
end