Sha256: 2ba9f7a0a9213c8731107e2330e2af6ca0c7067bc0e716bffffdccb0a8265dcc
Contents?: true
Size: 601 Bytes
Versions: 9
Compression:
Stored size: 601 Bytes
Contents
module MadChatter module Actions class Base include MadChatter::Actions::Dsl def initialize(regex = nil, block = nil) @regex = regex @block = block end def handle(message) if message.original_text =~ @regex args = @regex.match(message.original_text).captures @block.call(args) end end # used to register a class that extends MadChatter::Actions::Base def self.inherited(extension_class) MadChatter.message_listeners << extension_class.new end end end end
Version data entries
9 entries across 9 versions & 1 rubygems