Sha256: a9c95767c2cf9eb466b70fb044da20bbc63f65d4e060b6e16706daf1a3271d75

Contents?: true

Size: 665 Bytes

Versions: 15

Compression:

Stored size: 665 Bytes

Contents

class Standard::CreatesConfigStore
  class SetsTargetRubyVersion
    def call(options_config, standard_config)
      options_config["AllCops"]["TargetRubyVersion"] = floatify_version(
        max_rubocop_supported_version(standard_config[:ruby_version])
      )
    end

    private

    def max_rubocop_supported_version(desired_version)
      rubocop_supported_version = Gem::Version.new("2.5")
      if desired_version < rubocop_supported_version
        rubocop_supported_version
      else
        desired_version
      end
    end

    def floatify_version(version)
      major, minor = version.segments
      "#{major}.#{minor}".to_f # lol
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
standard-mkv-1.3.4 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-mkv-1.3.3 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-mkv-1.3.2 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-mkv-1.3.1 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-mkv-1.3.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.3.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.2.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.1.7 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.1.6 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.1.5 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.1.4 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.1.3 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.1.2 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.1.1 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.1.0 lib/standard/creates_config_store/sets_target_ruby_version.rb