Refactor lib/pry/commands/ls/globals.rb format method.