Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Ruby (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Ruby 2 === Ruby 2.0 was intended to be fully backward compatible with Ruby 1.9.3. As of the official 2.0.0 release on 24 February 2013, there were only five known incompatibilities.<ref name="2-0-release-incompatibilities"/> Starting with 2.1.0, Ruby's versioning policy changed to be more similar to [[semantic versioning]], although it differs slightly in that minor version increments may be API incompatible.<ref name="semantic-versioning"/> Ruby 2.2.0 includes speed-ups, bugfixes, and library updates and removes some deprecated APIs. Most notably, Ruby 2.2.0 introduces changes to memory handling{{snd}}an incremental garbage collector, support for garbage collection of symbols and the option to compile directly against jemalloc. It also contains experimental support for using [[vfork]](2) with system() and spawn(), and added support for the [[Unicode]] 7.0 specification. Since version 2.2.1,<ref name="2-2-1-release"/> [[Ruby (programming language)#Matz's Ruby interpreter|Ruby MRI]] performance on [[ppc64|PowerPC64]] was improved.<ref name="2-2-1-changelog"/><ref name="Pedrosa-1"/><ref name="Pedrosa-2"/> Features that were made obsolete or removed include callcc, the DL library, Digest::HMAC, lib/rational.rb, lib/complex.rb, GServer, Logger::Application as well as various C API functions.<ref name="obsolete-or-gone-in-2.2"/> Ruby 2.3.0 includes many performance improvements, updates, and bugfixes including changes to Proc#call, Socket and IO use of exception keywords, Thread#name handling, default passive Net::FTP connections, and Rake being removed from stdlib.<ref name="Ruby 2.3.0 NEWS"/> Other notable changes include: * The ability to mark all [[string literal]]s as frozen by default with a consequently large performance increase in string operations.<ref name="frozen-strings"/> * Hash comparison to allow direct checking of key/value pairs instead of just keys. * A new [[safe navigation operator]] <code>&.</code> that can ease nil handling (e.g. instead of {{code|lang=ruby|code=if obj && obj.foo && obj.foo.bar}}, we can use <code>if obj&.foo&.bar</code>). * The ''did_you_mean'' gem is now bundled by default and required on startup to automatically suggest similar name matches on a ''NameError'' or ''NoMethodError''. * ''Hash#dig'' and ''Array#dig'' to easily extract deeply nested values (e.g. given <syntaxhighlight inline lang=ruby>profile = { social: { wikipedia: { name: 'Foo Baz' } } }</syntaxhighlight>, the value ''Foo Baz'' can now be retrieved by <code>profile.dig(:social, :wikipedia, :name)</code>). * <code>.grep_v(regexp)</code> which will match all negative examples of a given regular expression in addition to other new features. Ruby 2.4.0 includes performance improvements to hash table, Array#max, Array#min, and instance variable access.<ref name=":0"/> Other notable changes include: * Binding#irb: Start a REPL session similar to binding.pry * Unify ''Fixnum'' and ''Bignum'' into ''Integer'' class * String supports Unicode case mappings, not just ASCII * A new method, Regexp#match?, which is a faster Boolean version of Regexp#match * Thread deadlock detection now shows threads with their backtrace and dependency A few notable changes in Ruby 2.5.0 include ''rescue'' and ''ensure'' statements automatically use a surrounding ''do-end'' block (less need for extra ''begin-end'' blocks), method-chaining with ''yield_self'', support for branch coverage and method coverage measurement, and easier Hash transformations with ''Hash#slice'' and ''Hash#transform_keys'' On top of that come a lot of performance improvements like faster block passing (3 times faster), faster Mutexes, faster ERB templates and improvements on some concatenation methods. A few notable changes in Ruby 2.6.0 include an experimental [[just-in-time compiler]] (JIT), and ''RubyVM::AbstractSyntaxTree'' (experimental). A few notable changes in Ruby 2.7.0 include pattern Matching (experimental), REPL improvements, a compaction GC, and separation of positional and keyword arguments.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)