Class: Canvas::Validator::Liquid
- Inherits:
-
Object
- Object
- Canvas::Validator::Liquid
- Defined in:
- lib/canvas/validators/liquid.rb
Overview
:documented:
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(file) ⇒ Liquid
constructor
A new instance of Liquid.
- #validate ⇒ Object
Constructor Details
#initialize(file) ⇒ Liquid
Returns a new instance of Liquid.
12 13 14 |
# File 'lib/canvas/validators/liquid.rb', line 12 def initialize(file) @file = file end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
10 11 12 |
# File 'lib/canvas/validators/liquid.rb', line 10 def errors @errors end |
Instance Method Details
#validate ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/canvas/validators/liquid.rb', line 16 def validate liquid = strip_out_front_matter(@file) ::Liquid::Template.parse( liquid, line_numbers: true, error_mode: :warn ) true rescue ::Liquid::SyntaxError => e @errors = [e.] false end |