From 7509f6b6c191e8e39b860768f9d9b642bb95de9f Mon Sep 17 00:00:00 2001 From: John Mair Date: Tue, 30 Aug 2011 03:00:13 +1200 Subject: [PATCH] Pry.editor -> Pry.config.editor --- lib/pry/config.rb | 4 ++-- lib/pry/default_commands/introspection.rb | 6 +++--- lib/pry/helpers/command_helpers.rb | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/pry/config.rb b/lib/pry/config.rb index 0c39f46b..0f311dbe 100644 --- a/lib/pry/config.rb +++ b/lib/pry/config.rb @@ -51,9 +51,9 @@ class Pry # return value of that callable invocation is used as the exact # shell command to invoke the editor. # @example String - # Pry.editor = "emacsclient" + # Pry.config.editor = "emacsclient" # @example Callable - # Pry.editor = proc { |file, line| "emacsclient #{file} +#{line}" } + # Pry.config.editor = proc { |file, line| "emacsclient #{file} +#{line}" } # @return [String, #call] attr_accessor :editor diff --git a/lib/pry/default_commands/introspection.rb b/lib/pry/default_commands/introspection.rb index 6e8d168b..46e375f6 100644 --- a/lib/pry/default_commands/introspection.rb +++ b/lib/pry/default_commands/introspection.rb @@ -112,7 +112,7 @@ class Pry opts = Slop.parse!(args) do |opt| opt.banner "Usage: edit [OPTIONS] [FILE]\n" \ "Edit the method FILE in an editor.\n" \ - "Ensure #{text.bold("Pry.editor")} is set to your editor of choice.\n" \ + "Ensure #{text.bold("Pry.config.editor")} is set to your editor of choice.\n" \ "e.g: edit sample.rb" opt.on :r, "reload", "Eval file content after editing (evals at top level)" @@ -168,7 +168,7 @@ class Pry opts = Slop.parse!(args) do |opt| opt.banner "Usage: edit-method [OPTIONS] [METH]\n" \ "Edit the method METH in an editor.\n" \ - "Ensure #{text.bold("Pry.editor")} is set to your editor of choice.\n" \ + "Ensure #{text.bold("Pry.config.editor")} is set to your editor of choice.\n" \ "e.g: edit-method hello_method" opt.on :M, "instance-methods", "Operate on instance methods." @@ -191,7 +191,7 @@ class Pry next end - next output.puts "Error: No editor set!\nEnsure that #{text.bold("Pry.editor")} is set to your editor of choice." if !Pry.editor + next output.puts "Error: No editor set!\nEnsure that #{text.bold("Pry.config.editor")} is set to your editor of choice." if !Pry.config.editor if is_a_c_method?(meth) output.puts "Error: Can't edit a C method." diff --git a/lib/pry/helpers/command_helpers.rb b/lib/pry/helpers/command_helpers.rb index d224ae79..60598cae 100644 --- a/lib/pry/helpers/command_helpers.rb +++ b/lib/pry/helpers/command_helpers.rb @@ -333,10 +333,10 @@ class Pry end def invoke_editor(file, line) - if Pry.editor.respond_to?(:call) - editor_invocation = Pry.editor.call(file, line) + if Pry.config.editor.respond_to?(:call) + editor_invocation = Pry.config.editor.call(file, line) else - editor_invocation = "#{Pry.editor} #{start_line_syntax_for_editor(file, line)}" + editor_invocation = "#{Pry.config.editor} #{start_line_syntax_for_editor(file, line)}" end run ".#{editor_invocation}" @@ -345,7 +345,7 @@ class Pry def start_line_syntax_for_editor(file_name, line_number) file_name = file_name.gsub(/\//, '\\') if RUBY_PLATFORM =~ /mswin|mingw/ - case Pry.editor + case Pry.config.editor when /^[gm]?vi/, /^emacs/, /^nano/, /^pico/, /^gedit/, /^kate/ "+#{line_number} #{file_name}" when /^mate/, /^geany/