diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2018-10-28 16:07:44 +0800 |
---|---|---|
committer | Kyrylo Silin <silin@kyrylo.org> | 2018-10-28 16:07:44 +0800 |
commit | 3deeeee11596a13bd09280af6ba068eefc368df7 (patch) | |
tree | d25105999dd9ff446dbd2491eb0679e506829d48 | |
parent | a567efdffcaf64745be170f9b2ce1c9225ebacf4 (diff) | |
download | pry-3deeeee11596a13bd09280af6ba068eefc368df7.tar.gz |
config/default: rename prompt_safe_objects to prompt_safe_contexts
It makes sense to rename it because "objects" we are referring in the context of
prompt are actually prompt "contexts".
-rw-r--r-- | lib/pry/config/default.rb | 4 | ||||
-rw-r--r-- | lib/pry/prompt.rb | 2 | ||||
-rw-r--r-- | lib/pry/pry_class.rb | 2 | ||||
-rw-r--r-- | spec/pry_defaults_spec.rb | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/lib/pry/config/default.rb b/lib/pry/config/default.rb index 7e5d6b13..09e9eb4c 100644 --- a/lib/pry/config/default.rb +++ b/lib/pry/config/default.rb @@ -18,8 +18,8 @@ class Pry::Config::Default prompt: proc { Pry::Prompt::DEFAULT }, - prompt_safe_objects: proc { - Pry::Prompt::SAFE_OBJECTS + prompt_safe_contexts: proc { + Pry::Prompt::SAFE_CONTEXTS }, print: proc { Pry::DEFAULT_PRINT diff --git a/lib/pry/prompt.rb b/lib/pry/prompt.rb index e0ad2749..63941bd5 100644 --- a/lib/pry/prompt.rb +++ b/lib/pry/prompt.rb @@ -2,7 +2,7 @@ class Pry class Prompt DEFAULT_NAME = 'pry'.freeze - SAFE_OBJECTS = [String, Numeric, Symbol, nil, true, false].freeze + SAFE_CONTEXTS = [String, Numeric, Symbol, nil, true, false].freeze # @return [String] DEFAULT_TEMPLATE = diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index eb19af8b..eea5e4f7 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -241,7 +241,7 @@ you can add "Pry.config.windows_console_warning = false" to your pryrc. # fixed as of https://github.com/jruby/jruby/commit/d365ebd309cf9df3dde28f5eb36ea97056e0c039 # we can drop in the future. obj.to_s - elsif Pry.config.prompt_safe_objects.any? { |v| v === obj } && obj.inspect.length <= max + elsif Pry.config.prompt_safe_contexts.any? { |v| v === obj } && obj.inspect.length <= max obj.inspect else id == true ? "#<#{obj.class}:0x%x>" % (obj.object_id << 1) : "#<#{obj.class}>" diff --git a/spec/pry_defaults_spec.rb b/spec/pry_defaults_spec.rb index 4fa36190..56a5faf9 100644 --- a/spec/pry_defaults_spec.rb +++ b/spec/pry_defaults_spec.rb @@ -274,7 +274,7 @@ describe "test Pry defaults" do it "returns the #inspect of the custom prompt safe objects" do Barbie = Class.new { def inspect; "life is plastic, it's fantastic" end } - Pry.config.prompt_safe_objects << Barbie + Pry.config.prompt_safe_contexts << Barbie output = Pry.view_clip(Barbie.new, DEFAULT_OPTIONS) expect(output).to eq "life is plastic, it's fantastic" end |