Sha256: a0350787a97192a57863c648df069abcb56444144b1a535fec2b9940d998c67e
Contents?: true
Size: 547 Bytes
Versions: 3
Compression:
Stored size: 547 Bytes
Contents
module Ucasy::Validators class Validate < Ucasy::Callable def initialize(klass, attributes) @klass = klass @attributes = attributes end def call @validator = @klass.new(@attributes) if @klass.present? self end def message @validator.try(:message_error) end def to_context @validator.try(:to_context) || {} end def valid? @validator&.valid? || false end def invalid? !valid? end def errors @validator&.errors || [] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ucasy-0.2.1 | lib/ucasy/validators/validate.rb |
ucasy-0.2.0 | lib/ucasy/validators/validate.rb |
ucasy-0.1.0 | lib/ucasy/validators/validate.rb |