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
Overview
API methods for the Scioly File Format
Defined Under Namespace
Classes: Events, Helper, Penalties, Placings, Scores, Sections, Teams, TopLevel, Tournament
Constant Summary collapse
- FILE_VALIDATION_MESSAGE =
"Validating file with Minitest...\n\nOverkill? Probably.\nDoesn't give line numbers from original file? Yeah.\n\n"
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.
17 18 19 |
# File 'lib/sciolyff.rb', line 17 def rep @rep end |
Class Method Details
.validate(rep, opts: {}) ⇒ Object
Assumes rep is the output of YAML.load
21 22 23 24 25 26 27 28 |
# File 'lib/sciolyff.rb', line 21 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
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sciolyff.rb', line 30 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 |