Method: Kimurai::Base::Saver#initialize

Defined in:
lib/kimurai/base/saver.rb

#initialize(path, format:, position: true, append: false) ⇒ Saver

Returns a new instance of Saver.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/kimurai/base/saver.rb', line 9

def initialize(path, format:, position: true, append: false)
  raise "SimpleSaver: wrong type of format: #{format}" unless i[json pretty_json compact_json jsonlines csv].include?(format)

  @path = path
  @format = format
  @format = :json if format == :pretty_json # :pretty_json is now an alias for :json
  @position = position
  @index = 0
  @append = append
  @mutex = Mutex.new
end