Skip to content

Commit c2ef3ef

Browse files
committed
Accept mode arguments for tty? in the stty backend
Only the `:any` mode, which is equivalent to the default `nil`.
1 parent d2bb01c commit c2ef3ef

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

  • jruby/lib/io/console/backend

‎jruby/lib/io/console/backend/stty.rb‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,23 @@ def oflush
208208

209209
def ioflush
210210
end
211+
212+
module PlatformStty # :nodoc:
213+
def tty?(*modes)
214+
modes.each do |mode|
215+
case mode
216+
when nil
217+
when :any
218+
when Symbol
219+
raise ArgumentError, "unknown tty type: #{mode.inspect}"
220+
else
221+
raise TypeError, "wrong argument type #{mode.class} (expected Symbol)"
222+
end
223+
end
224+
super()
225+
end
226+
end
227+
private_constant :PlatformStty
228+
229+
prepend PlatformStty
211230
end

0 commit comments

Comments
 (0)