class Semverve::VersionMatchPolicy
Decides whether a discovered version should be reported or fixed.
Public Class Methods
# File lib/semverve/version_match_policy.rb, line 17 def initialize(current_version:, match_mode:, target_version: nil) @current_version = current_version @match_mode = match_mode.to_sym @target_version = target_version end
Initializes a version match policy.
@param [Semverve::SemanticVersion] current_version @param [Symbol, String] match_mode @param [Semverve::SemanticVersion, nil] target_version
@return [Semverve::VersionMatchPolicy]
Public Instance Methods
Source
# File lib/semverve/version_match_policy.rb, line 29 def report?(version) return version == target_version if target_version case match_mode when :older version < current_version when :non_current version != current_version else raise Error, "Unknown version match mode #{match_mode.inspect}. Use :older or :non_current." end end
Whether the version should be reported or fixed.
@param [Semverve::SemanticVersion] version
@return [Boolean]