Method: Iri#port
- Defined in:
- lib/iri.rb
#port(val) ⇒ Iri
Replaces the port part of the URI.
256 257 258 259 260 261 262 263 264 265 |
# File 'lib/iri.rb', line 256 def port(val) raise ArgumentError, "The port can't be nil" if val.nil? val = val.to_i raise ArgumentError, "The port can'be negative" if val.negative? raise ArgumentError, "The port can'be zero" if val.zero? raise ArgumentError, "The port can'be larger than 65536" if val > 65_536 modify do |c| c.port = val end end |