Skip to content

Commit

Permalink
replace number with var
Browse files Browse the repository at this point in the history
  • Loading branch information
drinckes committed Dec 27, 2024
1 parent 21a7a9c commit eaee196
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ruby/lib/plus_codes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module PlusCodes
# The max number of characters can be placed before the separator.
SEPARATOR_POSITION = 8

# Minimum number of digits to process in a plus code.
MIN_CODE_LENGTH = 2

# Maximum number of digits to process in a plus code.
MAX_CODE_LENGTH = 15

Expand Down
3 changes: 2 additions & 1 deletion ruby/lib/plus_codes/open_location_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ def valid_character?(code)
end

def invalid_length?(code_length)
code_length < 2 || (code_length < PAIR_CODE_LENGTH && code_length.odd?)
code_length < MIN_CODE_LENGTH ||
(code_length < PAIR_CODE_LENGTH && code_length.odd?)
end

def padded(code)
Expand Down

0 comments on commit eaee196

Please sign in to comment.