lib/twilio-ruby/framework/serialize.rb in twilio-ruby-5.0.0.rc26 vs lib/twilio-ruby/framework/serialize.rb in twilio-ruby-5.0.0

- old
+ new

@@ -22,36 +22,30 @@ date end end def self.deserialize_rfc2822(date) - unless date.nil? - Time.rfc2822(date) - end + Time.rfc2822(date) unless date.nil? end def self.deserialize_iso8601_date(date) - unless date.nil? - Date.parse(date) - end + Date.parse(date) unless date.nil? end def self.deserialize_iso8601_datetime(date) - unless date.nil? - Time.parse(date) - end + Time.parse(date) unless date.nil? end def self.serialize_object(object) - if object.is_a?(Hash) or object.is_a?(Array) + if object.is_a?(Hash) || object.is_a?(Array) JSON.generate(object) else object end end - def self.flatten(map, result={}, previous=[]) + def self.flatten(map, result = {}, previous = []) map.each do |key, value| if value.is_a? Hash self.flatten(value, result, previous + [key]) else result[(previous + [key]).join('.')] = value @@ -71,7 +65,6 @@ end end result end - end