Module: Rawscsi::Stringifier::Encode

Included in:
Query::Compound, Compound, Simple
Defined in:
lib/rawscsi/stringifier/encode.rb

Instance Method Summary collapse

Instance Method Details

#encode(str) ⇒ Object



4
5
6
7
8
9
# File 'lib/rawscsi/stringifier/encode.rb', line 4

def encode(str)
  # URI and CGI.escape don't quite work here
  # For example, I need blank space as %20, but they encode it as +
  # So I have to write my own
  str.gsub(' ', '%20').gsub("'", '%27').gsub("[", '%5B').gsub("]",'%5D').gsub("{", '%7B').gsub("}", '%7D')
end