Sha256: 0ae35c85d58181cd50e5ad5098657390ba54286b63ba870e4208a553e9802dc9

Contents?: true

Size: 962 Bytes

Versions: 57

Compression:

Stored size: 962 Bytes

Contents

# frozen_string_literal: true

require "concurrent/map"
require "action_view/path_set"
require "action_view/render_parser"

module ActionView
  class DependencyTracker # :nodoc:
    extend ActiveSupport::Autoload

    autoload :ERBTracker
    autoload :RipperTracker

    @trackers = Concurrent::Map.new

    def self.find_dependencies(name, template, view_paths = nil)
      tracker = @trackers[template.handler]
      return [] unless tracker

      tracker.call(name, template, view_paths)
    end

    def self.register_tracker(extension, tracker)
      handler = Template.handler_for_extension(extension)
      if tracker.respond_to?(:supports_view_paths?)
        @trackers[handler] = tracker
      else
        @trackers[handler] = lambda { |name, template, _|
          tracker.call(name, template)
        }
      end
    end

    def self.remove_tracker(handler)
      @trackers.delete(handler)
    end

    register_tracker :erb, ERBTracker
  end
end

Version data entries

57 entries across 54 versions & 7 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/actionview-7.1.3.4/lib/action_view/dependency_tracker.rb
actionview-7.1.5.1 lib/action_view/dependency_tracker.rb
actionview-7.0.8.7 lib/action_view/dependency_tracker.rb
actionview-7.1.5 lib/action_view/dependency_tracker.rb
actionview-7.1.4.2 lib/action_view/dependency_tracker.rb
actionview-7.0.8.6 lib/action_view/dependency_tracker.rb
actionview-7.1.4.1 lib/action_view/dependency_tracker.rb
actionview-7.0.8.5 lib/action_view/dependency_tracker.rb
actionview-7.1.4 lib/action_view/dependency_tracker.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/actionview-7.1.3.4/lib/action_view/dependency_tracker.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/actionview-7.0.8.4/lib/action_view/dependency_tracker.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/actionview-7.0.5.1/lib/action_view/dependency_tracker.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/actionview-7.0.5.1/lib/action_view/dependency_tracker.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/actionview-7.0.5.1/lib/action_view/dependency_tracker.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/actionview-7.1.3.4/lib/action_view/dependency_tracker.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/actionview-7.1.3.4/lib/action_view/dependency_tracker.rb
actionview-7.1.3.4 lib/action_view/dependency_tracker.rb
actionview-7.0.8.4 lib/action_view/dependency_tracker.rb
actionview-7.1.3.2 lib/action_view/dependency_tracker.rb
actionview-7.1.3.1 lib/action_view/dependency_tracker.rb