class DailyAffirmation::Validators::CustomValidator

This affirmation accepts a :proc option and evaluates it’s results.

@option opts [Proc] :proc evaluated to determine if attribute should be

validated.

Public Instance Methods

error_message() click to toggle source
# File lib/daily_affirmation/validators/custom_validator.rb, line 14
def error_message
  @error_message ||= i18n_error_message(
    :custom, :default => "#{attribute} is invalid"
  )
end
valid?() click to toggle source
# File lib/daily_affirmation/validators/custom_validator.rb, line 10
def valid?
  @valid ||= opts[:proc].call(object)
end