module Telegram::Bot::Async::ClassMethods
Public Instance Methods
default_async_job()
click to toggle source
# File lib/telegram/bot/async.rb, line 54 def default_async_job @default_async_job ||= begin begin ApplicationJob rescue NameError raise 'Define ApplicationJob class or setup #async= with custom job class' end klass = Class.new(ApplicationJob) { include Job } klass.client_class = self const_set(:AsyncJob, klass) end end
default_async_job=(val)
click to toggle source
This is used in specs.
# File lib/telegram/bot/async.rb, line 68 def default_async_job=(val) @default_async_job = val remove_const(:AsyncJob) if const_defined?(:AsyncJob, false) end
prepare_async_args(*args)
click to toggle source
Prepares argments for async job. ActiveJob doesn't support Symbol in argumens. Also we can encode json bodies only once here, so it would not be unnecessarily serialized-deserialized.
This is stub method, which returns input. Every client class must prepare args itself.
# File lib/telegram/bot/async.rb, line 79 def prepare_async_args(*args) args end
prepare_async_val(val)
click to toggle source
Returns default_async_job
if `true` is given, treats String as a constant name, or bypasses any other values.
# File lib/telegram/bot/async.rb, line 85 def prepare_async_val(val) case val when true then default_async_job when String then Object.const_get(val) else val end end