lib/ensurance/hash_ensure.rb in ensurance-0.1.15 vs lib/ensurance/hash_ensure.rb in ensurance-0.1.16
- old
+ new
@@ -10,15 +10,15 @@
end
module ClassMethods
def ensure(thing)
case thing.class.name
+ when 'NilClass'
+ nil
when 'Hash', 'HashWithIndifferentAccess'
thing
when 'String'
JSON.parse(thing)
- when 'NilClass'
- nil
when 'ActionController::UnfilteredParameters', 'ActionController::Parameters'
thing.permit!.to_h
else
if thing.respond_to?(:to_h)
begin