Class: JsonResults

Inherits:
Object
  • Object
show all
Defined in:
lib/result_view/json_results.rb

Instance Method Summary collapse

Instance Method Details

#render(violations) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/result_view/json_results.rb', line 4

def render(violations)
  violations_hashes = violations.map do |violation|
    {
      type: violation.type,
      message: violation.message,
      logical_resource_ids: violation.logical_resource_ids,
      violating_code: violation.violating_code
    }
  end
  puts JSON.pretty_generate(violations_hashes)
end