Skip to content

Commit

Permalink
Merge pull request #149 from nanobowers/frozen_string_literal
Browse files Browse the repository at this point in the history
Enable frozen_string_literal for future-ruby support
  • Loading branch information
Fryguy committed May 1, 2024
2 parents 7431ace + 871a23a commit ea2af09
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/optimist.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# lib/optimist.rb -- optimist command-line processing library
# Copyright (c) 2008-2014 William Morgan.
# Copyright (c) 2014 Red Hat, Inc.
Expand Down Expand Up @@ -531,7 +533,7 @@ def each_arg(args)
end
i += 1
when /^-(\S+)$/ # one or more short arguments
short_remaining = ""
short_remaining = []
shortargs = $1.split(//)
shortargs.each_with_index do |a, j|
if j == (shortargs.length - 1)
Expand All @@ -541,7 +543,7 @@ def each_arg(args)
unless num_params_taken
short_remaining << a
if @stop_on_unknown
remains << "-#{short_remaining}"
remains << "-#{short_remaining.join}"
return remains += args[i + 1..-1]
end
else
Expand All @@ -551,16 +553,16 @@ def each_arg(args)
unless yield "-#{a}", []
short_remaining << a
if @stop_on_unknown
short_remaining += shortargs[j + 1..-1].join
remains << "-#{short_remaining}"
short_remaining << shortargs[j + 1..-1].join
remains << "-#{short_remaining.join}"
return remains += args[i + 1..-1]
end
end
end
end

unless short_remaining.empty?
remains << "-#{short_remaining}"
remains << "-#{short_remaining.join}"
end
i += 1
else
Expand Down

0 comments on commit ea2af09

Please sign in to comment.