Class: RedSnow::ResourceGroup

Inherits:
NamedBlueprintNode show all
Defined in:
lib/redsnow/blueprint.rb

Overview

Resource group Blueprint AST node

represents 'resource group section'

Instance Attribute Summary collapse

Attributes inherited from NamedBlueprintNode

#description, #name

Instance Method Summary collapse

Methods inherited from NamedBlueprintNode

#ensure_description_newlines

Constructor Details

#initialize(resource_group) ⇒ ResourceGroup

Returns a new instance of ResourceGroup.

Parameters:

  • resource_group (json)


327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/redsnow/blueprint.rb', line 327

def initialize(resource_group)
  @name = resource_group.fetch('name', '')
  @description = resource_group.fetch('description', '')

  @resources = []
  resource_group.key?('resources') && resource_group['resources'].each do |resource|
    @resources << Resource.new(resource).tap do |inst|
      resource_group_instance = self
      inst.define_singleton_method(:resource_group) { resource_group_instance }
    end
  end
end

Instance Attribute Details

#resourcesArray<Resource>

array of resources in the group

Returns:

  • (Array<Resource>)

    the current value of resources



323
324
325
# File 'lib/redsnow/blueprint.rb', line 323

def resources
  @resources
end