The UriFormatter handles URIs from user-input and escaping.
uf = Gem::UriFormatter.new 'example.com'
p uf.normalize #=> 'http://example.com'
Methods
Attributes
| [R] | uri | The URI to be formatted. |
Class Public methods
new(uri)
Link
Creates a new URI formatter for uri.
Source: show
# File lib/rubygems/uri_formatter.rb, line 21 def initialize uri @uri = uri end
Instance Public methods
escape()
Link
Source: show
# File lib/rubygems/uri_formatter.rb, line 28 def escape return unless @uri CGI.escape @uri end