Module: Mixpanel::Client::Utils
- Defined in:
- lib/mixpanel/utils.rb
Overview
Mixpanel API Ruby Client Library
Utility helpers
Copyright © 2009+ Keolo Keagy See LICENSE for details
Class Method Summary collapse
-
.to_hash(data, format) ⇒ JSON, String
Return a JSON object or a string depending on a given format.
Class Method Details
.to_hash(data, format) ⇒ JSON, String
Return a JSON object or a string depending on a given format
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mixpanel/utils.rb', line 23 def self.to_hash(data, format) if format == 'csv' || format == 'raw' data else begin JSON.parse(data) rescue JSON::ParserError => error raise ParseError, error end end end |