From 00a7255a8852b52abacb4c0a176967fd8854a1e1 Mon Sep 17 00:00:00 2001 From: James Conroy-Finn Date: Sat, 6 Feb 2010 00:21:46 +0800 Subject: [PATCH] ApplicationChecker compatibility and bug fix - Ruby 1.8 returns method names as strings whereas 1.9 returns symbols so remove both within run method. - Wrap culprits in Array to ensure we can enumerate over them. --- lib/application_checker.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/application_checker.rb b/lib/application_checker.rb index aac6a00..094c429 100644 --- a/lib/application_checker.rb +++ b/lib/application_checker.rb @@ -15,7 +15,8 @@ module Rails # Run all the check methods def run - the_methods = (self.public_methods - Object.methods) - ["run", "initialize"] + # Ruby 1.8 returns method names as strings whereas 1.9 uses symbols + the_methods = (self.public_methods - Object.methods) - [:run, :initialize, "run", "initialize"] the_methods.each {|m| send m } end @@ -299,7 +300,7 @@ module Rails puts "More information: #{more_info_url}" puts puts "The culprits: " - culprits.each do |c| + Array(culprits).each do |c| puts "\t- #{c}" end puts @@ -312,7 +313,7 @@ module Rails puts "#{BOLD}More information:#{CLEAR} #{CYAN}#{more_info_url}" puts puts "#{WHITE}The culprits: " - culprits.each do |c| + Array(culprits).each do |c| puts "#{YELLOW}\t- #{c}" end ensure