SlideShare a Scribd company logo
RUBY CAN
HELP YOU
WITH ...
ANYTHING!
By Viacheslav Horbovskykh
AGENDA
History of Ruby
Main philosophy and tricks
How Ruby can help you in QA, DevOps,
Development
Ruby in numbers
Q&A
HISTORY
Creator, Yukihiro “Matz” Matsumoto,
blended parts of his favourite languages
(Perl, Smalltalk, Eiffel, Ada, and Lisp)
”Ruby is simple in appearance, but
is very complex inside, just like our
human body”
THE NAME "RUBY"
• The name "Ruby" originated during an online chat session between
Matsumoto and Keiju Ishitsuka on February 24, 1993. Initially two
names were proposed: "Coral" and "Ruby". Matsumoto later noted a
factor in choosing the name "Ruby" – it was the birthstone of one of
his colleagues.
FIRST PUBLICATION
• The first public release of Ruby 0.95 was announced on Japanese
domestic newsgroups on December 21, 1995. Subsequently, three
more versions of Ruby were released in two days. The release
coincided with the launch of the Japanese-language ruby-list mailing
list, which was the first mailing list for the new language.
VERSION LIST
Following the release of Ruby 0.95 in 1995, several stable versions of Ruby were released in the following years:
• Ruby 1.0: December 25, 1996
• In 1997, the first article about Ruby was published on the Web. In the same year, Matsumoto was hired by
netlab.jp to work on Ruby as a full-time developer.
• In 1998, the Ruby Application Archive was launched by Matsumoto, along with a simple English-language
homepage for Ruby.
• In 1999, the first English language mailing list ruby-talk began, which signaled a growing interest in the language
outside Japan. In this same year, Matsumoto and Keiju Ishitsuka wrote the first book on Ruby, The Object-oriented
Scripting Language Ruby
• Ruby 1.6: September 2000
• Ruby 1.8 was initially released August 2003
• Ruby 1.9 was released on Christmas Day in 2007
• Ruby 2.0 As of the official 2.0.0 release on February 24, 2013. It has been obsolete since February 22, 2016, and it
will no longer receive bug and security fixes.
• Ruby 2.1.0 was released on Christmas Day in 2013
• Ruby 2.2.0 was released on Christmas Day in 2014
• Ruby 2.3.0 was released on Christmas Day in 2015
• Ruby 2.4.0 was released on Christmas Day in 2016.
• Ruby 2.5.0 was released on Christmas Day in 2017
• Ruby 2.6.0 was released on Christmas Day in 2018
• Ruby 2.7.0 was released on Christmas Day in 2019
VERSION LIST
PHILOSPHY
The principles of Ruby device and programming on it are
sometimes highlighted in the term “Ruby Way”.
• Language is for man, not computer.
• Simple but not too simple.
• Principle of least astonishment (POLA), meaning that the
language should behave in such a way as to minimize confusion
for experienced users.
irb(main):001:0> "alphabet".upcase.concat("Soup")
=> "ALPHABETSoup"
PHILOSPHY
• Principle of flexibility: There are multiple ways to accomplish
the same thing, and even built-in commands can be changed.
# Version 1:
if 3>4
puts "the condition is true"
else
puts "the condition is false"
End
# Version 2:
puts 3>4 ? 'the condition is true' : 'the condition is false'
Here’s an Hello World code spinet in Ruby,
Python and Java.
• Ruby:
puts "Hello World"
• Python:
print("Hello World")
• Java:
public class Main {
public static void main(String[] args {
System.out.println("Hello World");
}
}
COMPARISON
OF
HELLO WORLD
< = Java
Python =>
Ruby =>
HOW RUBY
CAN HELP
YOU IN …
QA
Tools:
• Cucumber, Rspec,
Capybara
• Selenium WebDriver, Watir
• …
# run options: rspec ruby_file.rb (require before launch gems: webdriver, rspec)
require 'webdrivers'
require 'rspec'
search_field = "//input[@type='text']"
prices = "//span[@class='s-item__price']"
describe "EBAY items" do
it "Sum of 10 ebay items should be more than 1000" do
driver = Selenium::WebDriver.for :chrome
driver.get "http://ebay.com"
element = driver.find_element(xpath: search_field)
element.send_keys "Astronomical Telescope"
element.submit
arr_prices = []
items_prices = driver.find_elements(xpath: prices)
items = items_prices.slice(0, 10)
# puts items
items.each do |item|
arr_prices.push(item.text.delete('$').to_f)
end
# puts arr_prices.sum
sum = arr_prices.sum
expect(sum).to be > 1000
end
end
DEVOPS
Tools:
• Pure ruby
• File, RubyXL, Dir, …
• Brackets ``
• …
# Writing to file
File.open('/some/file') do |file|
file.puts 'first line'
file.puts 'second line'
end
# Change dir
Dir.chdir('/some/place') do |dir|
do_something_in_some_place(dir)
end
# Reading from file
File.foreach('/some/file') do |line|
puts "Line read: #{line}"
do_something(line)
end
DEVELOPMENT
Tools:
• Ruby on Rails
• Sinatra
• Databases plugins
• …
require 'rubygems'
require 'sinatra'
require 'json'
# Home page
class ExampleApp < Sinatra::Base
path = __dir__
get '/' do
# Return index.html
File.read(File.join(path, 'public', 'index.html'))
end
# Error 404
get '/error404/?' do
# Return error 404.html
status 404
File.read(File.join(path, 'public', '404.html'))
end
end
webrick_options = {
Host: '0.0.0.0',
Port: '8080'
}
Rack::Handler::WEBrick.run ExampleApp, webrick_options
ICEBERG OF RUBY
• MRI interpreter
• Global interpreter lock (GIL)
• Multi Threads
• Multi Inheritance
• JRuby, IronRuby
• Garbage collector
• RVM, rbenv
• Bundler
• …
BIG RUBY PROJECTS
Ruby in
Numbers
Q & A

More Related Content

Similar to How to use Ruby in QA, DevOps, Development. Ruby lang Intro

Ruby, Rails, and the Open Source Community
Ruby, Rails, and the Open Source CommunityRuby, Rails, and the Open Source Community
Ruby, Rails, and the Open Source Community
Jim Myhrberg
 
Book of ruby
Book of rubyBook of ruby
Book of ruby
phongbk1609
 
Intro to Ruby (and RSpec)
Intro to Ruby (and RSpec)Intro to Ruby (and RSpec)
Intro to Ruby (and RSpec)
Blazing Cloud
 
Why ruby
Why rubyWhy ruby
Why ruby
Bill Chea
 
Fukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - OpalFukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - Opal
Andy Maleh
 
Ruby Beyond Rails
Ruby Beyond RailsRuby Beyond Rails
Ruby Beyond Rails
Gaveen Prabhasara
 
Ruby and japanese
Ruby and japaneseRuby and japanese
Ruby and japanese
Makoto Inoue
 
Ruby Class 1
Ruby Class 1Ruby Class 1
Ruby Class 1
Sarah Allen
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
guest5dedf5
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
Thomas Asikis
 
Learn Ruby 2011 - Session 1
Learn Ruby 2011 - Session 1Learn Ruby 2011 - Session 1
Learn Ruby 2011 - Session 1
James Thompson
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
myuser
 
Adventures of java developer in ruby world
Adventures of java developer in ruby worldAdventures of java developer in ruby world
Adventures of java developer in ruby world
Orest Ivasiv
 
Ruby Past, Present, Future
Ruby   Past, Present, FutureRuby   Past, Present, Future
Ruby Past, Present, Future
adamfine
 
Ruby on Rails Fundamentals, Class 1
Ruby on Rails Fundamentals, Class 1Ruby on Rails Fundamentals, Class 1
Ruby on Rails Fundamentals, Class 1
Sarah Allen
 
Japanese Rubyists you have not met yet
Japanese Rubyists you have not met yetJapanese Rubyists you have not met yet
Japanese Rubyists you have not met yet
masayoshi takahashi
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
ousli07
 
Ruby an overall approach
Ruby an overall approachRuby an overall approach
Ruby an overall approach
Felipe Schmitt
 
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar BatsovRuby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Michael Kimathi
 
Intro for RoR
Intro for RoRIntro for RoR

Similar to How to use Ruby in QA, DevOps, Development. Ruby lang Intro (20)

Ruby, Rails, and the Open Source Community
Ruby, Rails, and the Open Source CommunityRuby, Rails, and the Open Source Community
Ruby, Rails, and the Open Source Community
 
Book of ruby
Book of rubyBook of ruby
Book of ruby
 
Intro to Ruby (and RSpec)
Intro to Ruby (and RSpec)Intro to Ruby (and RSpec)
Intro to Ruby (and RSpec)
 
Why ruby
Why rubyWhy ruby
Why ruby
 
Fukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - OpalFukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - Opal
 
Ruby Beyond Rails
Ruby Beyond RailsRuby Beyond Rails
Ruby Beyond Rails
 
Ruby and japanese
Ruby and japaneseRuby and japanese
Ruby and japanese
 
Ruby Class 1
Ruby Class 1Ruby Class 1
Ruby Class 1
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
Learn Ruby 2011 - Session 1
Learn Ruby 2011 - Session 1Learn Ruby 2011 - Session 1
Learn Ruby 2011 - Session 1
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
 
Adventures of java developer in ruby world
Adventures of java developer in ruby worldAdventures of java developer in ruby world
Adventures of java developer in ruby world
 
Ruby Past, Present, Future
Ruby   Past, Present, FutureRuby   Past, Present, Future
Ruby Past, Present, Future
 
Ruby on Rails Fundamentals, Class 1
Ruby on Rails Fundamentals, Class 1Ruby on Rails Fundamentals, Class 1
Ruby on Rails Fundamentals, Class 1
 
Japanese Rubyists you have not met yet
Japanese Rubyists you have not met yetJapanese Rubyists you have not met yet
Japanese Rubyists you have not met yet
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Ruby an overall approach
Ruby an overall approachRuby an overall approach
Ruby an overall approach
 
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar BatsovRuby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
 
Intro for RoR
Intro for RoRIntro for RoR
Intro for RoR
 

Recently uploaded

20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 

Recently uploaded (20)

20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 

How to use Ruby in QA, DevOps, Development. Ruby lang Intro

