aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/core_ext/hash_ext.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/core_ext/hash_ext.rb')
-rw-r--r--activesupport/lib/core_ext/hash_ext.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/core_ext/hash_ext.rb b/activesupport/lib/core_ext/hash_ext.rb
new file mode 100644
index 0000000000..90670c42c7
--- /dev/null
+++ b/activesupport/lib/core_ext/hash_ext.rb
@@ -0,0 +1,6 @@
+class Hash
+ def assert_valid_keys(valid_keys)
+ unknown_keys = keys - valid_keys
+ raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
+ end
+end \ No newline at end of file