Sha256: fca3f3226e7db3158b7667e4735a1e584c6155cdca039bf92f139f64ff7ab561

Contents?: true

Size: 701 Bytes

Versions: 34

Compression:

Stored size: 701 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"
      else
        "base.yml"
      end

      Pathname.new(__dir__).join("../../../config/#{file_name}")
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
standard-0.5.2 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.5.1 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.5.0 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.4.7 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.4.6 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.4.5 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.4.4 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.4.3 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.4.2 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.4.1 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.4.0 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.3.0 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.2.5 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.2.4 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.2.3 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.2.2 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.2.1 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.2.0 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.1.10 lib/standard/creates_config_store/assigns_rubocop_yaml.rb
standard-0.1.9 lib/standard/creates_config_store/assigns_rubocop_yaml.rb