Skip to content

Commit c72315c

Browse files
committed
only enable source annotation on rails >= 4.2
Rails 3.2 .. 4.1 already supported HAML. Also, the original previous commit would have broken on Rails < 4.2.
1 parent 903a85c commit c72315c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/haml-rails.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ class Railtie < ::Rails::Railtie
4747

4848
initializer 'haml_rails.configure_source_annotation' do
4949
# Configure source annoatation on haml files
50-
SourceAnnotationExtractor::Annotation.register_extensions('haml') do |tag|
51-
/\s*-#\s*(#{tag}):?\s*(.*)/
50+
51+
# HAML support existed in Rails 3.2, 4.0, and 4.1, but was dropped in 4.2
52+
if ::Rails.version >= '4.2'
53+
SourceAnnotationExtractor::Annotation.register_extensions('haml') do |tag|
54+
/\s*-#\s*(#{tag}):?\s*(.*)/
55+
end
5256
end
5357
end
5458
end

0 commit comments

Comments
 (0)