Module: OutputFile
- Included in:
- Icersplicer::FileProcessor
- Defined in:
- lib/icersplicer.rb
Constant Summary collapse
- @@fileopen =
0
Instance Method Summary collapse
- #close ⇒ Object
- #open(outputfile) ⇒ Object
- #processdata(data, outputfile, quietmode) ⇒ Object
- #write(data) ⇒ Object
Instance Method Details
#close ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/icersplicer.rb', line 31 def close begin @export.close puts "Closing file" rescue NoMethodError end end |
#open(outputfile) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/icersplicer.rb', line 18 def open(outputfile) begin puts "Openfile: #{outputfile}" if @debug >= 1 @export = File.open("#{outputfile}", 'w') rescue Errno::EACCES raise IOError, "Can't create file please check file / directory permissions" end end |
#processdata(data, outputfile, quietmode) ⇒ Object
39 40 41 42 43 |
# File 'lib/icersplicer.rb', line 39 def processdata(data, outputfile, quietmode) open(outputfile) if @@fileopen == 0 write(data) @@fileopen += 1 end |
#write(data) ⇒ Object
27 28 29 |
# File 'lib/icersplicer.rb', line 27 def write(data) @export.write(data) end |