Skip to content

Commit

Permalink
Merge pull request #746 from deivid-rodriguez/replace_set_usage_with_…
Browse files Browse the repository at this point in the history
…arrays

🌈 Replace `set` usages with arrays
  • Loading branch information
rafaelfranca authored Jan 20, 2021
2 parents 80c6d19 + 34e71db commit e94bfe9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/thor.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "set"
require_relative "thor/base"

class Thor
Expand Down Expand Up @@ -324,7 +323,7 @@ def check_unknown_options?(config) #:nodoc:
# ==== Parameters
# Symbol ...:: A list of commands that should be affected.
def stop_on_unknown_option!(*command_names)
stop_on_unknown_option.merge(command_names)
@stop_on_unknown_option = stop_on_unknown_option | command_names
end

def stop_on_unknown_option?(command) #:nodoc:
Expand All @@ -338,7 +337,7 @@ def stop_on_unknown_option?(command) #:nodoc:
# ==== Parameters
# Symbol ...:: A list of commands that should be affected.
def disable_required_check!(*command_names)
disable_required_check.merge(command_names)
@disable_required_check = disable_required_check | command_names
end

def disable_required_check?(command) #:nodoc:
Expand All @@ -348,12 +347,12 @@ def disable_required_check?(command) #:nodoc:
protected

def stop_on_unknown_option #:nodoc:
@stop_on_unknown_option ||= Set.new
@stop_on_unknown_option ||= []
end

# help command has the required check disabled by default.
def disable_required_check #:nodoc:
@disable_required_check ||= Set.new([:help])
@disable_required_check ||= [:help]
end

# The method responsible for dispatching given the args.
Expand Down

0 comments on commit e94bfe9

Please sign in to comment.