Created
October 19, 2012 05:05
-
-
Save am0c/3916344 to your computer and use it in GitHub Desktop.
Hubot::Listener.pm6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
class Hubot::Listener { | |
has Code $.match is rw; | |
has Code $.callback is rw; # handles cb => postcircum:<( )> | |
# .. does not work | |
method call ($message --> Bool) { | |
my @matching = $.match.($message); | |
if @matching { | |
$.callback: Hubot::Response.new: | |
robot => self.robot, | |
message => $message, | |
match => @matching; | |
return True; | |
} | |
False; | |
} | |
} | |
# vim: set ft=perl6 sts=4 sw=4 ts=4 expandtab : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use Hubot::Response; | |
class Hubot::Listener { | |
has Code $.match is rw; | |
has Code $.callback is rw; # handles cb => postcircum:<( )> | |
# .. does not work | |
method call ($message --> Bool) { | |
my @matching = $.match.($message); | |
if @matching { | |
$.callback: Hubot::Response.new: | |
robot => self.robot, | |
message => $message, | |
match => @matching; | |
return True; | |
} | |
False; | |
} | |
} | |
# vim: set ft=perl6 sts=4 sw=4 ts=4 expandtab : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment