Sha256: 0fc96d1e6e16bd196d2135f194ff0b7b8bb57a9ca63bc83f06321c112ceed07b
Contents?: true
Size: 535 Bytes
Versions: 12
Compression:
Stored size: 535 Bytes
Contents
module Xeroizer module Record class Validator attr_reader :attribute attr_reader :options def initialize(attribute, options = {}) @attribute = attribute @options = options end def validate(record) run_validator = true run_validator = false if options[:if] && !options[:if].call(record) run_validator = false if options[:unless] && options[:unless].call(record) valid?(record) if run_validator end end end end
Version data entries
12 entries across 12 versions & 1 rubygems