Class: TelegramBot::CommandMatcher
- Defined in:
- lib/telegram_bot/matcher.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
Instance Method Summary collapse
- #===(msg) ⇒ Object
- #arguments(msg) ⇒ Object
-
#initialize(command) ⇒ CommandMatcher
constructor
A new instance of CommandMatcher.
Methods inherited from Matcher
Constructor Details
#initialize(command) ⇒ CommandMatcher
Returns a new instance of CommandMatcher.
62 63 64 |
# File 'lib/telegram_bot/matcher.rb', line 62 def initialize(command) @command = command end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
60 61 62 |
# File 'lib/telegram_bot/matcher.rb', line 60 def command @command end |
Instance Method Details
#===(msg) ⇒ Object
66 67 68 |
# File 'lib/telegram_bot/matcher.rb', line 66 def ===(msg) msg.type == :text and msg.text.start_with?("/#{@command}") end |
#arguments(msg) ⇒ Object
70 71 72 |
# File 'lib/telegram_bot/matcher.rb', line 70 def arguments(msg) msg.text.split[1..-1] end |