From 86206767f026aa8994156946f689b28c356fb3b2 Mon Sep 17 00:00:00 2001 From: John Mair Date: Mon, 7 Jan 2013 23:10:16 +0100 Subject: [PATCH] Pry::Command::Cat::FileFormatter: make format() private --- lib/pry/commands/cat/file_formatter.rb | 18 +++++++++--------- .../commands/cat/input_expression_formatter.rb | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/pry/commands/cat/file_formatter.rb b/lib/pry/commands/cat/file_formatter.rb index 02b32f6f..c60c55e8 100644 --- a/lib/pry/commands/cat/file_formatter.rb +++ b/lib/pry/commands/cat/file_formatter.rb @@ -11,6 +11,15 @@ class Pry @_pry_ = _pry_ end + def format + raise CommandError, "Must provide a filename, --in, or --ex." if !file_with_embedded_line + + set_file_and_dir_locals(file_name, _pry_, _pry_.current_context) + decorate(Pry::Code.from_file(file_name)) + end + + private + def file_and_line file_name, line_num = file_with_embedded_line.split(':') @@ -29,15 +38,6 @@ class Pry Pry.config.default_window_size || 7 end - def format - raise CommandError, "Must provide a filename, --in, or --ex." if !file_with_embedded_line - - set_file_and_dir_locals(file_name, _pry_, _pry_.current_context) - decorate(Pry::Code.from_file(file_name)) - end - - private - def decorate(content) line_number ? super.around(line_number, code_window_size) : super end diff --git a/lib/pry/commands/cat/input_expression_formatter.rb b/lib/pry/commands/cat/input_expression_formatter.rb index 674cd061..3650ede8 100644 --- a/lib/pry/commands/cat/input_expression_formatter.rb +++ b/lib/pry/commands/cat/input_expression_formatter.rb @@ -25,6 +25,7 @@ class Pry end private + def selected_input_items input_expressions[normalized_expression_range] || [] end