Class: RedSnow::ResourceGroup
- Inherits:
-
NamedBlueprintNode
- Object
- BlueprintNode
- NamedBlueprintNode
- RedSnow::ResourceGroup
- Defined in:
- lib/redsnow/blueprint.rb
Overview
Resource group Blueprint AST node
represents 'resource group section'
Instance Attribute Summary collapse
-
#resources ⇒ Array<Resource>
array of resources in the group.
Attributes inherited from NamedBlueprintNode
Instance Method Summary collapse
-
#initialize(resource_group) ⇒ ResourceGroup
constructor
A new instance of ResourceGroup.
Methods inherited from NamedBlueprintNode
Constructor Details
#initialize(resource_group) ⇒ ResourceGroup
Returns a new instance of ResourceGroup.
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
#resources ⇒ Array<Resource>
array of resources in the group
323 324 325 |
# File 'lib/redsnow/blueprint.rb', line 323 def resources @resources end |