Project

General

Profile

« Previous | Next » 

Revision b8b8b4eb

Added by Marc Dequènes over 15 years ago

  • ID b8b8b4eb0843e5ec040509469b500ce6d56e57e1

[fix] handle case when prefered language string is unparsable

View differences:

lib/cyborghood/objects.rb
def prefered_language(available_languages)
lang_chooser = HTTPHeaders::AcceptLanguage.parse(self.preferredLanguage)
return nil if lang_chooser.nil?
ordered_list = lang_chooser.reduce(available_languages)
ordered_list.empty? ? nil : ordered_list.first.range
end

Also available in: Unified diff