lib/ffprober/parsers/file.rb in ffprober-0.5.5 vs lib/ffprober/parsers/file.rb in ffprober-1.0
- old
+ new
@@ -1,18 +1,26 @@
+# typed: strict
# frozen_string_literal: true
module Ffprober
module Parsers
class FileParser
+ extend T::Sig
+
+ sig do
+ params(
+ file_to_parse: String,
+ exec: T.any(Ffprober::Ffmpeg::Exec, T.untyped)
+ ).void
+ end
def initialize(file_to_parse, exec = Ffprober::Ffmpeg::Exec.new)
- unless ::File.exist?(file_to_parse)
- raise ArgumentError, "File not found #{file_to_parse}"
- end
+ raise ArgumentError, "File not found #{file_to_parse}" unless ::File.exist?(file_to_parse)
@file_to_parse = file_to_parse
@exec = exec
end
+ sig { returns(Ffprober::Parsers::JsonParser) }
def load
JsonParser.new(@exec.json_output(@file_to_parse))
end
end
end