Skip to content

Commit

Permalink
BCDice: コンストラクタでBCDiceを用意する
Browse files Browse the repository at this point in the history
  • Loading branch information
ochaochaocha3 committed Jul 28, 2019
1 parent 73201da commit d6947d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
14 changes: 11 additions & 3 deletions lib/rgrb/plugin/bcdice/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ module Bcdice
class Generator
include PluginBase::Generator

# ジェネレータを初期化する
def initialize
@bcdice = CgiDiceBot.new
@version_and_commit_id = get_version_and_commit_id
end

# プラグインがアダプタによって読み込まれた際の設定
#
# アダプタによってジェネレータが用意されたとき
# BCDiceのバージョン情報をログに出力する。
def configure(*)
super

@bcdice = CgiDiceBot.new
@version_and_commit_id = get_version_and_commit_id
logger.warn("BCDice を読み込みました: #{bcdice_version}")
logger.info(bcdice_version)

self
end
Expand Down
9 changes: 0 additions & 9 deletions spec/rgrb/plugin/bcdice/generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
describe RGRB::Plugin::Bcdice::Generator do
let(:generator) do
g = described_class.new
g.instance_variable_set(
:@bcdice,
CgiDiceBot.new
)
g.instance_variable_set(
:@version_and_commit_id,
g.send(:get_version_and_commit_id)
)

g.logger = Lumberjack::Logger.new($stdout, progname: self.class.to_s)

g
Expand Down

0 comments on commit d6947d3

Please sign in to comment.