Skip to content

Commit a22c268

Browse files
committed
Add 「.selfrun」 method
It was annoying to have copy-pasted IRC::Client initialization, so now there is a 「.selfrun」 method that does that for you.
1 parent 1bf72b5 commit a22c268

File tree

4 files changed

+16
-39
lines changed

4 files changed

+16
-39
lines changed

Benchable.p6

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,6 @@ Z: loop (my int $x = 0; $x < +@commits - 1; $x++) {
181181
return ($msg-response, %graph);
182182
}
183183

184-
my $plugin = Benchable.new;
185-
my $nick = benchable6;
186-
187-
.run with IRC::Client.new(
188-
:$nick
189-
:userreal($nick.tc)
190-
:username($nick.tc)
191-
:host<irc.freenode.net>
192-
:channels(%*ENV<DEBUGGABLE> ?? <#whateverable> !! <#perl6 #perl6-dev>)
193-
:debug(?%*ENV<DEBUGGABLE>)
194-
:plugins($plugin)
195-
:filters( -> |c { $plugin.filter(|c) } )
196-
);
184+
Benchable.new.selfrun(benchable6);
197185

198186
# vim: expandtab shiftwidth=4 ft=perl6

Bisectable.p6

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,6 @@ method process($message, $code is copy, $good, $bad) {
146146
return $result;
147147
}
148148

149-
my $plugin = Bisectable.new;
150-
my $nick = bisectable6;
151-
152-
.run with IRC::Client.new(
153-
:$nick
154-
:userreal($nick.tc)
155-
:username($nick.tc)
156-
:host<irc.freenode.net>
157-
:channels(%*ENV<DEBUGGABLE> ?? <#whateverable> !! <#perl6 #perl6-dev>)
158-
:debug(?%*ENV<DEBUGGABLE>)
159-
:plugins($plugin)
160-
:filters( -> |c { $plugin.filter(|c) } )
161-
);
149+
Bisectable.new.selfrun(bisectable6);
162150

163151
# vim: expandtab shiftwidth=4 ft=perl6

Committable.p6

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,6 @@ method process($message, $config, $code is copy) {
104104
return $msg-response;
105105
}
106106

107-
my $plugin = Committable.new;
108-
my $nick = committable6;
109-
110-
.run with IRC::Client.new(
111-
:$nick
112-
:userreal($nick.tc)
113-
:username($nick.tc)
114-
:host<irc.freenode.net>
115-
:channels(%*ENV<DEBUGGABLE> ?? <#whateverable> !! <#perl6 #perl6-dev>)
116-
:debug(?%*ENV<DEBUGGABLE>)
117-
:plugins($plugin)
118-
:filters( -> |c { $plugin.filter(|c) } )
119-
);
107+
Committable.new.selfrun(committable6);
120108

121109
# vim: expandtab shiftwidth=4 ft=perl6

Whateverable.pm6

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,17 @@ method upload(%files is copy, :$description = ‘’, Bool :$public = True) {
149149
return $gist.paste(%files, desc => $description, public => $public);
150150
}
151151

152+
method selfrun($nick) {
153+
.run with IRC::Client.new(
154+
:$nick
155+
:userreal($nick.tc)
156+
:username($nick.tc)
157+
:host<irc.freenode.net>
158+
:channels(%*ENV<DEBUGGABLE> ?? <#whateverable> !! <#perl6 #perl6-dev>)
159+
:debug(?%*ENV<DEBUGGABLE>)
160+
:plugins(self)
161+
:filters( -> |c { self.filter(|c) } )
162+
)
163+
}
164+
152165
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)