class EasyJSONMatcher::JsonCoercer

Public Instance Methods

coerce(json:) click to toggle source
# File lib/easy_json_matcher/json_coercer.rb, line 7
def coerce(json:)
  begin
    JSON.parse(json)
  rescue JSON::ParserError, TypeError
    raise CoercionError.new invalid_string: json
  end
end