Class: Ace::Bundle::Atoms::SectionValidator
- Inherits:
-
Object
- Object
- Ace::Bundle::Atoms::SectionValidator
- Defined in:
- lib/ace/bundle/atoms/section_validator.rb
Overview
Validates section definitions and ensures section integrity
Constant Summary collapse
- SectionValidationError =
Ace::Bundle::SectionValidationError
- REQUIRED_FIELDS =
Required section fields (none - all fields are optional)
[].freeze
Instance Attribute Summary collapse
-
#errors ⇒ Array<String>
readonly
Returns validation errors.
Instance Method Summary collapse
-
#initialize ⇒ SectionValidator
constructor
A new instance of SectionValidator.
-
#validate_section(name, section) ⇒ Boolean
Validates a single section.
-
#validate_sections(sections) ⇒ Boolean
Validates section definitions from configuration.
Constructor Details
#initialize ⇒ SectionValidator
Returns a new instance of SectionValidator.
13 14 15 |
# File 'lib/ace/bundle/atoms/section_validator.rb', line 13 def initialize @errors = [] end |
Instance Attribute Details
#errors ⇒ Array<String> (readonly)
Returns validation errors
33 34 35 |
# File 'lib/ace/bundle/atoms/section_validator.rb', line 33 def errors @errors end |
Instance Method Details
#validate_section(name, section) ⇒ Boolean
Validates a single section
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ace/bundle/atoms/section_validator.rb', line 39 def validate_section(name, section) @errors.clear return true if section.nil? || section.empty? validate_section_name(name) validate_required_fields_for_section(name, section) validate_content_for_section(name, section) @errors.empty? end |
#validate_sections(sections) ⇒ Boolean
Validates section definitions from configuration
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ace/bundle/atoms/section_validator.rb', line 20 def validate_sections(sections) @errors.clear return true if sections.nil? || sections.empty? validate_section_names(sections) validate_required_fields(sections) validate_section_content(sections) @errors.empty? end |