Croma.SubtypeOfString (croma v0.12.0)
View SourceHelper module to define string-based types.
The following members are generated by use Croma.SubtypeOfString:
@type t@spec valid?(term) :: boolean
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