Class Citrus::StringTerminal

  1. lib/citrus.rb

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.:

`expr`

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

Methods

public class

  1. new

public instance

  1. ==
  2. eql?

Public class methods

new (rule='', flags=0)

The flags will be passed directly to Regexp#new.

[show source]
     # File lib/citrus.rb, line 946
946:     def initialize(rule='', flags=0)
947:       super(Regexp.new(Regexp.escape(rule), flags))
948:       @string = rule
949:     end

Public instance methods

== (other)
[show source]
     # File lib/citrus.rb, line 951
951:     def ==(other)
952:       case other
953:       when String
954:         @string == other
955:       else
956:         super
957:       end
958:     end
eql? (other)

Alias for #==