Sha256: 902f9c6da7b69e36b076a9f9f6485645f02ead6f2c629955668f794eb57f2044

Contents?: true

Size: 363 Bytes

Versions: 2

Compression:

Stored size: 363 Bytes

Contents

module UrlRegexp
  class Host < Node
    def initialize(options = {})
      @hosts = Set.new
      @options = options
    end

    def append(host)
      @hosts << host
    end

    def to_regexp_s
      hosts = @hosts.map { |h| Regexp.quote(h.to_s) }
      if 1 < hosts.size
        "(#{hosts.join('|')})"
      else
        hosts[0]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
url_regexp-0.1.4 lib/url_regexp/host.rb
url_regexp-0.1.3 lib/url_regexp/host.rb