README.md in smart_initializer-0.9.0 vs README.md in smart_initializer-0.9.1
- old
+ new
@@ -69,10 +69,13 @@
1. `original value`
2. *(if defined)*: `default value` (default value is used when `original value` is not defined)
3. *(if defined)*: `finalize`;
+- if `default`-object is a proc-object - this proc-object will be invoked in the `outer scope` of block definition;
+- if `finalize`-object is a proc-object - this proc-object will be invoked in the `isntance` context (class instance);
+
**NOTE**: `:finalize` block are not invoked on omitted `optional: true` attributes
which has no `:default` definition bock and which are not passed to the constructor. Example:
```ruby
# without :default
@@ -93,9 +96,11 @@
option :age, :string, optional: true, default: '0', finalize: -> (val) { "#{val}_years" }
end
User.new.age # => '0_years'
```
+
+---
### Constructor definition DSL
**NOTE**: last `Hash` argument will be treated as `kwarg`s;