Class: TypedParams::Validations::Depth

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

Instance Method Summary collapse

Methods inherited from Validation

#initialize, wrap

Constructor Details

This class inherits a constructor from TypedParams::Validations::Validation

Instance Method Details

#call(value) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/typed_params/validations/depth.rb', line 9

def call(value)
  case options
  in maximum: Integer => maximum_depth
    return if
      maximum_depth.nil? || maximum_depth == Float::INFINITY

    validate_depth!(value, maximum_depth:)
  end
end