Class: Telegram::Bot::Middleware
- Inherits:
-
Object
- Object
- Telegram::Bot::Middleware
- Defined in:
- lib/telegram/bot/middleware.rb
Instance Attribute Summary collapse
-
#bot ⇒ Object
readonly
Returns the value of attribute bot.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(bot, controller) ⇒ Middleware
constructor
A new instance of Middleware.
- #inspect ⇒ Object
Constructor Details
#initialize(bot, controller) ⇒ Middleware
Returns a new instance of Middleware.
13 14 15 16 |
# File 'lib/telegram/bot/middleware.rb', line 13 def initialize(bot, controller) @bot = bot @controller = controller end |
Instance Attribute Details
#bot ⇒ Object (readonly)
Returns the value of attribute bot.
11 12 13 |
# File 'lib/telegram/bot/middleware.rb', line 11 def bot @bot end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
11 12 13 |
# File 'lib/telegram/bot/middleware.rb', line 11 def controller @controller end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/telegram/bot/middleware.rb', line 18 def call(env) request = ActionDispatch::Request.new(env) update = request.request_parameters controller.dispatch(bot, update, request) [200, {}, ['']] end |
#inspect ⇒ Object
25 26 27 |
# File 'lib/telegram/bot/middleware.rb', line 25 def inspect "#<#{self.class.name}(#{controller&.name})>" end |