Class: LoGspot::Output::File
- Inherits:
-
Object
- Object
- LoGspot::Output::File
- Defined in:
- lib/lo_gspot/output/file.rb
Instance Method Summary collapse
- #finalize ⇒ Object
-
#initialize(arg) ⇒ File
constructor
A new instance of File.
- #puts(data) ⇒ Object
- #write(message) ⇒ Object
Constructor Details
#initialize(arg) ⇒ File
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/lo_gspot/output/file.rb', line 2 def initialize(arg) if arg.is_a?(String) @physical = true FileUtils.mkdir_p(File.dirname(arg)) @file = File.open(arg, 'a') else @physical = false @file = arg end end |
Instance Method Details
#finalize ⇒ Object
23 24 25 |
# File 'lib/lo_gspot/output/file.rb', line 23 def finalize file.close if physical end |
#puts(data) ⇒ Object
13 14 15 16 |
# File 'lib/lo_gspot/output/file.rb', line 13 def puts(data) file.puts(data[:message]) file.flush end |
#write(message) ⇒ Object
18 19 20 21 |
# File 'lib/lo_gspot/output/file.rb', line 18 def write() file.write() file.flush end |