Sha256: 9e3e5fc81ef29af7410e656f1a002c571695929daffb64dccf31aaafffeb778b

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 Bytes

Contents

require 'm2r/handler'

class TestHandler < M2R::Handler
  attr_reader :called_methods
  def initialize(connection)
    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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
m2r-1.0.0 test/support/test_handler.rb