Module: Plumb::Types::Forms

Defined in:
lib/plumb/types.rb

Defined Under Namespace

Modules: URI

Constant Summary collapse

True =
Types::True \
| (
  Types::String[/^true$/i] \
  | Types::String['1'] \
  | Types::Integer[1]
).transform(::TrueClass) { |_| true }
False =
Types::False \
| (
  Types::String[/^false$/i] \
  | Types::String['0'] \
  | Types::Integer[0]
).transform(::FalseClass) { |_| false }
Boolean =
True | False
Nil =
Nil | (String[BLANK_STRING] >> nil)
Date =

Accept a Date, or a string that can be parsed into a Date via Date.parse

Date | (String >> Any.build(::Date, :parse).policy(:rescue, ::Date::Error))
Time =
Time | (String >> Any.build(::Time, :parse).policy(:rescue, ::ArgumentError))