Module: TmpFile

Included in:
NlpToolz::Parser
Defined in:
lib/nlp_toolz/helpers/tmp_file.rb

Class Method Summary collapse

Class Method Details



13
14
15
16
# File 'lib/nlp_toolz/helpers/tmp_file.rb', line 13

def delete_and_unlink_tmp_file tmp_file
  tmp_file.close
  tmp_file.unlink
end

.make_tmp_file_from(text = nil) ⇒ Object



6
7
8
9
10
11
# File 'lib/nlp_toolz/helpers/tmp_file.rb', line 6

def make_tmp_file_from text = nil
  tmp_file = ::Tempfile.new('tmp.txt')
  tmp_file.write text unless text.nil?
  tmp_file.rewind
  tmp_file
end