Class: Validatable::ValidatesEach

Inherits:
ValidationBase show all
Defined in:
lib/validatable/validations/validates_each.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from ValidationBase

#attribute

Instance Method Summary collapse

Methods inherited from ValidationBase

after_validate, after_validations, all_after_validations, all_defaults, default, defaults, #i18n_prefix, #initialize, option, #raise_error_if_key_is_dup, required_option, #run_after_validate, #should_validate?, #validate_this_time?

Methods included from Requireable

included, #requires

Methods included from Understandable

included, #must_understand

Constructor Details

This class inherits a constructor from Validatable::ValidationBase

Instance Method Details

#i18nObject



14
15
16
# File 'lib/validatable/validations/validates_each.rb', line 14

def i18n
  super || "#{i18n_prefix}.invalid"
end

#message(instance) ⇒ Object



10
11
12
# File 'lib/validatable/validations/validates_each.rb', line 10

def message(instance)
  super || "is invalid"
end

#valid?(instance) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/validatable/validations/validates_each.rb', line 5

def valid?(instance)
  instance.instance_eval(&logic)
  true # return true so no error is added. should look in the future at doing this different.
end