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 - strips out nil members from an array
Writing comparator methods such as "larger" and "smaller" in Ruby
Using a hash to provide a table of counters
Calling another process via a pipe in Ruby
Definition and use of a class in Ruby
Definition and the redefinition of the same function in Ruby (written 2008-03-21 18:22:20)
Associated topics are indexed under
R104 - Ruby - Control Structures [2619] Passing code to procedures and yield in Ruby - (2010-02-02)
[2471] A short form of if ... then ... else - (2009-10-23)
[2287] Learning to program in Ruby - examples of the programming basics - (2009-07-15)
[1904] Ruby, Perl, Linux, MySQL - some training notes - (2008-11-23)
[1891] Ruby to access web services - (2008-11-16)
[1887] Ruby Programming Course - Saturday and Sunday - (2008-11-16)
[1870] What to do with a huge crop of apples - (2008-11-04)
[1738] Clean code, jump free (Example in Lua) - (2008-08-06)
[1696] Saying NOT in Perl, PHP, Python, Lua ... - (2008-07-04)
[1582] Ruby, C, Java and more - getting out of loops - (2008-03-19)
[1220] for loop - how it works (Perl, PHP, Java, C, etc) - (2007-06-06)
[1163] A better alternative to cutting and pasting code - (2007-04-26)
[995] Ruby's case - no break - (2006-12-17)
[985] Equality in Ruby - == eql? and equal? - (2006-12-14)
[962] Breaking a loop - Ruby and other languages - (2006-12-03)
[960] 1st, 2nd, 3rd revisited in Ruby - (2006-12-02)
R106 - Input and Output in Ruby [2621] Ruby collections and strings - some new examples - (2010-02-03)
[2614] Neatly formatting results into a table - (2010-02-01)
[2290] Opening and reading files - the ruby fundamentals - (2009-07-16)
R108 - Ruby - More Classes and Objects [2623] Object Oriented Ruby - new examples - (2010-02-03)
[2620] Direct access to object variable (attributes) in Ruby - (2010-02-02)
[2616] Defining a static method - Java, Python and Ruby - (2010-02-01)
[2604] Tips for writing a test program (Ruby / Python / Java) - (2010-01-29)
[2603] Ruby objects - a primer - (2010-01-29)
[2601] Ruby - is_a? v instance_of? - what is the difference? - (2010-01-27)
[2292] Object Orientation in Ruby - intermediate examples - (2009-07-16)
[1217] What are factory and singleton classes? - (2007-06-04)
[656] Think about your design even if you don't use full UML - (2006-03-24)
[184] MTBF of coffee machines - (2005-01-20)
R110 - Ruby - Special Variables and Pseudo-Variables [2613] Constants in Ruby - (2010-02-01)
[2296] Variable scope - what is it, and how does it Ruby? - (2009-07-18)
[1586] Variable types in Ruby - (2008-03-21)
[990] Ruby - Totally Topical - (2006-12-16)
Some other Articles
Easter Sunday at 404, The SpaAll Change, Portsmouth HarbourDynamic Memory Allocation in C - calloc, reallocString interpretation in RubySome Ruby programming examples from our courseWell House Consultants / Manor - StaffUsing Structs and Unions together effectively in CBusinesses in West Wiltshire - networking