-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- DiceBot#check_suc に移動 - パラメータを厳格化 - DiceBot#getDiceList, @diceText, @diffText を廃止
- Loading branch information
Showing
4 changed files
with
116 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Normalizer | ||
module_function | ||
|
||
# 比較演算子をシンボルに正規化する | ||
# | ||
# @param op [String] | ||
# @return [Symbol, nil] | ||
def cmp_op(op) | ||
case op | ||
when /<=|=</ | ||
:<= | ||
when />=|=>/ | ||
:>= | ||
when /<>|!=|=!/ | ||
:'!=' | ||
when /</ | ||
:< | ||
when />/ | ||
:> | ||
when /\=/ | ||
:== | ||
end | ||
end | ||
|
||
# 目標値を正規化する | ||
# | ||
# @param val [String] | ||
# @return [Integer, String] 整数か'?' | ||
def target_number(val) | ||
if val == '?' | ||
val | ||
else | ||
val.to_i | ||
end | ||
end | ||
end |