Class: Serega::SeregaPlugins::CamelCase::CheckOptCamelCase

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

Overview

Validator for attribute :camel_case option

Class Method Summary collapse

Class Method Details

.call(opts) ⇒ void

This method returns an undefined value.

Checks attribute :camel_case option must be boolean

Parameters:

  • opts (Hash)

    Attribute options

Raises:



139
140
141
142
143
144
145
146
147
# File 'lib/serega/plugins/camel_case/camel_case.rb', line 139

def call(opts)
  camel_case_option_exists = opts.key?(:camel_case)
  return unless camel_case_option_exists

  value = opts[:camel_case]
  return if value.equal?(true) || value.equal?(false)

  raise SeregaError, "Attribute option :camel_case must have a boolean value, but #{value.class} was provided"
end