SlideShare a Scribd company logo
RUBY 2.5
IRENEUSZ SKROBIŚ
Lead developer @ SELLEO
AGENDA
AGENDA
new features
AGENDA
new features
performance
improvements
AGENDA
new features
performance
improvements
other notable
changes
New features
1
rescue/else/ensure are now allowed
to be used directly with do/end blocks
AFTER:
lambda do
raise 'err'
rescue
$! # => #<RuntimeError: err>
end.call
BEFORE:
lambda do
begin
raise 'err'
rescue
$! # => #<RuntimeError: err>
end
end.call
Add yield_self to yield given block in its context
class Object
def yield_self(*args)
yield(self, *args)
end
end
2.yield_self { |x| x*x } # => 4
Hash#slice & Hash#except
{ a: 1, b: 2, c: 3, d: 4 }.slice(:a, :b)
# => { a: 1, b: 2 }
{ a: 1, b: 2, c: 3, d: 4 }.except(:a, :b)
# => { c: 3, d: 4 }
Hash#transform_keys
{ a: 1, b: 2 }.transform_keys { |k| k.to_s }
=> { "a"=>1, "b"=>2 }
Struct.new can create classes that accept keyword arguments
Point = Struct.new(:x, :y, :color)
point1 = Point.create(x: 1, y: 2)
# => Point<x: 1, y: 2, color: nil>
point2 = Point.create!(x: 1, y: 2)
# => ArgumentError, color not specified.
Enumerable#any?, all?, none?, and one? accept a pattern argument
[1, 3.14, 2ri].all?(Numeric) # => true
if should_be_all_symbols.any?(String)
...
end
some_strings.none?(/aeiou/i)
Array#prepend/append as aliases of unshift/push
array = [3, 4]
array.prepend(1, 2) #=> [1, 2, 3, 4]
array #=> [1, 2, 3, 4]
array = [1, 2]
array.append(3, 4) #=> [1, 2, 3, 4]
array #=> [1, 2, 3, 4]
Top-level constant look-up is no longer available
# this is removed:
irb(main):001:0> class Auth; end
=> nil
irb(main):002:0> class Twitter; end
=> nil
irb(main):003:0> Twitter::Auth
(irb):3: warning: toplevel constant Auth referenced by Twitter::Auth
=> Auth
Print backtrace and error message in reverse order
AFTER:
stack frame 3
stack frame 2
stack frame 1
Main Error Message
.....
BEFORE:
Main Error Message
stack frame 1
stack frame 2
stack frame 3
.....
Performance improvements
2
Performance improvements
◉ About 5-10% performance improvement by removing all
trace instructions from overall bytecode (instruction
sequences)
Performance improvements
◉ About 5-10% performance improvement by removing all
trace instructions from overall bytecode (instruction
sequences)
◉ Block passing by a block parameter
(e.g. def foo(&b); bar(&b); end)
is about 3 times faster than Ruby 2.4
Performance improvements
◉ About 5-10% performance improvement by removing all
trace instructions from overall bytecode (instruction
sequences)
◉ Block passing by a block parameter
(e.g. def foo(&b); bar(&b); end)
is about 3 times faster than Ruby 2.4
◉ ERB now generates code from a template twice as fast as
Ruby 2.4
Performance improvements
◉ About 5-10% performance improvement by removing all
trace instructions from overall bytecode (instruction
sequences)
◉ Block passing by a block parameter
(e.g. def foo(&b); bar(&b); end)
is about 3 times faster than Ruby 2.4
◉ ERB now generates code from a template twice as fast as
Ruby 2.4
◉ (and more…)
Other notable changes
3
Other notable changes
◉ Thread.report_on_exception is now set to true by default.
Other notable changes
◉ Thread.report_on_exception is now set to true by default.
◉ SecureRandom now prefers OS-provided sources over
OpenSSL
Other notable changes
◉ Thread.report_on_exception is now set to true by default.
◉ SecureRandom now prefers OS-provided sources over
OpenSSL
◉ Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils,
gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib
from standard libraries to default gems.
Other notable changes
◉ Thread.report_on_exception is now set to true by default.
◉ SecureRandom now prefers OS-provided sources over
OpenSSL
◉ Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils,
gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib
from standard libraries to default gems.
◉ Update supported Unicode version to 10.0.0.
Other notable changes
◉ Thread.report_on_exception is now set to true by default.
◉ SecureRandom now prefers OS-provided sources over
OpenSSL
◉ Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils,
gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib
from standard libraries to default gems.
◉ Update supported Unicode version to 10.0.0.
◉ Update to RubyGems 2.7.3, RDoc 6.0.1.
Other notable changes
◉ Thread.report_on_exception is now set to true by default.
◉ SecureRandom now prefers OS-provided sources over
OpenSSL
◉ Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils,
gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib
from standard libraries to default gems.
◉ Update supported Unicode version to 10.0.0.
◉ Update to RubyGems 2.7.3, RDoc 6.0.1.
◉ (and more…)
SUMMARY
new features
performance
improvements
other notable
changes
THANKS!
Live long and prosper :)
Ireneusz Skrobiś
@ireneuszskrobis

