Module: CustomFormGenerator::Helpers::YamlLoader

Included in:
Generator
Defined in:
lib/custom_form_generator/helpers/yaml_loader.rb

Overview

YamlLoader module provides YAML file loading functionality with safety checks along with error handling for the CustomFormGenerator gem

Instance Method Summary collapse

Instance Method Details

#load_yaml(file_path) ⇒ Object



9
10
11
12
13
# File 'lib/custom_form_generator/helpers/yaml_loader.rb', line 9

def load_yaml(file_path)
  raise CustomFormGenerator::Error, "YAML file not found: #{file_path}" unless File.exist?(file_path)

  YAML.safe_load(File.read(file_path), permitted_classes: [Symbol])
end