Class: Scrolls::IOLogger
- Inherits:
-
Object
- Object
- Scrolls::IOLogger
- Defined in:
- lib/scrolls/iologger.rb
Instance Method Summary collapse
-
#initialize(stream) ⇒ IOLogger
constructor
A new instance of IOLogger.
- #log(data) ⇒ Object
Constructor Details
#initialize(stream) ⇒ IOLogger
Returns a new instance of IOLogger.
3 4 5 6 7 8 |
# File 'lib/scrolls/iologger.rb', line 3 def initialize(stream) if stream.respond_to?(:sync) stream.sync = true end @stream = stream end |
Instance Method Details
#log(data) ⇒ Object
10 11 12 |
# File 'lib/scrolls/iologger.rb', line 10 def log(data) @stream.write("#{data}\n") end |