Sha256: 629c0544f0e01b7c97a7afaa4d14df5a6d63d8b76dbf63c6f04ce481b8e601c1

Contents?: true

Size: 378 Bytes

Versions: 5

Compression:

Stored size: 378 Bytes

Contents

module Inventory::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

5 entries across 5 versions & 1 rubygems

Version Path
aws-inventory-0.3.2 lib/inventory/security_group/shared.rb
aws-inventory-0.3.1 lib/inventory/security_group/shared.rb
aws-inventory-0.3.0 lib/inventory/security_group/shared.rb
aws-inventory-0.2.1 lib/inventory/security_group/shared.rb
aws-inventory-0.2.0 lib/inventory/security_group/shared.rb