Class: ParamsEncoder
- Defined in:
- lib/cocoa/params_encoder.rb,
lib/android/params_encoder.rb
Class Method Summary collapse
-
.encode(arg) ⇒ Object
TODO: check if iOS implements anything more performant/reliable that we should be using.
Class Method Details
.encode(arg) ⇒ Object
TODO: check if iOS implements anything more performant/reliable that we should be using.
3 4 5 6 7 |
# File 'lib/cocoa/params_encoder.rb', line 3 def self.encode(arg) arg.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/) do |m| '%' + m.unpack('H2' * m.bytesize).join('%').upcase end.tr(' ', '+') end |