Sha256: 79eb41d4d54504c596fa20d75bb4da7c016346e49d9b3e22067d6acd96824859
Contents?: true
Size: 903 Bytes
Versions: 5
Compression:
Stored size: 903 Bytes
Contents
module Kaya module Support module Logs def self.path "#{Dir.pwd}/kaya/" end def self.all logs = Hash.new Dir.glob(path + '*_log') do |log_file| name = log_file.split("/").last.gsub('.log','') text = File.read(log_file) logs[name] = text end logs end def self.read_log_file_content_for log=nil path = "#{Dir.pwd}/kaya/#{log}" if File.exist?("#{path}") FileUtils.cp(path, "#{path}~") all_content = IO.read("#{path}~") content = if all_content.split("\n").size > 500 all_content.split("\n")[-500..-1].join("<br>") else all_content.gsub("\n","<br>") end File.delete("#{path}~") else content = "" end content end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
kaya-0.0.5 | lib/kaya/support/logs.rb |
kaya-0.0.4 | lib/kaya/support/logs.rb |
kaya-0.0.3 | lib/kaya/support/logs.rb |
kaya-0.0.2 | lib/kaya/support/logs.rb |
kaya-0.0.1 | lib/kaya/support/logs.rb |