Class: Serega::Attribute::CheckOptMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/serega/validations/attribute/check_opt_method.rb

Class Method Summary collapse

Class Method Details

.call(opts) ⇒ void

This method returns an undefined value.

Checks attribute :method option

Parameters:

  • opts (Hash)

    Attribute options

Raises:

  • (Error)

    Error that option has invalid value



15
16
17
18
19
20
21
22
# File 'lib/serega/validations/attribute/check_opt_method.rb', line 15

def self.call(opts)
  return unless opts.key?(:method)

  value = opts[:method]
  return if value.is_a?(String) || value.is_a?(Symbol)

  raise Error, "Invalid option :method => #{value.inspect}. Must be a String or a Symbol"
end