Sha256: 99b7e6b7483d7ad6b7f87e021635db38c63afe686a7cbdca86d21bbadb05e36b
Contents?: true
Size: 647 Bytes
Versions: 1
Compression:
Stored size: 647 Bytes
Contents
require "vanguard" module Fortnox module API module Validator def validate( instance ) raise ArgumentError, "No validator given for #{name}" unless @validator validation_result = @validator.call( instance ) @violations = validation_result.violations return validation_result.valid? end def violations @violations ||= Set.new end def using_validations &block @validator = Vanguard::Validator.build &block end def instance raise ArgumentError, "No validator given for #{name}" unless @validator self end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fortnox-api-0.0.2 | lib/fortnox/api/validator.rb |