Class: Validation::Rule::Decay

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

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#error_keyObject



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

def error_key
  :decay_function
end

#paramsObject



14
15
16
# File 'lib/validation/rule/decay.rb', line 14

def params
  {}
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