class CheckPlease::Printers::JSON
Public Instance Methods
to_s()
click to toggle source
# File lib/check_please/printers/json.rb, line 5 def to_s return "[]" if diffs.empty? build_string do |io| io.puts "[" io.puts diffs.map { |diff| diff_json(diff) }.join(",\n") io.puts "]" end end
Private Instance Methods
diff_json(diff, prefix = " ")
click to toggle source
# File lib/check_please/printers/json.rb, line 17 def diff_json(diff, prefix = " ") h = diff.attributes json = ::JSON.pretty_generate(h) prefix.to_s + json.gsub(/\n\s*/, " ") end