Method: Fitting::Tests#save

Defined in:
lib/fitting/tests.rb

#saveObject



9
10
11
12
13
14
15
16
# File 'lib/fitting/tests.rb', line 9

def save
  array = @tested_requests.inject([]) do |res, request|
    next res unless request.path.to_s.start_with?(Fitting.configuration.prefix)
    res.push(request.to_spherical.to_hash)
  end
  json = JSON.dump(array)
  File.open("tests.json", 'w') { |file| file.write(json) }
end