Class: Serega::Attribute::CheckOptKey
- Inherits:
-
Object
- Object
- Serega::Attribute::CheckOptKey
- Defined in:
- lib/serega/validations/attribute/check_opt_key.rb
Class Method Summary collapse
-
.call(opts) ⇒ void
Checks attribute :key option.
Class Method Details
.call(opts) ⇒ void
This method returns an undefined value.
Checks attribute :key option
15 16 17 18 19 20 21 22 |
# File 'lib/serega/validations/attribute/check_opt_key.rb', line 15 def self.call(opts) return unless opts.key?(:key) value = opts[:key] return if value.is_a?(String) || value.is_a?(Symbol) raise Error, "Invalid option :key => #{value.inspect}. Must be a String or a Symbol" end |