Sha256: 53892e2ea0ed80fe2f9e1f0a59a744b28fa7e7653550fbe87669e00d25684def

Contents?: true

Size: 352 Bytes

Versions: 2

Compression:

Stored size: 352 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 = "(#{hosts.join('|')})"
      else
        hosts = hosts[0]
      end
      hosts
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
url_regexp-0.1.1 lib/url_regexp/host.rb
url_regexp-0.1.0 lib/url_regexp/host.rb