Get ready to dive deeper into the power and elegance of the language lauded as a possible contender to replace current programming languages.
by Jim White
April 10, 2006
uby is an object-oriented, metaprogramming language that has garnered a lot of attention in software development circles as of late. Metaprogramming is a means of writing software programs that write or manipulate other programs, thereby making coding faster and more reliable. Part 1 examined Ruby setup, general syntax, and object-oriented aspects. This article, part 2, looks at some other powerful features built into the Ruby programming language. Again, Ruby is based on and has adopted features from many languages including Lisp, Smalltalk, Python and Perl. So in many ways, Ruby is a "best of breed" language that has been assembled from the best and most powerful programming features found in its predecessors.
Numbers, Strings, and other "Standard" Types in Ruby
Everything in Ruby is an object. Maybe more precisely, everything in Ruby is treated as a full fledged object. So, the number 4, the fixed point number 3.14 and the string "Hi" are all objects in Ruby. Obviously, they are somewhat "special" objects since you don't have to use the new method to create one. Instead, you use the literal 4, for example, to create an instance of the object representing the number 4.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!