class XNM::Telegram::OnMessage
Public Class Methods
new(options)
click to toggle source
Calls superclass method
XNM::Telegram::OnTelegramEvent::new
# File lib/xnm/telegram/OnMessage.rb, line 6 def initialize(options) super() @block = options[:block] @regexp = options[:regexp] @priority += 1 if @regexp end
Public Instance Methods
nomp_message(message)
click to toggle source
# File lib/xnm/telegram/OnMessage.rb, line 15 def nomp_message(message) if @regexp match = @regexp.match message.to_s if match @block.call message, match message.handled = true end else @block.call message end end