Class: LIVR::Rules::Meta::Or
- Inherits:
-
LIVR::Rule
- Object
- LIVR::Rule
- LIVR::Rules::Meta::Or
- Defined in:
- lib/livr/rules/meta.rb
Instance Method Summary collapse
- #call(value, user_data, field_results) ⇒ Object
-
#initialize(*rule_sets) ⇒ Or
constructor
A new instance of Or.
Constructor Details
Instance Method Details
#call(value, user_data, field_results) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/livr/rules/meta.rb', line 179 def call(value, user_data, field_results) return if is_no_value(value) last_error = nil @validators.each do |validator| result = validator.validate(field: value) if result field_results << result[:field] return nil else last_error = validator.get_errors[:field] end end last_error ? last_error : nil end |