Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/wwwtf/utils/string.rb

Instance Method Summary collapse

Instance Method Details

#unescapeObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/wwwtf/utils/string.rb', line 3

def unescape
  string = self
  unescaped_string = ''
  escaped_at = string.index(/\\/)
  until escaped_at.nil?
    unescaped_string = "#{unescaped_string}#{string[0...escaped_at]}#{string[escaped_at + 1]}"
    string = string[(escaped_at + 2)..-1]
    escaped_at = string.index(/\\/)
  end
  "#{unescaped_string}#{string}"
end