More Related Content

PPTX
ODP
Os Cook
PDF
Vagrant + Rouster at salesforce.com - PuppetConf 2013
PDF
Perl Dist::Surveyor 2011
PDF
Pythonic Deployment with Fabric 0.9
PDF
Buffer Overflows 101: Some Assembly Required
PPTX
Shellcode mastering
PDF
Doing It Wrong with Puppet -
Os Cook
Vagrant + Rouster at salesforce.com - PuppetConf 2013
Perl Dist::Surveyor 2011
Pythonic Deployment with Fabric 0.9
Buffer Overflows 101: Some Assembly Required
Shellcode mastering
Doing It Wrong with Puppet -

What's hot (20)

PDF
Devel::NYTProf 2009-07 (OUTDATED, see 201008)
PDF
PL/Perl - New Features in PostgreSQL 9.0
ODP
Fabric Fast & Furious edition
PPTX
Terraform Immutablish Infrastructure with Consul-Template
PDF
Setup 3 Node Kafka Cluster on AWS - Hands On
KEY
Capistrano, Puppet, and Chef
PDF
Exploring Code with Pry!
PPTX
Powershell alias
PPT
Working with databases in Perl
PPTX
Server::Starter meets Java
PPT
Stackless Python In Eve
PDF
Tuning Solr for Logs
PDF
CoreOS + Kubernetes @ All Things Open 2015
PPTX
Real Time Analytics - Stream Processing (Colombo big data meetup 18/05/2017)
KEY
Deploy, Scale and Sleep at Night with JRuby
PDF
I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
PPTX
PHP Optimization
PDF
Power of Puppet 4
PDF
JavaOne 2015 Java Mixed-Mode Flame Graphs
PDF
Mysqlnd, an unknown powerful PHP extension
Devel::NYTProf 2009-07 (OUTDATED, see 201008)
PL/Perl - New Features in PostgreSQL 9.0
Fabric Fast & Furious edition
Terraform Immutablish Infrastructure with Consul-Template
Setup 3 Node Kafka Cluster on AWS - Hands On
Capistrano, Puppet, and Chef
Exploring Code with Pry!
Powershell alias
Working with databases in Perl
Server::Starter meets Java
Stackless Python In Eve
Tuning Solr for Logs
CoreOS + Kubernetes @ All Things Open 2015
Real Time Analytics - Stream Processing (Colombo big data meetup 18/05/2017)
Deploy, Scale and Sleep at Night with JRuby
I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
PHP Optimization
Power of Puppet 4
JavaOne 2015 Java Mixed-Mode Flame Graphs
Mysqlnd, an unknown powerful PHP extension
Ad

Similar to New features in Ruby 2.5 (20)

PDF
Gemification for Ruby 2.5/3.0
PDF
Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...
PDF
Gemification for Ruby 2.5/3.0
PDF
How to Begin to Develop Ruby Core
PDF
What's new in Ruby 2.0
PPTX
Ruby from zero to hero
PPTX
Day 1 - Intro to Ruby
PDF
The story of language development
PDF
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
PDF
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
PDF
Juicy Ruby 2.1
PDF
Ruby training day1
PDF
Ruby Presentation
PDF
Ruby 1.9
PDF
The Future of Dependency Management for Ruby
PPTX
Ruby data types and objects
DOCX
Page List & Sample Material (Repaired)
PDF
OSS Security the hard way
PDF
How to distribute Ruby to the world
PDF
The Future of Bundled Bundler
Gemification for Ruby 2.5/3.0
Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...
Gemification for Ruby 2.5/3.0
How to Begin to Develop Ruby Core
What's new in Ruby 2.0
Ruby from zero to hero
Day 1 - Intro to Ruby
The story of language development
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Juicy Ruby 2.1
Ruby training day1
Ruby Presentation
Ruby 1.9
The Future of Dependency Management for Ruby
Ruby data types and objects
Page List & Sample Material (Repaired)
OSS Security the hard way
How to distribute Ruby to the world
The Future of Bundled Bundler
Ad

More from Ireneusz Skrobiś (8)

PDF
Bugs and non-technical client
PDF
PayPal Subscriptions in Ruby on Rails application
PDF
How to introduce a new developer to a project.
PDF
Geolocation Databases in Ruby on Rails
PDF
New features in Ruby 2.4
PDF
Geocoding with Rails and Twitter Typeahead
PDF
LOL vs Dota2: Battle Of APIs
PDF
What to do when there is no API
Bugs and non-technical client
PayPal Subscriptions in Ruby on Rails application
How to introduce a new developer to a project.
Geolocation Databases in Ruby on Rails
New features in Ruby 2.4
Geocoding with Rails and Twitter Typeahead
LOL vs Dota2: Battle Of APIs
What to do when there is no API

Recently uploaded (20)

PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Geodesy 1.pptx...............................................
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPT
Project quality management in manufacturing
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
web development for engineering and engineering
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPT
Mechanical Engineering MATERIALS Selection
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Geodesy 1.pptx...............................................
Model Code of Practice - Construction Work - 21102022 .pdf
Project quality management in manufacturing
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
UNIT 4 Total Quality Management .pptx
web development for engineering and engineering
Operating System & Kernel Study Guide-1 - converted.pdf
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Mechanical Engineering MATERIALS Selection
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Lecture Notes Electrical Wiring System Components
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...

