scissor 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +1 -0
- data/lib/scissor/tape.rb +7 -7
- data/scissor.gemspec +1 -1
- data/spec/scissor_spec.rb +3 -4
- metadata +5 -5
data/README.rdoc
CHANGED
data/lib/scissor/tape.rb
CHANGED
@@ -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
|
-
|
156
|
-
raise OutOfDuration
|
157
|
-
end
|
154
|
+
new_instance += slice(0, start)
|
158
155
|
|
159
|
-
if
|
160
|
-
new_instance
|
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
|
-
|
161
|
+
|
162
|
+
if duration > offset
|
163
|
+
new_instance += slice(offset, duration - offset)
|
164
|
+
end
|
165
165
|
|
166
166
|
new_instance
|
167
167
|
end
|
data/scissor.gemspec
CHANGED
@@ -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.
|
16
|
+
gem.version = "0.6.0"
|
17
17
|
|
18
18
|
gem.add_dependency('open4', '>= 1.3.0')
|
19
19
|
gem.add_dependency('ruby-mp3info')
|
data/spec/scissor_spec.rb
CHANGED
@@ -238,10 +238,9 @@ describe Scissor do
|
|
238
238
|
scissor.fragments.size.should eql(1)
|
239
239
|
end
|
240
240
|
|
241
|
-
it "should
|
242
|
-
|
243
|
-
|
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.
|
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-
|
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:
|
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:
|
214
|
+
hash: 538315552897310387
|
215
215
|
requirements: []
|
216
216
|
rubyforge_project:
|
217
|
-
rubygems_version: 1.8.
|
217
|
+
rubygems_version: 1.8.24
|
218
218
|
signing_key:
|
219
219
|
specification_version: 3
|
220
220
|
summary: utility to chop sound files
|