The Object Oriented Scripting Language Ruby

Masumoto and Keiju

JR Ruby notes

Click here for the official Ruby Manual
------------------------------
ruby -v
  shows version

ruby -h    or --help
  for help

------------------------------
In Ruby, absolutely everything is an object,
meaning everything operates in the same paradigm
of sending and receiving messages.

In Python there are still primitive data types and
everything is not necessarily an object
•	Python tends to be object-oriented in practice
------------------------------
Whitespace is meaningful in Python
Rails is magical
------------------------------
JANGO is a Python framework for web development
Python Websites
•	Spotify
•	YouTube
•	Dropbox
•	Pinterest
•	Google (Uses extensively into various apps)
•	Quora
•	Instagram
•	Reddit

------------------------------
Rails is a Ruby framework for web development
Ruby Websites
•	Airbnb
•	Github
•	Kickstarter

------------------------------
Gem is the Ruby word for a library
Egg is the Python equivalent

------------------------------

interactive ruby
*           * *
irb  invokes the interpreter
quit returns to bash

pi@raspberrypi:~ $ irb
irb(main):001:0> puts "hellow wrld"
hellow wrld
=> nil
irb(main):002:0>
...
irb(main):010:0> def hola
irb(main):011:1> puts "Hello World!"
irb(main):012:1> end
=> :hola
irb(main):013:0> hola
Hello World!
=> nil
irb(main):014:0> hola()
Hello World!
=> nil



irb(main):002:0> quit
pi@raspberrypi:~ $

------------------------------
Ruby
  Math.sqrt(81)
 => 9.0

BASIC
 PRINT SQR(81)
         9

Python
 >>>import math
 >>>print(math.sqrt(81))
 >>>9.0
------------------------------

© JR 2019