SlideShare a Scribd company logo
THE RUBY LANGUAGE
THE RUBY LANGUAGE

• Originally by Yukihiro "Matz" Matsumoto
• “Ruby is designed for programmer productivity and fun, following
  the principles of good user interface design. He stresses that
  systems design needs to emphasize human, rather than computer,
  needs.”
                         http://en.wikipedia.org/wiki/Ruby_(programming_language)#History


• Ruby 1.0 was released in 1996.
RUBY LANGUAGE OVERVIEW

• Dynamically typed
• Interpreted
• Can be modified at runtime
• Object oriented
• Blocks & lambdas
• Nice support for Regular Expressions
RUBY VERSIONS
ruby -v
•1.8.6 – Still around but mostly supplanted by 1.8.7
•1.8.7 – some 1.9 features, compatible w/ 1.8.6
•1.9.2 – latest version, many VMs, Rails 2.3+
RUBY VMS


• MRI (Matz's Ruby Interpreter) the original Ruby, default for 1.8
• YARV (yet another Ruby VM) faster than MRI, default for 1.9
• JRuby (Java)
• Rubinius (pure ruby)
• IronRuby (.NET)
• MacRuby, HotCocoa
• HotRuby/RubyJS (Flash/Javascript)
LETS GET STARTED

• IRB: InteractiveRuBy
>> 4
>> 4 + 4
EVERYTHING IS AN OBJECT


“test”.upcase
“test”.class
“test”.methods
EVERYTHING EVALUATES TO
      SOMETHING

2+2
(2+2).zero?
METHODS ARE MESSAGES


thing.do(4)
thing.do 4
thing.send “do”, 4
OPERATORS ARE METHODS

thing.do 4           3+2
thing.do(4)          3.+(2)
thing.send “do”, 4   3.send "+", 2
DEFINING CLASSES

• Let’s write some code!
INTRODUCTION TO RSPEC

• Describe the feature
• Verify expectation
RSPEC SYNTAX

describe Something do




end
RSPEC SYNTAX

describe Something do

 it "should do whatever it should do"




end
RSPEC SYNTAX

describe Something do

 it "should do whatever it should do" do




 end

end
RSPEC SYNTAX

describe Something do

 it "should do whatever it should do" do

   s = Something.new



 end

end
RSPEC SYNTAX

describe Something do

 it "should do whatever it should do" do

   s = Something.new

   s.do_whatever(3, 2, 1)

 end

end
RSPEC SYNTAX

describe Something do

 it "should do whatever it should do" do

   s = Something.new

   s.do_whatever(3, 2, 1).should == "blast off!"

 end

end
RSPEC SYNTAX

describe Something do

 it "should do whatever it should do" do

   s = Something.new

   s.do_whatever(3, 2, 1).should == "blast off!"

 end

end
• Let's   try it!

More Related Content

PDF
FaaS you like it (if Shakespeare had written Functions-as-a-Service)
Ewan Slater
 
PDF
PureScript Tutorial 1
Ray Shih
 
PPT
Pete Heroku Waza 2013 Ruby 2.0
Peter Hudgins
 
PDF
Taming Pythons with ZooKeeper (Pyconfi edition)
Jyrki Pulliainen
 
PDF
Thrift
Yury Kaliada
 
PDF
Debugging RubyMotion
Joshua Ballanco
 
KEY
Ruby Midwest 2010 jRuby by Charles Nutter
Steven Chau
 
PPTX
OpenWhisk Go/Swift/Binaries Runtime
Michele Sciabarrà
 
FaaS you like it (if Shakespeare had written Functions-as-a-Service)
Ewan Slater
 
PureScript Tutorial 1
Ray Shih
 
Pete Heroku Waza 2013 Ruby 2.0
Peter Hudgins
 
Taming Pythons with ZooKeeper (Pyconfi edition)
Jyrki Pulliainen
 
Thrift
Yury Kaliada
 
Debugging RubyMotion
Joshua Ballanco
 
Ruby Midwest 2010 jRuby by Charles Nutter
Steven Chau
 
OpenWhisk Go/Swift/Binaries Runtime
Michele Sciabarrà
 

What's hot (20)

PPTX
OpenWhisk Go Runtime
Michele Sciabarrà
 
KEY
Less to Few
Shota Fukumori
 
PDF
Nodejs OC Docker and Node
Jeff Horn
 
KEY
自分をClojure化する方法
fukamachi
 
PPTX
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
epamspb
 
PDF
Code for Startup MVP (Ruby on Rails) Session 1
Henry S
 
PDF
A Serverless first approach - Will it Lambda?
Nick den Engelsman
 
PDF
KDE SC 4.6 Brings brand new kubuntu
csslayer
 
PDF
10 Things you should know about Ruby
sikachu
 
PPTX
Agile
Ambientia
 
PDF
Frameworks
Ryan Levick
 
KEY
Erlang: TL;DR
vorn
 
PDF
競プロの話
fukamachi
 
PDF
Garage RDBMS
ESUG
 
PPTX
Lisp in the Cloud
Mike Travers
 
PDF
RxSwiftを用いたアプリ開発の実践
GOMI NINGEN
 
PPTX
Firehose
Luca Grulla
 
PDF
データの民主化のために StackStorm を活用した事例
Yoshiyasu SAEKI
 
PDF
JRuby Hot Topics 2008-12-12
Koichiro Ohba
 
PPTX
5 Ways to Build Better Web APIs with Ruby and Rails
LaunchAny
 
OpenWhisk Go Runtime
Michele Sciabarrà
 
Less to Few
Shota Fukumori
 
Nodejs OC Docker and Node
Jeff Horn
 
自分をClojure化する方法
fukamachi
 
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
epamspb
 
Code for Startup MVP (Ruby on Rails) Session 1
Henry S
 
A Serverless first approach - Will it Lambda?
Nick den Engelsman
 
KDE SC 4.6 Brings brand new kubuntu
csslayer
 
10 Things you should know about Ruby
sikachu
 
Agile
Ambientia
 
Frameworks
Ryan Levick
 
Erlang: TL;DR
vorn
 
競プロの話
fukamachi
 
Garage RDBMS
ESUG
 
Lisp in the Cloud
Mike Travers
 
RxSwiftを用いたアプリ開発の実践
GOMI NINGEN
 
Firehose
Luca Grulla
 
データの民主化のために StackStorm を活用した事例
Yoshiyasu SAEKI
 
JRuby Hot Topics 2008-12-12
Koichiro Ohba
 
5 Ways to Build Better Web APIs with Ruby and Rails
LaunchAny
 
Ad

Viewers also liked (6)

PDF
Introduction to Selenium and Ruby
Ynon Perek
 
DOC
Selenium Automation Using Ruby
Kumari Warsha Goel
 
PDF
Automated Testing with Ruby
Keith Pitty
 
PPTX
Web driver training
Dipesh Bhatewara
 
PDF
Selenium webdriver
sean_todd
 
PDF
Join the darkside: Selenium testing with Nightwatch.js
Seth McLaughlin
 
Introduction to Selenium and Ruby
Ynon Perek
 
Selenium Automation Using Ruby
Kumari Warsha Goel
 
Automated Testing with Ruby
Keith Pitty
 
Web driver training
Dipesh Bhatewara
 
Selenium webdriver
sean_todd
 
Join the darkside: Selenium testing with Nightwatch.js
Seth McLaughlin
 
Ad

Similar to Intro to Ruby (and RSpec) (20)

PDF
J Ruby Whirlwind Tour
oscon2007
 
KEY
Rails development environment talk
Reuven Lerner
 
PPT
Initiation à Ruby on Rails
Microsoft Technet France
 
PPTX
Ruby on Rails - An overview
Thomas Asikis
 
KEY
Ruby on Rails Training - Module 1
Mark Menard
 
PDF
JRoR Deploying Rails on JRuby
elliando dias
 
KEY
Charles nutter star techconf 2011 - jvm languages
StarTech Conference
 
PDF
Ruby Performance - The Last Mile - RubyConf India 2016
Charles Nutter
 
PDF
Ruby and japanese
Makoto Inoue
 
KEY
Rails console
Reuven Lerner
 
PDF
Ruby an overall approach
Felipe Schmitt
 
PPTX
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
PDF
Spacebrew: The Overview
Brett Renfer
 
PDF
ruby-cocoa
tutorialsruby
 
PDF
ruby-cocoa
tutorialsruby
 
PDF
How to Begin to Develop Ruby Core
Hiroshi SHIBATA
 
PDF
RubyMotion
betabeers
 
PDF
ITP Spacebrew Workshop - Spring 2014
Brett Renfer
 
PPTX
How to use Ruby in QA, DevOps, Development. Ruby lang Intro
Viacheslav Horbovskykh
 
PDF
Scripting OS X with Applescript, without Applescript
Matt Patterson
 
J Ruby Whirlwind Tour
oscon2007
 
Rails development environment talk
Reuven Lerner
 
Initiation à Ruby on Rails
Microsoft Technet France
 
Ruby on Rails - An overview
Thomas Asikis
 
Ruby on Rails Training - Module 1
Mark Menard
 
JRoR Deploying Rails on JRuby
elliando dias
 
Charles nutter star techconf 2011 - jvm languages
StarTech Conference
 
Ruby Performance - The Last Mile - RubyConf India 2016
Charles Nutter
 
Ruby and japanese
Makoto Inoue
 
Rails console
Reuven Lerner
 
Ruby an overall approach
Felipe Schmitt
 
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
Spacebrew: The Overview
Brett Renfer
 
ruby-cocoa
tutorialsruby
 
ruby-cocoa
tutorialsruby
 
How to Begin to Develop Ruby Core
Hiroshi SHIBATA
 
RubyMotion
betabeers
 
ITP Spacebrew Workshop - Spring 2014
Brett Renfer
 
How to use Ruby in QA, DevOps, Development. Ruby lang Intro
Viacheslav Horbovskykh
 
Scripting OS X with Applescript, without Applescript
Matt Patterson
 

More from Blazing Cloud (20)

PDF
Rails ORM De-mystifying Active Record has_many
Blazing Cloud
 
PDF
Active Record Introduction - 3
Blazing Cloud
 
PDF
Rails Class Intro - 1
Blazing Cloud
 
PDF
Your first rails app - 2
Blazing Cloud
 
PDF
RSpec Quick Reference
Blazing Cloud
 
PDF
Extending rails
Blazing Cloud
 
KEY
2day Ruby Class Intro
Blazing Cloud
 
KEY
Mobile Lean UX
Blazing Cloud
 
KEY
Interactive Graphics
Blazing Cloud
 
KEY
Interactive Graphics w/ Javascript, HTML5 and CSS3
Blazing Cloud
 
KEY
Form helpers
Blazing Cloud
 
KEY
What you don't know (yet)
Blazing Cloud
 
KEY
Introduction to Rails
Blazing Cloud
 
KEY
ActiveRecord
Blazing Cloud
 
KEY
Ruby on Rails Class intro
Blazing Cloud
 
KEY
Ruby on rails toolbox
Blazing Cloud
 
KEY
Routes Controllers
Blazing Cloud
 
KEY
Test Driven Development
Blazing Cloud
 
KEY
Active Record
Blazing Cloud
 
KEY
Enumerables
Blazing Cloud
 
Rails ORM De-mystifying Active Record has_many
Blazing Cloud
 
Active Record Introduction - 3
Blazing Cloud
 
Rails Class Intro - 1
Blazing Cloud
 
Your first rails app - 2
Blazing Cloud
 
RSpec Quick Reference
Blazing Cloud
 
Extending rails
Blazing Cloud
 
2day Ruby Class Intro
Blazing Cloud
 
Mobile Lean UX
Blazing Cloud
 
Interactive Graphics
Blazing Cloud
 
Interactive Graphics w/ Javascript, HTML5 and CSS3
Blazing Cloud
 
Form helpers
Blazing Cloud
 
What you don't know (yet)
Blazing Cloud
 
Introduction to Rails
Blazing Cloud
 
ActiveRecord
Blazing Cloud
 
Ruby on Rails Class intro
Blazing Cloud
 
Ruby on rails toolbox
Blazing Cloud
 
Routes Controllers
Blazing Cloud
 
Test Driven Development
Blazing Cloud
 
Active Record
Blazing Cloud
 
Enumerables
Blazing Cloud
 

Intro to Ruby (and RSpec)

Editor's Notes