Method: Gitable::URI.parse_when_valid

Defined in:
lib/gitable/uri.rb

.parse_when_valid(uri) ⇒ Gitable::URI?

Parse a git repository URI into a URI object. Rescue parse errors and return nil if uri is not parseable.

Parameters:

  • uri (Addressable::URI, #to_str)

    URI of a git repository.

Returns:

  • (Gitable::URI, nil)

    The parsed uri, or nil if not parseable.



73
74
75
76
77
# File 'lib/gitable/uri.rb', line 73

def self.parse_when_valid(uri)
  parse(uri)
rescue TypeError, Gitable::URI::InvalidURIError
  nil
end