class Qbot::Message

Attributes

captures[R]
data[R]
text[RW]

Public Class Methods

new(data, text = '') click to toggle source
# File lib/qbot/message.rb, line 8
def initialize(data, text = '')
  @data = data
  @text = text
end

Public Instance Methods

match(regexp, prefix: nil) click to toggle source
# File lib/qbot/message.rb, line 13
def match(regexp, prefix: nil)
  text = @text.dup
  text.sub!(/^#{prefix}/, '') if prefix
  @captures = text.strip.match(regexp)
end
mention(regexp = nil) click to toggle source
# File lib/qbot/message.rb, line 19
def mention(regexp = nil)
  @mention = text.slice(regexp) if regexp
  @mention
end
mentioned?() click to toggle source
# File lib/qbot/message.rb, line 24
def mentioned?
  !!mention
end