PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Ruby

Ruby

< >

Ruby is a programming language created in 1995 by Yukihiro Matsumoto.

#13on PLDB 27Years Old 357.7kUsers
65Books 13Papers 3mRepos

Try now: Riju · TIO · Replit

Ruby is a dynamic, reflective, object-oriented, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan. According to its creator, Ruby was influenced by Perl, Smalltalk, Eiffel, Ada, and Lisp. Read more on Wikipedia...


Example from Compiler Explorer:
# Type your code here, or load an example. def square(num) num * num end
Example from Riju:
puts "Hello, world!"
Example from hello-world:
#!/usr/bin/env ruby print "Hello World"
Example from the Hello World Collection:
# Hello World in Ruby puts "Hello World!"
Example from Linguist:
module Foo end
Example from Wikipedia:
"Hello, World!".in_blue => "<span style=\"color: #00f\">Hello, World!</span>"

Keywords in Ruby

_ENCODING_> _>FILE_> _>LINE_ alias and BEGIN begin break case class def defined do else elsif END end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yield

Language features

Feature Supported Example Token
Conditionals
Functions
While Loops
Case Sensitivity
Range Operator
(3...6)
Line Comments
# A comment
#
Print() Debugging
puts "Hi"
puts
Operator Overloading
Multiline Strings
Mixins
module A
   def a1
   end
   def a2
   end
end
module B
   def b1
   end
   def b2
   end
end
class Sample
include A
include B
   def s1
   end
end
samp = Sample.new
samp.a1
samp.a2
samp.b1
Iterators
(0...42).each do |n|
  puts n
end
File Imports
load 'filename.rb'
require 'filename'
require 'trig.rb'
Directives
coding: UTF-8
Generators
# Generator from an Enumerator object
chars = Enumerator.new(['A', 'B', 'C', 'Z'])

4.times { puts chars.next }

# Generator from a block
count = Enumerator.new do |yielder|
  i = 0
  loop { yielder.yield i += 1 }
end

100.times { puts count.next }
Garbage Collection
MultiLine Comments
=begin
A comment.
=end
=begin =end
Comments
# This is a single line comment.
Classes
# A tiny Person class in Ruby:
class Person
  attr_accessor :name, :age, :   # getter and setter methods
  def initialize(name, age)
    @name = name
    @age = age
  end
end

# Create a new Person object:
person = Person.new("John", 30)
puts person.name
puts person.age

# Change the age of the person:
person.age = 35
puts person.age
Constants
# Constants in Ruby being with a capital letter. Will throw a warning or error, depending on runtime settings.
Name = "John"  
# Not a constant
name = "John"
Exceptions
def hello
 puts "Hello, World!"
   # start an exception handler
   begin
       raise "This is an exception"
   rescue => e
       puts "Exception caught: #{e}"
   end
 end
hello
Assignment
pldb = 80766866
Booleans true false
Integers
pldb = 80766866
Duck Typing
Regular Expression Syntax Sugar
puts "Hello World".match(/\w/)
Strings
"hello world"
"
Case Insensitive Identifiers ϴ
Semantic Indentation ϴ
Async Await ϴ
Function Overloading ϴ
Dispose Blocks Pattern ϴ
Dependent types ϴ

Books about Ruby from ISBNdb

