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.
This commit is contained in:
James Conroy-Finn 2010-02-06 00:21:46 +08:00 committed by Jeremy McAnally
parent 035b8168e6
commit 00a7255a88

View File

@ -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