Sha256: 660344b3938cd72304c4def621aaf1ad8d5d1823b1da86ed964b2846a6e1858d

Contents?: true

Size: 493 Bytes

Versions: 1

Compression:

Stored size: 493 Bytes

Contents

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

class MyMiddleware
  include Rlyeh::Dispatcher

  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 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.0.1 example/middleware.rb