Class Expect
In: lib/facet/expect.rb
Parent: Object

Expect

Given an IO object, read data from that object and expect certain data.

All expected data is expected in ‘chains’. When a message is received, it is compared to the pattern at the top of each chain. If it matches one of the patterns, then all is well, but an error message is printed otherwise.

A message can match patterns in more than one chain.

Synopsis

  require 'carat/expect'

  # to do

Legal

Adopted from Ruby Treasures 0.4 Copyright (C) 2002 Paul Brannan <paul@atdesk.com>

You may distribute this software under the same terms as Ruby (see the file COPYING that was distributed with this library).

History

  $Id: expect.rb, v0.4 2004/11/30 transami Exp $

Methods

expect   handle_event   handle_line   ignore   new   reset   run  

Classes and Modules

Class Expect::DefaultChain
Class Expect::SeparatedPattern
Class Expect::Timeout
Class Expect::UnmatchedMessage

Constants

VERSION = "0.4"

Attributes

timeout  [RW]  It is highly recommended that this be an immutable object.

Public Class methods

Create a new Expect_Test object.

@param io_object an IO object to read from. @param reactor a reactor to use

Public Instance methods

Expect a message matching pattern in a certain chain.

@param pattern the pattern to expect. @param chain the chain in which to expect the message.

Ignore a pattern in all chains.

@param pattern the pattern to ignore.

Reset the the ignore chain and all expect chains.

[Validate]