haml/haml — pull request #599 by amatsuda (2012-10-18 14:20:03+00:00)
Title: Every Ruby 1.8 Object responds_to :type

Since ec3157f4db4e945911196978aee56227d865d8a6, Haml scatters tons of warnings like this under Ruby 1.8:

.../haml-3.2.0.rc.1/lib/haml/template/plugin.rb:20: warning: Object#type is deprecated; use Object#class

Here's a patch that checks the ActionPack version before asking the template object respond_to? :type or not. I think this would be enough in this case because Rails 4 does not support Ruby < 1.9.

versions
ActionPack::VERSION::MAJOR >= 4
template.respond_to?(:type)

Ruby 1.9 + Rails 4	true	true

Ruby 1.8 + Rails 4	N/A

Ruby 1.9 + Rails 3	false	(will not executed)

Ruby 1.8 + Rails 3	false	(will not executed)

I didn't add new test code for this, but you can actually see these warnings as you run `rake` with 1.8.