Class: Validation::Rule::Decay

Inherits:
StretchyRule show all
Defined in:
lib/validation/rule/decay.rb

Constant Summary collapse

DECAY_FUNCTIONS =
[:gauss, :linear, :exp]

Instance Method Summary collapse

Methods inherited from StretchyRule

#empty_ok?, #initialize, #invalid_empty?, #is_empty?, #params, #required?

Constructor Details

This class inherits a constructor from Validation::Rule::StretchyRule

Instance Method Details

#error_keyObject



6
7
8
# File 'lib/validation/rule/decay.rb', line 6

def error_key
  :decay_function
end

#valid_value?(value) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/validation/rule/decay.rb', line 10

def valid_value?(value)
  DECAY_FUNCTIONS.any?{|f| f == value || f.to_s == value }
end