Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Ruby module R110
Special Variables and Pseudo-Variables
Exercises, examples and other material relating to training module R110. This topic is presented on public courses Learning to program in Ruby, Ruby Programming

Background
Every operation has a result. Easy - store it to a varibale. But operations have side effects too that you can read from special variables. And the very act of running your script provides a wide variety of extra information that you may want to use ... and is there, if you know where, for the asking.
Related technical and longer articles
Solution Centre - all article listing
Solution Centre - all article listing

Articles and tips on this subjectupdated
4682One line scripts - Awk, Perl and Ruby
The art of the one line script, originating in awk and passing through Perl lives on in Ruby!   WomanWithCat:4c grahamellis$ awk '/Upper/{c++}; END { print(c,"of",NR)}; BEGIN {c=0}' rstats2015.txt   5 of 2537   WomanWithCat:4c grahamellis$   WomanWithCat:4c grahamellis$ ...
2016-05-20
 
4502Reading and parsing a JSON object in Ruby
Here's a series of three new examples, building up from one another, showing the reading of a JSON feed from a remote web site in Ruby, and the analysis and presentation of that data. The first example - [here] - shows the loading of extra modules to handle reading from the web and the JSON format, ...
2015-06-02
 
3757Ruby - a teaching example showing many of the language features in short but useful program
Although the main publicity and driver for the Ruby language has been the Rails web framework (see previous article here), it's an excellent data manipulation language too - with many of the short and efficient coding techniques that you would have available to you in Perl, yet additionally with an object ...
2012-06-16
(longest)
2623Object Oriented Ruby - new examples
We had an "object oriented Ruby" morning on today's course. "But everything's an object in Ruby" you'll tell me and you're sort of right (we could argue about what symbols and code blocks are), but there are certain elements of object orientation which require specific coverage. Here are links to three ...
2010-02-04
 
2613Constants in Ruby
If you want to have a read only variable in Ruby, start its name with a capital letter (and you may like to go with a convention of using capitals right through the variable name). Note that a Ruby constant - a name starting with a capital - hasa global scope, just like a variable name that starts with ...
2010-02-01
(short)
2296Variable scope - what is it, and how does it Ruby?
Variables have different "scopes" - in other words, a name that is allocated to a piece of computer memory and subsequently used to refer to that memory may be 'know about" to your program only within a very small area, or much more widely. It's the same IRL ("In Real Life") - consider you, Dad, Graham ...
2009-07-19
 
1891Ruby to access web services
If you want to use a Ruby program to access an RSS feed (or some other XML or HTML data), you can start with the standard Net::HTTP module ... full (working, tested) example here. That example "just" uses a Get method to get an RSS feed of the latest posts to the First Great Western Coffee Shop Forum ...
2008-11-16
 
1586Variable types in Ruby
In Ruby: * Variable with names starting with a lower case letter are local variables * Names starting with a capital letter are constants - you can set them once each time you run a program and then they are fixed * Names starting with a single @ character are object variables - in other words, you'll ...
2008-03-22
 
1587Some Ruby programming examples from our course
I was giving a Public Ruby Course to a small group at the end of last week ... and having a small group gave me the opportunity to write some demonstrations in front of them. I have now tidied these up and have pleasure in presenting to more Ruby demonstrations: Ruby's BEGIN block The compact method ...
2008-03-21
 
990Ruby - Totally Topical
Ruby supports topicalisation - the $_ variable being set by certain statements when a piece of code such as gets in a while statement isn't assigned, and the the same variable being used in many other methods - and even as the object on which methods run by default - in following code. Here's a piece ...
2006-12-16
 
Examples from our training material
answer   Data manipulation example (table inversion)
av   Command Line Parameters to a Ruby program
c3.rb   Process every line via topicalisation
cc   begin block
envx   reading and setting environment variables from and for shell commands
gloop1   Topicalisation - before
gloop2   Topicalisation - after
pgv.rb   Predefined global variables and resources
rerub   Cleaning an incoming string in Ruby
ruby_awk.rb   implicit loop around code - awk mode
tiny   Autosplit mode, a loop round your code, BEGIN and END
topic.rb   Topicalisation - the use of $_
vvx   variable types
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from [here].
Topics covered in this module
ARGV, $0 and friends - the command line.
Other special variables from $: through $$ to $<.
Environment variables.
Pseudo-variables.
Reserved words in Ruby.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Ruby, Lua, Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre.


You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/R110.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb