class Telegram::Callback
Attributes
data[R]
Public Class Methods
new()
click to toggle source
# File lib/telegram/callback.rb, line 5 def initialize @success = nil @fail = nil @data = nil end
Public Instance Methods
callback(&cb)
click to toggle source
# File lib/telegram/callback.rb, line 11 def callback(&cb) @success = cb end
errback(&cb)
click to toggle source
# File lib/telegram/callback.rb, line 15 def errback(&cb) @fail = cb end
trigger(type = :success, data = nil)
click to toggle source
# File lib/telegram/callback.rb, line 19 def trigger(type = :success, data = nil) @data = data case type when :success @success.call when :fail @fail.call end end