Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def self.parse_json(data)
- if Object.const_defined?('ActiveSupport')
- ActiveSupport::JSON.decode(data)
- else
- JSON.parse(data)
- end
- end
- def self.parse_query(value, spliter = '&')
- Rack::Utils.parse_query(value, spliter).inject({}) {|h,(k,v)|
- h[k] = Array === v ? v.first : v
- h
- }
- end
Add Comment
Please, Sign In to add comment