module Utils
Public Class Methods
clear()
click to toggle source
# File lib/ap_api_tools/utils.rb, line 11 def self.clear system('clear') || system('cls') end
download(url, dir=nil)
click to toggle source
# File lib/ap_api_tools/utils.rb, line 30 def self.download(url, dir=nil) if dir.nil? || dir == '' dir = File.join(Dir.home,"Downloads") end file=File.basename(url) File.open(File.join(dir,file), "w") do |f| f.write(HTTP.get(url).body) f.close end end
internet?()
click to toggle source
# File lib/ap_api_tools/utils.rb, line 3 def self.internet? begin true if open("http://www.google.com/") rescue false end end