Class: Approvals::Writers::JsonWriter

Inherits:
TextWriter
  • Object
show all
Defined in:
lib/approvals/writers/json_writer.rb

Instance Method Summary collapse

Methods inherited from TextWriter

#write

Instance Method Details

#extensionObject



4
5
6
# File 'lib/approvals/writers/json_writer.rb', line 4

def extension
  'json'
end

#format(data) ⇒ Object



8
9
10
11
12
# File 'lib/approvals/writers/json_writer.rb', line 8

def format(data)
  hash_or_array = filter(parse_data(data))

  JSON.pretty_generate(hash_or_array) + "\n"
end