Class: Makit::Yaml
- Inherits:
-
Object
- Object
- Makit::Yaml
- Defined in:
- lib/makit/yaml.rb
Overview
YAML file validation utilities
This class provides methods for validating YAML file syntax and structure, helping to catch configuration errors early.
Class Method Summary collapse
-
.validate_yaml(file_path) ⇒ nil
Validate YAML file syntax and structure.
Class Method Details
.validate_yaml(file_path) ⇒ nil
Validate YAML file syntax and structure
Attempts to parse a YAML file to verify it has valid syntax. Prints a success message if valid, raises an error if invalid.
22 23 24 25 26 27 |
# File 'lib/makit/yaml.rb', line 22 def self.validate_yaml(file_path) YAML.load_file(file_path) puts "#{file_path} is a valid YAML file." rescue Psych::SyntaxError => e raise "YAML validation failed for #{file_path}: #{e}" end |