Module: SciolyFF
- Defined in:
- lib/sciolyff.rb,
lib/sciolyff/teams.rb,
lib/sciolyff/events.rb,
lib/sciolyff/scores.rb,
lib/sciolyff/placings.rb,
lib/sciolyff/sections.rb,
lib/sciolyff/penalties.rb,
lib/sciolyff/top_level.rb,
lib/sciolyff/tournament.rb,
lib/sciolyff/interpreter.rb,
lib/sciolyff/interpreter/team.rb,
lib/sciolyff/interpreter/event.rb,
lib/sciolyff/interpreter/model.rb,
lib/sciolyff/interpreter/penalty.rb,
lib/sciolyff/interpreter/placing.rb,
lib/sciolyff/interpreter/tournament.rb
Overview
API methods for the Scioly File Format
Defined Under Namespace
Classes: Events, Interpreter, Penalties, Placings, Scores, Sections, Teams, TopLevel, Tournament
Constant Summary collapse
- FILE_VALIDATION_MESSAGE =
<<~STRING Validating file with Minitest... Overkill? Probably. Doesn't give line numbers from original file? Yeah. STRING
Class Attribute Summary collapse
-
.rep ⇒ Object
Returns the value of attribute rep.
Class Method Summary collapse
-
.validate(rep, opts: {}) ⇒ Object
Assumes rep is the output of YAML.load.
- .validate_file(path, opts: {}) ⇒ Object
Class Attribute Details
.rep ⇒ Object
Returns the value of attribute rep.
19 20 21 |
# File 'lib/sciolyff.rb', line 19 def rep @rep end |
Class Method Details
.validate(rep, opts: {}) ⇒ Object
Assumes rep is the output of YAML.load
23 24 25 26 27 28 29 30 |
# File 'lib/sciolyff.rb', line 23 def self.validate(rep, opts: {}) SciolyFF.rep = rep mt_args = [] mt_args << '--verbose' if opts[:verbose] Minitest.run mt_args end |
.validate_file(path, opts: {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sciolyff.rb', line 32 def self.validate_file(path, opts: {}) file = File.read(path) rep = YAML.safe_load(file, permitted_classes: [Date], symbolize_names: true) rescue StandardError => e puts 'Error: could not read file as YAML.' warn e. else puts FILE_VALIDATION_MESSAGE validate(rep, opts: opts) end |