# File lib/language_detector.rb, line 17 def detect(text) p = LanguageDetector::Profile.new(:text => text) best_profile = nil best_distance = nil @profiles.each do |profile| distance = profile.compute_distance(p) if !best_distance or distance < best_distance best_distance = distance best_profile = profile end end p best_distance best_profile.name end