newspaper gemの全使用箇所 - fjordllc/bootcamp GitHub Wiki

1. Gem設定

  • Gemfile:52 - gem 'newspaper'
  • Gemfile.lock - バージョン情報 (0.2.0)

2. 初期化設定

  • config/initializers/newspaper.rb - 全22行でイベント購読設定

3. Publisherクラス(イベント発行)

コントローラー

  • app/controllers/graduation_controller.rb:12 - 卒業時
  • app/controllers/training_completion_controller.rb:18 - 研修完了時
  • app/controllers/retirement_controller.rb:17 - 退会時
  • app/controllers/comeback_controller.rb:15 - 復活時
  • app/controllers/checks_controller.rb:18,35 - チェック作成/キャンセル時
  • app/controllers/api/answers_controller.rb:33,42,51 - 回答保存/削除時
  • app/controllers/api/correct_answers_controller.rb:10,11,21 - 正解設定時
  • app/controllers/admin/users_controller.rb:38 - 管理者による退会処理時
  • app/controllers/scheduler/daily/auto_retire_controller.rb:18 - 自動退会時

モデル

  • app/models/question_auto_closer.rb:101,102 - 質問自動クローズ時
  • app/models/comment/after_create_callback.rb:77 - トークコメント時

4. Subscriberクラス(イベント購読)

以下のNotifierクラスがnewspaper経由で呼び出されます:

  • CorrectAnswerNotifier.new
  • GraduationNotifier.new
  • ComebackNotifier.new
  • CommentNotifierForAdmin.new
  • AnswerCacheDestroyer.new
  • UnfinishedDataDestroyer.new
  • TimesChannelDestroyer.new

5. 発行されているイベント

  • :answer_save - 回答保存時
  • :answer_destroy - 回答削除時
  • :correct_answer_save - 正解設定時
  • :graduation_update - 卒業時
  • :comeback_update - 復活時
  • :retirement_create - 退会時
  • :training_completion_create - 研修完了時
  • :check_create - チェック作成時
  • :check_cancel - チェックキャンセル時
  • :came_comment_in_talk - トークコメント時

6. その他

  • app/views/works/show.html.slim:74 - FontAwesomeアイコン(fa-newspaper)のみ

結論:newspaper gemは現在も活発に使用されており、通知システムの中核として機能しています。合計で約18箇所のコントローラー・モデルで使 用され、10種類のイベントが定義されています。