Skip to content

Commit

Permalink
Refactor decide_reroll_cmp_op
Browse files Browse the repository at this point in the history
  • Loading branch information
ysakasin committed Jul 1, 2020
1 parent fd6b822 commit 55df1f4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/dice/RerollDice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,19 @@ def target_from_default
# @param m [MatchData]
# @return [Symbol]
def decide_reroll_cmp_op(m)
bracket_op = m[2]
bracket_number = m[3]
at_op = m[6]
at_number = m[7]
cmp_op = m[4]

op =
if m[2] && m[3]
m[2]
elsif m[6] && m[7]
m[6]
if bracket_op && bracket_number
bracket_op
elsif at_op && at_number
at_op
else
m[4]
cmp_op
end

Normalize.comparison_operator(op) || :>=
Expand Down

0 comments on commit 55df1f4

Please sign in to comment.