Ruby

From XennisWiki
Jump to: navigation, search

Ruby is a dynamic, reflective, object-oriented, general-purpose programming language. (Wikipedia)

Installation

Further information: Download Ruby

Arch Linux

Install the ruby package.

export PATH=${PATH}:$HOME/.gem/ruby/2.5.0/bin

Ubuntu

There a multiple ways to install Ruby, checkout Installing Ruby for more information.

Using rbenv (on Ubuntu 13.10)

C[1] Install rbenv

cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

Install ruby-build

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

Install ruby (in this case version 2.3.1)

rbenv install 2.3.1
rbenv global 2.3.1
ruby -v

Windows

The simplest way to download and install Ruby on Windows is the RubyInstaller.

Example

A simple Hello World example

def sayHello
  puts "Hello world"
end
 
sayHello

Problems and errors

Install the Development Kit (Windows)

Further information: Development Kit

Based on[2]

cd C:\Ruby-xx\DevKit
ruby dk.rb init
  • Open the file C:\Ruby-xx\DevKit\config.yml and configure it like described in the file itself
  • Execute
ruby dk.rb review
ruby dk.rb install

See also

References

  1. Oliver Chris (). "Setup Ruby On Rails on Ubuntu 13.10 Saucy Salamander". Go Rails. Retrieved 30. November 2014 ,
  2. http://stackoverflow.com/a/8463500

External links