Module: Kreds::Inputs
Constant Summary collapse
- TYPES =
{ symbol_array: self::Array.of(self::Coercible::Symbol).constrained(min_size: 1), non_empty_string: self::Strict::String.constrained(min_size: 1), boolean: self::Strict::Bool }.freeze
Instance Method Summary collapse
Instance Method Details
#process(value, as:, optional: false, error: Kreds::InvalidArgumentError, message: nil) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/kreds/inputs.rb', line 15 def process(value, as:, optional: false, error: Kreds::InvalidArgumentError, message: nil) checker = type_for(as) checker = checker.optional if optional checker[value] rescue Dry::Types::CoercionError => e raise error, || e. end |