Class: Heartcheck::Controllers::Dev

Inherits:
Base
  • Object
show all
Defined in:
lib/heartcheck/controllers/dev.rb

Instance Method Summary collapse

Instance Method Details

#indexObject


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/heartcheck/controllers/dev.rb', line 4

def index
  results = []

  total_execution_time = time_diff do
    checks = Heartcheck.dev_checks

    results += checks.reduce([]) do |acc, elem|
      context_result = {}

      context_result['execution_time'] = time_diff do
        context_result.merge!(elem.check)
      end

      acc << context_result
    end
  end

  results << { 'total_execution_time' => total_execution_time }
  Oj.dump(results)
end