Class: Contrek::Cpp::CPPTempfile

Inherits:
CPPOfstream
  • Object
show all
Defined in:
lib/contrek/cpp/cpp_tempfile.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(name) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/contrek/cpp/cpp_tempfile.rb', line 6

def self.new(name)
  require "tempfile"
  tempfile = Tempfile.new(name)
  instance = super(tempfile.path)
  instance.instance_variable_set(:@tempfile, tempfile)
  instance
end

Instance Method Details

#closeObject



18
19
20
21
# File 'lib/contrek/cpp/cpp_tempfile.rb', line 18

def close
  super
  @tempfile.close
end

#pathObject



14
15
16
# File 'lib/contrek/cpp/cpp_tempfile.rb', line 14

def path
  @tempfile.path
end


23
24
25
# File 'lib/contrek/cpp/cpp_tempfile.rb', line 23

def unlink
  @tempfile.unlink
end