Class: Ffprober::Ffmpeg::Version

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/ffprober/ffmpeg/version.rb

Constant Summary collapse

VERSION_REGEX =
T.let(/^(ffprobe|avprobe|ffmpeg) version (\d+)\.?(\d+)\.?(\d+)*/.freeze, Regexp)
NIGHTLY_REGEX =
T.let(/^(ffprobe|avprobe|ffmpeg) version (N|git)-/.freeze, Regexp)
VERSION_FALLBACK =
T.let([0, 0, 0].freeze, T::Array[Integer])

Instance Method Summary collapse

Constructor Details

#initialize(ffprobe_exec = Ffprober::Ffmpeg::Exec.new) ⇒ Version

Returns a new instance of Version.



10
11
12
13
14
# File 'lib/ffprober/ffmpeg/version.rb', line 10

def initialize(ffprobe_exec = Ffprober::Ffmpeg::Exec.new)
  @ffprobe_exec = ffprobe_exec
  @version = T.let(nil, T.nilable(Gem::Version))
  @parse_version = T.let(nil, T.nilable(T::Array[Integer]))
end

Instance Method Details

#nightly?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/ffprober/ffmpeg/version.rb', line 26

def nightly?
  !(ffprobe_version_output =~ NIGHTLY_REGEX).nil?
end

#versionObject



21
22
23
# File 'lib/ffprober/ffmpeg/version.rb', line 21

def version
  @version ||= Gem::Version.new(parse_version.join('.'))
end