Class: Conjur::Policy::DuplicateResolver

Inherits:
Resolver show all
Defined in:
lib/conjur/policy/resolver.rb

Overview

Raises an exception if the same record is declared more than once.

Instance Attribute Summary

Attributes inherited from Resolver

#account, #namespace, #ownerid

Instance Method Summary collapse

Methods inherited from Resolver

#initialize, resolve

Constructor Details

This class inherits a constructor from Conjur::Policy::Resolver

Instance Method Details

#resolve(records) ⇒ Object



205
206
207
208
209
210
211
212
# File 'lib/conjur/policy/resolver.rb', line 205

def resolve records
  seen = Set.new
  Array(records).flatten.each do |record|
    if record.respond_to?(:id) && !seen.add?([ record.class.short_name, record.id ])
      raise "#{record} is declared more than once"
    end
  end
end