Sha256: dce13b85054af693acb798df0c1460cca8b1c58aa2f2b59ae6c7394d0dee5e0b

Contents?: true

Size: 582 Bytes

Versions: 11

Compression:

Stored size: 582 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  class SeoTag
    # Mixin to share common URL-related methods between class
    module UrlHelper
      private

      # Determines if the given string is an absolute URL
      #
      # Returns true if an absolute URL.
      # Retruns false if it's a relative URL
      # Returns nil if it is not a string or can't be parsed as a URL
      def absolute_url?(string)
        return unless string

        Addressable::URI.parse(string).absolute?
      rescue Addressable::URI::InvalidURIError
        nil
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bridgetown-seo-tag-6.0.0 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-5.0.0 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-4.0.1 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-4.0.0 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-3.0.5 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-3.0.5.beta1 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-3.0.4 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-3.0.3 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-3.0.2 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-3.0.1 lib/bridgetown-seo-tag/url_helper.rb
bridgetown-seo-tag-3.0.0 lib/bridgetown-seo-tag/url_helper.rb