Sha256: 09803d1008ca7bc3c5cd80fc8bd21e4aff776d5cf5ee7b600cb86ce242da45fe
Contents?: true
Size: 574 Bytes
Versions: 1
Compression:
Stored size: 574 Bytes
Contents
require_relative '../abstract_validator' module StValidation module Validators ## # Checks if a value matches any of given blueprints # class UnionValidator < AbstractValidator def initialize(blueprint_list, factory) # TODO: I think it's better to raise a different kind of error and transform it later raise InvalidBlueprintError if blueprint_list.empty? @validators = blueprint_list.map { |bp| factory.build(bp) } end def call(value) @validators.any? { |v| v.call(value) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
st_validation-0.1.0 | lib/st_validation/validators/union_validator.rb |