Browse files

Proper indenting and removed unnecessary 'then' for 'when' in case st…

…atements
  • Loading branch information...
1 parent 85e8ec9 commit c9d1d20228d766aac75c7d0fe74c16932fc7b591 @bcardarella bcardarella committed Mar 27, 2012
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/client_side_validations/action_view/form_builder.rb
View
20 lib/client_side_validations/action_view/form_builder.rb
@@ -99,15 +99,17 @@ def filter_validators(method, filters)
else
if (conditional = (validator.last[:if] || validator.last[:unless]))
result = case conditional
- when Symbol then
- if @object.respond_to?(conditional)
- @object.send(conditional)
- else
- raise(ArgumentError, "unknown method called '#{conditional}'")
- end
- when String then eval(conditional)
- when Proc then conditional.call(@object)
- end
+ when Symbol
+ if @object.respond_to?(conditional)
+ @object.send(conditional)
+ else
+ raise(ArgumentError, "unknown method called '#{conditional}'")
+ end
+ when String
+ eval(conditional)
+ when Proc
+ conditional.call(@object)
+ end
# :if was specified and result is false OR :unless was specified and result was true
if (validator.last[:if] && !result) || (validator.last[:unless] && result)

0 comments on commit c9d1d20

Please sign in to comment.