Permalink
Browse files

Scissor::Chunk#loop is not destructive

  • Loading branch information...
1 parent 1a5d84c commit 9c86ad805a11fda912cb110a90c18ee6af1bdb3b @youpy committed Dec 2, 2011
Showing with 7 additions and 4 deletions.
  1. +4 −2 lib/scissor/chunk.rb
  2. +3 −2 spec/scissor_spec.rb
@@ -108,12 +108,14 @@ def +(other)
def loop(count)
orig_fragments = @fragments.clone
+ new_instance = Scissor()
+ new_instance.add_fragments(orig_fragments)
(count - 1).times do
- add_fragments(orig_fragments)
+ new_instance.add_fragments(orig_fragments)
end
- self
+ new_instance
end
alias * loop
@@ -88,8 +88,9 @@
end
it "should loop" do
- scissor = @mp3.slice(0, 10).loop(3)
- scissor.duration.should eql(30.0)
+ scissor = @mp3.slice(0, 10)
+ scissor.loop(3).duration.should eql(30.0)
+ scissor.duration.should eql(10.0)
end
it "should loop using arithmetic operator" do

0 comments on commit 9c86ad8

Please sign in to comment.