Changed method to self
This commit is contained in:
parent
7dba2d6fb2
commit
085dd1c509
@ -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]
|
||||||
|
Loading…
Reference in New Issue
Block a user