Module: RuboCop::Cop::RSpec::SpecFilePathFormat::DefaultInflector

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

Overview

Inflector module that uses basic regex-based conversion

Class Method Summary collapse

Class Method Details

.call(string) ⇒ Object



93
94
95
96
97
98
# File 'lib/rubocop/cop/rspec/spec_file_path_format.rb', line 93

def self.call(string)
  string
    .gsub(/([^A-Z])([A-Z]+)/, '\1_\2')
    .gsub(/([A-Z])([A-Z][^A-Z\d]+)/, '\1_\2')
    .downcase
end