Class: Canvas::Validator::Sass

Inherits:
Object
  • Object
show all
Defined in:
lib/canvas/validators/sass.rb

Overview

:documented:

This validator can be used to validate Sass.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Sass

Returns a new instance of Sass.



13
14
15
# File 'lib/canvas/validators/sass.rb', line 13

def initialize(file)
  @file = file
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



11
12
13
# File 'lib/canvas/validators/sass.rb', line 11

def errors
  @errors
end

Instance Method Details

#validateObject



17
18
19
20
21
22
23
# File 'lib/canvas/validators/sass.rb', line 17

def validate
  DartSass.new(@file, style: :compressed).render
  true
rescue DartSass::Error => e
  @errors = [e.message]
  false
end