Class: ProjectMonitorStat::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/project_monitor_stat/util.rb

Class Method Summary collapse

Class Method Details

.get(url: raise, cookie: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/project_monitor_stat/util.rb', line 18

def self.get(url: raise, cookie: nil)
  uri = URI(url)
  request = Net::HTTP::Get.new(uri)
  request.add_field('Cookie', cookie) if cookie

  response = Net::HTTP.start(uri.hostname, uri.port) do |http|
    http.request(request)
  end

  response.body
end

.puts(*args) ⇒ Object



6
7
8
# File 'lib/project_monitor_stat/util.rb', line 6

def self.puts(*args)
  Kernel.puts(*args)
end

.system(*args) ⇒ Object



10
11
12
# File 'lib/project_monitor_stat/util.rb', line 10

def self.system(*args)
  Kernel.system(*args)
end

.x(command) ⇒ Object



14
15
16
# File 'lib/project_monitor_stat/util.rb', line 14

def self.x(command)
  %x(#{command}).chomp
end