julik-timecode 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.1.6 / 2009-01-28
2
+
3
+ * Fixed RDoc linkage
4
+ * Custom Timecode descendants should hold on to their class
5
+
1
6
  === 0.1.5 / 2009-01-14
2
7
 
3
8
  * Tests remade using test/spec
data/Manifest.txt CHANGED
@@ -4,5 +4,4 @@ README.txt
4
4
  SPECS.txt
5
5
  Rakefile
6
6
  lib/timecode.rb
7
- test/test_timecode.rb
8
- timecode.gemspec
7
+ test/test_timecode.rb
data/README.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  = timecode
2
2
 
3
- * http://wiretap.rubyforge.org/timecode
3
+ * http://guerilla-di.rubyforge.org/timecode
4
4
 
5
5
  == DESCRIPTION:
6
6
 
data/SPECS.txt CHANGED
@@ -51,8 +51,14 @@
51
51
  * disallow more frames than what the framerate permits
52
52
  * propery accept usable values
53
53
 
54
+ == A custom Timecode descendant should
55
+ * properly classify on parse
56
+ * properly classify on at
57
+ * properly classify on calculations
58
+
54
59
  == Timecode.parse() should
55
60
  * handle complete SMPTE timecode
61
+ * handle complete SMPTE timecode via new
56
62
  * refuse to handle timecode that is out of range for the framerate
57
63
  * parse a row of numbers as parts of a timecode starting from the right
58
64
  * parse a number with f suffix as frames
@@ -71,4 +77,4 @@
71
77
  * parse from a 4x4bits packed 32bit unsigned int
72
78
  * properly convert itself back to 4x4 bits 32bit unsigned int
73
79
 
74
- 48 specifications (80 requirements), 0 failures
80
+ 52 specifications (87 requirements), 0 failures
data/lib/timecode.rb CHANGED
@@ -12,7 +12,7 @@
12
12
  # :mapping => [%w(source_tc_frames total), %w(tape_fps fps)]
13
13
 
14
14
  class Timecode
15
- VERSION = '0.1.5'
15
+ VERSION = '0.1.6'
16
16
 
17
17
  include Comparable
18
18
 
@@ -252,29 +252,29 @@ class Timecode
252
252
  # add number of frames (or another timecode) to this one
253
253
  def +(arg)
254
254
  if (arg.is_a?(Timecode) && framerate_in_delta(arg.fps, @fps))
255
- Timecode.new(@total+arg.total, @fps)
255
+ self.class.new(@total+arg.total, @fps)
256
256
  elsif (arg.is_a?(Timecode))
257
257
  raise WrongFramerate, "You are calculating timecodes with different framerates"
258
258
  else
259
- Timecode.new(@total + arg, @fps)
259
+ self.class.new(@total + arg, @fps)
260
260
  end
261
261
  end
262
262
 
263
263
  # Subtract a number of frames
264
264
  def -(arg)
265
265
  if (arg.is_a?(Timecode) && framerate_in_delta(arg.fps, @fps))
266
- Timecode.new(@total-arg.total, @fps)
266
+ self.class.new(@total-arg.total, @fps)
267
267
  elsif (arg.is_a?(Timecode))
268
268
  raise WrongFramerate, "You are calculating timecodes with different framerates"
269
269
  else
270
- Timecode.new(@total-arg, @fps)
270
+ self.class.new(@total-arg, @fps)
271
271
  end
272
272
  end
273
273
 
274
274
  # Multiply the timecode by a number
275
275
  def *(arg)
276
276
  raise RangeError, "Timecode multiplier cannot be negative" if (arg < 0)
277
- Timecode.new(@total*arg.to_i, @fps)
277
+ self.class.new(@total*arg.to_i, @fps)
278
278
  end
279
279
 
280
280
  # Get the next frame
@@ -285,7 +285,7 @@ class Timecode
285
285
  # Get the number of times a passed timecode fits into this time span (if performed with Timecode) or
286
286
  # a Timecode that multiplied by arg will give this one
287
287
  def /(arg)
288
- arg.is_a?(Timecode) ? (@total / arg.total) : Timecode.new(@total /arg, @fps)
288
+ arg.is_a?(Timecode) ? (@total / arg.total) : self.class.new(@total /arg, @fps)
289
289
  end
290
290
 
291
291
  # Timecodes can be compared to each other
@@ -219,6 +219,32 @@ context "Timecode.at() should" do
219
219
  end
220
220
  end
221
221
 
222
+ context "A custom Timecode descendant should" do
223
+ class CustomTC < Timecode; end
224
+
225
+ specify "properly classify on parse" do
226
+ CustomTC.parse("001").should.be.kind_of CustomTC
227
+ end
228
+
229
+ specify "properly classify on at" do
230
+ CustomTC.at(10,10,10,10).should.be.kind_of CustomTC
231
+ end
232
+
233
+ specify "properly classify on calculations" do
234
+ computed = CustomTC.parse("10h") + Timecode.new(10)
235
+ computed.should.be.kind_of CustomTC
236
+
237
+ computed = CustomTC.parse("10h") - Timecode.new(10)
238
+ computed.should.be.kind_of CustomTC
239
+
240
+ computed = CustomTC.parse("10h") * 5
241
+ computed.should.be.kind_of CustomTC
242
+
243
+ computed = CustomTC.parse("10h") / 5
244
+ computed.should.be.kind_of CustomTC
245
+ end
246
+
247
+ end
222
248
 
223
249
  context "Timecode.parse() should" do
224
250
 
data/timecode.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{timecode}
5
- s.version = "0.1.5"
5
+ s.version = "0.1.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Julik"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: julik-timecode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik