1 Ruby Fundamentals Module1 Slides
1 Ruby Fundamentals Module1 Slides
Alex Korban
@alexkorban
korban.net
Overview
Setting up
IDE and tools
Language features
Standard libraries
Thoroughly
object oriented
Reflection
Dynamic typing
and duck typing
Metaprogramming
Multi-paradigm
Bytecode
interpreted
Installing Ruby
Windows: rubyinstaller.org -> Downloads -> get Ruby 2.0.0 or later
ruby v
Linux: rvm.io -> install RVM & the latest version of Ruby
Mac OS X: rvm.io -> install RVM & the latest version of Ruby
IDE Options
RubyMine -> jetbrains.com/ruby
Aptana Studio -> aptana.com
No IDE just your favorite text editor
(Emacs, VIM, SciTE, Notepad++)
Mathematical operators
>
==
>=
!=
<
<=
** (exponentiation)
Logical operators
!
not
&
<<
&&
||
and
or
|
>>
-=
*=
/=
%=
**=
&=
|=
^=
>>=
To Recap
my_awesome_var
myAwesomeVar
my_awesome_var = 10
$global_flag
my_awesome_var = 10
def some_method
my_awesome_var = "abc"
# ...
my_awesome_var = nil
no value
To Recap
2 spaces
return value
# go towards destination
def launch(destination)
set_destination(destination)
batten_hatches
light_seatbelt_sign
fire_up_engine
end
# preflight check is mandatory
if preflight_check == "complete"
launch("Earth")
end
To Recap
Input and output can be done with gets/puts/print
Call out to the system with backticks or system method
Summary
Underlying principles of Ruby and its implementation
Demo of IRB and RubyMine
Basics of the Ruby language features