title authors year publisher
Computer Science Programming Basics in Ruby: Exploring Concepts and Curriculum with Ruby Frieder, Ophir and Frieder, Gideon and Grossman, David 2013 O'Reilly Media
The Ruby Programming Language: Everything You Need to Know Flanagan, David and Matsumoto, Yukihiro 2008 O'Reilly Media
Ruby Programming (Introduction to Programming) Ford, Jr. Jerry Lee 2010 Cengage Learning
Programming Ruby 1.9: The Pragmatic Programmers' Guide (Facets of Ruby) Thomas, Dave and Fowler, Chad and Hunt, Andy 2009 Pragmatic Bookshelf
Ruby Under a Microscope: An Illustrated Guide to Ruby Internals Shaughnessy, Pat 2013 No Starch Press
Enterprise Integration with Ruby Schmidt, Maik 2006 Pragmatic Bookshelf
Practical Ruby Projects: Ideas for the Eclectic Programmer (Books for Professionals by Professionals) Cyll, Christopher 2007 Apress
Beginning Ruby on Rails Holzner, Steve 2006 Wrox
Ruby Developers Guide Syngress and Feldt, Robert and Johnson, Lyle and Ortiz, Jonothon 2002 Syngress
Ruby on Rails For Dummies Burd, Barry 2007 For Dummies
Sams Teach Yourself Ruby in 21 Days Slagell, Mark 2002 Sams Publishing
Making Use of Ruby w/WS Mahadevan, Suresh 2002 John Wiley & Sons
Build Your Own Ruby on Rails Web Applications Lenz, Patrick 2007 SitePoint
Distributed Programming with Ruby Bates, Mark 2009 AddisonWesley Professional
Metaprogramming Ruby: Program Like the Ruby Pros Paolo Perrotta 2010 Pragmatic Bookshelf
Ruby on Rails Tutorial Michael Hartl 20150424 Pearson Technology Group
Practical Object-Oriented Design in Ruby: An Agile Primer (Addison-Wesley Professional Ruby Series) Metz, Sandi 2012 Addison-Wesley Professional
Ruby Phrasebook Clinton, Jason D 2008 Addison-Wesley Professional
Ruby on Rails 3 Tutorial: Learn Rails by Example (Livelessons) Hartl, Michael 2011 Addison-Wesley Professional
MacRuby: The Definitive Guide: Ruby and Cocoa on OS X Aimonetti, Matt 2011 O'Reilly Media
Ruby Quick Syntax Reference Clements, Matt 2014 Apress
Ruby by Example: Concepts and Code Baird, Kevin C. 2007 No Starch Press
Ruby on Rails for Microsoft Developers Cangiano, Antonio 2009 Wrox
Beginning Ruby 3: From Beginner to Pro DiLeo, Carleton 2020 Apress
Beginning Ruby Peter Cooper 20170111 Springer Nature
Beginning Ruby Kenneth Cooper 20070501 Springer Nature
Ruby For Beginners: Your Guide To Easily Learn Ruby Programming in 7 days Academy, iCode 2017 Independently published
Practical Ruby for System Administration Andre Ben-Hamou 20071015 Springer Nature
Using Ruby On Rails For Web Development, Introduction Guide To Ruby On Rails: An Extensive Roundup Of 100 Ultimate Resources Jacob White 2008 Emereo Pty Ltd
Polished Ruby Programming: Build better software with more intuitive, maintainable, scalable, and high-performance Ruby code Evans, Jeremy 2021 Packt Publishing
Design Patterns in Ruby (Addison-Wesley Professional Ruby Series) Olsen, Russ 2007 Addison-Wesley Professional
Practical Object-Oriented Design: An Agile Primer Using Ruby Metz, Sandi 2018 Addison-Wesley Professional
Design Patterns in Ruby Olsen, Russ 2007 Addison-Wesley Professional
Ruby on Rails Tutorial Michael, Hartl 2020 Addison-Wesley Professional
Ruby Cookbook: Recipes for Object-Oriented Scripting Carlson, Lucas and Richardson, Leonard 2015 O'Reilly Media
Eloquent Ruby (Addison-Wesley Professional Ruby Series) Olsen, Russ 2011 Addison-Wesley Professional
Pro Active Record: Databases with Ruby and Rails (Expert's Voice) Pytel, Chad and Yurek, Jonathan and Marshall, Kevin 2007 Apress
Rails AntiPatterns: Best Practice Ruby on Rails Refactoring (Addison-Wesley Professional Ruby Series) Pytel, Chad and Saleh, Tammer 2010 Addison-Wesley Professional
Programming Ruby 1.9 & 2.0: The Pragmatic Programmers' Guide (The Facets of Ruby) Thomas, Dave and Hunt, Andy and Fowler, Chad 2013 Pragmatic Bookshelf
Intro To Ruby Programming: Beginners Guide Series Elder, John 2016-05-10T00:00:01Z Codemy.com
Ruby Way, The: Solutions and Techniques in Ruby Programming (Addison-Wesley Professional Ruby Series) Fulton, Hal and Arko, André 2015-03-02T00:00:01Z Addison-Wesley Professional
Metaprogramming Ruby 2: Program Like the Ruby Pros (Facets of Ruby) Perrotta, Paolo 2014 Pragmatic Bookshelf
Ruby Wizardry: An Introduction to Programming for Kids Weinstein, Eric 2014 No Starch Press
Effective Ruby: 48 Specific Ways to Write Better Ruby (Effective Software Development Series) Jones, Peter J. 2014 Addison-Wesley Professional
Ruby Way, The: Solutions and Techniques in Ruby Programming (Addison-Wesley Professional Ruby Series) Fulton, Hal and Arko, André 2015 Addison-Wesley Professional
Ruby on Rails Tutorial: Learn Web Development with Rails (Addison-Wesley Professional Ruby Series) Hartl, Michael 2016 Addison-Wesley Professional
Ruby Programming (Introduction to Programming) Ford Jr., Jerry Lee 2010 Cengage Learning
Learn Ruby the Hard Way: A Simple and Idiomatic Introduction to the Imaginative World Of Computational Thinking with Code (Zed Shaw's Hard Way Series) Shaw, Zed A. 2014 Addison-Wesley Professional
Ruby: Learn Ruby in 24 Hours or Less - A Beginner’s Guide To Learning Ruby Programming Now (Ruby, Ruby Programming, Ruby Course) Dwight, Robert 2016 CreateSpace Independent Publishing Platform
Ruby Beginner's Crash Course: Beginner's Guide to Ruby Programming, Ruby On Rails & Rails Programming Start Guides, Quick 2021 ND Publishing
The Well-Grounded Rubyist: Covers Ruby 1.9.1 David A. Black 2009 Manning Publications
Learn Rails 6: Accelerated Web Development with Ruby on Rails Notodikromo, Adam 2020 Apress
Ruby Programming: Basics to Advanced Concepts Andahi, Alban 2018-02-04T00:00:01Z CreateSpace Independent Publishing Platform
Ruby by Example: Concepts and Code Baird, Kevin C. 2007 No Starch Press
Ruby on Rails 3 Tutorial: Learn Rails by Example (Addison-Wesley Professional Ruby Series) Hartl, Michael 2010 Addison-Wesley Professional
The Ruby Workshop: Develop powerful applications by writing clean, expressive code with Ruby and Ruby on Rails Paul, Akshat and Philips, Peter and Szabó, Dániel and Wallace, Cheyne 2019 Packt Publishing
Ruby Cookbook (Cookbooks (O'Reilly)) Carlson, Lucas and Richardson, Leonard 2006 O'Reilly Media
Ruby In A Nutshell Yukihiro Matsumoto 2001 O'Reilly Media
Learn Rails 5.2: Accelerated Web Development with Ruby on Rails Wintermeyer, Stefan 2018 Apress
RUBY Beginner's Crash Course: Ruby for Beginner's Guide to Ruby Programming, Ruby On Rails & Rails Programming (Ruby, Operating Systems, Programming) (Volume 1) Guides, Quick Start 2015-10-21T00:00:01Z CreateSpace Independent Publishing Platform
Distributed Programming with Ruby (Addison-Wesley Professional Ruby Series) Bates, Mark 2009 Addison-Wesley Professional
Head First Rails: A Learner's Companion to Ruby on Rails Griffiths, David 2009 O'Reilly Media
Ruby Best Practices: Increase Your Productivity - Write Better Code Brown, Gregory T 2009 O'Reilly Media
The Ruby Way, Second Edition: Solutions and Techniques in Ruby Programming (2nd Edition) Fulton, Hal 2006 Addison-Wesley Professional
Ruby for Rails: Ruby Techniques for Rails Developers David Black 2006 Manning Publications

Publications about Ruby from Semantic Scholar

title authors year citations influentialCitations
BioRuby: bioinformatics software for the Ruby programming language Naohisa Goto and P. Prins and M. Nakao and R. Bonnal and J. Aerts and Toshiaki Katayama 2010 186 10
Programming ruby Parasuram Anantharam 2001 40 5
FSelector: a Ruby gem for feature selection Tiejun Cheng and Yanli Wang and S. Bryant 2012 35 5
A little language for surveys: constructing an internal DSL in Ruby H. C. Cunningham 2008 31 1
Feature-oriented programming with Ruby S. Günther and Sagar Sunkle 2009 27 1
The ruby intermediate language Michael Furr and Jong-hoon An and J. Foster and M. Hicks 2009 25 4
FlowR: aspect oriented programming for information flow control in ruby Thomas Pasquier and J. Bacon and B. Shand 2014 17 1
αRby - An Embedding of Alloy in Ruby Aleksandar Milicevic and I. Efrati and D. Jackson 2014 16 3
A machine vision extension for the Ruby programming language J. Wedekind and B. Amavasai and K. Dutton and M. Boissenin 2008 7 0
Language design and implementation using ruby and the interpreter pattern Ariel Ortiz 2008 4 0
Specializing ropes for ruby Kevin Menard and Chris Seaton and Benoit Daloze 2018 2 0
Let’s Get It Started: Installing Ruby Pete Cooper 2020 1 0
A machine vision extension to the Ruby programming language using OpenCV and FFI A. Marburg and M. Hayes and A. Bainbridge-Smith 2013 1 0
csharp.html · ruby.html · fortran.html

View source

PLDB - Build the next great programming language · v2022 · Day 93 · Docs · Build · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com