@@ -40,16 +40,15 @@ def to_org(hash:, allow_create: true)
4040 allow_create ? initialize_org ( hash : hash ) : nil
4141 end
4242
43- # rubocop:disable Metrics/AbcSize
4443 def to_identifiers ( hash :)
4544 return [ ] unless hash . present?
4645
4746 out = [ ]
4847 # Process each of the identifiers
4948 hash = hash . with_indifferent_access
50- idents = hash . select { | k , _v | identifier_keys . include? ( k ) }
49+ idents = hash . slice ( * identifier_keys )
5150 idents . each do |key , value |
52- attrs = hash . select { | k , _v | attr_keys ( hash : hash ) . include? ( k ) }
51+ attrs = hash . slice ( * attr_keys ( hash : hash ) )
5352 attrs = { } unless attrs . present?
5453 out << Identifier . new (
5554 identifier_scheme_id : IdentifierScheme . by_name ( key ) . first &.id ,
@@ -59,7 +58,6 @@ def to_identifiers(hash:)
5958 end
6059 out
6160 end
62- # rubocop:enable Metrics/AbcSize
6361
6462 private
6563
@@ -71,7 +69,7 @@ def lookup_org_by_id(hash:)
7169
7270 # Lookup the Org by its :identifiers and return if the name matches the search
7371 def lookup_org_by_identifiers ( hash :)
74- identifiers = hash . select { | k , _v | identifier_keys . include? ( k ) }
72+ identifiers = hash . slice ( * identifier_keys )
7573 ids = identifiers . map { |k , v | { name : k , value : v } }
7674 org = Org . from_identifiers ( array : ids ) if ids . any?
7775 exact_match? ( rec : org , name2 : hash [ :name ] ) ? org : nil
0 commit comments