README.md in metaractor-3.0.1 vs README.md in metaractor-3.1.0

- old
+ new

@@ -1,6 +1,6 @@ -# Metaractor +# Metaractor [![Build status](https://badge.buildkite.com/70063a5154eb7366b8b7fd65a875c5f64301bc60f6d29a2ad7.svg)](https://buildkite.com/outstand/metaractor) Adds parameter validation and error control to [interactor](https://github.com/collectiveidea/interactor). ## Installation Add this line to your application's Gemfile: @@ -100,9 +100,27 @@ This works with `allow_blank` and can also be anything that responds to `#call`. ```ruby parameter :role, allow_blank: true, default: -> { context.default_role } ``` + +#### Typecasting/Coersion +You can supply Metaractor with a callable that will typecast incoming parameters: +```ruby +optional :needs_to_be_a_string, type: ->(value) { value.to_s } +``` + +You can also configure Metaractor with named types and use them: +```ruby +Metaractor.configure do |config| + config.register_type(:boolean, ->(value) { ActiveModel::Type::Boolean.new.cast(value) }) +end +``` +```ruby +required :is_awesome, type: :boolean +``` + +**Note**: Typecasters will _not_ be called on `nil` values. ### Custom Validation Metaractor supports doing custom validation before any user supplied before_hooks run. ```ruby validate_parameters do