Class: PopCap::TagWriter

Inherits:
FFmpeg
  • Object
show all
Defined in:
lib/pop_cap/ffmpeg/tag_writer.rb

Overview

Public: This class wraps FFmpeg to write tags for a specified file.

Instance Attribute Summary

Attributes inherited from FFmpeg

#commander, #filepath, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FFmpeg

#error_message, #execute, #initialize

Constructor Details

This class inherits a constructor from PopCap::FFmpeg

Class Method Details

.write(filepath, options = {}) ⇒ Object

Public: A convenience class method to wrap #new & #write.



22
23
24
# File 'lib/pop_cap/ffmpeg/tag_writer.rb', line 22

def self.write(filepath, options = {})
  new(filepath, options).write
end

Instance Method Details

#writeObject

Public: This methods writes the tags to a temporary file, if successful, it moves the temporary file over the original. This is done to prevent corrupting the original file.



12
13
14
15
16
17
18
# File 'lib/pop_cap/ffmpeg/tag_writer.rb', line 12

def write
  unless execute.success?
    cleanup_failed_write
    raise(FFmpegError, error_message('writing'))
  end
  FileUtils.move(tmppath, filepath)
end