LoginSignup
13
13

More than 5 years have passed since last update.

Ruboty | Handlers と Actions #ruboty #chatops

Last updated at Posted at 2014-10-23

Ruboty | Handlers と Actions #ruboty #chatops

概要

Ruboty の Handlers と Actions に関して。

資料

Ruboty の構成要素については、下記記事を参照
Ruboty | 基本構成図解

詳細

Handler

Handler は Ruboty の振る舞いをハンドリングします。
Ruboty::Handlers::Base を継承して作成され、
組み込みでは以下の3つがあります

Handler では on クラスメソッドによって

key value
pattern 正規表現によるパターン
description help に表示される説明文
name 振る舞いの名前=メソッド名

を定義します。
そして、 name で指定した名前のインスタンスメソッドを作成し、
正規表現のパターンに一致した場合の処理= Action を呼び出します。

Actions

Actions は Ruboty::Actions::Base を継承して作成し、
call メソッドに正規表現に一致した際に呼び出される具体的な処理を記述します。

先述の Handler に対応する Action は以下です。

参照

Ruboty GitHub
Ruboty RubyGems

13
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
13