diff --git a/lib/pry/cli.rb b/lib/pry/cli.rb index c27bc154..55f77d4a 100644 --- a/lib/pry/cli.rb +++ b/lib/pry/cli.rb @@ -114,7 +114,7 @@ Copyright (c) 2013 John Mair (banisterfiend) -- } on :e, :exec=, "A line of code to execute in context before the session starts" do |input| - exec_string << input + "\n" + exec_string << input << "\n" end on "no-pager", "Disable pager for long output" do @@ -155,7 +155,7 @@ Copyright (c) 2013 John Mair (banisterfiend) puts "Installed Plugins:" puts "--" Pry.locate_plugins.each do |plugin| - puts "#{plugin.name}".ljust(18) + plugin.spec.summary + puts "#{plugin.name}".ljust(18) << plugin.spec.summary end exit end diff --git a/lib/pry/code.rb b/lib/pry/code.rb index d7eedb5b..5655d394 100644 --- a/lib/pry/code.rb +++ b/lib/pry/code.rb @@ -356,7 +356,7 @@ class Pry # # @return [String] def raw - @lines.map(&:line).join("\n") + "\n" + @lines.map(&:line).join("\n") << "\n" end # Return the number of lines stored. diff --git a/lib/pry/command.rb b/lib/pry/command.rb index 81f4eb26..4b3cb9de 100644 --- a/lib/pry/command.rb +++ b/lib/pry/command.rb @@ -307,8 +307,7 @@ class Pry collision_type ||= 'local-variable' if arg_string.match(%r{\A\s*[-+*/%&|^]*=}) if collision_type - output.puts "#{text.bold('WARNING:')} Calling Pry command '#{command_match}'," + - "which conflicts with a #{collision_type}.\n\n" + output.puts "#{text.bold('WARNING:')} Calling Pry command '#{command_match}', which conflicts with a #{collision_type}.\n\n" end rescue Pry::RescuableException end diff --git a/lib/pry/command_set.rb b/lib/pry/command_set.rb index b1d1e199..ce0d63b5 100644 --- a/lib/pry/command_set.rb +++ b/lib/pry/command_set.rb @@ -410,7 +410,7 @@ class Pry else commands.keys.select do |key| String === key && key.start_with?(search) - end.map{ |key| key + " " } + Bond::DefaultMission.completions + end.map{ |key| key + " " } << Bond::DefaultMission.completions end end end diff --git a/lib/pry/commands.rb b/lib/pry/commands.rb index 2472d02c..4b85ada1 100644 --- a/lib/pry/commands.rb +++ b/lib/pry/commands.rb @@ -1,6 +1,6 @@ # Default commands used by Pry. Pry::Commands = Pry::CommandSet.new -Dir[File.expand_path('../commands', __FILE__) + '/*.rb'].each do |file| +Dir[File.expand_path('../commands', __FILE__) << '/*.rb'].each do |file| require file end diff --git a/lib/pry/commands/amend_line.rb b/lib/pry/commands/amend_line.rb index cb4ef415..838d5c85 100644 --- a/lib/pry/commands/amend_line.rb +++ b/lib/pry/commands/amend_line.rb @@ -48,11 +48,11 @@ class Pry def insert_into_array(array, range) insert_slot = Array(range).first - array.insert(insert_slot, arg_string[1..-1] + "\n") + array.insert(insert_slot, arg_string[1..-1] << "\n") end def replace_in_array(array, range) - array[range] = arg_string + "\n" + array[range] = arg_string << "\n" end # @return [Fixnum] The number of lines currently in `eval_string` (the input buffer). diff --git a/lib/pry/commands/find_method.rb b/lib/pry/commands/find_method.rb index 0bead171..3e61c351 100644 --- a/lib/pry/commands/find_method.rb +++ b/lib/pry/commands/find_method.rb @@ -97,7 +97,7 @@ class Pry output.puts text.bold(klass.name) grouped[klass].each do |method| header = method.name_with_owner - output.puts header + additional_info(header, method) + output.puts header << additional_info(header, method) end end @@ -105,7 +105,7 @@ class Pry # if `-c` was not given def additional_info(header, method) if opts.content? - ": " + colorize_code(matched_method_lines(header, method)) + ": " << colorize_code(matched_method_lines(header, method)) else "" end diff --git a/lib/pry/commands/help.rb b/lib/pry/commands/help.rb index e6e4e198..d4c9473d 100644 --- a/lib/pry/commands/help.rb +++ b/lib/pry/commands/help.rb @@ -59,7 +59,7 @@ class Pry # @param [Array]] commands # @return [String] The generated help string. def help_text_for_commands(name, commands) - "#{text.bold(name)}\n" + commands.map do |command| + "#{text.bold(name)}\n" << commands.map do |command| " #{command.options[:listing].to_s.ljust(18)} #{command.description}" end.join("\n") end diff --git a/lib/pry/commands/ls.rb b/lib/pry/commands/ls.rb index 441138d8..b4616fa3 100644 --- a/lib/pry/commands/ls.rb +++ b/lib/pry/commands/ls.rb @@ -34,8 +34,8 @@ class Pry opt.on :v, :verbose, "Show methods and constants on all super-classes (ignores Pry.config.ls.ceiling)" opt.on :g, :globals, "Show global variables, including those builtin to Ruby (in cyan)" opt.on :l, :locals, "Show hash of local vars, sorted by descending size" - opt.on :c, :constants, "Show constants, highlighting classes (in blue), and exceptions (in purple).\n" + - " " * 32 + "Constants that are pending autoload? are also shown (in yellow)" + opt.on :c, :constants, "Show constants, highlighting classes (in blue), and exceptions (in purple).\n" << + " " * 32 << "Constants that are pending autoload? are also shown (in yellow)" opt.on :i, :ivars, "Show instance variables (in blue) and class variables (in bright blue)" opt.on :G, :grep, "Filter output by regular expression", :argument => true diff --git a/lib/pry/commands/pry_backtrace.rb b/lib/pry/commands/pry_backtrace.rb index d27a4816..bac23514 100644 --- a/lib/pry/commands/pry_backtrace.rb +++ b/lib/pry/commands/pry_backtrace.rb @@ -17,8 +17,8 @@ class Pry BANNER def process - stagger_output text.bold('Backtrace:') + - "\n--\n" + _pry_.backtrace.join("\n") + stagger_output text.bold('Backtrace:') << + "\n--\n" << _pry_.backtrace.join("\n") end end diff --git a/lib/pry/commands/show_info.rb b/lib/pry/commands/show_info.rb index e2d65bb9..722e656d 100644 --- a/lib/pry/commands/show_info.rb +++ b/lib/pry/commands/show_info.rb @@ -63,7 +63,7 @@ class Pry end def content_and_header_for_code_object(code_object) - header(code_object) + content_for(code_object) + header(code_object) << content_for(code_object) end def content_and_headers_for_all_module_candidates(mod) @@ -95,7 +95,7 @@ class Pry h << code_object_header(code_object, line_num) h << "\n#{Pry::Helpers::Text.bold('Number of lines:')} " << "#{content_for(code_object).lines.count}\n\n" - h << Helpers::Text.bold('** Warning:') + " Cannot find code for #{@original_code_object.nonblank_name}. Showing superclass #{code_object.nonblank_name} instead. **\n\n" if @used_super + h << Helpers::Text.bold('** Warning:') << " Cannot find code for #{@original_code_object.nonblank_name}. Showing superclass #{code_object.nonblank_name} instead. **\n\n" if @used_super h end @@ -128,7 +128,7 @@ class Pry h << " #{text.bold('name:')} #{code_object.nonblank_name}" if code_object.number_of_candidates > 1 - h << (text.bold("\nNumber of monkeypatches: ") + code_object.number_of_candidates.to_s) + h << (text.bold("\nNumber of monkeypatches: ") << code_object.number_of_candidates.to_s) h << ". Use the `-a` option to display all available monkeypatches" end h diff --git a/lib/pry/commands/whereami.rb b/lib/pry/commands/whereami.rb index 134472bc..2ec82252 100644 --- a/lib/pry/commands/whereami.rb +++ b/lib/pry/commands/whereami.rb @@ -88,8 +88,8 @@ class Pry set_file_and_dir_locals(@file) - out = "\n#{text.bold('From:')} #{location}:\n\n" + - code.with_line_numbers(use_line_numbers?).with_marker(marker).to_s + "\n" + out = "\n#{text.bold('From:')} #{location}:\n\n" << + code.with_line_numbers(use_line_numbers?).with_marker(marker).to_s << "\n" stagger_output(out) end diff --git a/lib/pry/completion.rb b/lib/pry/completion.rb index 03e5e74d..42fd8c5c 100644 --- a/lib/pry/completion.rb +++ b/lib/pry/completion.rb @@ -112,7 +112,7 @@ class Pry # Symbol if Symbol.respond_to?(:all_symbols) sym = Regexp.quote($1) - candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} + candidates = Symbol.all_symbols.collect{|s| ":" << s.id2name} candidates.grep(/^#{sym}/) else @@ -123,7 +123,7 @@ class Pry # Absolute Constant or class methods receiver = $1 candidates = Object.constants.collect(&:to_s) - candidates.grep(/^#{receiver}/).collect{|e| "::" + e} + candidates.grep(/^#{receiver}/).collect{|e| "::" << e} # Complete target symbols @@ -151,7 +151,7 @@ class Pry rescue RescuableException candidates = [] end - candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} + candidates.grep(/^#{message}/).collect{|e| receiver << "::" << e} when /^(:[^:.]+)\.([^.]*)$/ # Symbol @@ -261,10 +261,10 @@ class Pry candidates.grep(/^#{message}/).collect { |e| case e when /^[a-zA-Z_]/ - path.call(receiver + "." + e) + path.call(receiver + "." << e) when /^[0-9]/ when *Operators - #receiver + " " + e + #receiver + " " << e end }.compact end diff --git a/lib/pry/indent.rb b/lib/pry/indent.rb index e760655c..848454a4 100644 --- a/lib/pry/indent.rb +++ b/lib/pry/indent.rb @@ -94,8 +94,8 @@ class Pry indent = new lines = str.split("\n") n = line_number - 1 - to_indent = lines[0...n] + (lines[n] || "").split("def").first(1) - indent.indent(to_indent.join("\n") + "\n") + to_indent = lines[0...n] << (lines[n] || "").split("def").first(1) + indent.indent(to_indent.join("\n") << "\n") indent.module_nesting end @@ -156,7 +156,7 @@ class Pry before.times{ prefix.sub! SPACES, '' } new_prefix = prefix + SPACES * after - line = prefix + line.lstrip unless previously_in_string + line = prefix << line.lstrip unless previously_in_string output += line @@ -384,7 +384,7 @@ class Pry # @return [String] def correct_indentation(prompt, code, overhang=0) prompt = prompt.delete("\001\002") - line_to_measure = Pry::Helpers::Text.strip_color(prompt) + code + line_to_measure = Pry::Helpers::Text.strip_color(prompt) << code whitespace = ' ' * overhang _, cols = Terminal.screen_size