Class: HandBrake::Chapter

Inherits:
Object
  • Object
show all
Includes:
ConstructWithProperties, DurationAsSeconds
Defined in:
lib/handbrake/disc.rb

Overview

The metadata about a single chapter in a title of a DVD.

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from ConstructWithProperties

#initialize

Methods included from DurationAsSeconds

#seconds

Instance Attribute Details

#durationString



223
224
225
# File 'lib/handbrake/disc.rb', line 223

def duration
  @duration
end

#numberFixnum



228
229
230
# File 'lib/handbrake/disc.rb', line 228

def number
  @number
end

#titleTitle



232
233
234
# File 'lib/handbrake/disc.rb', line 232

def title
  @title
end

Class Method Details

.from_tree(chapter_node) ⇒ Chapter

Creates a new instance from the given title subtree.

See Also:



240
241
242
243
244
245
# File 'lib/handbrake/disc.rb', line 240

def self.from_tree(chapter_node)
  self.new.tap do |ch|
    ch.duration = chapter_node.name.scan(/duration (\d\d:\d\d:\d\d)/).first.first
    ch.number = chapter_node.name.scan(/(\d+): cells/).first.first.to_i
  end
end