scissor 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,7 @@ supported file format:
8
8
 
9
9
  * mp3
10
10
  * wav
11
+ * m4a
11
12
 
12
13
  == Installation
13
14
 
@@ -5,7 +5,6 @@ module Scissor
5
5
  class Tape
6
6
  class Error < StandardError; end
7
7
  class EmptyFragment < Error; end
8
- class OutOfDuration < Error; end
9
8
 
10
9
  attr_reader :fragments
11
10
 
@@ -152,16 +151,17 @@ module Scissor
152
151
  new_instance = self.class.new
153
152
  offset = start + length
154
153
 
155
- if offset > duration
156
- raise OutOfDuration
157
- end
154
+ new_instance += slice(0, start)
158
155
 
159
- if start > 0
160
- new_instance += slice(0, start)
156
+ if new_instance.duration < start
157
+ new_instance + Scissor.silence(start - new_instance.duration)
161
158
  end
162
159
 
163
160
  new_instance += replaced
164
- new_instance += slice(offset, duration - offset)
161
+
162
+ if duration > offset
163
+ new_instance += slice(offset, duration - offset)
164
+ end
165
165
 
166
166
  new_instance
167
167
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
14
  gem.name = %q{scissor}
15
15
  gem.require_paths = ["lib"]
16
- gem.version = "0.5.0"
16
+ gem.version = "0.6.0"
17
17
 
18
18
  gem.add_dependency('open4', '>= 1.3.0')
19
19
  gem.add_dependency('ruby-mp3info')
@@ -238,10 +238,9 @@ describe Scissor do
238
238
  scissor.fragments.size.should eql(1)
239
239
  end
240
240
 
241
- it "should raise error if replaced range is out of duration" do
242
- lambda {
243
- @mp3.slice(0, 100).replace(60, 41, @mp3.slice(0, 60))
244
- }.should raise_error(Scissor::Tape::OutOfDuration)
241
+ it "should expand if replaced range is out of duration" do
242
+ replaced = @mp3.slice(0, 100).replace(60, 41, @mp3.slice(0, 60))
243
+ replaced.duration.should eql(120.0)
245
244
  end
246
245
 
247
246
  it "should write to file and return new instance of Scissor" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scissor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-22 00:00:00.000000000 Z
12
+ date: 2012-12-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: open4
@@ -202,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  segments:
204
204
  - 0
205
- hash: 337261600329672185
205
+ hash: 538315552897310387
206
206
  required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  none: false
208
208
  requirements:
@@ -211,10 +211,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  version: '0'
212
212
  segments:
213
213
  - 0
214
- hash: 337261600329672185
214
+ hash: 538315552897310387
215
215
  requirements: []
216
216
  rubyforge_project:
217
- rubygems_version: 1.8.23
217
+ rubygems_version: 1.8.24
218
218
  signing_key:
219
219
  specification_version: 3
220
220
  summary: utility to chop sound files