lib/hamlit-rails.rb in hamlit-rails-0.2.0 vs lib/hamlit-rails.rb in hamlit-rails-0.2.1

- old
+ new

@@ -41,10 +41,16 @@ # Configure source annotation on haml files (support for HAML was # provided directly by railties 3.2..4.1 but was dropped in 4.2. if Gem::Requirement.new(">= 4.2").satisfied_by?(Gem::Version.new(::Rails.version)) initializer 'hamlit_rails.configure_source_annotation' do - SourceAnnotationExtractor::Annotation.register_extensions('haml') do |tag| + if Gem::Requirement.new(">= 6.0").satisfied_by?(Gem::Version.new(::Rails.version)) + annotation_class = ::Rails::SourceAnnotationExtractor::Annotation + else + annotation_class = SourceAnnotationExtractor::Annotation + end + + annotation_class.register_extensions('haml') do |tag| /\s*-#\s*(#{tag}):?\s*(.*)/ end end end