New features in Ruby 2.5

  • 1. RUBY 2.5 IRENEUSZ SKROBIŚ Lead developer @ SELLEO
  • 7. rescue/else/ensure are now allowed to be used directly with do/end blocks AFTER: lambda do raise 'err' rescue $! # => #<RuntimeError: err> end.call BEFORE: lambda do begin raise 'err' rescue $! # => #<RuntimeError: err> end end.call
  • 8. Add yield_self to yield given block in its context class Object def yield_self(*args) yield(self, *args) end end 2.yield_self { |x| x*x } # => 4
  • 9. Hash#slice & Hash#except { a: 1, b: 2, c: 3, d: 4 }.slice(:a, :b) # => { a: 1, b: 2 } { a: 1, b: 2, c: 3, d: 4 }.except(:a, :b) # => { c: 3, d: 4 }
  • 10. Hash#transform_keys { a: 1, b: 2 }.transform_keys { |k| k.to_s } => { "a"=>1, "b"=>2 }
  • 11. Struct.new can create classes that accept keyword arguments Point = Struct.new(:x, :y, :color) point1 = Point.create(x: 1, y: 2) # => Point<x: 1, y: 2, color: nil> point2 = Point.create!(x: 1, y: 2) # => ArgumentError, color not specified.
  • 12. Enumerable#any?, all?, none?, and one? accept a pattern argument [1, 3.14, 2ri].all?(Numeric) # => true if should_be_all_symbols.any?(String) ... end some_strings.none?(/aeiou/i)
  • 13. Array#prepend/append as aliases of unshift/push array = [3, 4] array.prepend(1, 2) #=> [1, 2, 3, 4] array #=> [1, 2, 3, 4] array = [1, 2] array.append(3, 4) #=> [1, 2, 3, 4] array #=> [1, 2, 3, 4]
  • 14. Top-level constant look-up is no longer available # this is removed: irb(main):001:0> class Auth; end => nil irb(main):002:0> class Twitter; end => nil irb(main):003:0> Twitter::Auth (irb):3: warning: toplevel constant Auth referenced by Twitter::Auth => Auth
  • 15. Print backtrace and error message in reverse order AFTER: stack frame 3 stack frame 2 stack frame 1 Main Error Message ..... BEFORE: Main Error Message stack frame 1 stack frame 2 stack frame 3 .....
  • 17. Performance improvements ◉ About 5-10% performance improvement by removing all trace instructions from overall bytecode (instruction sequences)
  • 18. Performance improvements ◉ About 5-10% performance improvement by removing all trace instructions from overall bytecode (instruction sequences) ◉ Block passing by a block parameter (e.g. def foo(&b); bar(&b); end) is about 3 times faster than Ruby 2.4
  • 19. Performance improvements ◉ About 5-10% performance improvement by removing all trace instructions from overall bytecode (instruction sequences) ◉ Block passing by a block parameter (e.g. def foo(&b); bar(&b); end) is about 3 times faster than Ruby 2.4 ◉ ERB now generates code from a template twice as fast as Ruby 2.4
  • 20. Performance improvements ◉ About 5-10% performance improvement by removing all trace instructions from overall bytecode (instruction sequences) ◉ Block passing by a block parameter (e.g. def foo(&b); bar(&b); end) is about 3 times faster than Ruby 2.4 ◉ ERB now generates code from a template twice as fast as Ruby 2.4 ◉ (and more…)
  • 22. Other notable changes ◉ Thread.report_on_exception is now set to true by default.
  • 23. Other notable changes ◉ Thread.report_on_exception is now set to true by default. ◉ SecureRandom now prefers OS-provided sources over OpenSSL
  • 24. Other notable changes ◉ Thread.report_on_exception is now set to true by default. ◉ SecureRandom now prefers OS-provided sources over OpenSSL ◉ Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils, gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib from standard libraries to default gems.
  • 25. Other notable changes ◉ Thread.report_on_exception is now set to true by default. ◉ SecureRandom now prefers OS-provided sources over OpenSSL ◉ Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils, gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib from standard libraries to default gems. ◉ Update supported Unicode version to 10.0.0.
  • 26. Other notable changes ◉ Thread.report_on_exception is now set to true by default. ◉ SecureRandom now prefers OS-provided sources over OpenSSL ◉ Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils, gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib from standard libraries to default gems. ◉ Update supported Unicode version to 10.0.0. ◉ Update to RubyGems 2.7.3, RDoc 6.0.1.
  • 27. Other notable changes ◉ Thread.report_on_exception is now set to true by default. ◉ SecureRandom now prefers OS-provided sources over OpenSSL ◉ Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils, gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib from standard libraries to default gems. ◉ Update supported Unicode version to 10.0.0. ◉ Update to RubyGems 2.7.3, RDoc 6.0.1. ◉ (and more…)
  • 29. THANKS! Live long and prosper :) Ireneusz Skrobiś @ireneuszskrobis