Sha256: eaf5dd2f34b696edfda8e217cb925650ed4f0274e235b9c5745c7e377441d1b1
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking target ruby version. module TargetRubyVersion def required_minimum_ruby_version @minimum_target_ruby_version end def required_maximum_ruby_version @maximum_target_ruby_version end def minimum_target_ruby_version(version) @minimum_target_ruby_version = version end def maximum_target_ruby_version(version) @maximum_target_ruby_version = version end def support_target_ruby_version?(version) # By default, no minimum or maximum versions of ruby are required # to run any cop. In order to do a simple numerical comparison of # the requested version against any requirements, we use 0 and # Infinity as the default values to indicate no minimum (0) and no # maximum (Infinity). min = required_minimum_ruby_version || 0 max = required_maximum_ruby_version || Float::INFINITY min <= version && max >= version end end end end
Version data entries
4 entries across 4 versions & 1 rubygems