The Language
Ruby is a language
optimised for joy.
Created by Yukihiro "Matz" Matsumoto in 1995, Ruby is a dynamic, object-oriented language designed with a radical premise: programmers are humans, and code should be pleasant to read and write.
Philosophy
Everything is an object.
Numbers, strings, even nil — everything responds to methods. Blocks make iteration expressive. Symbols make configuration elegant. Duck typing means if it quacks like a duck, it is one.
- — MINASWAN: Matz is nice and so we are nice.
- — Convention over configuration.
- — The principle of least surprise.
- — Optimize for reading, not writing.
# Ruby reads almost like English.
5.times { puts "Hello, world!" }
[:coffee, :tea, :water].each do |drink|
puts "One #{drink}, please."
end
class Person
attr_accessor :name
def initialize(name) = @name = name
def greet = "Hi, I'm #{@name}."
end
puts Person.new("Yukihiro").greet1995
First public release
3.x
Latest generation — fast, concurrent, typed
∞
Gems on RubyGems.org