Class: TypedParams::Validations::Wrapped

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

Instance Method Summary collapse

Methods inherited from Validation

wrap

Constructor Details

#initialize(fn) ⇒ Wrapped

Returns a new instance of Wrapped.



8
# File 'lib/typed_params/validations/wrapped.rb', line 8

def initialize(fn) = @fn = fn

Instance Method Details

#call(value) ⇒ Object

Raises:



10
11
12
# File 'lib/typed_params/validations/wrapped.rb', line 10

def call(value)
  raise ValidationError, 'is invalid' unless fn.call(value)
end