class Standard::CreatesConfigStore::SetsTargetRubyVersion
def call(options_config, standard_config)
def call(options_config, standard_config) options_config["AllCops"]["TargetRubyVersion"] = normalize_version( min_target_ruby_version_supported(standard_config[:ruby_version]) ) end
def min_target_ruby_version_supported(desired_target_ruby_version)
def min_target_ruby_version_supported(desired_target_ruby_version) return desired_target_ruby_version unless Gem::Version.correct?(desired_target_ruby_version) min_target_ruby_version = Gem::Version.new(MIN_TARGET_RUBY_VERSION) if desired_target_ruby_version < min_target_ruby_version min_target_ruby_version else desired_target_ruby_version end end
def normalize_version(version)
def normalize_version(version) return version unless Gem::Version.correct?(version) major, minor = version.segments "#{major}.#{minor}".to_f # lol end