Class: Approvals::Writers::ArrayWriter

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

Instance Method Summary collapse

Methods inherited from TextWriter

#extension, #write

Instance Method Details

#filter(data) ⇒ Object


11
12
13
14
# File 'lib/approvals/writers/array_writer.rb', line 11

def filter data
  filter = ::Approvals::Filter.new(Approvals.configuration.excluded_json_keys)
  filter.apply(data)
end

#format(data) ⇒ Object


5
6
7
8
9
# File 'lib/approvals/writers/array_writer.rb', line 5

def format(data)
  filter(data).map.with_index do |value, i|
    "[#{i.inspect}] #{value.inspect}\n"
  end.join
end