Sha256: 2ec3affb9d5992eda5baeec8539509aafdabefbcbfb2fb795fbe283377158118

Contents?: true

Size: 662 Bytes

Versions: 8

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true
class DrupalUrlParser < URLParser
  private

  def full_domain
    'https://git.drupalcode.org/project'
  end

  def tlds
    %w(org)
  end

  def domain
    'git.drupalcode'
  end

  def remove_domain
    # find the matches for any github domain characters in the url string
    # and replace only the first match incase we find a repo with something like github.com as the name
    url.sub!(/(drupalcode\.org\/project)+?(:|\/)?/i, '')
  end

  def format_url
    # if this is an Array then the url has gone through all the clean up steps
    return nil unless url.is_a?(Array) && url.length.positive?

    url.join("/")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
librariesio-url-parser-1.0.10 lib/drupal_url_parser.rb
librariesio-url-parser-1.0.9 lib/drupal_url_parser.rb
librariesio-url-parser-1.0.8 lib/drupal_url_parser.rb
librariesio-url-parser-1.0.7 lib/drupal_url_parser.rb
librariesio-url-parser-1.0.6 lib/drupal_url_parser.rb
librariesio-url-parser-1.0.5 lib/drupal_url_parser.rb
librariesio-url-parser-1.0.4 lib/drupal_url_parser.rb
librariesio-url-parser-1.0.3 lib/drupal_url_parser.rb