lib/scss_lint/engine.rb in scss-lint-0.21.0 vs lib/scss_lint/engine.rb in scss-lint-0.22.0
- old
+ new
@@ -18,14 +18,14 @@
else
@engine = Sass::Engine.new(scss_or_filename, ENGINE_OPTIONS)
@contents = scss_or_filename
end
- @lines = @contents.split("\n")
+ @lines = @contents.lines.to_a # Need `to_a` for Ruby 1.9.3
@tree = @engine.to_tree
- rescue Encoding::UndefinedConversionError, ArgumentError => error
+ rescue Encoding::UndefinedConversionError, Sass::SyntaxError => error
if error.is_a?(Encoding::UndefinedConversionError) ||
- error.message.include?('invalid byte sequence')
+ error.message.match(/invalid.*(byte sequence|character)/i)
raise FileEncodingError,
"Unable to parse SCSS file: #{error}",
error.backtrace
else
raise