Sha256: 6051986b33e69bdd6c5c476d82bcde20dda09c7b153874b46355c256f6306f0b
Contents?: true
Size: 468 Bytes
Versions: 3
Compression:
Stored size: 468 Bytes
Contents
require 'tempfile' require 'socket' module Dklet::Util module_function def tmpfile_for(str, prefix: 'kc-tmp') file = Tempfile.new(prefix) file.write str file.close # save to disk # unlink清理问题:引用进程结束时自动删除?👍 file.path end def human_timestamp(t = Time.now) t.strftime("%Y%m%d%H%M%S") end def host_ip Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dklet-0.1.3 | lib/dklet/util.rb |
dklet-0.1.2 | lib/dklet/util.rb |
dklet-0.1.1 | lib/dklet/util.rb |