Class: CloudFormer::Resource

Inherits:
Object
  • Object
show all
Includes:
HasPropertiesAndAttributes, MakesJson
Defined in:
lib/cloud_former/resources/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MakesJson

#dump_json, included

Methods included from HasPropertiesAndAttributes

included

Constructor Details

#initialize(name, &block) ⇒ Resource

Returns a new instance of Resource.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cloud_former/resources/resource.rb', line 16

def initialize(name, &block)
  @name = name
  if name.nil? || name.empty?
    raise ArgumentError.new("Attempting to create a resource of type #{self.class.name} with no name")
  end
  @metadata_items = []
  @aws_type = self.class.name.sub('CloudFormer', 'AWS')
  if block_given?
    self.instance_eval(&block)
  end
end

Instance Attribute Details

#aws_typeObject (readonly)

Returns the value of attribute aws_type.



10
11
12
# File 'lib/cloud_former/resources/resource.rb', line 10

def aws_type
  @aws_type
end

#metadata_itemsObject (readonly)

Returns the value of attribute metadata_items.



11
12
13
# File 'lib/cloud_former/resources/resource.rb', line 11

def 
  @metadata_items
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/cloud_former/resources/resource.rb', line 9

def name
  @name
end

Instance Method Details

#add_metadata(metadata) ⇒ Object



28
29
30
# File 'lib/cloud_former/resources/resource.rb', line 28

def ()
  @metadata_items << 
end