Class: UrlRegexp::Host
Instance Method Summary collapse
- #append(host) ⇒ Object
-
#initialize(options = {}) ⇒ Host
constructor
A new instance of Host.
- #to_regexp_s ⇒ Object
Methods inherited from Node
Constructor Details
Instance Method Details
#append(host) ⇒ Object
8 9 10 |
# File 'lib/url_regexp/host.rb', line 8 def append(host) @hosts << host end |
#to_regexp_s ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/url_regexp/host.rb', line 12 def to_regexp_s hosts = @hosts.map { |h| Regexp.quote(h.to_s) } if 1 < hosts.size "(#{hosts.join('|')})" else hosts[0] end end |