class Gem::UriFormatter
Die UriFormatter behandelt URIs aus Benutzereingaben und deren Escaping.
uf = Gem::UriFormatter.new 'example.com' p uf.normalize #=> 'http://example.com'
Attribute
Öffentliche Klassenmethoden
Öffentliche Instanzmethoden
Source
# File lib/rubygems/uri_formatter.rb, line 29 def escape return unless @uri CGI.escape @uri end
Source
# File lib/rubygems/uri_formatter.rb, line 37 def normalize /^(https?|ftp|file):/i.match?(@uri) ? @uri : "http://#{@uri}" end
Normalisiert den URI durch Hinzufügen von „http://“, falls er fehlt.
Source
# File lib/rubygems/uri_formatter.rb, line 44 def unescape return unless @uri CGI.unescape @uri end