Module: Mongoid::Clients::Validators::Storage
| Relationships & Source Files | |
| Defined in: | lib/mongoid/clients/validators/storage.rb |
Overview
Validates the options passed to :store_in.
Constant Summary
-
VALID_OPTIONS =
# File 'lib/mongoid/clients/validators/storage.rb', line 13
The valid options for storage.
[ :collection, :, :database, :client ].freeze
Instance Method Summary
-
#validate(klass, options)
Validate the options provided to
:store_in. -
#valid_keys?(options) ⇒ true | false
private
Internal use only
Internal use only
Determine if all keys in the options hash are valid.
Instance Method Details
#valid_keys?(options) ⇒ true | false (private)
This method is for internal use only.
Determine if all keys in the options hash are valid.
# File 'lib/mongoid/clients/validators/storage.rb', line 38
def valid_keys?() return false unless .is_a?(::Hash) .keys.all? do |key| VALID_OPTIONS.include?(key) end end
#validate(klass, options)
Validate the options provided to :store_in.
# File 'lib/mongoid/clients/validators/storage.rb', line 22
def validate(klass, ) valid_keys?() or raise Errors::InvalidStorageOptions.new(klass, ) end