File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,11 @@ def filename_quote_characters=(v)
114114 end
115115
116116 def special_prefixes = ( v )
117- @special_prefixes = v . encode ( encoding )
117+ if v . nil?
118+ @special_prefixes = ''
119+ else
120+ @special_prefixes = v . encode ( encoding )
121+ end
118122 end
119123
120124 def completion_case_fold = ( v )
@@ -174,14 +178,26 @@ def dialog_proc(name_sym)
174178 end
175179
176180 def input = ( val )
177- raise TypeError unless val . respond_to? ( :getc ) or val . nil?
181+ raise TypeError unless val . respond_to? ( :getc )
178182 if val . respond_to? ( :getc ) && io_gate . respond_to? ( :input= )
179183 io_gate . input = val
184+ elsif val . nil?
185+ io_gate . input = STDIN
186+ return
187+ else
188+ # noop
189+ # Reline::Windows does not suppport input= method
180190 end
181191 end
182192
183193 def output = ( val )
184- raise TypeError unless val . respond_to? ( :write ) or val . nil?
194+ if val . nil?
195+ val = STDOUT
196+ return
197+ elsif !val . respond_to? ( :write )
198+ raise TypeError
199+ end
200+
185201 @output = val
186202 io_gate . output = val
187203 end
You can’t perform that action at this time.
0 commit comments