lib/ellen/message.rb in ellen-0.0.4 vs lib/ellen/message.rb in ellen-0.0.5
- old
+ new
@@ -1,15 +1,19 @@
module Ellen
class Message
- attr_reader :body, :source, :command
+ attr_reader :body, :command, :match_data, :source
def initialize(options)
@body = options[:body]
@source = options[:source]
@command = options[:command]
end
- def match(pattern, options = {})
- (!options[:command] || command) && pattern === body
+ def match(pattern)
+ @match_data = pattern.match(body)
+ end
+
+ def [](index)
+ match_data[index]
end
end
end