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



73
74
75
# File 'lib/rubocop/cop/rspec/spec_file_path_format.rb', line 73

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

.prepare_availability(inflector_path) ⇒ Object



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

def self.prepare_availability(inflector_path)
  return if @prepared

  @prepared = true

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

  require 'active_support/inflector'
  require inflector_path
end