Class: Fog::JSON
Defined Under Namespace
Modules: LegacyJSON, NewJSON Classes: LoadError
Class Method Summary collapse
- .decode(obj) ⇒ Object
-
.encode(obj) ⇒ Object
Do the MultiJson introspection at this level so we can define our encode/decode methods and perform the introspection only once rather than once per call.
- .sanitize(data) ⇒ Object
Class Method Details
.decode(obj) ⇒ Object
71 72 73 |
# File 'lib/fog/core/json.rb', line 71 def self.decode(obj) Fog::JSON.instance.decode(obj) end |
.encode(obj) ⇒ Object
Do the MultiJson introspection at this level so we can define our encode/decode methods and perform the introspection only once rather than once per call.
67 68 69 |
# File 'lib/fog/core/json.rb', line 67 def self.encode(obj) Fog::JSON.instance.encode(obj) end |
.sanitize(data) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fog/core/json.rb', line 50 def self.sanitize(data) case data when Array data.map {|datum| sanitize(datum)} when Hash for key, value in data data[key] = sanitize(value) end when ::Time data.strftime("%Y-%m-%dT%H:%M:%SZ") else data end end |