Sha256: d8b19e08e3a7945cf480c942940a73721e2c7bdc337cf36b9de45d3d9bd45018

Contents?: true

Size: 729 Bytes

Versions: 26

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

module Appsignal
  class EventFormatter
    # @api private
    module ViewComponent
      class RenderFormatter
        BLANK = ""

        attr_reader :root_path

        def initialize
          @root_path = "#{Rails.root}/"
        end

        def format(payload)
          [payload[:name], payload[:identifier].sub(@root_path, BLANK)]
        end
      end
    end
  end
end

if defined?(Rails) && defined?(ViewComponent)
  Appsignal::EventFormatter.register(
    "render.view_component",
    Appsignal::EventFormatter::ViewComponent::RenderFormatter
  )
  Appsignal::EventFormatter.register(
    "!render.view_component",
    Appsignal::EventFormatter::ViewComponent::RenderFormatter
  )
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
appsignal-3.12.3-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.12.3 lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.12.2-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.12.2 lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.12.1-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.12.1 lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.12.0-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.12.0 lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.11.0-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.11.0 lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.10.0-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.10.0 lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.9.3-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.9.3 lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.9.2-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.9.2 lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.9.1-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.9.1 lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.9.0-java lib/appsignal/event_formatter/view_component/render_formatter.rb
appsignal-3.9.0 lib/appsignal/event_formatter/view_component/render_formatter.rb