Sha256: bc2c3e81c95f2f7e06233955b1397f833d63a478555d708ed5e979cbd5f5a772

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
$LOAD_PATH.unshift 'lib', '../lib'
require 'rlyeh'
require 'logger'

class MyMiddleware
  include Rlyeh::Dispatchable

  on :privmsg do |env|
    p "Middleware: #{env.message}"
  end

  def initialize(app)
    @app = app
  end

  def call(env)
    dispatch env
    @app.call env
  end
end

class MyApp < Rlyeh::Base
  use Rlyeh::DeepOnes::Logger, :level => Logger::DEBUG
  use MyMiddleware

  on :privmsg do |env|
    p "MyApp1: #{env.message}"
  end

  on :privmsg do |env|
    p "MyApp2: #{env.message}"
  end
end

Rlyeh.run MyApp

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rlyeh-0.1.1 examples/middleware.rb