sequencer 1.0.0 → 1.0.1

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/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.0.1 / 2010-02-10
2
+
3
+ * Add Sequence#length, Sequence#to_a, Sequence#directory and Sequence#to_paths
4
+
1
5
  === 1.0.0 / 2010-02-10
2
6
 
3
7
  * 1 major enhancement
data/lib/sequencer.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Sequencer
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  NUMBERS_AT_END = /(\d+)([^\d]+)?$/
4
4
 
5
5
  extend self
@@ -75,6 +75,7 @@ module Sequencer
75
75
  class Sequence
76
76
  include Enumerable
77
77
  attr_reader :pattern
78
+ attr_reader :directory
78
79
 
79
80
  def initialize(directory, filenames)
80
81
  raise "Can't sequence nothingness" if filenames.empty?
@@ -134,6 +135,7 @@ module Sequencer
134
135
  def file_count
135
136
  @file_count ||= @filenames.length
136
137
  end
138
+ alias_method :length, :file_count
137
139
 
138
140
  # Check if this sequencer includes a file
139
141
  def include?(base_filename)
@@ -150,6 +152,16 @@ module Sequencer
150
152
  @filenames.each{|f| yield(File.join(@directory, f))}
151
153
  end
152
154
 
155
+ # Returns the array of filenames
156
+ def to_a
157
+ @filenames.dup
158
+ end
159
+
160
+ # Returns paths to the files
161
+ def to_paths
162
+ @filenames.map{|f| File.join(@directory, f) }
163
+ end
164
+
153
165
  private
154
166
 
155
167
  def natural_sort(ar)
@@ -124,12 +124,18 @@ context "A Sequence created from pad-numbered files should" do
124
124
 
125
125
  @gapless.should.blaming("this is a gapless sequence").not.be.gaps?
126
126
  @gapless.file_count.should.blaming("actual file count in sequence").equal(446)
127
+ @gapless.length.should.blaming("actual file count in sequence").equal(446)
127
128
  @gapless.expected_frames.should.blaming("expected frame count in sequence").equal(446)
128
129
  @gapless.inspect.should.blaming("inspect itself").equal('#<seq1.[123..568].tif>')
129
130
  @gapless.pattern.should.equal 'seq1.%06d.tif'
130
- files = @gapless.map {|f| f }
131
+
132
+ files = @gapless.to_a
131
133
  files.length.should.equal 446
132
134
  files[0].should.equal 'seq1.000123.tif'
135
+
136
+ paths = @gapless.to_paths
137
+ paths.length.should.equal 446
138
+ paths[0].should.equal(File.dirname(__FILE__) + "/tmp/sequence_and_sole_file/seq1.000123.tif")
133
139
  end
134
140
 
135
141
  specify "initialize itself from one path to a file in the sequence with gaps" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequencer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-13 00:00:00 +01:00
12
+ date: 2010-02-14 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency