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

Tools

  • repl.it - 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

Books

Related Tags


Icon:

ruby icon

228397 questions
63
votes
5 answers

Ruby on Rails plural (controller) and singular (model) convention - explanation

As per Ruby on Rails convention, controller names get pluralized while model names are singular. Example : a Users controller, but a User model. rails generate controller Users rails generate model User name:string email:string Now open migration…
user1322512
62
votes
2 answers

What is the difference between map, each, and collect?

In Ruby, is there any difference between the functionalities of each, map, and collect?
Rahul
  • 44,892
  • 25
  • 73
  • 103
62
votes
10 answers

Unable to use dot syntax for ruby hash

I'm using net/http to pull in some json data from the Yahoo Placemaker API. After receiving the response I am performing JSON.parse on the response. This gives me a hash that looks like: {"processingTime"=>"0.001493", "version"=>"1.4.0.526 build…
Kyle Decot
  • 20,715
  • 39
  • 142
  • 263
62
votes
25 answers

git, Heroku: pre-receive hook declined

I am in the process of setting up a git repository and attempting to link it to Heroku. When I run the command git push heroku master I receive Counting objects: 7, done. Delta compression using up to 2 threads. Compressing objects: 100% (5/5),…
wuliwong
  • 4,238
  • 9
  • 41
  • 69
62
votes
4 answers

When do we use the "||=" operator in Rails ? What is its significance?

Possible Duplicate: What does the operator ||= stands for in ruby? I am confused with the usage of ||= operator in Rails. I couldn't locate anything useful on the web. Can anyone please guide me? Do let me know if there are any weblinks that you…
geeky_monster
  • 8,672
  • 18
  • 55
  • 86
62
votes
5 answers

cocoa pods install on iOS project not working

I have a react native project and want to install cocoa pods for iOS native specifics but the instal fails, I have ruby ruby 2.5.1p57 on Mac book pro I have posted the error down, would be grateful for help pod install Analyzing…
simonC
  • 4,101
  • 10
  • 50
  • 78
62
votes
2 answers

Should one use dashes or underscores when naming a gem with more than one word?

I'm confused about what the gem naming convention is when the gem name has more than one word. thinking-sphinx is the name of the gem, but the base *.rb file for this gem is lib/thinking_sphinx.rb (underscores) acts-as-taggable-on is the name of…
dan
  • 43,914
  • 47
  • 153
  • 254
62
votes
11 answers

How can I uninstall Ruby on ubuntu?

How can I uninstall Ruby 1.9.2dev (2010-07-02) [i486-linux] on ubuntu? Need to reinstall - please help
khanh
  • 4,516
  • 10
  • 29
  • 48
62
votes
9 answers

Errors Installing mysql2 gem via the Bundler

I am trying to install the mysql2 gem via the Bundler, but it keeps dying with the following error: ** executing command /home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in 'rescue in block in build_extensions':…
T.J. Schuck
  • 3,645
  • 2
  • 19
  • 20
62
votes
7 answers

RVM equivalent for PHP?

I can't seem to find a way to switch versions of PHP quickly. Is there something equivalent to ruby version manager for php? I need to switch between 5.3 and 5.2 on OS X.
johmas
  • 669
  • 1
  • 5
  • 5
62
votes
3 answers

Install gem in local folder

I have limited privileges on a shared machine I'm using, so I can't install gems the way I'm used to. For example: $ gem install request-log-analyzer ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions…
m81
  • 2,217
  • 5
  • 31
  • 47
62
votes
6 answers

Is it right to assign multiple variables like this a = b = c = d = 5?

a = b = c = d = 5 puts (a) >> 5 puts (b) >> 5 puts (b) >> 5 puts (b) >> 5 a= a+1 puts (a) >> 6 puts (b) >> 5 I found there is no problem with the assigning of values like this. My question is should one assign like the one given above or like…
Salil
  • 46,566
  • 21
  • 122
  • 156
62
votes
2 answers

How to access attributes using Nokogiri

I have a simple task of accessing the values of some attributes. This is a simple script that uses Nokogiri::XML::Builder to create a simple XML doc. require 'nokogiri' builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| …
Liz
  • 621
  • 1
  • 5
  • 3
62
votes
2 answers

In Ruby, how does coerce() actually work?

It is said that when we have a class Point and knows how to perform point * 3 like the following: class Point def initialize(x,y) @x, @y = x, y end def *(c) Point.new(@x * c, @y * c) end end point = Point.new(1,2) p point p point *…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
62
votes
3 answers

Using gets() gives "No such file or directory" error when I pass arguments to my script

Hi I am making a simple ruby script practiced where I make a form using gets.chomp and arguments, the problem is that when gets.chomp use the script returns me an error when I apply the argument test. The code: #!usr/bin/ruby def formulario(quien) …
adsdsa
  • 657
  • 1
  • 5
  • 11