[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
This commit is contained in:
Stan Lo 2023-07-07 18:27:14 +01:00 committed by git
parent a642a94b68
commit 24d9e21f84
15 changed files with 60 additions and 52 deletions

View file

@ -8,7 +8,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
@config.autocompletion = false
Reline::HISTORY.instance_variable_set(:@config, @config)
Reline::HISTORY.clear
@encoding = Reline::IOGate.encoding
@encoding = Reline.core.encoding
@line_editor = Reline::LineEditor.new(@config, @encoding)
@line_editor.reset(@prompt, encoding: @encoding)
end
@ -2167,7 +2167,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
# Unicode emoji test
def test_ed_insert_for_include_zwj_emoji
omit "This test is for UTF-8 but the locale is #{Reline::IOGate.encoding}" if Reline::IOGate.encoding != Encoding::UTF_8
omit "This test is for UTF-8 but the locale is #{Reline.core.encoding}" if Reline.core.encoding != Encoding::UTF_8
# U+1F468 U+200D U+1F469 U+200D U+1F467 U+200D U+1F466 is family: man, woman, girl, boy "👨‍👩‍👧‍👦"
input_keys("\u{1F468}") # U+1F468 is man "👨"
assert_line("\u{1F468}")
@ -2213,7 +2213,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
end
def test_ed_insert_for_include_valiation_selector
omit "This test is for UTF-8 but the locale is #{Reline::IOGate.encoding}" if Reline::IOGate.encoding != Encoding::UTF_8
omit "This test is for UTF-8 but the locale is #{Reline.core.encoding}" if Reline.core.encoding != Encoding::UTF_8
# U+0030 U+FE00 is DIGIT ZERO + VARIATION SELECTOR-1 "0"
input_keys("\u0030") # U+0030 is DIGIT ZERO
assert_line("\u0030")