Debian Codegraph @

plugin/template

raw
1 #
2 # プラグインテンプレート
3 #
4
5 # これを基にプラグインを作って行く
6 # 別にこれを基にしなくてもいい
7 # 以下、MyPluginプラグインを作る例
8
9 require 'utils'
10 require 'plugin/plugin'
11
12 module Plugin
13 class MyPlugin < Plugin
14
15 # 毎分のイベントハンドラ
16 def onperiod(watch)
17 return watch.post(Message.new('hello, MyPlugin!', [self.name]))
18 end
19
20 def oncall(watch, message, tag)
21 return watch.post(Message.new("called by you", [self.name], message))
22 end
23 end
24
25 end
26
27 # プラグインの登録
28 Plugin::Ring.push Plugin::MyPlugin.new,[:period, :call]