0% found this document useful (0 votes)
40 views

1 Ruby Fundamentals Module1 Slides

Ruby Fundamentals provides an overview of the Ruby programming language. It discusses Ruby's object-oriented design, dynamic typing, reflection and metaprogramming capabilities. It also demonstrates how to install Ruby, use the Interactive Ruby Shell (IRB) for experimentation, and choose from IDE options like RubyMine. The document then summarizes key Ruby language features such as operators, variables, and methods.

Uploaded by

maheshgajelli
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

1 Ruby Fundamentals Module1 Slides

Ruby Fundamentals provides an overview of the Ruby programming language. It discusses Ruby's object-oriented design, dynamic typing, reflection and metaprogramming capabilities. It also demonstrates how to install Ruby, use the Interactive Ruby Shell (IRB) for experimentation, and choose from IDE options like RubyMine. The document then summarizes key Ruby language features such as operators, variables, and methods.

Uploaded by

maheshgajelli
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Ruby Fundamentals

Alex Korban
@alexkorban
korban.net

Overview
Setting up
IDE and tools
Language features
Standard libraries

10,000 Foot View of Ruby


Focused on helping developers be productive and happy

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

Interactive Ruby Shell (IRB)


Great for experimentation and exploration
irb

Allows arbitrary Ruby code


Use up arrow to go through history
_ stores the result of the last evaluated expression

IDE Options
RubyMine -> jetbrains.com/ruby
Aptana Studio -> aptana.com
No IDE just your favorite text editor
(Emacs, VIM, SciTE, Notepad++)

Some Ruby Operators


Comparison operators

Mathematical operators

>
==

>=
!=

<

<=

** (exponentiation)

Logical operators

Bitwise integer operators

!
not

&
<<

&&
||
and
or

|
>>

Assignment operators: a += 10 is shorthand for a = a + 10


+=
<<=

-=

*=

/=

%=

**=

&=

|=

^=

>>=

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

You might also like