ERB::Util 模块
公共类方法
url_encode(s) 单击切换源
将 String
s 编码为 URL 的实用方法。
require "erb" include ERB::Util puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
生成
Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
# File lib/erb/util.rb, line 57 def url_encode(s) CGI.escapeURIComponent(s.to_s) end
别名:u
私有实例方法
url_encode(s) 单击切换源
将 String
s 编码为 URL 的实用方法。
require "erb" include ERB::Util puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
生成
Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
# File lib/erb/util.rb, line 57 def url_encode(s) CGI.escapeURIComponent(s.to_s) end
别名:u