Answers

Question and Answer:

  Home  Ruby Developer

⟩ Tell me what is the difference between Ruby 1.9 and Ruby 2.0?

Ruby 2.0 differs in various ways, such as:

FASTER

Ruby 2 has a few patches that dramatically improve performance. The biggest of these is a substantial optimization to Kernel#require, which speeds up Rails startup dramatically. Ruby 2 also has improved GC, VM optimizations, and improvements to floating point operations.

UTF-8 BY DEFAULT

All Ruby scripts now default to UTF-8 encoding. This makes the #encoding: utf-8 magic comment no longer necessary.

LITERAL SYMBOL ARRAY SYNTAX

You can now use %i and %I to make an array of symbols:

LAZY ENUMERATORS

Ruby 2 introduces the concept of a lazy Enumerable object. A lazy Enumerable will not consume excess memory, and will process individual elements as needed instead of the entire array/range passed to it.

 154 views

More Questions for you: