Ruby Version Changes
By Jesus Castello
On this page you'll find a list of Ruby versions with the most important changes since Ruby 2.0. This includes features of the language itself & new methods that can help you write better Ruby code.
If you'd like to know what version of Ruby you have installed you can run this command:
ruby -v
Inside a Ruby program, you can use the RUBY_VERSION constant.
I hope you find this useful!
Ruby 2.7
Released December, 2019
New Features
- Pattern Matching (experimental)
- Numbered block parameters (experimental)
- IRB updates
Methods
- Enumerable#tally
- Enumerator#produce
- Arrary#intersection
Ruby 2.6
Released December, 2018
New Features
- Endless ranges
- Transient heap (performance increase for small objects)
- JIT compiler (experimental)
Methods
- Array#union & Array#difference
- TracePoint#parameters
- Range#%
- Integer() & Float() now take an optional "exception" keyword argument
- Array#merge accepts multiple arguments
- Kernel#then is a new alias for Kernel#yield_self
- Enumerable#filter is a new alias for Enumerable#select
Ruby 2.5
Released December, 2017
New Features
- Reversed stack trace
- About 5-10% performance improvement
- You can now use rescue / else / ensure with a do / end block
Methods
- Kernel#yield_self
- Hash#transform_keys / Hash#transform_keys!
- Hash#slice
- String#delete_prefix / String#delete_suffix
- Enumerable#any?, all?, none?, and one? accept a pattern argument
- Struct.new can create classes that accept keyword arguments
Ruby 2.4
Released December, 2016
New Features
- Fixnum + Bignum merge into Integer
- Better Thread error reporting
- Refinements now work with Kernel#send & Symbol#to_proc
Methods
- Dir.empty?
- File.empty?
- Regexp#match?
- Enumerable#sum
- Integer#digits
- Hash#compact / Hash#compact!
- Hash#transform_values / Hash#transform_values!
- Kernel#clone now takes an optional keyword argument (freeze).
Ruby 2.3
New Features
- Frozen strings pragma
- Safe navigator operator (&.)
- Squiggly heredoc (<<~)
- 'Did you mean?' gem included by default
Methods
- Hash#dig
- Array#dig
- File.mkfifo
- Hash#fetch_values
- Enumerable#chunk_while
Ruby 2.2
New Features
- Symbol GC
- Incremental GC
- Support Unicode 7.0
Methods
- Method#curry
- Kernel#itself
- Enumerable#slice_after
- Enumerable#slice_when
- Float#next_float, Float#prev_float (#9834)
Share this page if you like it!
Ruby 2.1
New Features
- Required Keyword Arguments
- Generational GC
- New GC environment variables
- Refinements
Methods
- String#scrub and String#scrub!
- Binding#local_variable_get(symbol)
- Binding#local_variable_set(symbol, obj)
- Binding#local_variable_defined?(symbol)
Ruby 2.0
New Features
- Lazy enumerators
- Keyword Arguments
- UTF-8 as default encoding
- Refinements (experimental)
- New regular expression engine
- `%i` and `%I` for symbol list creation (similar to `%w` and `%W`)
Methods
- Kernel#__dir__
- Array#bsearch
- Module#prepend
- Module.prepended
- Module.prepend_features
- Return an Array instead of an Enumerator:
- String#chars
- String#bytes
- ​String#lines
- String#codepoints
Click the button below to share this page if you found it useful :)