Skip to content

Commit

Permalink
Reverse conditional ordering and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-lord committed Nov 9, 2017
1 parent a870154 commit 66af143
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/regexp-examples/repeaters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ class RangeRepeater < BaseRepeater
def initialize(group, min, has_comma, max)
super(group)
@min_repeats = min || 0
@max_repeats = if !has_comma
@min_repeats
else
@max_repeats = if has_comma # e.g. a{1,}, a{,3} or a{1,3}
[
max,
@min_repeats + RegexpExamples::Config.max_repeater_variance
].compact.min
else # e.g. a{1}
@min_repeats
end
end
end
Expand Down

0 comments on commit 66af143

Please sign in to comment.