class Lita::Response
A wrapper object that provides the primary interface for handlers to respond to incoming chat messages.
Attributes
extensions[RW]
A hash of arbitrary data that can be populated by Lita
extensions. @return [Hash] The extensions data. @since 3.2.0
message[RW]
The incoming message. @return [Lita::Message] The message.
pattern[RW]
The pattern the incoming message matched. @return [Regexp] The pattern.
Public Class Methods
new(message, pattern)
click to toggle source
@param message [Lita::Message] The incoming message. @param pattern [Regexp] The pattern the incoming message matched.
# File lib/lita/response.rb, line 43 def initialize(message, pattern) self.message = message self.extensions = {} self.pattern = pattern end
Public Instance Methods
match_data()
click to toggle source
A MatchData
object from running the pattern against the message body. @return [MatchData] The MatchData
.
# File lib/lita/response.rb, line 57 def match_data @match_data ||= pattern.match(message.body) end
matches()
click to toggle source
An array of matches from scanning the message against the route pattern. @return [Array<String>, Array<Array<String>>] The array of matches.
# File lib/lita/response.rb, line 51 def matches @matches ||= message.match(pattern) end