Sha256: 6a1845b9a2d73d81500dbe70f550b84e959ccccdb45f14a2a556d5bc4c5e7755

Contents?: true

Size: 574 Bytes

Versions: 3

Compression:

Stored size: 574 Bytes

Contents

module Cucover
  module Rails
    class << self
      def patch_if_necessary
        return if @patched
        return unless defined?(ActionView)
      
        Monkey.extend_every ActionView::Base => Cucover::Rails::RecordsRenders
        # Monkey.extend_every ActionView::Template => Cucover::Rails::RecordsRenders # TODO: patch nicer template
        
        @patched = true
      end
    end
  
    module RecordsRenders
      def render(*args)
        filename = args[0][:file].filename
        Cucover.record_file(filename)
        super
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucover-0.1.4 lib/cucover/rails.rb
cucover-0.1.3 lib/cucover/rails.rb
cucover-0.1.2 lib/cucover/rails.rb