# File lib/validates_timeliness/formats.rb, line 230 def add_formats(type, *add_formats) formats = self.send("#{type}_formats") options = {} options = add_formats.pop if add_formats.last.is_a?(Hash) before = options[:before] raise "Format for :before option #{format} was not found." if before && !formats.include?(before) add_formats.each do |format| raise "Format #{format} is already included in #{type} formats" if formats.include?(format) index = before ? formats.index(before) : -1 formats.insert(index, format) end compile_format_expressions end