Sha256: 6eae28f0d2cedecc66790fbb5156fa3264fd2521082287350772ec169d2f5233

Contents?: true

Size: 381 Bytes

Versions: 2

Compression:

Stored size: 381 Bytes

Contents

module AwsInventory::SecurityGroup::Shared
  def used_security_groups
    groups = instances.inject([]) do |results, i|
      results += i.security_groups
      results
    end
    groups.uniq(&:group_id)
  end

  def unused_security_groups
    used_group_ids = used_security_groups.map(&:group_id)
    security_groups.reject {|sg| used_group_ids.include?(sg.group_id) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aws-inventory-0.4.2 lib/aws_inventory/security_group/shared.rb
aws-inventory-0.4.0 lib/aws_inventory/security_group/shared.rb