Class: Serega::SeregaPlugins::HideNil::CheckOptHideNil

Inherits:
Object
  • Object
show all
Defined in:
lib/serega/plugins/hide_nil/hide_nil.rb

Overview

Validator class for :hide_nil attribute option

Class Method Summary collapse

Class Method Details

.call(opts) ⇒ void

This method returns an undefined value.

Checks attribute :hide_nil option

Parameters:

  • opts (Hash)

    Attribute options

Raises:



80
81
82
83
84
85
86
87
# File 'lib/serega/plugins/hide_nil/hide_nil.rb', line 80

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

  value = opts[:hide_nil]
  return if (value == true) || (value == false)

  raise SeregaError, "Invalid option :hide_nil => #{value.inspect}. Must have a boolean value"
end