lib/kijkwijzer/result.rb in kijkwijzer-0.1.1 vs lib/kijkwijzer/result.rb in kijkwijzer-0.1.2

- old
+ new

@@ -10,16 +10,12 @@ # @return [String] with kijkwijzer-ratings (English-language-labels) def ratings @ratings.collect do |rating| rating = rating.to_s.downcase rv = nil - rv = rating if ["al","6","9","12","16"].include? rating - rv = "violence" if ["violence","g"].include? rating - rv = "scary" if ["scary","a"].include? rating - rv = "sex" if ["sex","s"].include? rating - rv = "drugs" if ["drugs","h"].include? rating - rv = "discrimination" if ["discrimination","d"].include? rating - rv = "language" if ["language","t"].include? rating + Kijkwijzer::POSSIBLE_RATINGS.each do |pr| + rv = pr[:value] if (rating == pr[:value] or rating == pr[:code]) + end rv end.compact end def to_s \ No newline at end of file