Sha256: 22ea99e4ff78d62b4187c9b9e9235ca0a5d70a178238fbcb8ad3386ce1969dd4

Contents?: true

Size: 1009 Bytes

Versions: 15

Compression:

Stored size: 1009 Bytes

Contents

require "pathname"

class Standard::CreatesConfigStore
  class AssignsRubocopYaml
    def call(config_store, standard_config)
      config_store.options_config = rubocop_yaml_path(standard_config[:ruby_version])
      config_store.instance_variable_get("@options_config")
    end

    private

    def rubocop_yaml_path(desired_version)
      file_name = if desired_version < Gem::Version.new("1.9")
        "ruby-1.8.yml"
      elsif desired_version < Gem::Version.new("2.0")
        "ruby-1.9.yml"
      elsif desired_version < Gem::Version.new("2.3")
        "ruby-2.2.yml"
      elsif desired_version < Gem::Version.new("2.4")
        "ruby-2.3.yml"
      elsif desired_version < Gem::Version.new("2.5")
        "ruby-2.4.yml"
      elsif desired_version < Gem::Version.new("2.6")
        "ruby-2.5.yml"
      elsif desired_version < Gem::Version.new("3.0")
        "ruby-2.7.yml"
      else
        "base.yml"
      end

      Pathname.new(__dir__).join("../../../config/#{file_name}")
    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/assigns_rubocop_yaml.rb
standard-mkv-1.3.3 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-mkv-1.3.2 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-mkv-1.3.1 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-mkv-1.3.0 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.3.0 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.2.0 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.1.7 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.1.6 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.1.5 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.1.4 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.1.3 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.1.2 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.1.1 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-1.1.0 lib/standard/creates_config_store/assigns_rubocop_yaml.rb