Module: Beslist::ParamsEncoder

Defined in:
lib/beslist/util/params_encoder.rb

Class Method Summary collapse

Class Method Details

.decode(string) ⇒ Object



14
15
16
# File 'lib/beslist/util/params_encoder.rb', line 14

def self.decode(string)
  string
end

.encode(params) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/beslist/util/params_encoder.rb', line 3

def self.encode(params)
  params.map do |k, v|
    case v
    when Array, Hash
      "#{k}=#{URI.escape(JSON.dump(v))}"
    else
      "#{k}=#{v}"
    end
  end.join('&')
end