Module: Startback::Audit::Shared
- Included in:
- OperationTracer, Prometheus
- Defined in:
- lib/startback/audit/shared.rb
Instance Method Summary collapse
Instance Method Details
#op_context(op) ⇒ Object
15 16 17 |
# File 'lib/startback/audit/shared.rb', line 15 def op_context(op) op.respond_to?(:context, false) ? op.context.to_h : {} end |
#op_data(op) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/startback/audit/shared.rb', line 19 def op_data(op) if op.respond_to?(:op_data, false) op.op_data elsif op.respond_to?(:to_trail, false) op.to_trail elsif op.respond_to?(:input, false) op.input elsif op.respond_to?(:request, false) op.request elsif op.is_a?(Operation::MultiOperation) op.ops.map{ |sub_op| op_to_trail(sub_op) } end end |
#op_name(op) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/startback/audit/shared.rb', line 5 def op_name(op) return op.op_name if op.respond_to?(:op_name) case op when String then op when Class then op.name else op.class.name end end |