Module: Qwack::Base
Overview
Base module for types
Instance Method Summary collapse
- #mock(input = nil) ⇒ Object
- #mock!(input = nil) ⇒ Object
- #validate!(input, path = 'root') ⇒ Object
- #validation_errors(input, path = 'root') ⇒ Object
Instance Method Details
#mock(input = nil) ⇒ Object
19 20 21 |
# File 'lib/qwack/base.rb', line 19 def mock(input = nil) raise NotImplementedError end |
#mock!(input = nil) ⇒ Object
23 24 25 |
# File 'lib/qwack/base.rb', line 23 def mock!(input = nil) validate!(mock(input)) end |
#validate!(input, path = 'root') ⇒ Object
12 13 14 15 16 17 |
# File 'lib/qwack/base.rb', line 12 def validate!(input, path = 'root') errors = validation_errors(input, path) raise Qwack::Errors::ValidationError, errors unless errors.empty? input end |
#validation_errors(input, path = 'root') ⇒ Object
8 9 10 |
# File 'lib/qwack/base.rb', line 8 def validation_errors(input, path = 'root') raise NotImplementedError end |