Skip to content

Commit

Permalink
Rename to Normalize.comparison_operator
Browse files Browse the repository at this point in the history
  • Loading branch information
ysakasin committed Apr 1, 2020
1 parent 6456840 commit 414bf48
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/dice/AddDice.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

require "utils/normalizer"
require "utils/normalize"

class AddDice
def initialize(bcdice, diceBot)
Expand Down Expand Up @@ -91,8 +91,8 @@ def rollDice(string)
total_n += revision

if signOfInequality != "" # 成功度判定処理
cmp_op = Normalizer.comparison_op(signOfInequality)
target = Normalizer.target_number(diffText)
cmp_op = Normalize.comparison_operator(signOfInequality)
target = Normalize.target_number(diffText)
successText = @diceBot.check_result(total_n, dice_n, @dice_list, dice_max, cmp_op, target)
debug("check_suc successText", successText)
output += successText
Expand Down
2 changes: 1 addition & 1 deletion src/diceBot/BeastBindTrinity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def bbt_check(string)
end

if signOfInequality != "" # 成功度判定処理
cmp_op = Normalizer.comparison_op(signOfInequality)
cmp_op = Normalize.comparison_operator(signOfInequality)
dice_list = dice_num
output += check_result(total_n, dice_now, dice_list, 6, cmp_op, diff)
end
Expand Down
2 changes: 1 addition & 1 deletion src/diceBot/DarkBlaze.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def check_roll(string, nick_e)

if signOfInequality != "" # 成功度判定処理
dice_total = dice_list.inject(&:+)
cmp_op = Normalizer.comparison_op(signOfInequality)
cmp_op = Normalize.comparison_operator(signOfInequality)
output += check_result(total, dice_total, dice_list, 6, cmp_op, diff)
end

Expand Down
2 changes: 1 addition & 1 deletion src/diceBot/MeikyuDays.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def checkRoll(string)
end

if signOfInequality != "" # 成功度判定処理
cmp_op = Normalizer.comparison_op(signOfInequality)
cmp_op = Normalize.comparison_operator(signOfInequality)
output += check_2D6(total_n, dice_now, dice_num, cmp_op, diff)
end

Expand Down
2 changes: 1 addition & 1 deletion src/diceBot/MeikyuKingdom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def mayokin_check(string, nick_e)
end

if signOfInequality != "" # 成功度判定処理
cmp_op = Normalizer.comparison_op(signOfInequality)
cmp_op = Normalize.comparison_operator(signOfInequality)
output += check_result(total_n, dice_now, dice_list, 6, cmp_op, diff)
end

Expand Down
4 changes: 2 additions & 2 deletions src/utils/normalizer.rb → src/utils/normalize.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module Normalizer
module Normalize
module_function

# 比較演算子をシンボルに正規化する
#
# @param op [String]
# @return [Symbol, nil]
def comparison_op(op)
def comparison_operator(op)
case op
when /<=|=</
:<=
Expand Down

0 comments on commit 414bf48

Please sign in to comment.