...

Ruby represents an object-oriented programming language that appeared in 1995 and is equivalent to English documentation in 2000. According to the so-called Duck Typing of programming, the methods of an object are in the foreground. Compared to other programming languages, the class of the object plays a secondary role in Ruby.

Ruby's first steps in the world of computer science

The programming language Ruby was released in 1995 and was developed by Yukihiro Matsumoto, a computer scientist by training, from 1993 onwards. Ruby is independent of the operating system (platform independent), but originally existed exclusively in Japanese.

In Japan, the programming language met with great approval and prevailed against numerous competitors. Over time, implementations such as JRuby, Rubinius, and CRuby (YARV) emerged, of which CRuby is the most common - but in Europe, its use did not initially spread due to the language barrier. It was not until five years after Ruby was released that interested users outside Japan began to show up, as documentation of the programming language in English was added. From this documentation, further instructions and reference works for Ruby were established.

Although Ruby was designed to be intuitive to use, this additional literature was necessary. If you would like to learn more about Ruby, there are publications that can help you. In addition, you can now find numerous tutorials on the Internet that explain step-by-step how to use the programming language.

Yukihiro Matsumoto stated as his motivation for developing his own programming language that he was not satisfied with the options available to him at that time. Accordingly, during the two-year development phase of Ruby, he was guided primarily by his own ideas and interests in the field of computer science. Ruby's approach is largely object-oriented, but the programming language also incorporates other possibilities.

The name "Ruby" is a reference to another programming language, which is also named after a precious gem: Perl. But also JavaScript, Python and other well-known programming languages influenced Yukihiro Matsumoto in his work.

Plesk RubyTerms

The Ruby package system is called RubyGems and manages the various programs.

In order to work with Ruby, you will need an appropriate working environment. The environment is provided by the command line interpreter (CLI), which is adapted to a particular programming language. Together with the interpreter for Ruby you get Interactive Ruby, or irb for short. The purpose of irb is to give you a way to test the program you are writing. You use it with the "irb(main)" command.

RDoc is a tool that serves the purpose of software documentation. One of its main tasks is to describe the source code of the program. In connection with RDoc, Ruby Index (ri) should also be mentioned: The tool supports you in Database to search through which RDoc creates.

Both RubyGems ("gem") and Ruby Index ("ri") can be accessed from the command line with appropriate commands.

Syntax of Ruby: Some examples

In Ruby the use of blocks is possible. These can replace For loops, for example. You can also call such a block several times. The program will then repeat the section or block as many times as you have specified - for example, five times for the "5.times" element. The operation to be performed by the program is indicated between two braces.

Like other programming languages, Ruby requires a declaration of procedures. This is usually at the beginning of the program. To initiate the declaration, use the familiar "def" command; to complete it, set an "end".

Ruby follows the principle of duck typing, which is based on a saying by James Whitcomb Riley: "If I see a bird that walks like a duck, swims like a duck, and quacks like a duck, I call that bird a duck." Duck Typing is designed to make programming more flexible. In German, this concept is known as Ententest. The procedure is not limited to Ruby, but can also be found in PHP and Python application.

You can mark the end of a command in Ruby with a semicolon - or you can simply write a line break (without a semicolon).

Current articles