Class: RulesEngine::Process::DbAuditor
- Defined in:
- lib/rules_engine/process/auditor/db_auditor.rb
Instance Attribute Summary
Attributes inherited from Auditor
Instance Method Summary collapse
- #audit(process_id, message, code = RulesEngine::Process::AUDIT_INFO) ⇒ Object
- #history(process_id, options = {}) ⇒ Object
-
#initialize(*options) ⇒ DbAuditor
constructor
A new instance of DbAuditor.
Methods inherited from Auditor
Constructor Details
#initialize(*options) ⇒ DbAuditor
Returns a new instance of DbAuditor.
20 21 |
# File 'lib/rules_engine/process/auditor/db_auditor.rb', line 20 def initialize(*) end |
Instance Method Details
#audit(process_id, message, code = RulesEngine::Process::AUDIT_INFO) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rules_engine/process/auditor/db_auditor.rb', line 23 def audit(process_id, , code = RulesEngine::Process::AUDIT_INFO) super if perform_audit?(code) # $stderr.puts("#{'*' * 5} #{process_id}, #{code}, #{message}") ReProcessAudit.create({ :process_id => process_id, :created_at => Time.now, :code => code, :message => }); end end |
#history(process_id, options = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rules_engine/process/auditor/db_auditor.rb', line 35 def history(process_id, ={}) re_process_audits = ReProcessAudit.history(process_id, ) { "audits" => re_process_audits.map do |re_process_audit| { "process_id" => re_process_audit.process_id, "created_at" => re_process_audit.created_at.utc.to_s, "code" => re_process_audit.code, "message" => re_process_audit. } end } end |