Module: Telegram::Bot::UpdatesController::Testing
- Defined in:
- lib/telegram/bot/updates_controller/testing.rb
Constant Summary collapse
- IVARS_TO_KEEP =
%i[@_session].freeze
Instance Method Summary collapse
-
#dispatch_again(bot = nil, update = nil) ⇒ Object
Perform multiple dispatches on same instance.
-
#recycle!(full = false) ⇒ Object
Cleans controller between dispatches.
Instance Method Details
#dispatch_again(bot = nil, update = nil) ⇒ Object
Perform multiple dispatches on same instance.
8 9 10 11 12 |
# File 'lib/telegram/bot/updates_controller/testing.rb', line 8 def dispatch_again(bot = nil, update = nil) recycle! initialize(bot, update) dispatch end |
#recycle!(full = false) ⇒ Object
Cleans controller between dispatches. Seems like there is nothing to clean between requests for now: everything will be rewriten with #initialize.
With ‘full` set to `true` it’ll clear all cached instance variables.
19 20 21 22 23 24 |
# File 'lib/telegram/bot/updates_controller/testing.rb', line 19 def recycle!(full = false) return unless full (instance_variables - IVARS_TO_KEEP).each do |ivar| remove_instance_variable(ivar) end end |