From fd9a23eb30aec723d0775d72a31e93280409d3fb Mon Sep 17 00:00:00 2001 From: Robert Gleeson Date: Fri, 7 Feb 2014 01:55:48 +0100 Subject: [PATCH] update 'cat' command to use _pry_.config.default_window_size --- lib/pry/commands/cat/exception_formatter.rb | 8 ++++---- lib/pry/commands/cat/file_formatter.rb | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/pry/commands/cat/exception_formatter.rb b/lib/pry/commands/cat/exception_formatter.rb index ca6818da..f794c68d 100644 --- a/lib/pry/commands/cat/exception_formatter.rb +++ b/lib/pry/commands/cat/exception_formatter.rb @@ -1,9 +1,9 @@ class Pry class Command::Cat class ExceptionFormatter < AbstractFormatter - attr_accessor :ex - attr_accessor :opts - attr_accessor :_pry_ + attr_reader :ex + attr_reader :opts + attr_reader :_pry_ def initialize(exception, _pry_, opts) @ex = exception @@ -23,7 +23,7 @@ class Pry private def code_window_size - Pry.config.default_window_size || 5 + _pry_.config.default_window_size || 5 end def backtrace_level diff --git a/lib/pry/commands/cat/file_formatter.rb b/lib/pry/commands/cat/file_formatter.rb index a03655fb..92c62688 100644 --- a/lib/pry/commands/cat/file_formatter.rb +++ b/lib/pry/commands/cat/file_formatter.rb @@ -1,9 +1,9 @@ class Pry class Command::Cat class FileFormatter < AbstractFormatter - attr_accessor :file_with_embedded_line - attr_accessor :opts - attr_accessor :_pry_ + attr_reader :file_with_embedded_line + attr_reader :opts + attr_reader :_pry_ def initialize(file_with_embedded_line, _pry_, opts) @file_with_embedded_line = file_with_embedded_line @@ -36,7 +36,7 @@ class Pry end def code_window_size - Pry.config.default_window_size || 7 + _pry_.config.default_window_size || 7 end def decorate(content) @@ -49,7 +49,7 @@ class Pry def detect_code_type_from_file(file_name) code_type = @code_from_file.code_type - + if code_type == :unknown name, ext = File.basename(file_name).split('.', 2) case name