Module: TLSmap::Utils

Defined in:
lib/tls_map/utils.rb

Overview

Generic utilities

Class Method Summary collapse

Class Method Details

.json_load_file(filespec, opts = {}) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/tls_map/utils.rb', line 21

def self.json_load_file(filespec, opts = {})
  if RUBY_VERSION < '3.0.0'
    JSON.parse(File.read(filespec), opts)
  else
    JSON.load_file(filespec, opts)
  end
end

.tmpfile(name, url) ⇒ Object



12
13
14
15
16
17
# File 'lib/tls_map/utils.rb', line 12

def self.tmpfile(name, url)
  tmp = Tempfile.new(name)
  tmp.write(Net::HTTP.get(URI(url)))
  tmp.close
  tmp
end