Sha256: fcd3c19cc8286b6cdb84846dbfcbc10526e5a66a846f3b6870e8ea3b5f26a943
Contents?: true
Size: 978 Bytes
Versions: 3
Compression:
Stored size: 978 Bytes
Contents
# frozen_string_literal: true module Ffprober module Ffmpeg class Version def initialize(ffprobe_exec = Ffprober::Ffmpeg::Exec.new) @ffprobe_exec = ffprobe_exec end VERSION_REGEX = /^(ffprobe|avprobe|ffmpeg) version (\d+)\.?(\d+)\.?(\d+)*/ NIGHTLY_REGEX = /^(ffprobe|avprobe|ffmpeg) version (N|git)-/ VERSION_FALLBACK = [0, 0, 0].freeze def version @version ||= Gem::Version.new(parse_version.join('.')) end def nightly? !(ffprobe_version_output =~ NIGHTLY_REGEX).nil? end private def parse_version @parse_version ||= begin ffprobe_version_output.match(VERSION_REGEX) do |match| [match[2].to_i, match[3].to_i, match[4].to_i] end || VERSION_FALLBACK end end def ffprobe_version_output @ffprobe_exec.ffprobe_version_output end def to_s parse_version.join('.') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ffprober-0.5.5 | lib/ffprober/ffmpeg/version.rb |
ffprober-0.5.3 | lib/ffprober/ffmpeg/version.rb |
ffprober-0.5.2 | lib/ffprober/ffmpeg/version.rb |