lib/mongoid/kms.rb in mongoid-kms-0.0.15 vs lib/mongoid/kms.rb in mongoid-kms-0.0.16

- old
+ new

@@ -18,11 +18,15 @@ @kms = nil # Module methods class << self def configure(args) - @configuration = args + if args[:region] && args[:region] != "" && args[:key] && args[:key] != "" + @configuration = args + else + raise Errors::ConfigurationError.new("Region and KMS id key are required.") + end end def configuration @configuration || {} end @@ -161,8 +165,12 @@ define_method("#{field_name}=") do |value| self.send("#{field_name}_will_change!") instance_variable_set("@#{field_name}", value) end end + end + + module Errors + class ConfigurationError < RuntimeError; end end end end