Class: Suspect::Storage::Appender

Inherits:
Object
  • Object
show all
Defined in:
lib/suspect/storage/appender.rb

Constant Summary collapse

VERSION =
'1'

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Appender

Returns a new instance of Appender.



11
12
13
14
15
16
# File 'lib/suspect/storage/appender.rb', line 11

def initialize(opts)
  @writer = opts[:writer] || ::Suspect::FileUtils::FlockWriter.new
  @dir_helper = opts[:dir_helper] ||fail(ArgumentError, 'No dir_helper found')
  @dir_path = opts[:dir_path] || fail(ArgumentError, 'No dir_path found')
  @collector_id = opts[:collector_id] || fail(ArgumentError, 'No collector_id found')
end

Instance Method Details

#append(run_info) ⇒ Object



18
19
20
21
22
23
# File 'lib/suspect/storage/appender.rb', line 18

def append(run_info)
  dir_helper.mkdir dir_path.expand_path

  writer.write filename,
               serialize(run_info)
end