Class: CompletionKit::Checks::ValidJson

Inherits:
Object
  • Object
show all
Defined in:
app/services/completion_kit/checks/valid_json.rb

Instance Method Summary collapse

Instance Method Details

#call(target, _config) ⇒ Object



4
5
6
7
8
9
# File 'app/services/completion_kit/checks/valid_json.rb', line 4

def call(target, _config)
  JSON.parse(target.to_s)
  Result.new(passed: true, detail: "valid JSON")
rescue JSON::ParserError
  Result.new(passed: false, detail: "not valid JSON")
end