Skip to content

Commit

Permalink
Refactor ARGV handling by centralizing in Ocran.init
Browse files Browse the repository at this point in the history
- Centralized the handling of ARGV to the Ocran.init method to simplify how command-line arguments are managed within the application.
- Removed the ARGV parameter from the Ocran.init method, as it now directly accesses ARGV internally. This change reduces redundancy and improves the clarity of method interfaces.

This update streamlines the initialization process of Ocran, ensuring that command-line arguments are handled consistently and more efficiently.
shinokaro committed Jun 14, 2024
1 parent 8ac665c commit 72e267d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/ocran
Original file line number Diff line number Diff line change
@@ -285,9 +285,10 @@ EOF
@rubyopt ||= @options[:rubyopt] || ENV["RUBYOPT"] || ""
end

def Ocran.init(argv)
def Ocran.init
save_environment
parseargs(argv)
parseargs(ARGV)
ARGV.replace(Ocran.arg)
IGNORE_MODULES.push(*ObjectSpace.each_object(Module).to_a)
end

@@ -806,8 +807,7 @@ EOF
end # module Ocran

if File.basename(__FILE__) == File.basename($PROGRAM_NAME)
Ocran.init(ARGV)
ARGV.replace(Ocran.arg)
Ocran.init

unless Ocran.main_script.exist?
Ocran.fatal_error "#{Ocran.main_script} was not found!"

0 comments on commit 72e267d

Please sign in to comment.