  • 1. RUBY CAN HELP YOU WITH ... ANYTHING! By Viacheslav Horbovskykh
  • 2. AGENDA History of Ruby Main philosophy and tricks How Ruby can help you in QA, DevOps, Development Ruby in numbers Q&A
  • 3. HISTORY Creator, Yukihiro “Matz” Matsumoto, blended parts of his favourite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) ”Ruby is simple in appearance, but is very complex inside, just like our human body”
  • 4. THE NAME "RUBY" • The name "Ruby" originated during an online chat session between Matsumoto and Keiju Ishitsuka on February 24, 1993. Initially two names were proposed: "Coral" and "Ruby". Matsumoto later noted a factor in choosing the name "Ruby" – it was the birthstone of one of his colleagues. FIRST PUBLICATION • The first public release of Ruby 0.95 was announced on Japanese domestic newsgroups on December 21, 1995. Subsequently, three more versions of Ruby were released in two days. The release coincided with the launch of the Japanese-language ruby-list mailing list, which was the first mailing list for the new language.
  • 5. VERSION LIST Following the release of Ruby 0.95 in 1995, several stable versions of Ruby were released in the following years: • Ruby 1.0: December 25, 1996 • In 1997, the first article about Ruby was published on the Web. In the same year, Matsumoto was hired by netlab.jp to work on Ruby as a full-time developer. • In 1998, the Ruby Application Archive was launched by Matsumoto, along with a simple English-language homepage for Ruby. • In 1999, the first English language mailing list ruby-talk began, which signaled a growing interest in the language outside Japan. In this same year, Matsumoto and Keiju Ishitsuka wrote the first book on Ruby, The Object-oriented Scripting Language Ruby • Ruby 1.6: September 2000 • Ruby 1.8 was initially released August 2003 • Ruby 1.9 was released on Christmas Day in 2007 • Ruby 2.0 As of the official 2.0.0 release on February 24, 2013. It has been obsolete since February 22, 2016, and it will no longer receive bug and security fixes. • Ruby 2.1.0 was released on Christmas Day in 2013 • Ruby 2.2.0 was released on Christmas Day in 2014 • Ruby 2.3.0 was released on Christmas Day in 2015 • Ruby 2.4.0 was released on Christmas Day in 2016. • Ruby 2.5.0 was released on Christmas Day in 2017 • Ruby 2.6.0 was released on Christmas Day in 2018 • Ruby 2.7.0 was released on Christmas Day in 2019
  • 7. PHILOSPHY The principles of Ruby device and programming on it are sometimes highlighted in the term “Ruby Way”. • Language is for man, not computer. • Simple but not too simple. • Principle of least astonishment (POLA), meaning that the language should behave in such a way as to minimize confusion for experienced users. irb(main):001:0> "alphabet".upcase.concat("Soup") => "ALPHABETSoup"
  • 8. PHILOSPHY • Principle of flexibility: There are multiple ways to accomplish the same thing, and even built-in commands can be changed. # Version 1: if 3>4 puts "the condition is true" else puts "the condition is false" End # Version 2: puts 3>4 ? 'the condition is true' : 'the condition is false'
  • 9. Here’s an Hello World code spinet in Ruby, Python and Java. • Ruby: puts "Hello World" • Python: print("Hello World") • Java: public class Main { public static void main(String[] args { System.out.println("Hello World"); } } COMPARISON OF HELLO WORLD
  • 14. QA Tools: • Cucumber, Rspec, Capybara • Selenium WebDriver, Watir • … # run options: rspec ruby_file.rb (require before launch gems: webdriver, rspec) require 'webdrivers' require 'rspec' search_field = "//input[@type='text']" prices = "//span[@class='s-item__price']" describe "EBAY items" do it "Sum of 10 ebay items should be more than 1000" do driver = Selenium::WebDriver.for :chrome driver.get "http://ebay.com" element = driver.find_element(xpath: search_field) element.send_keys "Astronomical Telescope" element.submit arr_prices = [] items_prices = driver.find_elements(xpath: prices) items = items_prices.slice(0, 10) # puts items items.each do |item| arr_prices.push(item.text.delete('$').to_f) end # puts arr_prices.sum sum = arr_prices.sum expect(sum).to be > 1000 end end
  • 15. DEVOPS Tools: • Pure ruby • File, RubyXL, Dir, … • Brackets `` • … # Writing to file File.open('/some/file') do |file| file.puts 'first line' file.puts 'second line' end # Change dir Dir.chdir('/some/place') do |dir| do_something_in_some_place(dir) end # Reading from file File.foreach('/some/file') do |line| puts "Line read: #{line}" do_something(line) end
  • 16. DEVELOPMENT Tools: • Ruby on Rails • Sinatra • Databases plugins • … require 'rubygems' require 'sinatra' require 'json' # Home page class ExampleApp < Sinatra::Base path = __dir__ get '/' do # Return index.html File.read(File.join(path, 'public', 'index.html')) end # Error 404 get '/error404/?' do # Return error 404.html status 404 File.read(File.join(path, 'public', '404.html')) end end webrick_options = { Host: '0.0.0.0', Port: '8080' } Rack::Handler::WEBrick.run ExampleApp, webrick_options
  • 17. ICEBERG OF RUBY • MRI interpreter • Global interpreter lock (GIL) • Multi Threads • Multi Inheritance • JRuby, IronRuby • Garbage collector • RVM, rbenv • Bundler • …
  • 20. Q & A