Class: SCSSLint::AutoCorrect::Correctors::HexNotation
- Inherits:
-
Base
- Object
- Base
- SCSSLint::AutoCorrect::Correctors::HexNotation
show all
- Defined in:
- lib/scss_lint/auto_correct/correctors/hex_notation.rb
Instance Attribute Summary
Attributes inherited from Base
#config
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#enabled?, #initialize, linter_name, priority, short_name
Class Method Details
.description ⇒ Object
12
13
14
|
# File 'lib/scss_lint/auto_correct/correctors/hex_notation.rb', line 12
def self.description
"Downcase hex color values"
end
|
Instance Method Details
#call(contents) ⇒ Object
3
4
5
|
# File 'lib/scss_lint/auto_correct/correctors/hex_notation.rb', line 3
def call(contents)
contents.gsub(/#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/) { |m| correct_case(m) }
end
|
#correct_case(str) ⇒ Object
7
8
9
10
|
# File 'lib/scss_lint/auto_correct/correctors/hex_notation.rb', line 7
def correct_case(str)
return str.downcase if config['style'] == 'lowercase' || config['style'].nil?
str.upcase
end
|