Module: Rouge::Guessers::Util::SourceNormalizer

Defined in:
lib/rouge/guessers/util.rb

Constant Summary collapse

UTF8_BOM =
"\xEF\xBB\xBF"
UTF8_BOM_RE =
/\A#{UTF8_BOM}/

Class Method Summary collapse

Class Method Details

.normalize(source) ⇒ String?

Parameters:

  • source (String, nil)

Returns:

  • (String, nil)


10
11
12
# File 'lib/rouge/guessers/util.rb', line 10

def self.normalize(source)
  source.sub(UTF8_BOM_RE, '').gsub(/\r\n/, "\n")
end