class TelegramBot::TextMatcher
Attributes
pattern[RW]
Public Class Methods
new(pat = nil)
click to toggle source
# File lib/telegram_bot/matcher.rb, line 15 def initialize(pat = nil) @pattern = pat end
Public Instance Methods
===(msg)
click to toggle source
# File lib/telegram_bot/matcher.rb, line 19 def ===(msg) return false unless msg.type == :text return true if @pattern.nil? @pattern === msg.text end
arguments(msg)
click to toggle source
# File lib/telegram_bot/matcher.rb, line 25 def arguments(msg) if Regexp === @pattern md = @pattern.match(msg.text) md.to_a else [msg.text] end end