# File lib/chronic/handlers.rb, line 108 def apply_endian_precedences(precedences) date_defs = @definitions[:date] # map the precedence array to indices on @definitions[:date] indices = precedences.map { |e| handler = instance_variable_get(endian_variable_name_for(e)) date_defs.index(handler) } # swap the handlers if we discover they are at odds with the desired preferences swap(date_defs, indices.first, indices.last) if indices.first > indices.last end