Class: Serega::SeregaValidations::Attribute::CheckOptSerializer
- Inherits:
-
Object
- Object
- Serega::SeregaValidations::Attribute::CheckOptSerializer
- Defined in:
- lib/serega/validations/attribute/check_opt_serializer.rb
Overview
Attribute :serializer option validator
Class Method Summary collapse
-
.call(opts, block = nil) ⇒ void
Checks attribute :serializer option.
Class Method Details
.call(opts, block = nil) ⇒ void
This method returns an undefined value.
Checks attribute :serializer option
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/serega/validations/attribute/check_opt_serializer.rb', line 24 def call(opts, block = nil) return unless opts.key?(:serializer) raise SeregaError, "Option :serializer can not be used together with block" if block value = opts[:serializer] return if valid_serializer?(value) raise SeregaError, "Invalid option :serializer => #{value.inspect}." \ " Can be a Serega subclass, a String or a Proc without arguments" end |