class Citrus::StringTerminal

A StringTerminal is a Terminal that may be instantiated from a String object. The Citrus notation is any sequence of characters enclosed in either single or double quotes, e.g.:

'expr'
"expr"

This notation works the same as it does in Ruby; i.e. strings in double quotes may contain escape sequences while strings in single quotes may not. In order to specify that a string should ignore case when matching, enclose it in backticks instead of single or double quotes, e.g.:

%x`expr`

Besides case sensitivity, case-insensitive strings have the same semantics as double-quoted strings.

Public Class Methods

new(rule='', flags=0) click to toggle source

The flags will be passed directly to Regexp#new.

Calls superclass method Citrus::Terminal.new
# File lib/citrus.rb, line 945
def initialize(rule='', flags=0)
  super(Regexp.new(Regexp.escape(rule), flags))
  @string = rule
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method Citrus::Terminal#==
# File lib/citrus.rb, line 950
def ==(other)
  case other
  when String
    @string == other
  else
    super
  end
end
Also aliased as: eql?
eql?(other)
Alias for: ==