Author: admin

  • Executing Ruby from the Command Line

    Ruby allows users to run lines of code as command-line options to the ruby tool. The ‘-e’ command line flag is used to accomplish this. Let’s run ‘Hello Ninjas! Let’s learn Ruby.’.  Example: You can also try this code with Online Ruby Compiler Run Code Output: Though this ‘-e’ flag only allows a single line of…

  • Basic Ruby Example

    Ruby is not only a flexible scripting language in terms of syntax, but it is also extremely flexible in terms of how scripts can be executed. In this section, we’ll look at some simple Ruby examples to learn Ruby before diving into the various ways Ruby code can be executed. The most basic example we…

  • I can’t understand Ruby even after reading the manual!

    by

    in

    The syntax of Ruby has been fairly stable since Ruby 1.0, but new features are added every now and then. So, the books and the online documentation can get behind. If you have a problem, feel free to ask in the mailing list (see the Mailing Lists page). Generally you’ll get timely answers from Matz himself,…

  • How can I annotate Ruby code with its results?

    by

    in

    People commonly annotate Ruby code by showing the results of executing each statement as a comment attached to that statement. For example, in the following code, we show that the assignment generates the string “Billy Bob”, and then the result of extracting some substrings. Emacs and vim users can integrate this with their editing environments,…

  • Which is correct, “Ruby” or “ruby”?

    by

    in

    Officially, the language is called “Ruby”. On most systems, it is invoked using the command ruby. It’s OK to use “ruby” instead of “Ruby”. Please don’t use “RUBY” as the language name. Originally, or historically, it was called “ruby”.

  • How can I thread the mailing list in mutt?

    by

    in

    This section or parts of it might be out-dated or in need of confirmation. For some of the Ruby mailing lists, the mailing list software adds a prefix to the subject lines, for example ruby-core:1234. This can confuse the threading in some mail user agents. In mutt, you can get threading to work using the following…

  • Is there a Ruby mailing list?

    by

    in

    There are several mailing lists talking about Ruby. See the Mailing Lists page for more information. You can search the mailing list archives using https://ml.ruby-lang.org/mailman3/hyperkitty/list/[email protected]/. (This is the URL for the ruby-talk list, munge as required for the others).

  • Where is the Ruby Home Page?

    by

    in

    The official Ruby Home Page is www.ruby-lang.org. Besides the English and Japanese versions, there exist translations into various other languages. Good starting points for finding Ruby information are the Documentation and Community pages.

  • What is the history of Ruby?

    by

    in

    The following is a summary of a posting made by Matz in [ruby-talk:00382] on June 4, 1999. (The birthday of Ruby has been corrected in [ruby-list:15977].) Well, Ruby was born on February 24, 1993. I was talking with my colleague about the possibility of an object-oriented scripting language. I knew Perl (Perl4, not Perl5), but I didn’t like…