lib/billy/json_utils.rb in puffing-billy-0.4.1 vs lib/billy/json_utils.rb in puffing-billy-0.5.0
- old
+ new
@@ -1,10 +1,9 @@
require 'json'
module Billy
module JSONUtils
-
def self.json?(value)
!!JSON.parse(value)
rescue JSON::ParserError, TypeError
false
end
@@ -31,9 +30,9 @@
# and "An array is an ordered collection of values". So, we can sort the
# name/value pairs by name (key), but we must preserve the order of an array.
# Processing JSON in this way enables a consistent SHA to be derived from
# JSON payloads which have the same name/value pairs, but different orders.
def self.sort_json(json_str)
- JSONUtils::sort_hash_keys(JSON.parse(json_str, symbolize_names: true)).to_json
+ JSONUtils.sort_hash_keys(JSON.parse(json_str, symbolize_names: true)).to_json
end
end
end