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, webhook_request = 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, webhook_request = nil) ⇒ Object
Perform multiple dispatches on same instance.
10 11 12 13 14 |
# File 'lib/telegram/bot/updates_controller/testing.rb', line 10 def dispatch_again(bot = nil, update = nil, webhook_request = nil) recycle! initialize(bot, update, webhook_request) 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.
21 22 23 24 25 26 |
# File 'lib/telegram/bot/updates_controller/testing.rb', line 21 def recycle!(full = false) # rubocop:disable Style/OptionalBooleanParameter return unless full (instance_variables - IVARS_TO_KEEP).each do |ivar| remove_instance_variable(ivar) end end |