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

What's hot (20)

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

Viewers also liked (6)

Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
Ynon Perek
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
Kumari Warsha Goel
 
Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with Ruby
Keith Pitty
 
Web driver training
Web driver trainingWeb driver training
Web driver training
Dipesh Bhatewara
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriver
sean_todd
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
Seth McLaughlin
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
Ynon Perek
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
Kumari Warsha Goel
 
Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with Ruby
Keith Pitty
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriver
sean_todd
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
Seth McLaughlin
 

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

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

More from Blazing Cloud (20)

Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_many
Blazing Cloud
 
Active Record Introduction - 3
Active Record Introduction - 3Active Record Introduction - 3
Active Record Introduction - 3
Blazing Cloud
 
Rails Class Intro - 1
Rails Class Intro - 1 Rails Class Intro - 1
Rails Class Intro - 1
Blazing Cloud
 
Your first rails app - 2
 Your first rails app - 2 Your first rails app - 2
Your first rails app - 2
Blazing Cloud
 
RSpec Quick Reference
RSpec Quick ReferenceRSpec Quick Reference
RSpec Quick Reference
Blazing Cloud
 
Extending rails
Extending railsExtending rails
Extending rails
Blazing Cloud
 
2day Ruby Class Intro
2day Ruby Class Intro2day Ruby Class Intro
2day Ruby Class Intro
Blazing Cloud
 
Mobile Lean UX
Mobile Lean UXMobile Lean UX
Mobile Lean UX
Blazing Cloud
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive Graphics
Blazing Cloud
 
Interactive Graphics w/ Javascript, HTML5 and CSS3
Interactive Graphics w/ Javascript, HTML5 and CSS3Interactive Graphics w/ Javascript, HTML5 and CSS3
Interactive Graphics w/ Javascript, HTML5 and CSS3
Blazing Cloud
 
Form helpers
Form helpersForm helpers
Form helpers
Blazing Cloud
 
What you don't know (yet)
What you don't know (yet)What you don't know (yet)
What you don't know (yet)
Blazing Cloud
 
Introduction to Rails
Introduction to RailsIntroduction to Rails
Introduction to Rails
Blazing Cloud
 
ActiveRecord
ActiveRecordActiveRecord
ActiveRecord
Blazing Cloud
 
Ruby on Rails Class intro
Ruby on Rails Class introRuby on Rails Class intro
Ruby on Rails Class intro
Blazing Cloud
 
Ruby on rails toolbox
Ruby on rails toolboxRuby on rails toolbox
Ruby on rails toolbox
Blazing Cloud
 
Routes Controllers
Routes ControllersRoutes Controllers
Routes Controllers
Blazing Cloud
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Blazing Cloud
 
Active Record
Active RecordActive Record
Active Record
Blazing Cloud
 
Enumerables
EnumerablesEnumerables
Enumerables
Blazing Cloud
 
Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_many
Blazing Cloud
 
Active Record Introduction - 3
Active Record Introduction - 3Active Record Introduction - 3
Active Record Introduction - 3
Blazing Cloud
 
Rails Class Intro - 1
Rails Class Intro - 1 Rails Class Intro - 1
Rails Class Intro - 1
Blazing Cloud
 
Your first rails app - 2
 Your first rails app - 2 Your first rails app - 2
Your first rails app - 2
Blazing Cloud
 
RSpec Quick Reference
RSpec Quick ReferenceRSpec Quick Reference
RSpec Quick Reference
Blazing Cloud
 
2day Ruby Class Intro
2day Ruby Class Intro2day Ruby Class Intro
2day Ruby Class Intro
Blazing Cloud
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive Graphics
Blazing Cloud
 
Interactive Graphics w/ Javascript, HTML5 and CSS3
Interactive Graphics w/ Javascript, HTML5 and CSS3Interactive Graphics w/ Javascript, HTML5 and CSS3
Interactive Graphics w/ Javascript, HTML5 and CSS3
Blazing Cloud
 
What you don't know (yet)
What you don't know (yet)What you don't know (yet)
What you don't know (yet)
Blazing Cloud
 
Introduction to Rails
Introduction to RailsIntroduction to Rails
Introduction to Rails
Blazing Cloud
 
Ruby on Rails Class intro
Ruby on Rails Class introRuby on Rails Class intro
Ruby on Rails Class intro
Blazing Cloud
 
Ruby on rails toolbox
Ruby on rails toolboxRuby on rails toolbox
Ruby on rails toolbox
Blazing Cloud
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Blazing Cloud
 

Intro to Ruby (and RSpec)

Editor's Notes