Sha256: 4ea0e901c1526cd265be640336102378adbc04f43c5171874144c751e7463da6

Contents?: true

Size: 706 Bytes

Versions: 4

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true

module RailsMiniProfiler
  module Tracing
    class TraceFactory
      class << self
        def create(event)
          factory = new(event)
          factory.create
        end
      end

      def initialize(event)
        @event = event
      end

      def create
        trace_class.new(@event).trace
      end

      private

      def trace_class
        case @event.name
        when 'sql.active_record'
          SequelTracer
        when 'render_template.action_view', 'render_partial.action_view'
          ViewTracer
        when 'process_action.action_controller'
          ControllerTracer
        else
          Tracer
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_mini_profiler-0.7.0 lib/rails_mini_profiler/tracing/trace_factory.rb
rails_mini_profiler-0.6.0 lib/rails_mini_profiler/tracing/trace_factory.rb
rails_mini_profiler-0.5.0 lib/rails_mini_profiler/tracing/trace_factory.rb
rails_mini_profiler-0 lib/rails_mini_profiler/tracing/trace_factory.rb