Sha256: 6a44288d0a6d8acee9b1769f246b0c6a7ed758766e75c66db70be20750d166b1

Contents?: true

Size: 791 Bytes

Versions: 13

Compression:

Stored size: 791 Bytes

Contents

require 'appmap/handler/function'

module AppMap
  module Handler
    module Rails
      class RenderHandler < AppMap::Handler::Function
        def handle_call(receiver, args)
          options, _ = args
          # TODO: :file, :xml
          # https://guides.rubyonrails.org/v5.1/layouts_and_rendering.html
          if options[:json]
            Thread.current[TEMPLATE_RENDER_FORMAT] = :json
          end

          super
        end

        def handle_return(call_event_id, elapsed, return_value, exception)
          if Thread.current[TEMPLATE_RENDER_FORMAT] == :json
            Thread.current[TEMPLATE_RENDER_VALUE] = JSON.parse(return_value) rescue nil
          end
          Thread.current[TEMPLATE_RENDER_FORMAT] = nil

          super
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
appmap-0.83.6 lib/appmap/handler/rails/render_handler.rb
appmap-0.83.5 lib/appmap/handler/rails/render_handler.rb
appmap-0.83.4 lib/appmap/handler/rails/render_handler.rb
appmap-0.83.3 lib/appmap/handler/rails/render_handler.rb
appmap-0.83.2 lib/appmap/handler/rails/render_handler.rb
appmap-0.83.1 lib/appmap/handler/rails/render_handler.rb
appmap-0.83.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.82.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.81.1 lib/appmap/handler/rails/render_handler.rb
appmap-0.81.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.80.2 lib/appmap/handler/rails/render_handler.rb
appmap-0.80.1 lib/appmap/handler/rails/render_handler.rb
appmap-0.80.0 lib/appmap/handler/rails/render_handler.rb