Class: Log
- Inherits:
-
Object
- Object
- Log
- Defined in:
- lib/log.rb
Instance Method Summary collapse
- #addContent(content) ⇒ Object
-
#initialize ⇒ Log
constructor
A new instance of Log.
Constructor Details
#initialize ⇒ Log
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 |