diff --git a/README.md b/README.md index ec50be6b..d133d323 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,19 @@ user.phone_numbers # => [#, user.addresses # => #}> ``` +### Hash attributes coercion + +``` ruby +class Package + include Virtus + + attribute :dimensions, Hash[Symbol => Float] +end + +package = Package.new(:dimensions => { 'width' => "2.2", :height => 2, "length" => 4.5 }) +package.dimensions # => { :with => 2.2, :height => 2.0, :length => 4.5 } +``` + ### Value Objects ``` ruby