Class: TypedParams::Validations::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/typed_params/validations/validation.rb

Direct Known Subclasses

Depth, Exclusion, Format, Inclusion, Length, Wrapped

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Validation

Returns a new instance of Validation.



6
# File 'lib/typed_params/validations/validation.rb', line 6

def initialize(options) = @options = options

Class Method Details

.wrap(fn) ⇒ Object

wraps a callable e.g. Proc for use as a Validation



10
11
12
13
14
# File 'lib/typed_params/validations/validation.rb', line 10

def self.wrap(fn)
  return fn if fn in Validation

  Wrapped.new(fn)
end

Instance Method Details

#call(value) ⇒ Object

Raises:

  • (NotImplementedError)


7
# File 'lib/typed_params/validations/validation.rb', line 7

def call(value)         = raise NotImplementedError