Class: Validation::Rule::NotEmpty

Inherits:
Object
  • Object
show all
Defined in:
lib/validation/rule/not_empty.rb

Overview

Rule for not empty

Instance Method Summary collapse

Instance Method Details

#error_keyObject

The error key for this field



16
17
18
# File 'lib/validation/rule/not_empty.rb', line 16

def error_key
  :not_empty
end

#paramsObject

This rule has no params



6
7
8
# File 'lib/validation/rule/not_empty.rb', line 6

def params
  {}
end

#valid_value?(value) ⇒ Boolean

Determines if value is empty or not. In this rule, nil is empty

Returns:

  • (Boolean)


11
12
13
# File 'lib/validation/rule/not_empty.rb', line 11

def valid_value?(value)
  ! (value.nil? || value.empty?)
end