Class: InternetHakai::PStoreReporter

Inherits:
Reporter show all
Defined in:
lib/internethakai/reporter.rb

Constant Summary

Constants inherited from Reporter

Reporter::UNIQUE_BY_THREAD

Constants inherited from BaseHandler

BaseHandler::UNIQUE_BY_THREAD

Instance Method Summary collapse

Methods inherited from Reporter

#get_filename, #init_filename, #set_dir

Methods inherited from BaseHandler

clear, clearall, get_class, get_config, get_handler, get_instance, get_instance_thread, get_thread_id, #initialize, #on_create, set_config, set_thread_id, unique_by_thread?

Constructor Details

This class inherits a constructor from InternetHakai::BaseHandler

Instance Method Details

#run(record) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/internethakai/reporter.rb', line 20

def run record
    super
    return unless record
    fpath = File::join(@dir, @filename)
    @logger.run("save to #{fpath}\n", 3)
    db = PStore::new(fpath)
    db.transaction do
        db["result"] = ResponseRecord::new unless db.root?('result')
        db['result'] += record
    end
end