Class: Validation::Rule::RespondsTo

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

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



5
6
7
# File 'lib/validation/rule/responds_to.rb', line 5

def error_key
  :responds_to
end

#valid_value?(value) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/validation/rule/responds_to.rb', line 9

def valid_value?(value)
  value.respond_to?(params[:method])
end