Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Ruby Hello World Tutorial

From Wiki
Jump to: navigation, search
Article Metadata
Created: hamishwillee (10 May 2011)
Last edited: hamishwillee (17 Jul 2012)
Trails.png Getting Started with Ruby
 > Download and Install > Hello World > Ruby Quick Start

This article shows how to write a very basic Ruby on Symbian "Hello World", copy it to the device, and run it. It assumes you've already installed Ruby and the GUI interactive shell on the phone.

Ruby Hello World

A basic Ruby Hello World is shown below. To spice it up, the script also takes a picture immediately after printing HelloWorld to standard IO:

# Takes a picture using phone camera and saves it to the default image location,
# C:\Data\Images\ECamExtImage<X>.jpg where X is a number.
require 'ECamera'
puts "Hello World"

The script should be copied to the device - the easiest way to do this is to connect using your PC suite and copy-paste the file into the phone file system using Windows File explorer. Then start the basic GUI interactive "Front End" shell, navigate to the file in the file system. The shell will then display the text, take a picture, and then exit with the message "Script Finished. Category: Kill Reason 0"

Running scripts on the command line

Advanced users can also run Ruby scripts with a command line:

ruby <script> [arg1, [arg2, […]]],

where script is a full path to Ruby script, and arg1, arg2, … are optional script arguments. In this case, if the script is calling STDIO functions, you will need the Open C/Open C++ component stdioserver_s60_x_x_SS.SIS (you should already have installed this)

Unfortunately, the standard application manager for Symbian and S60 based phones cannot start the application with a command line, and a data-content recognizer for Ruby scripts is not yet available. So, to run Ruby scripts from a command line, you will need an additional application, for example, the alternative text shell eshell, which is available on some Symbian devices in ROM. (There is no standalone installation file for eshell in the public domain however.) A remote PC console (such as HyperTerminal for Windows) could also be used for this purpose with Telnet daemon for Symbian.

Licence icon cc-by-sa 3.0-88x31.png© 2010 Symbian Foundation Limited. This document is licensed under the Creative Commons Attribution-Share Alike 2.0 license. See for the full terms of the license.
Note that this content was originally hosted on the Symbian Foundation developer wiki.

Trails.png Getting Started with Ruby
 > Download and Install > Hello World > Ruby Quick Start

This page was last modified on 17 July 2012, at 05:44.
47 page views in the last 30 days.