module Micro::Attributes::Features::Accept::Validate
Public Class Methods
call(context)
click to toggle source
# File lib/micro/attributes/features/accept.rb, line 114 def self.call(context) return if context.allow_nil? validate = self.with(expected = context.expected) return unless validate truthy = validate.call(expected, context.value) return truthy ? nil : validate.accept_failed(expected) if context.accept? validate.reject_failed(expected) if truthy end
with(expected)
click to toggle source
# File lib/micro/attributes/features/accept.rb, line 108 def self.with(expected) return Callable if Callable.call?(expected) return KindOf if KindOf.call?(expected) return Predicate if Predicate.call?(expected) end