Skip to content

Commit 8fa688e

Browse files
authored
Remove useless begin/end [ci skip] (#680)
The `rescue` was removed at 420e7d227011.
1 parent 3847532 commit 8fa688e

File tree

1 file changed

+48
-50
lines changed

1 file changed

+48
-50
lines changed

lib/irb/input-method.rb

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -159,66 +159,64 @@ def close
159159
end
160160
end
161161

162-
begin
163-
class ReadlineInputMethod < StdioInputMethod
164-
def self.initialize_readline
165-
require "readline"
166-
rescue LoadError
167-
else
168-
include ::Readline
169-
end
162+
class ReadlineInputMethod < StdioInputMethod
163+
def self.initialize_readline
164+
require "readline"
165+
rescue LoadError
166+
else
167+
include ::Readline
168+
end
170169

171-
include HistorySavingAbility
170+
include HistorySavingAbility
172171

173-
# Creates a new input method object using Readline
174-
def initialize
175-
self.class.initialize_readline
176-
if Readline.respond_to?(:encoding_system_needs)
177-
IRB.__send__(:set_encoding, Readline.encoding_system_needs.name, override: false)
178-
end
172+
# Creates a new input method object using Readline
173+
def initialize
174+
self.class.initialize_readline
175+
if Readline.respond_to?(:encoding_system_needs)
176+
IRB.__send__(:set_encoding, Readline.encoding_system_needs.name, override: false)
177+
end
179178

180-
super
179+
super
181180

182-
@eof = false
181+
@eof = false
183182

184-
if Readline.respond_to?("basic_word_break_characters=")
185-
Readline.basic_word_break_characters = IRB::InputCompletor::BASIC_WORD_BREAK_CHARACTERS
186-
end
187-
Readline.completion_append_character = nil
188-
Readline.completion_proc = IRB::InputCompletor::CompletionProc
183+
if Readline.respond_to?("basic_word_break_characters=")
184+
Readline.basic_word_break_characters = IRB::InputCompletor::BASIC_WORD_BREAK_CHARACTERS
189185
end
186+
Readline.completion_append_character = nil
187+
Readline.completion_proc = IRB::InputCompletor::CompletionProc
188+
end
190189

191-
# Reads the next line from this input method.
192-
#
193-
# See IO#gets for more information.
194-
def gets
195-
Readline.input = @stdin
196-
Readline.output = @stdout
197-
if l = readline(@prompt, false)
198-
HISTORY.push(l) if !l.empty?
199-
@line[@line_no += 1] = l + "\n"
200-
else
201-
@eof = true
202-
l
203-
end
190+
# Reads the next line from this input method.
191+
#
192+
# See IO#gets for more information.
193+
def gets
194+
Readline.input = @stdin
195+
Readline.output = @stdout
196+
if l = readline(@prompt, false)
197+
HISTORY.push(l) if !l.empty?
198+
@line[@line_no += 1] = l + "\n"
199+
else
200+
@eof = true
201+
l
204202
end
203+
end
205204

206-
# Whether the end of this input method has been reached, returns +true+
207-
# if there is no more data to read.
208-
#
209-
# See IO#eof? for more information.
210-
def eof?
211-
@eof
212-
end
205+
# Whether the end of this input method has been reached, returns +true+
206+
# if there is no more data to read.
207+
#
208+
# See IO#eof? for more information.
209+
def eof?
210+
@eof
211+
end
213212

214-
# For debug message
215-
def inspect
216-
readline_impl = (defined?(Reline) && Readline == Reline) ? 'Reline' : 'ext/readline'
217-
str = "ReadlineInputMethod with #{readline_impl} #{Readline::VERSION}"
218-
inputrc_path = File.expand_path(ENV['INPUTRC'] || '~/.inputrc')
219-
str += " and #{inputrc_path}" if File.exist?(inputrc_path)
220-
str
221-
end
213+
# For debug message
214+
def inspect
215+
readline_impl = (defined?(Reline) && Readline == Reline) ? 'Reline' : 'ext/readline'
216+
str = "ReadlineInputMethod with #{readline_impl} #{Readline::VERSION}"
217+
inputrc_path = File.expand_path(ENV['INPUTRC'] || '~/.inputrc')
218+
str += " and #{inputrc_path}" if File.exist?(inputrc_path)
219+
str
222220
end
223221
end
224222

0 commit comments

Comments
 (0)