summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4280e7b..4cf0214 100644
--- a/README.md
+++ b/README.md
@@ -43,6 +43,7 @@
- [PropertyTranslation](#propertytranslation)
- [Mash and Rails 4 Strong Parameters](#mash-and-rails-4-strong-parameters)
- [Coercion](#coercion-1)
+ - [PredefinedValues](#predefinedvalues)
- [Trash](#trash)
- [Clash](#clash)
- [Rash](#rash)
@@ -968,6 +969,20 @@ class UserHash < Hashie::Dash
end
```
+### PredefinedValues
+
+The `Hashie::Extensions::Dash::PredefinedValues` mixin extends a Dash with
+the ability to accept predefined values on a property.
+
+```ruby
+class UserHash < Hashie::Dash
+ include Hashie::Extensions::PredefinedValues
+
+ property :gender, values: %i[male female prefer_not_to_say]
+ property :age, values: (0..150)
+end
+```
+
## Trash
A Trash is a Dash that allows you to translate keys on initialization. It mixes