Class: Log
- Inherits:
-
Object
- Object
- Log
- Defined in:
- lib/log.rb
Instance Method Summary collapse
- #addData(data) ⇒ Object
-
#initialize ⇒ Log
constructor
A new instance of Log.
Constructor Details
#initialize ⇒ Log
Returns a new instance of Log.
3 4 5 |
# File 'lib/log.rb', line 3 def initialize() @fname = "log.txt" end |
Instance Method Details
#addData(data) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/log.rb', line 7 def addData (data) date = Time.now.strftime("%d/%m/%Y %H:%M") File.open(@fname, 'a+') do |file| file.puts("#{date}: \n") file.puts("#{data} \n") file.puts("\n") end end |