Class: PopCap::AnalyzeFile

Inherits:
Object
  • Object
show all
Defined in:
lib/pop_cap/analyze_file.rb

Overview

Public: This class is similar to TagReader, but is useful for debugging. If a file cannot be read, this will return the error message generated by FFprobe

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ AnalyzeFile

Public: Initialize an instance of AnalyzeFile. filepath = relative path to a file on the filesystem



14
15
16
17
# File 'lib/pop_cap/analyze_file.rb', line 14

def initialize(filepath)
  @filepath = File.expand_path(filepath)
  @datetime = Time.now.strftime("%Y-%m-%d at %H:%M:%S")
end

Instance Attribute Details

#filepathObject (readonly)

Returns the value of attribute filepath.



9
10
11
# File 'lib/pop_cap/analyze_file.rb', line 9

def filepath
  @filepath
end

Class Method Details

.examine(filepath) ⇒ Object

Public: A convenience class method for examining a file.



29
30
31
# File 'lib/pop_cap/analyze_file.rb', line 29

def self.examine(filepath)
  new(filepath).examine
end

Instance Method Details

#examineObject

Public: This method returns the stderr of FFprobe -show_format as an array. The first element is a datetime stamp, the second element is the error message.



23
24
25
# File 'lib/pop_cap/analyze_file.rb', line 23

def examine
  [datetimestamp, error]
end