Skip to content

Commit

Permalink
There is no super method to check
Browse files Browse the repository at this point in the history
Thor will not inherit from any other class, and the goal is to allow
subclasses to override the sort_commands! method, so we don't need to
check for super.
  • Loading branch information
rafaelfranca committed May 11, 2023
1 parent 60abf76 commit b2590c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/thor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def help(command = nil, subcommand = true); super; end
# Can be overridden in the subclass to change the display order of the
# commands.
def sort_commands!(list)
defined?(super) ? super(list) : list.sort! { |a, b| a[0] <=> b[0] }
list.sort! { |a, b| a[0] <=> b[0] }
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/sort_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ def self.sort_commands!(list)
expect(@content).to match(/:help.+:a.+:z/m)
end
end
end
end

0 comments on commit b2590c1

Please sign in to comment.