Class: Log

Inherits:
Object
  • Object
show all
Defined in:
lib/log.rb

Instance Method Summary collapse

Constructor Details

#initializeLog

Returns a new instance of Log.



4
5
6
# File 'lib/log.rb', line 4

def initialize()
    @file = "log.txt"
end

Instance Method Details

#addContent(content) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/log.rb', line 8

def addContent(content)
    date = Time.now.strftime("%d/%m/%Y %H:%M")
    File.open(@file, 'a+') do |file|
        file.puts("#{date}: \n")
        file.puts("#{content} \n")
        file.puts("\n")
    end
end