Class: HandBrake::Chapter
- Inherits:
-
Object
- Object
- HandBrake::Chapter
- Includes:
- DurationAsSeconds
- Defined in:
- lib/handbrake/titles.rb
Overview
The metadata about a single chapter in a title of a DVD.
Instance Attribute Summary collapse
-
#duration ⇒ String
The duration of the title in the format "hh:mm:ss".
-
#number ⇒ Fixnum
The chapter number for this chapter (a positive integer).
-
#title ⇒ Title
The title that contains this chapter.
Class Method Summary collapse
-
.from_tree(chapter_node) ⇒ Chapter
Creates a new instance from the given title subtree.
Methods included from DurationAsSeconds
Instance Attribute Details
#duration ⇒ String
Returns The duration of the title in the format "hh:mm:ss".
183 184 185 |
# File 'lib/handbrake/titles.rb', line 183 def duration @duration end |
#number ⇒ Fixnum
Returns The chapter number for this chapter (a positive integer).
188 189 190 |
# File 'lib/handbrake/titles.rb', line 188 def number @number end |
#title ⇒ Title
Returns The title that contains this chapter.
192 193 194 |
# File 'lib/handbrake/titles.rb', line 192 def title @title end |
Class Method Details
.from_tree(chapter_node) ⇒ Chapter
Creates a new instance from the given title subtree.
200 201 202 203 204 205 |
# File 'lib/handbrake/titles.rb', line 200 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 |