Class: Serega::SeregaPlugins::Metadata::MetaAttribute::CheckOptHideNil

Inherits:
Object
  • Object
show all
Defined in:
lib/serega/plugins/metadata/validations/check_opt_hide_nil.rb

Overview

Validator for meta_attribute :hide_nil 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:

  • (SeregaError)

    SeregaError that option has invalid value



21
22
23
24
25
26
27
28
# File 'lib/serega/plugins/metadata/validations/check_opt_hide_nil.rb', line 21

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

  value = opts[:hide_nil]
  return if value == true

  raise SeregaError, "Invalid option :hide_nil => #{value.inspect}. Must be true"
end