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!
Ad

Recommended

FaaS you like it (if Shakespeare had written Functions-as-a-Service)
FaaS you like it (if Shakespeare had written Functions-as-a-Service)
Ewan Slater
 
PureScript Tutorial 1
PureScript Tutorial 1
Ray Shih
 
Pete Heroku Waza 2013 Ruby 2.0
Pete Heroku Waza 2013 Ruby 2.0
Peter Hudgins
 
Taming Pythons with ZooKeeper (Pyconfi edition)
Taming Pythons with ZooKeeper (Pyconfi edition)
Jyrki Pulliainen
 
Thrift
Thrift
Yury Kaliada
 
Debugging RubyMotion
Debugging RubyMotion
Joshua Ballanco
 
Ruby Midwest 2010 jRuby by Charles Nutter
Ruby Midwest 2010 jRuby by Charles Nutter
Steven Chau
 
OpenWhisk Go/Swift/Binaries Runtime
OpenWhisk Go/Swift/Binaries Runtime
Michele Sciabarrà
 
OpenWhisk Go Runtime
OpenWhisk Go Runtime
Michele Sciabarrà
 
Less to Few
Less to Few
Shota Fukumori
 
Nodejs OC Docker and Node
Nodejs OC Docker and Node
Jeff Horn
 
自分をClojure化する方法
自分をClojure化する方法
fukamachi
 
#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 1
Henry S
 
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 kubuntu
csslayer
 
10 Things you should know about Ruby
10 Things you should know about Ruby
sikachu
 
Agile
Agile
Ambientia
 
Frameworks
Frameworks
Ryan Levick
 
Erlang: TL;DR
Erlang: TL;DR
vorn
 
競プロの話
競プロの話
fukamachi
 
Garage RDBMS
Garage RDBMS
ESUG
 
Lisp in the Cloud
Lisp in the Cloud
Mike Travers
 
RxSwiftを用いたアプリ開発の実践
RxSwiftを用いたアプリ開発の実践
GOMI NINGEN
 
Firehose
Firehose
Luca Grulla
 
データの民主化のために StackStorm を活用した事例
データの民主化のために StackStorm を活用した事例
Yoshiyasu SAEKI
 
JRuby 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 Rails
LaunchAny
 
Introduction to Selenium and Ruby
Introduction to Selenium and Ruby
Ynon Perek
 
Selenium Automation Using Ruby
Selenium Automation Using Ruby
Kumari Warsha Goel
 

More Related Content

What's hot (20)

OpenWhisk Go Runtime
OpenWhisk Go Runtime
Michele Sciabarrà
 
Less to Few
Less to Few
Shota Fukumori
 
Nodejs OC Docker and Node
Nodejs OC Docker and Node
Jeff Horn
 
自分をClojure化する方法
自分をClojure化する方法
fukamachi
 
#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 1
Henry S
 
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 kubuntu
csslayer
 
10 Things you should know about Ruby
10 Things you should know about Ruby
sikachu
 
Agile
Agile
Ambientia
 
Frameworks
Frameworks
Ryan Levick
 
Erlang: TL;DR
Erlang: TL;DR
vorn
 
競プロの話
競プロの話
fukamachi
 
Garage RDBMS
Garage RDBMS
ESUG
 
Lisp in the Cloud
Lisp in the Cloud
Mike Travers
 
RxSwiftを用いたアプリ開発の実践
RxSwiftを用いたアプリ開発の実践
GOMI NINGEN
 
Firehose
Firehose
Luca Grulla
 
データの民主化のために StackStorm を活用した事例
データの民主化のために StackStorm を活用した事例
Yoshiyasu SAEKI
 
JRuby 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 Rails
LaunchAny
 
Nodejs OC Docker and Node
Nodejs OC Docker and Node
Jeff Horn
 
自分をClojure化する方法
自分をClojure化する方法
fukamachi
 
#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 1
Henry S
 
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 kubuntu
csslayer
 
10 Things you should know about Ruby
10 Things you should know about Ruby
sikachu
 
Erlang: TL;DR
Erlang: TL;DR
vorn
 
競プロの話
競プロの話
fukamachi
 
Garage RDBMS
Garage RDBMS
ESUG
 
RxSwiftを用いたアプリ開発の実践
RxSwiftを用いたアプリ開発の実践
GOMI NINGEN
 
データの民主化のために StackStorm を活用した事例
データの民主化のために StackStorm を活用した事例
Yoshiyasu SAEKI
 
JRuby 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 Rails
LaunchAny
 

Viewers also liked (6)

Introduction to Selenium and Ruby
Introduction to Selenium and Ruby
Ynon Perek
 
Selenium Automation Using Ruby
Selenium Automation Using Ruby
Kumari Warsha Goel
 
Automated Testing with Ruby
Automated Testing with Ruby
Keith Pitty
 
Web driver training
Web driver training
Dipesh Bhatewara
 
Selenium webdriver
Selenium webdriver
sean_todd
 
Join 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 Ruby
Ynon Perek
 
Selenium Automation Using Ruby
Selenium Automation Using Ruby
Kumari Warsha Goel
 
Automated Testing with Ruby
Automated Testing with Ruby
Keith Pitty
 
Selenium webdriver
Selenium webdriver
sean_todd
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
Seth McLaughlin
 
Ad

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

J Ruby Whirlwind Tour
J Ruby Whirlwind Tour
oscon2007
 
Rails development environment talk
Rails development environment talk
Reuven Lerner
 
Initiation à Ruby on Rails
Initiation à Ruby on Rails
Microsoft Technet France
 
Ruby on Rails - An overview
Ruby on Rails - An overview
Thomas Asikis
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
Mark Menard
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
elliando dias
 
Charles 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 2016
Charles Nutter
 
Ruby and japanese
Ruby and japanese
Makoto Inoue
 
Rails console
Rails console
Reuven Lerner
 
Ruby an overall approach
Ruby an overall approach
Felipe Schmitt
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
Spacebrew: The Overview
Spacebrew: The Overview
Brett Renfer
 
ruby-cocoa
ruby-cocoa
tutorialsruby
 
ruby-cocoa
ruby-cocoa
tutorialsruby
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
Hiroshi SHIBATA
 
RubyMotion
RubyMotion
betabeers
 
ITP 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 Intro
Viacheslav Horbovskykh
 
Scripting OS X with Applescript, without Applescript
Scripting OS X with Applescript, without Applescript
Matt Patterson
 
J Ruby Whirlwind Tour
J Ruby Whirlwind Tour
oscon2007
 
Rails development environment talk
Rails development environment talk
Reuven Lerner
 
Ruby on Rails - An overview
Ruby on Rails - An overview
Thomas Asikis
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
Mark Menard
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
elliando dias
 
Charles 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 2016
Charles Nutter
 
Ruby an overall approach
Ruby an overall approach
Felipe Schmitt
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
Spacebrew: The Overview
Spacebrew: The Overview
Brett Renfer
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
Hiroshi SHIBATA
 
ITP 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 Intro
Viacheslav Horbovskykh
 
Scripting OS X with Applescript, without Applescript
Scripting OS X with Applescript, without Applescript
Matt Patterson
 
Ad

More from Blazing Cloud (20)

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

Intro to Ruby (and RSpec)

Editor's Notes