Class: Canvas::ValidMenuSchemaCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/canvas/checks/valid_menu_schema_check.rb

Overview

:documented: This check will validate the schema defined in the front matter within each menu template file.

Example of menu Liquid with valid front matter:


max_item_levels: 2 supports_open_new_tab: true attributes: my_title: type: string my_color: type: color label: My color hint: "Select your favourite color"

My menu HTML

Instance Attribute Summary

Attributes inherited from Check

#offenses

Instance Method Summary collapse

Methods inherited from Check

#failed?, #initialize

Constructor Details

This class inherits a constructor from Canvas::Check

Instance Method Details

#runObject



25
26
27
28
29
30
# File 'lib/canvas/checks/valid_menu_schema_check.rb', line 25

def run
  file = File.read(menu_filename)
  front_matter = extract_front_matter(file)
  validate_format(front_matter) &&
    validate_schema(front_matter)
end