Ruby 2.5 Major Changes


  • 1. rescue/else/ensure are allowed inside do/end blocks without begin/end
  • 2. Print backtrace and error message in reverse order (experimental)
  • 3. Kernel#yield_self
          2.yield_self { |n| n * 10 } #=> 20
          names = ['Alice', 'Bob'] 
          names.join(', ').yield_self { |s| "(#{s})" }
          #=> "(Alice, Bob)"

  • 4. String#delete_prefix/delete_suffix
  • 5. Array#prepend/append as aliases of unshift/push
  • 6. Hash#transform_keys/transform_keys!

Comments

Popular posts from this blog

Rails Kaminari - Ajax pagination

Rails mongoid has field model validation

Rails Upgrading a project