class Gtin2atc::Util
Public Class Methods
debug_msg(msg)
click to toggle source
# File lib/gtin2atc/util.rb, line 33 def Util.debug_msg(msg) return unless @@logging Util.init if @@logging or defined?(MiniTest) then $stdout.puts Time.now.to_s + ': ' + msg; $stdout.flush; return end @@checkLog.puts("#{Time.now}: #{msg}") @@checkLog.flush end
get_archive()
click to toggle source
# File lib/gtin2atc/util.rb, line 13 def Util.get_archive @@archive end
get_latest_and_dated_name(keyword, extension)
click to toggle source
# File lib/gtin2atc/util.rb, line 40 def Util.get_latest_and_dated_name(keyword, extension) return File.expand_path(File.join(Util.get_archive, keyword + '-latest' + extension)), File.expand_path(File.join(Util.get_archive, Util.get_today.strftime("#{keyword}-%Y.%m.%d" + extension))) end
get_today()
click to toggle source
# File lib/gtin2atc/util.rb, line 7 def Util.get_today @@today end
info(msg)
click to toggle source
# File lib/gtin2atc/util.rb, line 19 def Util.info(msg) puts msg return unless @@logging Util.init @@checkLog.puts("#{Time.now}: #{msg}") end
init()
click to toggle source
# File lib/gtin2atc/util.rb, line 25 def Util.init return unless @@logging if not defined?(@@checkLog) or not @@checkLog name = File.join(@@archive, 'log.log') FileUtils.makedirs(@@archive) @@checkLog = File.open(name, 'a+') end end
set_archive_dir(archiveDir)
click to toggle source
# File lib/gtin2atc/util.rb, line 10 def Util.set_archive_dir(archiveDir) @@archive = archiveDir end
set_logging(default)
click to toggle source
# File lib/gtin2atc/util.rb, line 16 def Util.set_logging(default) @@logging = default end