From a2baae9728ca3ff25884ea179377c95f351e06ca Mon Sep 17 00:00:00 2001 From: Adam Meehan Date: Mon, 3 Apr 2023 15:11:15 +1000 Subject: [PATCH] chore: remove timeliness_validation_for helper method to reduce method pollution --- lib/validates_timeliness/helper_methods.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/validates_timeliness/helper_methods.rb b/lib/validates_timeliness/helper_methods.rb index 6d3a9a42..e854e174 100644 --- a/lib/validates_timeliness/helper_methods.rb +++ b/lib/validates_timeliness/helper_methods.rb @@ -3,25 +3,19 @@ module Validations module HelperMethods def validates_date(*attr_names) - timeliness_validation_for attr_names, :date + validates_with TimelinessValidator, _merge_attributes(attr_names).merge(type: :date) end def validates_time(*attr_names) - timeliness_validation_for attr_names, :time + validates_with TimelinessValidator, _merge_attributes(attr_names).merge(type: :time) end def validates_datetime(*attr_names) - timeliness_validation_for attr_names, :datetime + validates_with TimelinessValidator, _merge_attributes(attr_names).merge(type: :datetime) end def validates_timeliness_of(*attr_names) - timeliness_validation_for attr_names - end - - def timeliness_validation_for(attr_names, type=nil) - options = _merge_attributes(attr_names) - options.update(:type => type) if type - validates_with TimelinessValidator, options + validates_with TimelinessValidator, _merge_attributes(attr_names) end end