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.2.4 lib/pupa/models/identifier_list.rb
pupa-0.2.3 lib/pupa/models/identifier_list.rb
pupa-0.2.2 lib/pupa/models/identifier_list.rb
pupa-0.2.1 lib/pupa/models/identifier_list.rb
pupa-0.2.0 lib/pupa/models/identifier_list.rb
pupa-0.1.11 lib/pupa/models/identifier_list.rb
pupa-0.1.10 lib/pupa/models/identifier_list.rb
pupa-0.1.9 lib/pupa/models/identifier_list.rb
pupa-0.1.8 lib/pupa/models/identifier_list.rb
pupa-0.1.7 lib/pupa/models/identifier_list.rb
pupa-0.1.6 lib/pupa/models/identifier_list.rb
pupa-0.1.5 lib/pupa/models/identifier_list.rb
pupa-0.1.4 lib/pupa/models/identifier_list.rb
pupa-0.1.3 lib/pupa/models/identifier_list.rb
pupa-0.1.2 lib/pupa/models/identifier_list.rb
pupa-0.1.1 lib/pupa/models/identifier_list.rb
pupa-0.1.0 lib/pupa/models/identifier_list.rb
pupa-0.0.13 lib/pupa/models/identifier_list.rb
pupa-0.0.12 lib/pupa/models/identifier_list.rb
pupa-0.0.11 lib/pupa/models/identifier_list.rb