croma v0.4.5 Croma.SubtypeOfString
Helper module to define string-based types.
The following members are generated by use Croma.SubtypeOfString
:
@type t
@spec validate(term) :: Croma.Result.t(t)
Options:
:pattern
- A regex pattern to check whether a string is classified into this type or not.:default
- Default value for this type. Passing this option generatesdefault/0
.
Examples
defmodule MyString do
use Croma.SubtypeOfString, pattern: ~r/^foo|bar$/, default: "foo"
end