Sha256: f4d7d9f6b94b41ef4859b427c0afe20737791ea46cd868b09de5c08b1c685d23

Contents?: true

Size: 387 Bytes

Versions: 25

Compression:

Stored size: 387 Bytes

Contents

module Pupa
  # A list of identifiers.
  class IdentifierList < Array
    # Returns the first identifier matching the scheme.
    #
    # @param [String] scheme a scheme
    # @return [String,nil] an identifier
    def find_by_scheme(scheme)
      find{|identifier|
        identifier[:scheme] == scheme
      }.try{|identifier|
        identifier[:identifier]
      }
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
pupa-0.0.10 lib/pupa/models/identifier_list.rb
pupa-0.0.9 lib/pupa/models/identifier_list.rb
pupa-0.0.8 lib/pupa/models/identifier_list.rb
pupa-0.0.7 lib/pupa/models/identifier_list.rb
pupa-0.0.6 lib/pupa/models/identifier_list.rb