Ruby environment


Release date:2023-10-24 Update date:2023-10-24 Editor:admin View counts:237

Label:

Ruby environment

Local environment settings

If you want to set up the environment for the Ruby programming language, please read this chapter. This chapter introduces you to all the important topics related to environment settings. It is recommended that you learn thefollowing topics before delving into other topics:

  • Ruby installation on Linux/Unix: if you want to configure the development environment on Linux/Unix, review this section.

  • Ruby installation on Windows: if you want to configure the development environment on Windows, review this section.

  • Ruby command line options: this section lists all the command line options that you can use with the Ruby interpreter.

  • Ruby environment variables: this section lists all the important environmentvariables and sets them to make the Ruby interpreter work.

Popular Ruby editor

To write a Ruby program, you need an editor:

  • If you are writing on Windows, you can use any simple text editor, such as Notepad or Edit plus.

  • VIM (Vi IMproved) is a simple text editor that is available on almost all Unix and can now be used on Windows. In addition, you can use your favorite vi editor to write Ruby programs.

  • RubyWin is a Ruby integrated development environment (IDE) for Windows.

  • Ruby Development Environment (RDE) is also a good integrated development environment (IDE) for Windows users.

Interactive Ruby (IRb)

Interactive Ruby (IRb) provides a shell for experience. Within IRb shell, you can immediately view the interpretation results line by line.

This tool comes automatically with the installation of Ruby, so you don’t need to do anything else for IRb to work.

Simply type irb at the command prompt, and an interactive Ruby Session will begin, as follows:

$irb
irb 0.6.1(99/09/16)
irb(main):001:0> def hello
irb(main):002:1> out = "Hello World"
irb(main):003:1> puts out
irb(main):004:1> end
nil
irb(main):005:0> hello
Hello World
nil
irb(main):006:0>

You don’t have to worry about the execution of the above command here, which we will explain to you in the following chapters.

What will you learn next?

Suppose you have now set up your Ruby environment and are ready to write your first Ruby program. In the next chapter, we will show you how to write Ruby programs.

Powered by TorCMS (https://github.com/bukun/TorCMS).