Class: SciolyFF::Validator::Checker

Inherits:
Object
  • Object
show all
Defined in:
lib/sciolyff/validator/checker.rb

Overview

An empty base class to ensure consistent inheritance. All instance methods in children classes should take the arguments rep and logger.

Direct Known Subclasses

Events, Penalties, Placings, Raws, Teams, TopLevel, Tournament

Instance Method Summary collapse

Constructor Details

#initialize(rep) ⇒ Checker



7
# File 'lib/sciolyff/validator/checker.rb', line 7

def initialize(rep); end

Instance Method Details

#send(method, *args) ⇒ Object

wraps method calls (always using send in Validator) so that exceptions in the check cause check to pass, as what caused the exception should cause some other check to fail if the SciolyFF is truly invalid

this simplifies the checking code greatly, even if it is a bit hacky



14
15
16
17
18
# File 'lib/sciolyff/validator/checker.rb', line 14

def send(method, *args)
  super
rescue StandardError => e
  args[1].debug "#{e}\n  #{e.backtrace.first}" # args[1] is the logger
end