Module: TmpFile

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

Class Method Summary collapse

Class Method Details



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

def delete_and_unlink_tmp_file tmp_file
  tmp_file.close
  tmp_file.unlink
end

.make_tmp_file_from(text = nil) ⇒ Object



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

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