Module: Kaya::Support::Logs
- Defined in:
- lib/kaya/support/logs.rb
Class Method Summary collapse
Class Method Details
.all ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/kaya/support/logs.rb', line 9 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 |
.path ⇒ Object
5 6 7 |
# File 'lib/kaya/support/logs.rb', line 5 def self.path "#{Dir.pwd}/kaya/" end |
.read_log_file_content_for(log = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/kaya/support/logs.rb', line 19 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 = all_content.gsub("\n","<br>") File.delete("#{path}~") else content = "" end content end |