Module: Linearly::Validation::Expectation
- Defined in:
- lib/linearly/validation.rb
Overview
Expectation is a helper module to turn various types of expectations into Procs.
Class Method Summary collapse
-
.to_proc(expectation) ⇒ Proc
private
Turn one of the supported expecation types into a Proc.
Class Method Details
.to_proc(expectation) ⇒ Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Turn one of the supported expecation types into a Proc
This method reeks of :reek:TooManyStatements.
187 188 189 190 191 192 |
# File 'lib/linearly/validation.rb', line 187 def to_proc(expectation) klass = expectation.class return ->(value) { value.is_a?(expectation) } if klass == Class return ->(_) { true } if klass == TrueClass expectation end |