Class: DTAS::CueIndex
- Inherits:
-
Object
- Object
- DTAS::CueIndex
- Defined in:
- lib/dtas/cue_index.rb
Overview
embedded CUE sheet representation for -player
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#offset ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#initialize(index, offset) ⇒ CueIndex
constructor
A new instance of CueIndex.
- #offset_samples(format) ⇒ Object
- #pregap? ⇒ Boolean
- #subindex? ⇒ Boolean
- #to_hash ⇒ Object
- #track? ⇒ Boolean
Constructor Details
#initialize(index, offset) ⇒ CueIndex
Returns a new instance of CueIndex.
11 12 13 14 15 16 |
# File 'lib/dtas/cue_index.rb', line 11 def initialize(index, offset) @index = index.to_i # must be compatible with the sox "trim" effect @offset = offset # "#{INTEGER}s" (samples) or HH:MM:SS:FRAC end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
9 10 11 |
# File 'lib/dtas/cue_index.rb', line 9 def index @index end |
#offset ⇒ Object (readonly)
:nodoc:
8 9 10 |
# File 'lib/dtas/cue_index.rb', line 8 def offset @offset end |
Instance Method Details
#offset_samples(format) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/dtas/cue_index.rb', line 22 def offset_samples(format) case @offset when /\A(\d+)s\z/ $1.to_i else format.hhmmss_to_samples(@offset) end end |
#pregap? ⇒ Boolean
31 32 33 |
# File 'lib/dtas/cue_index.rb', line 31 def pregap? @index == 0 end |
#subindex? ⇒ Boolean
39 40 41 |
# File 'lib/dtas/cue_index.rb', line 39 def subindex? @index > 1 end |
#to_hash ⇒ Object
18 19 20 |
# File 'lib/dtas/cue_index.rb', line 18 def to_hash { "index" => @index, "offset" => @offset } end |
#track? ⇒ Boolean
35 36 37 |
# File 'lib/dtas/cue_index.rb', line 35 def track? @index == 1 end |