diff options
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/core_ext.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/core_ext/hash_ext.rb | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/lib/core_ext.rb b/activesupport/lib/core_ext.rb new file mode 100644 index 0000000000..d288fb7e31 --- /dev/null +++ b/activesupport/lib/core_ext.rb @@ -0,0 +1 @@ +Dir[File.dirname(__FILE__) + "/core_ext/*.rb"].each { |file| require(file) }
\ No newline at end of file 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 |