Class: RulesEngine::Process::Auditor
- Inherits:
-
Object
- Object
- RulesEngine::Process::Auditor
- Defined in:
- lib/rules_engine/process/auditor.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#audit_level ⇒ Object
Returns the value of attribute audit_level.
Instance Method Summary collapse
- #audit(process_id, message, code = RulesEngine::Process::AUDIT_INFO) ⇒ Object
- #history(process_id, options = {}) ⇒ Object
- #perform_audit?(code) ⇒ Boolean
Instance Attribute Details
#audit_level ⇒ Object
Returns the value of attribute audit_level.
34 35 36 |
# File 'lib/rules_engine/process/auditor.rb', line 34 def audit_level @audit_level end |
Instance Method Details
#audit(process_id, message, code = RulesEngine::Process::AUDIT_INFO) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rules_engine/process/auditor.rb', line 36 def audit(process_id, , code = RulesEngine::Process::AUDIT_INFO) if perform_audit?(code) if defined?(Rails) && Rails.logger case code when RulesEngine::Process::AUDIT_FAILURE Rails.logger.error("#{'*' * 5} #{process_id}, #{code}, #{}") else # when RulesEngine::Process::AUDIT_INFO, RulesEngine::Process::AUDIT_SUCCESS Rails.logger.info("#{'*' * 5} #{process_id}, #{code}, #{}") end else $stderr.puts("#{'*' * 5} #{process_id}, #{code}, #{}") end end end |
#history(process_id, options = {}) ⇒ Object
51 52 53 54 55 |
# File 'lib/rules_engine/process/auditor.rb', line 51 def history(process_id, = {}) { "audits" => [] } end |
#perform_audit?(code) ⇒ Boolean
57 58 59 |
# File 'lib/rules_engine/process/auditor.rb', line 57 def perform_audit?(code) audit_level.nil? || (audit_level != RulesEngine::Process::AUDIT_NONE && code >= audit_level) end |