Skip to content

Commit

Permalink
reference tempfile to prevent GC
Browse files Browse the repository at this point in the history
  • Loading branch information
youpy committed Jan 19, 2012
1 parent 13bb8a1 commit 4641bda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/scissor/tape.rb
Expand Up @@ -47,7 +47,11 @@ def self.new_from_url(url)
file.flush
end

new(file.path)
tape = new(file.path)

# reference tempfile to prevent GC
tape.instance_variable_set('@__tempfile', file)
tape
end

def add_fragment(fragment)
Expand Down

0 comments on commit 4641bda

Please sign in to comment.