class Piculet::DSL::EC2
Attributes
result[R]
Public Class Methods
new(context, vpc, security_groups = [], &block)
click to toggle source
# File lib/piculet/dsl/ec2.rb, line 8 def initialize(context, vpc, security_groups = [], &block) @names = Set.new @context = context.merge(:vpc => vpc) @result = OpenStruct.new({ :vpc => vpc, :security_groups => security_groups, }) instance_eval(&block) end
Private Instance Methods
security_group(name, &block)
click to toggle source
# File lib/piculet/dsl/ec2.rb, line 21 def security_group(name, &block) if @names.include?(name) raise "EC2 `#{@result.vpc || :classic}`: `#{name}` is already defined" end @result.security_groups << SecurityGroup.new(@context, name, @result.vpc, &block).result @names << name end