Class: TL1::Session::WaitforWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/tl1/session.rb

Overview

Wraps objects that support ‘#waitfor` but not `#expect`, such as Net::Telnet and Net::SSH::Telnet. It is used transparently by `TL1::Session#initialize` for those classes, so it shouldn’t be necessary to use it directly. If you are defining a new class that responds to ‘#waitfor`, you can define your own `#expect` method instead of using this.

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ WaitforWrapper

Returns a new instance of WaitforWrapper.



73
74
75
# File 'lib/tl1/session.rb', line 73

def initialize(io)
  @io = io
end

Instance Method Details

#expect(pattern, timeout) ⇒ Object



77
78
79
# File 'lib/tl1/session.rb', line 77

def expect(pattern, timeout)
  @io.waitfor('Match' => pattern, 'Timeout' => timeout)
end

#write(*args) ⇒ Object



81
82
83
# File 'lib/tl1/session.rb', line 81

def write(*args)
  @io.write(*args)
end