module Conjur::Escape

Provides helpers for escaping url components.

The helpers are added as both class and isntance methods.

Public Class Methods

included(base) click to toggle source

@api private

# File lib/conjur/escape.rb, line 89
def self.included(base)
  base.extend ClassMethods
end

Public Instance Methods

fully_escape(str) click to toggle source

URL escape the entire string. This is essentially the same as calling ‘CGI.escape str`.

@example

fully_escape 'foo/bar@baz'
# => "foo%2Fbar%40baz"

@param [String] str the string to escape @return [String] the escaped string @see Conjur::Escape::ClassMethods#fully_escape

# File lib/conjur/escape.rb, line 102
def fully_escape(str)
  self.class.fully_escape str
end
path_escape(str) click to toggle source

Escape a URI path component.

This method simply calls {Conjur::Escape::ClassMethods#path_or_query_escape}.

@param [String] str the string to escape @return [String] the escaped string @see Conjur::Escape::ClassMethods#path_or_query_escape

# File lib/conjur/escape.rb, line 113
def path_escape(str)
  self.class.path_escape str
end
query_escape(str) click to toggle source

Escape a URI query value.

This method simply calls {Conjur::Escape::ClassMethods#path_or_query_escape}.

@param [String] str the string to escape @return [String] the escaped string @see Conjur::Escape::ClassMethods#path_or_query_escape

# File lib/conjur/escape.rb, line 125
def query_escape(str)
  self.class.query_escape str
end