@@ -159,66 +159,64 @@ def close
159
159
end
160
160
end
161
161
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
170
169
171
- include HistorySavingAbility
170
+ include HistorySavingAbility
172
171
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
179
178
180
- super
179
+ super
181
180
182
- @eof = false
181
+ @eof = false
183
182
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
189
185
end
186
+ Readline . completion_append_character = nil
187
+ Readline . completion_proc = IRB ::InputCompletor ::CompletionProc
188
+ end
190
189
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
204
202
end
203
+ end
205
204
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
213
212
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
222
220
end
223
221
end
224
222
0 commit comments