Class: Fontisan::Validators::ProfileLoader
- Inherits:
-
Object
- Object
- Fontisan::Validators::ProfileLoader
- Defined in:
- lib/fontisan/validators/profile_loader.rb
Overview
ProfileLoader manages validation profiles and loads appropriate validators
This class provides a registry of validation profiles, each configured for specific use cases. Profiles define which validator to use, loading mode, and severity thresholds.
Available profiles:
- indexability: Fast validation for font discovery (BasicValidator)
- usability: Basic usability for installation (FontBookValidator)
- production: Comprehensive quality checks (OpenTypeValidator)
- web: Web embedding and optimization (WebFontValidator)
- spec_compliance: Full OpenType spec compliance (OpenTypeValidator)
- default: Alias for production profile
Constant Summary collapse
- PROFILES =
Profile definitions (hardcoded, no YAML)
{ indexability: { name: "Font Indexability", description: "Fast validation for font discovery and indexing", validator: "BasicValidator", loading_mode: "metadata", severity_threshold: "error", }, usability: { name: "Font Usability", description: "Basic usability for installation", validator: "FontBookValidator", loading_mode: "full", severity_threshold: "warning", }, production: { name: "Production Quality", description: "Comprehensive quality checks", validator: "OpenTypeValidator", loading_mode: "full", severity_threshold: "warning", }, web: { name: "Web Font Readiness", description: "Web embedding and optimization", validator: "WebFontValidator", loading_mode: "full", severity_threshold: "warning", }, spec_compliance: { name: "OpenType Specification", description: "Full OpenType spec compliance", validator: "OpenTypeValidator", loading_mode: "full", severity_threshold: "info", }, default: { name: "Default Profile", description: "Default validation profile (alias for production)", validator: "OpenTypeValidator", loading_mode: "full", severity_threshold: "warning", }, }.freeze
Class Method Summary collapse
-
.all_profiles ⇒ Hash
Get all profiles with their configurations.
-
.available_profiles ⇒ Array<Symbol>
Get list of available profile names.
-
.load(profile_name) ⇒ Validator
Load a validator for the specified profile.
-
.profile_info(profile_name) ⇒ Hash?
Get profile configuration.
Class Method Details
.all_profiles ⇒ Hash
Get all profiles with their configurations
128 129 130 |
# File 'lib/fontisan/validators/profile_loader.rb', line 128 def all_profiles PROFILES end |
.available_profiles ⇒ Array<Symbol>
Get list of available profile names
104 105 106 |
# File 'lib/fontisan/validators/profile_loader.rb', line 104 def available_profiles PROFILES.keys end |
.load(profile_name) ⇒ Validator
Load a validator for the specified profile
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/fontisan/validators/profile_loader.rb', line 82 def load(profile_name) profile_name = profile_name.to_sym profile_config = PROFILES[profile_name] unless profile_config raise ArgumentError, "Unknown profile: #{profile_name}. " \ "Available profiles: #{available_profiles.join(', ')}" end validator_class_name = profile_config[:validator] validator_class = Validators.const_get(validator_class_name) validator_class.new end |
.profile_info(profile_name) ⇒ Hash?
Get profile configuration
116 117 118 |
# File 'lib/fontisan/validators/profile_loader.rb', line 116 def profile_info(profile_name) PROFILES[profile_name.to_sym] end |