class Ffprober::Ffmpeg::Version

Constants

NIGHTLY_REGEX
VERSION_FALLBACK
VERSION_REGEX

Public Class Methods

new(ffprobe_exec = Ffprober::Ffmpeg::Exec.new) click to toggle source
# 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

Public Instance Methods

nightly?() click to toggle source
# File lib/ffprober/ffmpeg/version.rb, line 26
def nightly?
  !(ffprobe_version_output =~ NIGHTLY_REGEX).nil?
end
version() click to toggle source
# File lib/ffprober/ffmpeg/version.rb, line 21
def version
  @version ||= Gem::Version.new(parse_version.join('.'))
end

Private Instance Methods

ffprobe_version_output() click to toggle source
# File lib/ffprober/ffmpeg/version.rb, line 48
def ffprobe_version_output
  @ffprobe_exec.ffprobe_version_output
end
parse_version() click to toggle source
# File lib/ffprober/ffmpeg/version.rb, line 33
def parse_version
  return @parse_version if @parse_version

  match_data = ffprobe_version_output.match(VERSION_REGEX)

  @parse_version = if match_data
                     [match_data[2].to_i, match_data[3].to_i, match_data[4].to_i]
                   else
                     VERSION_FALLBACK
                   end

  @parse_version
end
to_s() click to toggle source
# File lib/ffprober/ffmpeg/version.rb, line 53
def to_s
  parse_version.join('.')
end