diff --git a/README.md b/README.md index cad534a..a7215c1 100644 --- a/README.md +++ b/README.md @@ -1547,6 +1547,18 @@ schema.with_context(five: 15).(nil) # => Datacaster::ValidResult(nil) ``` +Helper method `has_key?` is available, it can be used to search through existing context keys. + +```ruby +schema = + Datacaster.schema do + check { context.has_key?(:five) } + end + +schema.with_context(five: 15).(nil) +# => Datacaster::ValidResult(nil) +``` + **Note** `context` can be accesed only in casters' blocks. It can't be used in schema definition itself: