Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Scissor::Chunk#loop is not destructive

  • Loading branch information...
commit 9c86ad805a11fda912cb110a90c18ee6af1bdb3b 1 parent 1a5d84c
@youpy authored
Showing with 7 additions and 4 deletions.
  1. +4 −2 lib/scissor/chunk.rb
  2. +3 −2 spec/scissor_spec.rb
View
6 lib/scissor/chunk.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
View
5 spec/scissor_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.