README.md in schemacop-2.4.4 vs README.md in schemacop-2.4.5
- old
+ new
@@ -625,9 +625,21 @@
Schema.new do
req :foo, default: { bar: :baz } do
req :foo
end
end
+
+# You can also specify blocks (without params) as defaults that will be
+# evaluated at time of validation.
+Schema.new do
+ opt :year, :integer, default: ->() { Time.now.year }
+end
+
+# If, for some very specific reason, you *need* the default to be an actual
+# proc, wrap it inside another proc.
+Schema.new do
+ opt :myproc, Proc, default: ->() { ->() { 42 } }
+end
```
### Required data points
Note that any *required* validation is done before applying the defaults. If you