Class: SCSSLint::AutoCorrect::Correctors::VariableName

Inherits:
Base
  • Object
show all
Defined in:
lib/scss_lint/auto_correct/correctors/variable_name.rb

Instance Attribute Summary

Attributes inherited from Base

#config

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#enabled?, #initialize, priority, short_name

Constructor Details

This class inherits a constructor from SCSSLint::AutoCorrect::Correctors::Base

Class Method Details

.descriptionObject



11
12
13
# File 'lib/scss_lint/auto_correct/correctors/variable_name.rb', line 11

def self.description
  "Use dashes instead of underscores in variable names"
end

.linter_nameObject



7
8
9
# File 'lib/scss_lint/auto_correct/correctors/variable_name.rb', line 7

def self.linter_name
  "NameFormat"
end

Instance Method Details

#call(contents) ⇒ Object



3
4
5
# File 'lib/scss_lint/auto_correct/correctors/variable_name.rb', line 3

def call(contents)
  contents.gsub(/\$[a-z_-]+/) { |m| m.gsub('_', '-') }
end