Sha256: 872f0eb4acc31160b6592e87604e3f3a0271c2efb3949df80673654c6b412461

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

# frozen_string_literal: true

#
# Abstraction over WebMock to reduce duplication
#
# @author Mikael Henriksson <mikael@zoolutions.se>
# @since 0.1.0
#
module StubRequests
  module URI
    #
    # Module Suffix deals with validating {URI} suffix
    #
    module Suffix
      #
      # @return [RegExp] a pattern used for matching HTTP(S) ports
      PORT_REGEX = %r{:(\d+)/}.freeze

      #
      # Checks if the host has a valid suffix
      #
      # @param [String] host a string to check
      #
      # @return [true,false]
      #
      def self.valid?(host)
        PublicSuffix.valid?(host, default_rule: nil)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stub_requests-0.1.1 lib/stub_requests/uri/suffix.rb
stub_requests-0.1.0 lib/stub_requests/uri/suffix.rb