Module: OAuth::Helper

Defined in:
lib/tinatra.rb

Instance Method Summary collapse

Instance Method Details

#escape(value) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/tinatra.rb', line 18

def escape(value)
  begin
    URI::escape(value.to_s, OAuth::RESERVED_CHARACTERS)
  rescue ArgumentError
    URI::escape(
      value.to_s.force_encoding(Encoding::UTF_8),
      OAuth::RESERVED_CHARACTERS
    )
  end
end