Class: DVDConverter::Track
- Inherits:
-
Object
- Object
- DVDConverter::Track
- Defined in:
- lib/dvd_converter/track.rb
Instance Attribute Summary collapse
-
#audio ⇒ Object
Returns the value of attribute audio.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#movie ⇒ Object
Returns the value of attribute movie.
-
#subtitles ⇒ Object
Returns the value of attribute subtitles.
-
#track_id ⇒ Object
Returns the value of attribute track_id.
Instance Method Summary collapse
- #convert(options = {}) ⇒ Object
- #convert_everything(options = {}) ⇒ Object
-
#initialize(id, movie) ⇒ Track
constructor
A new instance of Track.
- #print_description ⇒ Object
Constructor Details
#initialize(id, movie) ⇒ Track
Returns a new instance of Track.
11 12 13 14 15 16 |
# File 'lib/dvd_converter/track.rb', line 11 def initialize(id, movie) self.track_id = id self.movie = movie self.audio = {} self.subtitles = {} end |
Instance Attribute Details
#audio ⇒ Object
Returns the value of attribute audio.
5 6 7 |
# File 'lib/dvd_converter/track.rb', line 5 def audio @audio end |
#duration ⇒ Object
Returns the value of attribute duration.
6 7 8 |
# File 'lib/dvd_converter/track.rb', line 6 def duration @duration end |
#movie ⇒ Object
Returns the value of attribute movie.
8 9 10 |
# File 'lib/dvd_converter/track.rb', line 8 def movie @movie end |
#subtitles ⇒ Object
Returns the value of attribute subtitles.
9 10 11 |
# File 'lib/dvd_converter/track.rb', line 9 def subtitles @subtitles end |
#track_id ⇒ Object
Returns the value of attribute track_id.
7 8 9 |
# File 'lib/dvd_converter/track.rb', line 7 def track_id @track_id end |
Instance Method Details
#convert(options = {}) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/dvd_converter/track.rb', line 18 def convert( = {}) as = [:audio].map { |a| self.audio[a] } ss = [:subtitles].map { |s| self.subtitles[s] } converter = Converter.new self, as, ss, converter.process end |
#convert_everything(options = {}) ⇒ Object
26 27 28 29 30 |
# File 'lib/dvd_converter/track.rb', line 26 def convert_everything( = {}) [:audio] = self.audio.keys.sort [:subtitles] = self.subtitles.keys.sort convert end |
#print_description ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/dvd_converter/track.rb', line 32 def print_description print "Track: #{self.track_id}" print " Duration: #{self.duration}" if self.duration print "\n" self.audio.keys.sort.each do |key| a = self.audio[key] a.print_description end self.subtitles.keys.sort.each do |key| s = self.subtitles[key] s.print_description end puts '' end |