Class: ActiveEndpoint::Probe

Inherits:
ApplicationRecord show all
Defined in:
app/models/active_endpoint/probe.rb

Direct Known Subclasses

UnregistredProbe

Instance Method Summary collapse

Instance Method Details

#tagObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/active_endpoint/probe.rb', line 20

def tag
  definitions = ActiveEndpoint.tags.definition
  methods = ActiveEndpoint::Extentions::ActiveRecord::METHODS

  definitions.each do |tag_name, operators|
    last_operation_index = operators.length - 1

    exec_operator = ''
    operators.each_with_index do |(key, value), index|
      exec_operator << "#{duration * 1000} #{methods[key]} #{value}"
      exec_operator << (index == last_operation_index ? '' : ' && ')
    end

    return tag_name if eval(exec_operator)
  end
end