Skip to content

Commit

Permalink
Added tiny improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ucnv committed Jul 11, 2024
1 parent b31b350 commit 89fdfc9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/aviglitch/frames.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def * times
times.times do
result.concat frames
end
frames.terminate
result
end

Expand Down Expand Up @@ -177,6 +178,8 @@ def slice! *args
tail = self.slice((b + l)..-1)
self.clear
self.concat head + tail
head.terminate
tail.terminate
sliced
end

Expand All @@ -200,6 +203,7 @@ def []= *args

self.clear
self.concat new_frames
new_frames.terminate
end

##
Expand Down Expand Up @@ -343,6 +347,7 @@ def insert n, *args

self.clear
self.concat new_frames
new_frames.terminate
self
end

Expand Down Expand Up @@ -370,6 +375,13 @@ def == other
@avi == other.avi
end

##
# Closes the internal temp file explicitly. This instance becomes unusable.
def terminate
@avi.close
@avi = nil
end

##
# Generates new AviGlitch::Base instance using self.
def to_avi
Expand Down

0 comments on commit 89fdfc9

Please sign in to comment.