module BCDice::Normalize
Public Instance Methods
comparison_operator(op)
click to toggle source
比較演算子をシンボルに正規化する
@param op [String] @return [Symbol, nil]
# File lib/bcdice/normalize.rb, line 11 def comparison_operator(op) case op when /<=|=</ :<= when />=|=>/ :>= when /<>|!=|=!/ :'!=' when /</ :< when />/ :> when /=/ :== end end
target_number(val)
click to toggle source
目標値を正規化する
@param val [String] @return [Integer, String] 整数か'?'
# File lib/bcdice/normalize.rb, line 32 def target_number(val) if val == "?" val else val.to_i end end