Class: Varify::Rules::Rule

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

Direct Known Subclasses

BetweenRule, IsARule, OneOfRule, RequiredRule

Instance Method Summary collapse

Constructor Details

#initialize(key, name, value, options = {}) ⇒ Rule

Returns a new instance of Rule.



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

def initialize(key,name,value,options={})
  @value   = value
  @key     = key
  @name    = name
  @options = options
end

Instance Method Details

#error_messageObject



17
18
19
# File 'lib/varify/rules/rule.rb', line 17

def error_message
  "#{@name} (:#{@key}) failed verification"
end

#valid?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/varify/rules/rule.rb', line 13

def valid?
  raise NotImplementedError
end