lib/crack/json.rb in crack-0.1.4 vs lib/crack/json.rb in crack-0.1.5

- old
+ new

@@ -18,11 +18,11 @@ def self.unescape(str) str.gsub(/\\u([0-9a-f]{4})/) { [$1.hex].pack("U") } end # matches YAML-formatted dates - DATE_REGEX = /^\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?$/ + DATE_REGEX = /^\d{4}-\d{2}-\d{2}$|^\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?$/ # Ensure that ":" and "," are always followed by a space def self.convert_json_to_yaml(json) #:nodoc: scanner, quoting, marks, pos, times = StringScanner.new(json), false, [], nil, [] while scanner.scan_until(/(\\['"]|['":,\\]|\\.)/) @@ -63,6 +63,6 @@ output.gsub!(/\\\//, '/') output end end end -end \ No newline at end of file +end