Module: Conjur::Escape::ClassMethods
- Defined in:
- lib/conjur/escape.rb
Instance Method Summary collapse
- #fully_escape(str) ⇒ Object
- #path_escape(str) ⇒ Object
- #path_or_query_escape(str) ⇒ Object
- #query_escape(str) ⇒ Object
Instance Method Details
#fully_escape(str) ⇒ Object
4 5 6 7 |
# File 'lib/conjur/escape.rb', line 4 def fully_escape(str) require 'cgi' CGI.escape(str.to_s) end |
#path_escape(str) ⇒ Object
9 10 11 |
# File 'lib/conjur/escape.rb', line 9 def path_escape(str) path_or_query_escape str end |
#path_or_query_escape(str) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/conjur/escape.rb', line 17 def path_or_query_escape(str) return "false" unless str str = str.id if str.respond_to?(:id) # Leave colons and forward slashes alone require 'uri' pattern = URI::PATTERN::UNRESERVED + ":\\/@" URI.escape(str.to_s, Regexp.new("[^#{pattern}]")) end |
#query_escape(str) ⇒ Object
13 14 15 |
# File 'lib/conjur/escape.rb', line 13 def query_escape(str) path_or_query_escape str end |