Sha256: bfe8cd6fe12803b0bd0f8729bdd7f1f736c0e84a7f6f060754d662dc348166a7

Contents?: true

Size: 958 Bytes

Versions: 3

Compression:

Stored size: 958 Bytes

Contents

require 'm2r/handler'

class TestHandler < M2R::Handler
  attr_reader :called_methods
  def initialize(connection, parser)
    super
    @called_methods = []
  end

  def on_wait()
    unless @called_methods.empty?
      stop
      return
    end
    @called_methods << :wait
  end

  def on_request(request)
    @called_methods << :request
  end

  def process(request)
    @called_methods << :process
    return "response"
  end

  def on_disconnect(request)
    @called_methods << :disconnect
  end

  def on_upload_start(request)
    @called_methods << :start
  end

  def on_upload_done(request)
    @called_methods << :done
  end

  def after_process(request, response)
    @called_methods << :after
    return response
  end

  def after_reply(request, response)
    @called_methods << :reply
  end

  def after_all(request, response)
    @called_methods << :all
  end

  def on_error(request, response, error)
    @called_methods << :error
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
m2r-2.0.2 test/support/test_handler.rb
m2r-2.0.1 test/support/test_handler.rb
m2r-2.0.0 test/support/test_handler.rb