Class: HandBrake::Titles
- Inherits:
-
Hash
- Object
- Hash
- HandBrake::Titles
- Defined in:
- lib/handbrake/titles.rb
Overview
And enhanced Hash which can self-parse the output from
HandBrakeCLI's --scan mode. The keys of this hash will be title
numbers and the values will be Title instances.
Instance Attribute Summary collapse
-
#raw_output ⇒ String?
The HandBrakeCLI scan output from which this instance was parsed, if available.
-
#raw_tree ⇒ String?
readonly
A tree representing the indented output at the end of the HandBrakeCLI scan output, if available.
Class Method Summary collapse
-
.from_output(output) ⇒ Titles
Builds a new Titles instance from the output of
HandBrakeCLI --scan.
Instance Attribute Details
#raw_output ⇒ String?
The HandBrakeCLI scan output from which this instance was parsed, if available.
19 20 21 |
# File 'lib/handbrake/titles.rb', line 19 def raw_output @raw_output end |
#raw_tree ⇒ String? (readonly)
A tree representing the indented output at the end of the HandBrakeCLI scan output, if available.
26 27 28 |
# File 'lib/handbrake/titles.rb', line 26 def raw_tree @raw_tree end |
Class Method Details
.from_output(output) ⇒ Titles
Builds a new HandBrake::Titles instance from the output of HandBrakeCLI
--scan.
34 35 36 37 38 39 40 41 42 |
# File 'lib/handbrake/titles.rb', line 34 def self.from_output(output) self.new.tap do |titles| titles.raw_output = output titles.raw_tree.children. collect { |title_node| Title.from_tree(title_node) }. each { |title| title.collection = titles }. each { |title| titles[title.number] = title } end end |