Skip to content

Commit 4098629

Browse files
committed
Add validate! command to EncryptedConfiguration
Resolves #145
1 parent 96f887c commit 4098629

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/diffcrypt/rails/encrypted_configuration.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ def change(&block)
8080
writing read, &block
8181
end
8282

83+
def validate! # :nodoc:
84+
deserialize(read).each_key do |key|
85+
key.to_sym
86+
rescue NoMethodError
87+
raise InvalidKeyError.new(content_path, key)
88+
end
89+
end
90+
8391
protected
8492

8593
# rubocop:disable Metrics/AbcSize

0 commit comments

Comments
 (0)