Ruby Notes

Squish assumes that all test.rb files use the UTF-8 encoding. Every .rb you use should begin with the line:

# encoding: UTF-8

Squish tests written in Ruby should always begin:

# encoding: UTF-8
require 'squish'
include Squish

A Ruby-savvy editor will notice the first line and will correctly load and save using the UTF-8 encoding that Squish expects, as a result.

Furthermore, the Ruby versions of the functions documented in Object Access Functions must be fully-qualified with Squish:: to avoid clashes with the default Ruby Object type. For instance, you must use:

list = Squish::Object.children(o);

Instead of:

list = Object.children(o);

The latter will cause an error when replaying the test script since the Ruby interpreter will attempt to access the (non-existant) children method on the built-in Object type.

Ruby Language Documentation

The official Ruby website has many documentation links on the http://www.ruby-lang.org/en/documentation/ page. There is also an online book, Programming Ruby: The Pragmatic Programmer's Guide.

If you prefer books, a good Ruby book is The Ruby Programming Language by David Flanagan and Yukihiro Matsumoto (Ruby's creator).

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.