File tree Expand file tree Collapse file tree 2 files changed +5
-23
lines changed
lib/simple_form/components Expand file tree Collapse file tree 2 files changed +5
-23
lines changed Original file line number Diff line number Diff line change @@ -19,33 +19,23 @@ def integer?
1919
2020 def minimum_value ( validator_options )
2121 if integer? && validator_options . key? ( :greater_than )
22- evaluate_numericality_validator_option ( validator_options [ :greater_than ] ) + 1
22+ resolve_validator_value ( validator_options [ :greater_than ] ) + 1
2323 else
24- evaluate_numericality_validator_option ( validator_options [ :greater_than_or_equal_to ] )
24+ resolve_validator_value ( validator_options [ :greater_than_or_equal_to ] )
2525 end
2626 end
2727
2828 def maximum_value ( validator_options )
2929 if integer? && validator_options . key? ( :less_than )
30- evaluate_numericality_validator_option ( validator_options [ :less_than ] ) - 1
30+ resolve_validator_value ( validator_options [ :less_than ] ) - 1
3131 else
32- evaluate_numericality_validator_option ( validator_options [ :less_than_or_equal_to ] )
32+ resolve_validator_value ( validator_options [ :less_than_or_equal_to ] )
3333 end
3434 end
3535
3636 def find_numericality_validator
3737 find_validator ( :numericality )
3838 end
39-
40- def evaluate_numericality_validator_option ( option )
41- if option . is_a? ( Numeric )
42- option
43- elsif option . is_a? ( Symbol )
44- object . send ( option )
45- elsif option . respond_to? ( :call )
46- option . call ( object )
47- end
48- end
4939 end
5040 end
5141end
Original file line number Diff line number Diff line change @@ -15,21 +15,13 @@ def pattern_source
1515 if pattern . is_a? ( String )
1616 pattern
1717 elsif ( pattern_validator = find_pattern_validator ) && ( with = pattern_validator . options [ :with ] )
18- evaluate_format_validator_option ( with ) . source
18+ resolve_validator_value ( with ) . source
1919 end
2020 end
2121
2222 def find_pattern_validator
2323 find_validator ( :format )
2424 end
25-
26- def evaluate_format_validator_option ( option )
27- if option . respond_to? ( :call )
28- option . call ( object )
29- else
30- option
31- end
32- end
3325 end
3426 end
3527end
You can’t perform that action at this time.
0 commit comments