Sha256: 5a561e07774b5fe38bde39181a537942f3694a62b1d66a6f55bb553923db0b8b

Contents?: true

Size: 324 Bytes

Versions: 1

Compression:

Stored size: 324 Bytes

Contents

module UrlRegexp
  class Host < Node
    def initialize
      @hosts = Set.new
    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

1 entries across 1 versions & 1 rubygems

Version Path
url_regexp-0.1.2 lib/url_regexp/host.rb