SlideShare una empresa de Scribd logo
1 de 20
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!

Más contenido relacionado

La actualidad más candente

Nodejs OC Docker and Node
Nodejs OC Docker and NodeNodejs OC Docker and Node
Nodejs OC Docker and NodeJeff 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 1Henry 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 kubuntucsslayer
 
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 Rubysikachu
 
Erlang: TL;DR
Erlang: TL;DRErlang: TL;DR
Erlang: TL;DRvorn
 
競プロの話
競プロの話競プロの話
競プロの話fukamachi
 
Garage RDBMS
Garage RDBMSGarage RDBMS
Garage RDBMSESUG
 
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-12Koichiro 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 RailsLaunchAny
 

La actualidad más candente (20)

OpenWhisk Go Runtime
OpenWhisk Go RuntimeOpenWhisk Go Runtime
OpenWhisk Go Runtime
 
Less to Few
Less to FewLess to Few
Less to Few
 
Nodejs OC Docker and Node
Nodejs OC Docker and NodeNodejs OC Docker and Node
Nodejs OC Docker and Node
 
自分をClojure化する方法
自分をClojure化する方法自分をClojure化する方法
自分をClojure化する方法
 
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
 
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
 
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?
 
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
 
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
 
Agile
AgileAgile
Agile
 
Frameworks
FrameworksFrameworks
Frameworks
 
Erlang: TL;DR
Erlang: TL;DRErlang: TL;DR
Erlang: TL;DR
 
競プロの話
競プロの話競プロの話
競プロの話
 
Garage RDBMS
Garage RDBMSGarage RDBMS
Garage RDBMS
 
Lisp in the Cloud
Lisp in the CloudLisp in the Cloud
Lisp in the Cloud
 
RxSwiftを用いたアプリ開発の実践
RxSwiftを用いたアプリ開発の実践RxSwiftを用いたアプリ開発の実践
RxSwiftを用いたアプリ開発の実践
 
Firehose
FirehoseFirehose
Firehose
 
データの民主化のために StackStorm を活用した事例
データの民主化のために StackStorm を活用した事例データの民主化のために StackStorm を活用した事例
データの民主化のために StackStorm を活用した事例
 
JRuby Hot Topics 2008-12-12
JRuby Hot Topics 2008-12-12JRuby Hot Topics 2008-12-12
JRuby Hot Topics 2008-12-12
 
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
 

Destacado

Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and RubyYnon Perek
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 
Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with RubyKeith Pitty
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriversean_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.jsSeth McLaughlin
 

Destacado (6)

Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with Ruby
 
Web driver training
Web driver trainingWeb driver training
Web driver training
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriver
 
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
 

Similar a Intro to the Ruby Programming Language

J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Touroscon2007
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talkReuven Lerner
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overviewThomas Asikis
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyelliando 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 languagesStarTech 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 2016Charles Nutter
 
Ruby an overall approach
Ruby an overall approachRuby an overall approach
Ruby an overall approachFelipe Schmitt
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
Spacebrew: The Overview
Spacebrew: The OverviewSpacebrew: The Overview
Spacebrew: The OverviewBrett 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 CoreHiroshi SHIBATA
 
ITP Spacebrew Workshop - Spring 2014
ITP Spacebrew Workshop - Spring 2014ITP Spacebrew Workshop - Spring 2014
ITP Spacebrew Workshop - Spring 2014Brett 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 IntroViacheslav 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 ApplescriptMatt Patterson
 

Similar a Intro to the Ruby Programming Language (20)

J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talk
 
Initiation à Ruby on Rails
Initiation à Ruby on RailsInitiation à Ruby on Rails
Initiation à Ruby on Rails
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
 
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
 
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
 
Ruby and japanese
Ruby and japaneseRuby and japanese
Ruby and japanese
 
Rails console
Rails consoleRails console
Rails console
 
Ruby an overall approach
Ruby an overall approachRuby an overall approach
Ruby an overall approach
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Spacebrew: The Overview
Spacebrew: The OverviewSpacebrew: The Overview
Spacebrew: The Overview
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
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
 
RubyMotion
RubyMotionRubyMotion
RubyMotion
 
ITP Spacebrew Workshop - Spring 2014
ITP Spacebrew Workshop - Spring 2014ITP Spacebrew Workshop - Spring 2014
ITP Spacebrew Workshop - Spring 2014
 
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
 
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
 

Más de 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_manyBlazing Cloud
 
Active Record Introduction - 3
Active Record Introduction - 3Active Record Introduction - 3
Active Record Introduction - 3Blazing 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 - 2Blazing Cloud
 
RSpec Quick Reference
RSpec Quick ReferenceRSpec Quick Reference
RSpec Quick ReferenceBlazing Cloud
 
2day Ruby Class Intro
2day Ruby Class Intro2day Ruby Class Intro
2day Ruby Class IntroBlazing Cloud
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive GraphicsBlazing 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 CSS3Blazing 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 RailsBlazing Cloud
 
Ruby on Rails Class intro
Ruby on Rails Class introRuby on Rails Class intro
Ruby on Rails Class introBlazing Cloud
 
Ruby on rails toolbox
Ruby on rails toolboxRuby on rails toolbox
Ruby on rails toolboxBlazing Cloud
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentBlazing Cloud
 

Más de 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
 
Active Record Introduction - 3
Active Record Introduction - 3Active Record Introduction - 3
Active Record Introduction - 3
 
Rails Class Intro - 1
Rails Class Intro - 1 Rails Class Intro - 1
Rails Class Intro - 1
 
Your first rails app - 2
 Your first rails app - 2 Your first rails app - 2
Your first rails app - 2
 
RSpec Quick Reference
RSpec Quick ReferenceRSpec Quick Reference
RSpec Quick Reference
 
Extending rails
Extending railsExtending rails
Extending rails
 
2day Ruby Class Intro
2day Ruby Class Intro2day Ruby Class Intro
2day Ruby Class Intro
 
Mobile Lean UX
Mobile Lean UXMobile Lean UX
Mobile Lean UX
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive Graphics
 
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
 
Form helpers
Form helpersForm helpers
Form helpers
 
What you don't know (yet)
What you don't know (yet)What you don't know (yet)
What you don't know (yet)
 
Introduction to Rails
Introduction to RailsIntroduction to Rails
Introduction to Rails
 
ActiveRecord
ActiveRecordActiveRecord
ActiveRecord
 
Ruby on Rails Class intro
Ruby on Rails Class introRuby on Rails Class intro
Ruby on Rails Class intro
 
Ruby on rails toolbox
Ruby on rails toolboxRuby on rails toolbox
Ruby on rails toolbox
 
Routes Controllers
Routes ControllersRoutes Controllers
Routes Controllers
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Active Record
Active RecordActive Record
Active Record
 
Enumerables
EnumerablesEnumerables
Enumerables
 

Intro to the Ruby Programming Language

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n