Class: Varify::Rules::RequiredRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/varify/rules/required.rb

Instance Method Summary collapse

Methods inherited from Rule

#initialize

Constructor Details

This class inherits a constructor from Varify::Rules::Rule

Instance Method Details

#error_messageObject



14
15
16
# File 'lib/varify/rules/required.rb', line 14

def error_message
  "#{@name} (:#{@key}) is required"
end

#valid?Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
# File 'lib/varify/rules/required.rb', line 6

def valid?
  if @options
    !@value.nil? 
  else
    true
  end
end