Sha256: 780b1efde0ee6542b9d82ec6d54cdb14464360fa37e58f46c74fbb0ee83f5853

Contents?: true

Size: 806 Bytes

Versions: 39

Compression:

Stored size: 806 Bytes

Contents

require 'appmap/handler/function_handler'

module AppMap
  module Handler
    module Rails
      class RenderHandler < AppMap::Handler::FunctionHandler
        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

39 entries across 39 versions & 1 rubygems

Version Path
appmap-1.1.1 lib/appmap/handler/rails/render_handler.rb
appmap-1.0.1 lib/appmap/handler/rails/render_handler.rb
appmap-1.0.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.103.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.102.2 lib/appmap/handler/rails/render_handler.rb
appmap-0.102.1 lib/appmap/handler/rails/render_handler.rb
appmap-0.102.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.101.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.100.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.99.4 lib/appmap/handler/rails/render_handler.rb
appmap-0.99.2 lib/appmap/handler/rails/render_handler.rb
appmap-0.99.1 lib/appmap/handler/rails/render_handler.rb
appmap-0.99.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.98.1 lib/appmap/handler/rails/render_handler.rb
appmap-0.98.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.97.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.96.0 lib/appmap/handler/rails/render_handler.rb
appmap-0.95.2 lib/appmap/handler/rails/render_handler.rb
appmap-0.95.1 lib/appmap/handler/rails/render_handler.rb
appmap-0.95.0 lib/appmap/handler/rails/render_handler.rb