Sha256: 240a71ede5613a73a4625c7ea597f440c9298ab59f955a13d1fcbd90fd41b658
Contents?: true
Size: 1.19 KB
Versions: 5
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true class AndroidGooglesourceUrlParser < URLParser CASE_SENSITIVE = true private def full_domain 'https://android.googlesource.com' end def tlds %w(com) end def domain 'android.googlesource' end def remove_domain url.sub!(/(android\.googlesource\.com)+?(:|\/)?/i, '') end def remove_extra_segments self.url = url.split('/').reject{ |s| s.strip.empty? } end def format_url # if this is an Array then the url has gone through all the clean up steps # # if this is just a string then the url was not cleaned up and I have no idea how to format it return nil unless url.is_a?(Array) && url.length.positive? # the links that code into specific branches of the repository start with + in the path # for example https://android.googlesource.com/device/amlogic/yukawa/ is the top level repository # but looking at the master branch is the url # https://android.googlesource.com/device/amlogic/yukawa/+/refs/heads/master # and the same applies for tags # https://android.googlesource.com/device/amlogic/yukawa/+/refs/tags/android-12.1.0_r16 self.url = url.join("/").split("+").first.chomp("/") end end
Version data entries
5 entries across 5 versions & 1 rubygems