Guest User

Untitled

a guest
Jun 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. def self.parse_json(data)
  2. if Object.const_defined?('ActiveSupport')
  3. ActiveSupport::JSON.decode(data)
  4. else
  5. JSON.parse(data)
  6. end
  7. end
  8.  
  9. def self.parse_query(value, spliter = '&')
  10. Rack::Utils.parse_query(value, spliter).inject({}) {|h,(k,v)|
  11. h[k] = Array === v ? v.first : v
  12. h
  13. }
  14. end
Add Comment
Please, Sign In to add comment