Class: Canvas::Validator::SchemaAttribute::Base
- Inherits:
-
Object
- Object
- Canvas::Validator::SchemaAttribute::Base
- Defined in:
- lib/canvas/validators/schema_attributes/base.rb
Overview
:documented:
Validations to run against an attribute’s schema that are shared across types. This class acts as the base class for type-specific validators.
Direct Known Subclasses
Color, Date, EnquiryForm, ExperienceDate, ExperienceSlot, Image, Link, Number, Package, Page, Post, Product, Radio, Range, Select, Variant
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(attribute) ⇒ Base
constructor
A new instance of Base.
- #validate ⇒ Object
Constructor Details
#initialize(attribute) ⇒ Base
Returns a new instance of Base.
14 15 16 17 |
# File 'lib/canvas/validators/schema_attributes/base.rb', line 14 def initialize(attribute) @attribute = attribute @errors = [] end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
12 13 14 |
# File 'lib/canvas/validators/schema_attributes/base.rb', line 12 def attribute @attribute end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
12 13 14 |
# File 'lib/canvas/validators/schema_attributes/base.rb', line 12 def errors @errors end |
Instance Method Details
#validate ⇒ Object
19 20 21 22 23 |
# File 'lib/canvas/validators/schema_attributes/base.rb', line 19 def validate ensure_has_required_keys && ensure_no_unrecognized_keys && ensure_keys_are_correct_types end |