Module: ERB::Util
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Escape
|
|
Defined in: | lib/erb/util.rb |
Class Method Summary
-
.h(s)
mod_func
Alias for Escape#html_escape.
-
.u(s)
mod_func
Alias for #url_encode.
-
.url_encode(s)
(also: #u)
mod_func
A utility method for encoding the String s as a URL.
Instance Method Summary
Escape
- Included
#html_escape |
|
Class Method Details
.h(s) (mod_func)
Alias for Escape#html_escape.
# File 'lib/erb/util.rb', line 42
alias h html_escape
.u(s) (mod_func)
Alias for #url_encode.
# File 'lib/erb/util.rb', line 60
alias u url_encode
.url_encode(s) (mod_func) Also known as: #u
A utility method for encoding the String s as a URL.
require "erb"
include ERB::Util
puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
Generates
Programming%20Ruby
# File 'lib/erb/util.rb', line 57
def url_encode(s) CGI.escapeURIComponent(s.to_s) end