Sha256: 478b490bbf3b30ac77976a238abb4872372760f41c01b324b8d02fe5f5ee81c7

Contents?: true

Size: 542 Bytes

Versions: 2

Compression:

Stored size: 542 Bytes

Contents

class Headhunter
  module Rack
    class CapturingMiddleware
      def initialize(app, headhunter)
        @app = app
        @hh  = headhunter
      end

      def call(env)
        response = @app.call(env)
        process(response)
        response
      end

      def process(rack_response)
        status, headers, response = rack_response

        if html = extract_html_from(response)
          @hh.process!('unknown', html)
        end
      end

      def extract_html_from(response)
        response[0]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
headhunter-0.0.5 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.0.2 lib/headhunter/rack/capturing_middleware.rb