Sha256: a7bdb191f8e61351c7d5375dd41ec50585e57621a6c520b3742de1612ef8e453

Contents?: true

Size: 665 Bytes

Versions: 31

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.4")
      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

31 entries across 31 versions & 1 rubygems

Version Path
standard-1.0.5 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.0.4 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.0.3 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.0.2 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.0.1 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-1.0.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.13.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.12.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.11.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.10.2 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.10.1 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.10.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.9.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.8.1 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.8 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.7 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.6.2 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.6.1 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.6.0 lib/standard/creates_config_store/sets_target_ruby_version.rb
standard-0.5.2 lib/standard/creates_config_store/sets_target_ruby_version.rb