summaryrefslogtreecommitdiff
path: root/lib/reline
diff options
context:
space:
mode:
authorStan Lo <stan001212@gmail.com>2023-07-07 18:27:14 +0100
committergit <svn-admin@ruby-lang.org>2023-07-07 17:27:25 +0000
commit24d9e21f84eced634b3e443ada2a57621b2b4b9b (patch)
tree96ecaa8228d6b04c80b48047e8a77abc15b5cb61 /lib/reline
parenta642a94b68a31c0e7c092087114c269132cdb159 (diff)
[ruby/reline] Reduce direct references to `Reline::IOGate`
(https://github.com/ruby/reline/pull/566) * Avoid referencing IOGate from IOGate classes The only time those classes being used is when themselves being the IOGate. So when referencing to IOGate, it's better to use `self` instead. * Avoid referencing to IOGate from LineEditor directly * Avoid referencing to IOGate from Core directly * Reference to Reline.core directly * Replace Reline::IOGate with Reline.core.io_gate
Diffstat (limited to 'lib/reline')
-rw-r--r--lib/reline/ansi.rb2
-rw-r--r--lib/reline/line_editor.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb
index 06ea9efd09..1e018d4e82 100644
--- a/lib/reline/ansi.rb
+++ b/lib/reline/ansi.rb
@@ -206,7 +206,7 @@ class Reline::ANSI
end
def self.in_pasting?
- @@in_bracketed_paste_mode or (not Reline::IOGate.empty_buffer?)
+ @@in_bracketed_paste_mode or (not empty_buffer?)
end
def self.empty_buffer?
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 404a595f9c..4030902139 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -60,6 +60,10 @@ class Reline::LineEditor
reset_variables(encoding: encoding)
end
+ def io_gate
+ Reline::IOGate
+ end
+
def set_pasting_state(in_pasting)
@in_pasting = in_pasting
end