module ERB::Util - Documentation for Ruby 4.0
Description: module ERB::Util: Util A utility module for conversion routines, often handy in HTML generation.
Keywords: ruby,module,ERB::Util

🔍

No recent searches

# module ERB::Util

`ERB::Util`

A utility module for conversion routines, often handy in HTML generation.

### Public Class Methods

u (s)
Alias for: url_encode
url_encode (s)
Source

    # File lib/erb/util.rb, line 64
    def url_encode(s)
      CGI.escapeURIComponent(s.to_s)
    end

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%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide

Also aliased as: u

### Private Instance Methods

u (s)
Alias for: url_encode
url_encode (s)
Source

    # File lib/erb/util.rb, line 64
    def url_encode(s)
      CGI.escapeURIComponent(s.to_s)
    end

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%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide

Also aliased as: u