lib/mxfinfo.rb in mxfinfo-0.0.3.3 vs lib/mxfinfo.rb in mxfinfo-0.0.3.4

- old
+ new

@@ -1,8 +1,9 @@ require "forwardable" -require "mxfinfo/version" -require "mxfinfo/attr_readers" +require File.join(File.dirname(__FILE__),"mxfinfo/version") +require File.join(File.dirname(__FILE__),"mxfinfo/attr_readers") +require File.join(File.dirname(__FILE__),"mxfinfo/string") class MXFinfo extend Forwardable # We assume it's in the path of the user @@binary = 'avidmxfinfo' @@ -41,20 +42,18 @@ def initialize(input, process = true) if process @filepath = File.absolute_path(input) File.exists?(@filepath) ? @valid = true : @valid = false - if @valid - @mxfinfo = mxfinfo - # Check if output contains error from binary - @mxfinfo.include?("ERROR") ? @valid = false : @valid = true - @mxfinfo.include?("Failed to open file") ? @valid = false : @valid = true - @mxfinfo.include?("mxf_disk_file_open_read") ? @valid = false : @valid = true - end + @mxfinfo = mxfinfo if @valid else @valid = true @mxfinfo = input end + # Check if output contains error from binary + @mxfinfo.include?("ERROR") ? @valid = false : @valid = true + @mxfinfo.include?("Failed to open file") ? @valid = false : @valid = true + @mxfinfo.include?("mxf_disk_file_open_read") ? @valid = false : @valid = true process_data if @valid end def valid? @valid