Class: Nitlink::ParamDecoder

Inherits:
Object
  • Object
show all
Defined in:
lib/nitlink/param_decoder.rb

Instance Method Summary collapse

Instance Method Details

#decode(param_value) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/nitlink/param_decoder.rb', line 5

def decode(param_value)
  charset, language, value_chars = param_value.split("'")

  raise syntax_error(param_value) unless charset && language && value_chars
  raise wrong_charset(charset) unless charset.downcase == 'utf-8'

  CGI.unescape(value_chars)
end