Module: RuboCop::Cop::RSpec::SpecFilePathFormat::ActiveSupportInflector

Defined in:
lib/rubocop/cop/rspec/spec_file_path_format.rb

Overview

Inflector module that uses ActiveSupport for advanced inflection rules

Class Method Summary collapse

Class Method Details

.call(string) ⇒ Object



70
71
72
# File 'lib/rubocop/cop/rspec/spec_file_path_format.rb', line 70

def self.call(string)
  ActiveSupport::Inflector.underscore(string)
end

.prepare_availability(config) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/rubocop/cop/rspec/spec_file_path_format.rb', line 74

def self.prepare_availability(config)
  return if @prepared

  @prepared = true

  inflector_path = config.fetch('InflectorPath')

  unless File.exist?(inflector_path)
    raise "The configured `InflectorPath` #{inflector_path} does " \
          'not exist.'
  end

  require 'active_support/inflector'
  require inflector_path
end