Questions tagged [ruby]

Ruby is a multi-platform open-source, dynamic object-oriented interpreted language. The [ruby] tag is for questions related to the Ruby language, including its syntax and its libraries. Ruby on Rails questions should be tagged with [ruby-on-rails].

The tag is for questions related to the Ruby language, including its syntax and its libraries. Questions specifically about the Ruby on Rails framework should be tagged with in addition to . Do not use this to tag ruby used in the Japanese language.

Ruby is an open-source dynamic object-oriented interpreted language that combines concepts from Perl, Smalltalk, and Lisp. It supports multiple programming paradigms including functional, object-oriented, and imperative. It also has a dynamic type system and automatic memory management; it is, therefore, similar in varying respects to Smalltalk, Python, Perl, Lisp, Dylan, and CLU. Ruby's primary purpose is to "help every programmer in the world to be productive, and to enjoy programming, and to be happy." Ruby focuses on simplicity and productivity.

Ruby was initially conceived on February 24, 1993, by Yukihiro Matsumoto ('Matz') and version 1.0 was released in 1996. Ruby's mindshare spiked around 2005 due to Ruby on Rails, an MVC (Model, View, Controller) framework for building web applications and usage continues to grow as of 2016 with Ruby continuing to find acceptance in the commercial marketplace. The current stable version is 3.2.0 (2022-12-25).

Documentation, Announcements, Issue Tracker

Unofficial Reference

Implementations, Installers

  • Ruby version managers. chruby, rbenv, rvm, pik (Windows)
  • Ruby, the official implementation also known as Matz' Ruby Implementation (MRI), YARV-Ruby. Official Site, GitHub
  • JRuby, an implementation of Ruby on top of Java with access to the JVM
  • Rubinius, an implementation of Ruby supporting native OS threads and a core library written almost entirely in Ruby
  • Ruby Enterprise Edition (not maintained anymore), a branch of MRI Ruby made for efficiency
  • MacRuby, an implementation of Ruby on Apples Objective-C and Cocoa frameworks
  • MagLev an implementation on top of VMWare's GemStone virtual machine
  • IronRuby is an implementation of Ruby on top of Microsoft's .NET CLR/DLR platform
  • Cardinal is an implementation of Ruby for the Parrot Virtual Machine
  • Topaz is an implementation of Ruby written in Python, on top of RPython
  • RubyMotion is an implementation of Ruby to develop native iOS and OS X applications

Gems (Library)

  • Ruby Gems - The Standard Library
  • Ruby Toolbox - Ruby Gems categorization, ranking, and statistics
  • Awesome Ruby - A categorized collection of awesome Ruby libraries, tools, frameworks, and software. The essential Ruby to build modern Apps and Web Apps
  • Bundler - Manage your application's gem dependencies
  • DevKit - A windows toolkit that makes it easy to build and use native C/C++ extensions


  • - Online REPL
  • RSpec - A testing tool for Ruby
  • Minitest - A testing tool for Ruby
  • Rubular - A Ruby regular expression tool
  • Pry - REPL and debugger for Ruby
  • Rubocop - A Ruby linter and code formatter

Online Courses


Related Tags


ruby icon

228397 questions
28 answers

How to write a switch statement in Ruby

How do I write a switch statement in Ruby?
  • 343,444
  • 107
  • 203
  • 205
28 answers

How to check if a value exists in an array in Ruby

I have a value 'Dog' and an array ['Cat', 'Dog', 'Bird']. How do I check if it exists in the array without looping through it? Is there a simple way of checking if the value exists, nothing more?
  • 18,067
  • 10
  • 25
  • 19
22 answers

How to call shell commands from Ruby

How do I call shell commands from inside of a Ruby program? How do I then get output from these commands back into Ruby?
  • 35,598
  • 21
  • 73
  • 86
11 answers

How to convert a string to lower or upper case in Ruby

How do I take a string and convert it to lower or upper case in Ruby?
Heat Miser
  • 19,438
  • 7
  • 35
  • 38
15 answers

How to understand nil vs. empty vs. blank in Ruby

I find myself repeatedly looking for a clear definition of the differences of nil?, blank?, and empty? in Ruby on Rails. Here's the closest I've come: blank? objects are false, empty, or a whitespace string. For example, "", " ", nil, [], and {}…
  • 13,558
  • 7
  • 26
  • 24
21 answers

How to pass command line arguments to a rake task

I have a rake task that needs to insert a value into multiple databases. I'd like to pass this value into the rake task from the command line, or from another rake task. How can I do this?
  • 48,165
  • 17
  • 52
  • 58
20 answers

What is attr_accessor in Ruby?

I am having a hard time understanding attr_accessor in Ruby. Can someone explain this to me?
  • 25,132
  • 33
  • 116
  • 189
33 answers

How do I get the current absolute URL in Ruby on Rails?

How can I get the current absolute URL in my Ruby on Rails view? The request.request_uri only returns the relative URL.
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
13 answers

How to make --no-ri --no-rdoc the default for gem install?

I don't use the RI or RDoc output from the gems I install in my machine or in the servers I handle (I use other means of documentation). Every gem I install installs RI and RDoc documentation by default, because I forget to set --no-ri --no-rdoc. Is…
Ricardo Acras
  • 35,784
  • 16
  • 71
  • 112
10 answers

Understanding the Rails Authenticity Token

What is the Authenticity Token in Rails?
Ricardo Acras
  • 35,784
  • 16
  • 71
  • 112
8 answers

Ruby: How to install a specific version of a ruby gem?

Using the command-line gem tool, how can I install a specific version of a gem?
  • 63,493
  • 27
  • 91
  • 122
6 answers

class << self idiom in Ruby

What does class << self do in Ruby?
  • 47,058
  • 76
  • 251
  • 433
6 answers

Why is it bad style to `rescue Exception => e` in Ruby?

Ryan Davis’s Ruby QuickRef says (without explanation): Don’t rescue Exception. EVER. or I will stab you. Why not? What’s the right thing to do?
  • 29,546
  • 11
  • 78
  • 79
8 answers

What does %w(array) mean?

I'm looking at the documentation for FileUtils. I'm confused by the following line: FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6' What does the %w mean? Can you point me to the documentation?
Dane O'Connor
  • 75,180
  • 37
  • 119
  • 173
10 answers

How to check whether a string contains a substring in Ruby

I have a string variable with content: varMessage = "hi/thsid/sdfhsjdf/dfjsd/sdjfsdn\n" "/my/name/is/\n" "call::myFunction(int const&)\n" "void::secondFunction(char const&)\n" …
  • 11,499
  • 8
  • 34
  • 68
2 3
99 100