mruby 1.3.0 is released. Download mruby 1.3.0 now.
&.
)mruby 1.3 now supports the safe navigation operator (&.
) to help handle nil
value returned from methods. This feature comes from Ruby 2.3.
By using the safe navigation operator, you can simply write
account&.owner&.address
Instead of writing
account && account.owner && account.owner.address
Or (with ActiveSupport)
account.try(:owner).try(:address)
Array#dig
, Hash#dig
#dig
is a method to retrieve a value from JSON-like nested Array/Hash structures.
This feature also comes from Ruby 2.3.
For example:
params.dig(:account, :owner, :address)
Instead of
account = params[:account]
owner = account[:owner]
owner[:address]
Object#freeze
You can now “freeze” an object by using Object#freeze.
Frozen objects cannot be modified.
Kernel#caller
You can retrieve call frame information by using Kernel#caller
.
After the code-freeze of 1.3 release, following issues are filed and fixed in the master branch.
The following issues are not yet fixed as of 2017-07-04.