Class: HandBrake::Chapter
- Inherits:
-
Object
- Object
- HandBrake::Chapter
- 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
-
#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 ConstructWithProperties
Methods included from DurationAsSeconds
Instance Attribute Details
#duration ⇒ String
Returns The duration of the title in the format "hh:mm:ss".
223 224 225 |
# File 'lib/handbrake/disc.rb', line 223 def duration @duration end |
#number ⇒ Fixnum
Returns The chapter number for this chapter (a positive integer).
228 229 230 |
# File 'lib/handbrake/disc.rb', line 228 def number @number end |
#title ⇒ Title
Returns The title that contains this chapter.
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.
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 |