module TLSmap::Utils
Generic utilities
Public Class Methods
json_load_file(filespec, opts = {})
click to toggle source
bring JSON.load_file before ruby 3.0.0 ruby-doc.org/stdlib-3.0.0/libdoc/json/rdoc/JSON.html#method-i-load_file
# File lib/tls_map/utils/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)
click to toggle source
# File lib/tls_map/utils/utils.rb, line 12 def self.tmpfile(name, url) tmp = Tempfile.new(name) tmp.write(Net::HTTP.get(URI(url))) tmp.close tmp end