Fireship · @fireship
Ruby in 100 Seconds
Uploaded January 31, 2022 · Length 2:37
Summary
ruby basics explained in 100 seconds, including syntax, object-oriented features, and development ecosystem.
- ruby programming language
- ruby basics
- ruby syntax
- ruby development
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
[Music]
- 0:00
ruby a dynamic interpreted scripting
- 0:02
language made famous for taking
- 0:04
simplicity and code readability to the
- 0:06
extreme it was first conceived by
- 0:07
yukihiro matsumoto aka mats in 1993 as
- 0:11
an easy-to-use scripting language like
- 0:13
python but with genuine object-oriented
- 0:15
features like smalltalk it exploded in
- 0:17
popularity after david hanemeyer hansen
- 0:19
aka dhh created rails in 2005 a model
- 0:23
view controller framework at the time it
- 0:25
was a game changer for startups because
- 0:27
it reduced the complexity required to
- 0:29
build a full stack web application and
- 0:30
has been used to build unicorns like
- 0:32
twitter shopify github and airbnb just
- 0:34
to name a few ruby is often called a
- 0:36
programmer's best friend thanks to its
- 0:38
minimal syntax that relies on plain
- 0:40
english words and the use of blocks to
- 0:42
write concise functional code at the
- 0:44
same time it's a true object-oriented
- 0:46
language where everything is an object
- 0:48
and every object can be modified giving
- 0:50
developers the flexibility to extend or
- 0:52
modify the behavior of the underlying
- 0:54
language the developer ecosystem is
- 0:56
large and mature code is shared between
- 0:58
developers with the rubygems package
- 1:00
manager where a program is organized
- 1:01
into a self-contained format called a
- 1:03
gem to get started install ruby then
- 1:05
create a file ending in rb to declare a
- 1:08
local variable give it a name followed
- 1:10
by a value there's no variable keyword
- 1:12
but you can define constants in all caps
- 1:14
or global variables with a dollar sign
- 1:16
every value is an instance of an object
- 1:18
which means we can call methods directly
- 1:19
on a string like so and parentheses are
- 1:21
usually optional ruby is dynamically
- 1:23
typed which means there's no type
- 1:25
annotations however modern tools like
- 1:27
rbs can add a type system on top of it
- 1:29
kind of like how typescript does for
- 1:30
javascript now to print a value to the
- 1:32
standard output use the puts method we
- 1:34
can define our own custom methods using
- 1:36
the def keyword which end with the end
- 1:38
keyword every method will always return
- 1:40
exactly one object no return keyword is
- 1:42
necessary or if you don't want a named
- 1:44
method you might create a block with a
- 1:46
do keyword which works like an anonymous
- 1:48
function blocks can also take arguments
- 1:50
found in between the pipe characters now
- 1:52
use the class keyword to create
- 1:53
blueprints for your own custom objects
- 1:55
an interesting point is that ruby
- 1:57
supports duct typing which means that if
- 1:59
it walks like a duck and quacks like a


