1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-03 17:55:52 +03:00
Этот коммит содержится в:
Max Melentiev
2016-02-22 22:53:59 +06:00
Коммит 37a63f7b23
29 изменённых файлов: 1333 добавлений и 0 удалений

26
lib/telegram/bot/middleware.rb Обычный файл
Просмотреть файл

@@ -0,0 +1,26 @@
require 'active_support/concern'
require 'action_dispatch/http/mime_type'
require 'action_dispatch/middleware/params_parser'
module Telegram
class Bot
class Middleware
attr_reader :bot, :controller
def initialize(bot, controller)
@bot = bot
@controller = controller
end
def call(env)
update = env['action_dispatch.request.request_parameters']
controller.dispatch(bot, update)
[200, {}, '']
end
def inspect
"#<#{self.class.name}(#{controller.try!(:name)})>"
end
end
end
end