Skip to content

Commit

Permalink
Avoid newer ruby range syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Jul 27, 2022
1 parent d7c9135 commit 0974810
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/dotenv/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def expand_newlines(value)
end

def variable_not_set?(line)
!line.split[1..].all? { |var| @hash.member?(var) }
!line.split[1..-1].all? { |var| @hash.member?(var) }
end

def unescape_value(value, maybe_quote)
Expand Down
2 changes: 1 addition & 1 deletion lib/dotenv/substitutions/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def call(value, _env, _is_load)

if $LAST_MATCH_INFO[:backslash]
# Command is escaped, don't replace it.
$LAST_MATCH_INFO[0][1..]
$LAST_MATCH_INFO[0][1..-1]
else
# Execute the command and return the value
`#{command}`.chomp
Expand Down
2 changes: 1 addition & 1 deletion lib/dotenv/substitutions/variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def call(value, env, is_load)

def substitute(match, variable, env)
if match[1] == "\\"
variable[1..]
variable[1..-1]
elsif match[3]
env.fetch(match[3], "")
else
Expand Down

0 comments on commit 0974810

Please # to comment.