Opal v0.9.0 Release Notes
Release Date: 2015-12-20 // over 8 years ago-
โ Added
- A
console
wrapper has been added to the stdlib, requiring it will make available the$console
global variable. - โ
method_added
,method_removed
andmethod_undefined
reflection now works. singleton_method_added
,singleton_method_removed
andsingleton_method_undefined
reflection now works.- ๐ Now you can bridge a native class to a Ruby class that inherits from another Ruby class
- ๐
Numeric
semantics are now compliant with Ruby. Complex
has been fully implemented.Rational
has been fully implemented.- ๐ป
Kernel#raise
now properly re-raises exceptions (regardless of how many levels deep you are) and works properly if supplied a class that has an exception method. - ๐ป
Exception#exception
,Exception::exception
,Exception#message
, andException#to_s
are fully implemented - ๐ You can make direct JavaScript method calls on using the
recv.JS.method
syntax. Has support for method calls, final callback (as a block), property getter and setter (via#[]
and#[]=
), splats, JavaScript keywords (via the::JS
module) and global functions (afterrequire "js"
). Set#superset?
,Set#subset?
, and the respectiveproper_
variant of each are now implementedNameError
andNoMethodError
- add#name
and#args
attributesRegExp#match
now works correctly in multiline mode with white space- ๐
BasicObject#instance_eval
now can accept a string argument (afterrequire "opal-parser"
) โ Adds Nashorn (Java 8+ Javascript engine) runner
bundle exec bin/opal -R nashorn -r nashorn hello.rb
๐ Newly compliant with the Ruby Spec Suite:
Enumerable#chunk
Enumerable#each_cons
Enumerable#minmax
Range#to_a
(#1246)Module
comparison methods:#<
#<=
#<=>
#>
#>=
OpenStruct#method_missing
OpenStruct#inspect
OpenStruct#to_s
OpenStruct#delete_field
๐ Changed
- ๐ Renamed:
Hash.keys
=>Hash.$$keys
Hash.map
=>Hash.$$map
Hash.smap
=>Hash.$$smap
- ๐
Kernel#pp
no longer forwards arguments directly toconsole.log
, this behavior has been replaced by stdlib's ownconsole.rb
(see above). Opal::Sprockets.javascript_include_tag
has been added to allow easy debug mode (i.e. with source maps) when including a sprockets asset into an HTML page.
๐ Deprecated
Opal::Processor.load_asset_code(sprockets, name)
has been deprecated in favor ofOpal::Sprockets.load_asset(name, sprockets)
.
๐ Fixed
- ๐ Fixed usage of JavaScript keywords as instance variable names for:
Kernel#instance_variable_set
Kernel#instance_variable_get
Kernel#instance_variables
Struct#hash
now works properly based on struct contents- No longer crashes when calling a method with an opt arg followed by an optional kwarg when called without the kwarg
- Operator methods (e.g.
+
,<
, etc.) can be handled bymethod_missing
- ๐ Fix issue where passing a block after a parameter and a hash was causing block to not be passed (e.g.
method1 some_param, 'a' => 1, &block
) - Method defs issued inside
Module#instance_eval
andClass#instance_eval
, and the respectiveexec
now create class methods - ๐ Now with enabled arity checks calling a method with more arguments than those supported by its signature raises an
ArgumentError
as well. - Previously arity checks would raise an error without clearing the block for a method, that could lead to strange bugs in case the error was rescued.
Regexp#===
returns false when the right hand side of the expression cannot be coereced to a string (instead of throwing aTypeError
)- โก๏ธ
Regexp#options
has been optimized and correctly returns 0 when called on a Regexp literal without any options (e.g.//
) - ๐ Fix
Kernel#exit
to allow exit inside#at_exit
- ๐ Fixed a number of syntax errors (e.g. #1224 #1225 #1227 #1231 #1233 #1226)
- ๐ Fixed
Native()
when used withArray
instances containing native objects (which weren't wrapped properly) โ #1212 - Fix
Array#to_n
,Hash#to_n
,Struct#to_n
when the object contains native objects (#1249) - Internal cleanup and lots of bugs!
- A