Changed method to self

This commit is contained in:
Luiz F Picolo 2023-09-11 22:46:41 -04:00
parent 7dba2d6fb2
commit 085dd1c509

View File

@ -29,7 +29,7 @@ class Rate < ActiveRecord::Base
end end
def self.save def self.save
results = run_speedtest results = self.run_speedtest
if results if results
Rate.create({ Rate.create({
download: results[:download], download: results[:download],
@ -38,7 +38,7 @@ class Rate < ActiveRecord::Base
end end
end end
def run_speedtest def self.run_speedtest
output = `speedtest` output = `speedtest`
if $?.success? if $?.success?
download_speed = output.match(/Download:\s+(\d+\.\d+)\sMbps/)[1] download_speed = output.match(/Download:\s+(\d+\.\d+)\sMbps/)[1]