summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorDaniel Doubrovkine (dB.) @dblockdotorg <dblock@dblock.org>2020-09-24 14:47:48 -0400
committerGitHub <noreply@github.com>2020-09-24 14:47:48 -0400
commita30327a40b032767b5f61e7b22ec15ac1645cb76 (patch)
treed14c852181ddb262c475c171c69a863c70deee44 /README.md
parentb24d6dca2c545637bc3cc3ac4d89f565fc27a9d0 (diff)
parent4cd2844357adfe9321e31c02b76c9945baaeffe4 (diff)
downloadhashie-a30327a40b032767b5f61e7b22ec15ac1645cb76.tar.gz
Merge pull request #530 from caalberts/dash-allowed-values
Hashie::Extensions::Dash::PredefinedValues
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