Class: SciolyFF::Validator
- Inherits:
-
Object
- Object
- SciolyFF::Validator
- Defined in:
- lib/sciolyff/validator.rb
Overview
Checks if SciolyFF YAML files and/or representations (i.e. hashes that can be directly converted to YAML) comply with spec (i.e. safe for interpreting)
Defined Under Namespace
Modules: Canonical, Range, Sections Classes: Checker, Events, Logger, Penalties, Placings, Raws, Subdivisions, Teams, TopLevel, Tournament
Instance Method Summary collapse
-
#initialize(loglevel: Logger::WARN, canonical: true) ⇒ Validator
constructor
A new instance of Validator.
- #last_log ⇒ Object
- #valid?(rep_or_yaml) ⇒ Boolean
Constructor Details
Instance Method Details
#last_log ⇒ Object
35 36 37 |
# File 'lib/sciolyff/validator.rb', line 35 def last_log @logger.log end |
#valid?(rep_or_yaml) ⇒ Boolean
25 26 27 28 29 30 31 32 33 |
# File 'lib/sciolyff/validator.rb', line 25 def valid?(rep_or_yaml) @logger.flush if rep_or_yaml.instance_of? String valid_yaml?(rep_or_yaml, @logger) else valid_rep?(rep_or_yaml, @logger) end end |