Class: Tempfile

Inherits:
Object
  • Object
show all
Defined in:
lib/riel/tempfile.rb

Class Method Summary collapse

Class Method Details

.open(*args, &blk) ⇒ Object

this works around the behavior (fixed in 1.9) so that open returns the new temporary file instead of nil.



13
14
15
16
17
18
19
20
21
22
# File 'lib/riel/tempfile.rb', line 13

def open(*args, &blk)
  tempname = nil
  original_open(*args) do |tf|
    tempname = tf.path
    
    blk.call(tf) if blk
  end

  tempname
end

.original_openObject



8
# File 'lib/riel/tempfile.rb', line 8

alias_method :original_open, :open