Class: SecurityGroups
- Inherits:
-
Object
- Object
- SecurityGroups
- Includes:
- Enumerable
- Defined in:
- lib/ec2/security_groups.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(provider, config) ⇒ SecurityGroups
constructor
A new instance of SecurityGroups.
- #size ⇒ Object
Constructor Details
#initialize(provider, config) ⇒ SecurityGroups
Returns a new instance of SecurityGroups.
8 9 10 11 |
# File 'lib/ec2/security_groups.rb', line 8 def initialize(provider, config) @groups = provider.security_groups @config = config end |
Instance Method Details
#each(&block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ec2/security_groups.rb', line 13 def each(&block) groups = @groups.select { |sg| !@config.exclusions.match(sg.name) } groups.each { |group| if block_given? block.call SecurityGroup.new(@groups, group, @config) else yield SecurityGroup.new(@groups, group, @config) end } end |
#size ⇒ Object
24 25 26 |
# File 'lib/ec2/security_groups.rb', line 24 def size @groups.size end |