Class: Periphery::JsonParser

Inherits:
Object
  • Object
show all
Defined in:
lib/periphery/json_parser.rb

Overview

Parses JSON formatted output produced by Periphery with –format=json option.

Instance Method Summary collapse

Instance Method Details

#parse(string) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/periphery/json_parser.rb', line 9

def parse(string)
  JSON.parse(string).map do |entry|
    path, line, column = parse_location(entry['location'])
    message = compose_message(*entry.slice('name', 'kind', 'hints', 'modules').values)
    ScanResult.new(path, line, column, message)
  end
end