Sha256: f8051c646b65ae1835b1cc11aa99468e68e588d519679d1a36acf109e008269c

Contents?: true

Size: 662 Bytes

Versions: 1

Compression:

Stored size: 662 Bytes

Contents

# 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)
        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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffprober-1.0 lib/ffprober/parsers/file.rb