Class: Validation::Rule::NotEmpty
- Inherits:
-
Object
- Object
- Validation::Rule::NotEmpty
- Defined in:
- lib/validation/rule/not_empty.rb
Overview
Rule for not empty
Instance Method Summary collapse
-
#error_key ⇒ Object
The error key for this field.
-
#params ⇒ Object
This rule has no params.
-
#valid_value?(value) ⇒ Boolean
Determines if value is empty or not.
Instance Method Details
#error_key ⇒ Object
The error key for this field
16 17 18 |
# File 'lib/validation/rule/not_empty.rb', line 16 def error_key :not_empty end |
#params ⇒ Object
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
11 12 13 |
# File 'lib/validation/rule/not_empty.rb', line 11 def valid_value?(value) ! (value.nil? || value.empty?) end |