source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
opal/opal
https://github.com/opal/opal
spec/filters/platform/bun/freeze.rb
Ruby
mit
4,915
master
661
# NOTE: run bin/format-filters after changing this file opal_filter "freezing" do fails "Kernel#freeze on a Float has no effect since it is already frozen" # Expected false to be true fails "Kernel#freeze on integers has no effect since they are already frozen" # Expected false to be true fails "Kernel#freeze on ...
github
opal/opal
https://github.com/opal/opal
spec/filters/platform/bun/kernel.rb
Ruby
mit
4,915
master
228
# NOTE: run bin/format-filters after changing this file opal_filter "Kernel" do fails "Kernel#caller includes core library methods defined in Ruby" fails "Kernel#object_id returns the same value for two Symbol literals" end
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/hash.rb
Ruby
mit
4,915
master
1,711
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Hash" do fails "Hash#[] compares key via hash" # Mock '0' expected to receive hash("any_args") exactly 1 times but received it 0 times (performance optimization) fails "Hash#[]= duplicates and freezes string keys" # NotImplementedError...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/set.rb
Ruby
mit
4,915
master
381
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Set" do fails "Set#eql? returns true when the passed argument is a Set and contains the same elements" # Expected #<Set: {1,2,3}> not to have same value or type as #<Set: {1,2,3}> fails "Set#initialize is private" # Expected Set to hav...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/singleton.rb
Ruby
mit
4,915
master
687
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Singleton" do fails "Singleton#_dump returns an empty string from a singleton subclass" # NoMethodError: undefined method `_dump' for #<SingletonSpecs::MyClassChild:0x9dc> fails "Singleton#_dump returns an empty string" # NoMethodError...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/file.rb
Ruby
mit
4,915
master
253
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "File" do fails "File.join doesn't mutate the object when calling #to_str" # Mock 'usr' expected to receive to_str("any_args") exactly 1 times but received it 0 times end
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/float.rb
Ruby
mit
4,915
master
3,894
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Float" do fails "Complex#/ with Fixnum raises a ZeroDivisionError when given zero" # Expected ZeroDivisionError but no exception was raised ((Infinity+Infinity*i) was returned) fails "Complex#eql? returns false when the imaginary parts...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/marshal.rb
Ruby
mit
4,915
master
3,545
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Marshal" do fails "Marshal.dump dumps subsequent appearances of a symbol as a link" # Expected "\x04\b[\a\"\x06a@\x06" == "\x04\b[\a:\x06a;\x00" to be truthy but was false fails "Marshal.dump raises a TypeError if dumping a IO/File ins...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/class.rb
Ruby
mit
4,915
master
202
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Class" do fails "Class#initialize is private" # Expected Class to have private method 'initialize' but it does not end
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/string.rb
Ruby
mit
4,915
master
95,395
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "String" do fails "BasicObject#__id__ returns a different value for two String literals" # Expected "hello" == "hello" to be falsy but was true fails "Module#const_defined? returns true when passed a constant name with EUC-JP characters...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/struct.rb
Ruby
mit
4,915
master
484
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Struct" do fails "Struct#initialize is private" # Expected StructClasses::Car to have private instance method 'initialize' but it does not fails "Struct.new does not create a constant with symbol as first argument" # Expected true to b...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/integer.rb
Ruby
mit
4,915
master
12,766
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Integer" do fails "Integer#% bignum returns the modulus obtained from dividing self by the given argument" # Expected 0 == 18446744073709552000 to be truthy but was false fails "Integer#& bignum raises a TypeError when passed a Float" ...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/math.rb
Ruby
mit
4,915
master
216
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Math" do fails "Math#atanh is a private instance method" # Expected Math to have private instance method 'atanh' but it does not end
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/symbol.rb
Ruby
mit
4,915
master
2,880
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Symbol" do fails "A Symbol literal can be an empty string" # Expected "\"\"" == ":\"\"" to be truthy but was false fails "A Symbol literal can be created by the %s-delimited expression" # Expected "\"foo bar\"" == ":\"foo bar\"" to be ...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/basicobject.rb
Ruby
mit
4,915
master
2,573
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "BasicObject" do fails "BasicObject#method_missing for a Class raises a NoMethodError when a private method is called" # Expected NoMethodError but no exception was raised ("class_private_method" was returned) fails "BasicObject#method_...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/regexp.rb
Ruby
mit
4,915
master
8,264
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Regexp" do fails "Regexp#options does not include Regexp::FIXEDENCODING for a Regexp literal with the 'n' option" # NameError: uninitialized constant Regexp::FIXEDENCODING fails "Regexp#options includes Regexp::FIXEDENCODING for a Rege...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/array.rb
Ruby
mit
4,915
master
3,888
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Array" do fails "Array#[] raises a RangeError when the length is out of range of Fixnum" # Expected RangeError but no exception was raised ([2, 3, 4, 5, 6] was returned) fails "Array#[] raises a RangeError when the start index is out o...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/enumerable.rb
Ruby
mit
4,915
master
587
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Enumerable" do fails "Enumerable#chunk does not return elements for which the block returns :_separator" # Expected [[1, [1]], ["_separator", [2]], [1, [3, 3]], ["_separator", [2]], [1, [1]]] == [[1, [1]], [1, [3, 3]], [1, [1]]] to be tr...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/usage_of_files.rb
Ruby
mit
4,915
master
31,541
# NOTE: run bin/format-filters after changing this file opal_filter "Specs that use temporary files" do fails "A Symbol literal inherits the encoding of the magic comment and can have a binary encoding" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x94928> fails "Kernel.printf formatting io is not specifi...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/time.rb
Ruby
mit
4,915
master
24,738
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Time" do fails "Time#+ accepts arguments that can be coerced into Rational" # Mock '10' expected to receive to_r("any_args") exactly 1 times but received it 0 times fails "Time#+ adds a negative Float" # Expected 700000 == 699999 to be...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/privacy.rb
Ruby
mit
4,915
master
58,922
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "privacy" do fails "A method definition always resets the visibility to public for nested definitions at the toplevel" # Expected NoMethodError (/private/) but no exception was raised ("nested_method_in_toplevel_method" was returned) fa...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/language.rb
Ruby
mit
4,915
master
5,728
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "language" do fails "Ruby String literals with a magic frozen comment produce different objects for literals with the same content in different files if the other file doesn't have the comment" # NoMethodError: undefined method `tmp' for ...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/matchdata.rb
Ruby
mit
4,915
master
6,358
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "MatchData" do fails "MatchData#[Symbol] returns matches in the String's encoding" # ArgumentError: unknown encoding name - euc-jp fails "MatchData#[Symbol] returns the last match when multiple named matches exist with the same name" # ...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/enumerator.rb
Ruby
mit
4,915
master
400
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Enumerator" do fails "Enumerator#rewind calls the enclosed object's rewind method if one exists" # Mock 'rewinder' expected to receive rewind("any_args") exactly 1 times but received it 0 times fails "Enumerator#rewind clears a pending...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/delegator.rb
Ruby
mit
4,915
master
566
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Delegator" do fails "SimpleDelegator.new doesn't forward private method calls even via send or __send__" # Expected NoMethodError but no exception was raised (["priv", 42] was returned) fails "SimpleDelegator.new doesn't forward privat...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/kernel.rb
Ruby
mit
4,915
master
2,823
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Kernel" do fails "Kernel has private instance method Array()" # Expected Kernel to have private instance method 'Array' but it does not fails "Kernel has private instance method Hash()" # Expected Kernel to have private instance method...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/bignum.rb
Ruby
mit
4,915
master
3,778
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Bignum" do fails "BasicObject#__id__ returns a different value for two Bignum literals" # Expected 4e+100 == 4e+100 to be falsy but was true fails "Complex#== with Numeric returns true when self's imaginary part is 0 and the real part ...
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/range.rb
Ruby
mit
4,915
master
211
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Range" do fails "Range#initialize is private" # Expected Range to have private instance method 'initialize' but it does not end
github
opal/opal
https://github.com/opal/opal
spec/filters/unsupported/thread.rb
Ruby
mit
4,915
master
239
# NOTE: run bin/format-filters after changing this file opal_unsupported_filter "Thread" do fails "The return keyword in a Thread raises a LocalJumpError if used to exit a thread" # NotImplementedError: Thread creation not available end
github
opal/opal
https://github.com/opal/opal
spec/support/match_helpers.rb
Ruby
mit
4,915
master
1,197
module MatchHelpers class MatchMatcher def initialize(expected) fail "Expected #{expected} to be a Regexp!" unless expected.is_a?(Regexp) @expected = expected end def matches?(actual) @actual = actual @expected.match(@actual) end def failure_message ["Expected #{@ac...
github
opal/opal
https://github.com/opal/opal
spec/support/mspec_rspec_adapter.rb
Ruby
mit
4,915
master
723
module MSpecRSpecAdapter def expect(object) MSpecRSpecAdapterShould.new(object) end def eq(expected) MSpecRSpecAdapterEq.new(expected) end class MSpecRSpecAdapterEq < Struct.new(:object) end class MSpecRSpecAdapterShould < Struct.new(:object) def to(expectation) apply_expectation(:sho...
github
opal/opal
https://github.com/opal/opal
spec/support/rewriters_helper.rb
Ruby
mit
4,915
master
1,571
module RewritersHelper module Common def s(type, *children) ::Opal::AST::Node.new(type, children) end def parse(source) buffer = Opal::Parser::SourceBuffer.new('(eval)') buffer.source = source parser = Opal::Parser.default_parser parser.parse(buffer) end # Parse, bu...
github
opal/opal
https://github.com/opal/opal
spec/support/source_map_helper.rb
Ruby
mit
4,915
master
7,495
module SourceMapHelper extend self # Just for debugging purposes def inspect_source(source) puts source_with_lines(source) end # Just for debugging purposes def source_with_lines(source) source.split("\n", -1).map.with_index { |line, index| "#{(index).to_s.rjust(3)} | #{line}" }.join("\n") end ...
github
opal/opal
https://github.com/opal/opal
vendored-minitest/minitest.rb
Ruby
mit
4,915
master
18,282
# await: *await* require "optparse" require "thread" require "mutex_m" # require "minitest/parallel" require "await" ## # :include: README.txt module Minitest VERSION = "5.5.1" # :nodoc: ENCS = "".respond_to? :encoding # :nodoc: @@installed_at_exit ||= false @@after_run = [] @extensions = [] mc = (clas...
github
opal/opal
https://github.com/opal/opal
vendored-minitest/minitest/mock.rb
Ruby
mit
4,915
master
6,241
class MockExpectationError < StandardError; end # :nodoc: module Minitest # :nodoc: ## # A simple and clean mock object framework. # # All mock objects are an instance of Mock class Mock alias :__respond_to? :respond_to? overridden_methods = %w( === inspect object_id public...
github
opal/opal
https://github.com/opal/opal
vendored-minitest/minitest/assertions.rb
Ruby
mit
4,915
master
17,733
require "rbconfig" require "tempfile" require 'stringio' module Minitest ## # Minitest Assertions. All assertion methods accept a +msg+ which is # printed if the assertion fails. # # Protocol: Nearly everything here boils up to +assert+, which # expects to be able to increment an instance accessor named ...
github
opal/opal
https://github.com/opal/opal
vendored-minitest/minitest/spec.rb
Ruby
mit
4,915
master
7,969
require "minitest/test" class Module # :nodoc: def infect_an_assertion meth, new_name, dont_flip = false # :nodoc: # warn "%-22p -> %p %p" % [meth, new_name, dont_flip] dont_flip = !!dont_flip self.class_eval do define_method(new_name) do |*args| case when dont_flip Minite...
github
opal/opal
https://github.com/opal/opal
vendored-minitest/minitest/benchmark.rb
Ruby
mit
4,915
master
11,622
# await: *await* require 'minitest/unit' require 'minitest/spec' module Minitest ## # Subclass Benchmark to create your own benchmark runs. Methods # starting with "bench_" get executed on a per-class. # # See Minitest::Assertions class Benchmark < Test def self.io # :nodoc: @io end de...
github
opal/opal
https://github.com/opal/opal
vendored-minitest/minitest/test.rb
Ruby
mit
4,915
master
6,933
# await: *await* require "minitest" unless defined? Minitest::Runnable module Minitest ## # Subclass Test to create your own tests. Typically you'll want a # Test subclass per implementation class. # # See Minitest::Assertions class Test < Runnable require "minitest/assertions" include Minitest::...
github
opal/opal
https://github.com/opal/opal
vendored-minitest/minitest/expectations.rb
Ruby
mit
4,915
master
5,714
## # It's where you hide your "assertions". # # Please note, because of the way that expectations are implemented, # all expectations (eg must_equal) are dependent upon a thread local # variable +:current_spec+. If your specs rely on mixing threads into # the specs themselves, you're better off using assertions. For # ...
github
opal/opal
https://github.com/opal/opal
vendored-minitest/test/unit.rb
Ruby
mit
4,915
master
688
# test/unit compatibility layer using minitest. require 'minitest/autorun' module Test module Unit class TestCase < Minitest::Test alias assert_raise assert_raises def assert_nothing_raised(*) yield end def assert_raise_with_message(exception, err_message, msg = nil) err...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_hash_literal_object_large.rb
Ruby
mit
4,915
master
20,916
1000.times do h = {Object.new => '0', Object.new => '1', Object.new => '2', Object.new => '3', Object.new => '4', Object.new => '5', Object.new => '6', Object.new => '7', Object.new => '8', Object.new => '9', Object.new => '10', Object.new => '11', Object.new => '12', Object.new => '13', Object.new => '14', Object.ne...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_union_strings.rb
Ruby
mit
4,915
master
16,075
a1 = ['4768', '4964', '4266', '4872', '4231', '4017', '4565', '4793', '4298', '4135', '4639', '4780', '4237', '4548', '4655', '4153', '4654', '4922', '4563', '4042', '4329', '4699', '4352', '4127', '4544', '4906', '4814', '4948', '4977', '4830', '4405', '4642', '4666', '4402', '4679', '4465', '4401', '4155', '4767', '4...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_dispatch_hardcoded.rb
Ruby
mit
4,915
master
738
class HardcodedDispatch attr_reader :event_log def initialize @event_log = [] end def call(event) case event.name when :foo handle_foo(event) when :bar handle_bar(event) when :baz handle_baz(event) end end def handle_foo(event) event_log << event end def...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_intersection_numbers.rb
Ruby
mit
4,915
master
12,071
a1 = [4768, 4964, 4266, 4872, 4231, 4017, 4565, 4793, 4298, 4135, 4639, 4780, 4237, 4548, 4655, 4153, 4654, 4922, 4563, 4042, 4329, 4699, 4352, 4127, 4544, 4906, 4814, 4948, 4977, 4830, 4405, 4642, 4666, 4402, 4679, 4465, 4401, 4155, 4767, 4510, 4747, 4993, 4508, 4697, 4758, 4133, 4348, 4200, 4442, 4970, 4452, 4041, 41...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_dispatch_send.rb
Ruby
mit
4,915
master
691
class SendDispatch attr_reader :event_log def initialize @event_log = [] end def call(event) handler_name = "handle_#{event.name}" __send__(handler_name, event) if respond_to?(handler_name) end def handle_foo(event) event_log << event end def handle_bar(event) event_log << event ...
github
opal/opal
https://github.com/opal/opal
benchmark/run.rb
Ruby
mit
4,915
master
2,288
require 'open3' require 'optparse' require 'opal/os' require 'opal/cli_runners' OS = Opal::OS files = ARGV # ruby exes ruby_exe = Gem.ruby bench_exe = { "bun" => "bin/opal -Rbun -rnodejs/file", "chrome" => "bin/opal -Rchrome -rheadless_browser/base -rheadless_browser/file", "firefox" => "bin/opal -Rfire...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_intersection_objects.rb
Ruby
mit
4,915
master
24,083
a1 = [Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Ob...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_dispatch_send_table.rb
Ruby
mit
4,915
master
1,239
class SendTableDispatch attr_reader :event_log def initialize @event_log = [] end def self.method_added_cheat(method_name) if method_name.to_s =~ /^handle_(.+)$/ handler_methods[$1.to_sym] = method_name.to_sym end # Cheating here, because Opal does not support method_added hook yet #...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_union_objects.rb
Ruby
mit
4,915
master
24,083
a1 = [Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Ob...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_dispatch_code_gen_if.rb
Ruby
mit
4,915
master
1,406
class IfCodeGenDispatch attr_reader :event_log def initialize @event_log = [] end def self.method_added_cheat(method_name) if method_name.to_s =~ /^handle_(.+)$/ handler_methods << $1 regenerate_dispatch_method end # Cheating here, because Opal does not support method_added hook ye...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_dispatch_code_gen.rb
Ruby
mit
4,915
master
1,403
class CodeGenDispatch attr_reader :event_log def initialize @event_log = [] end def self.method_added_cheat(method_name) if method_name.to_s =~ /^handle_(.+)$/ handler_methods << $1 regenerate_dispatch_method end # Cheating here, because Opal does not support method_added hook yet ...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_hash_literal_string_large.rb
Ruby
mit
4,915
master
13,808
10_000.times do h = {"0"=>"0", "1"=>"1", "2"=>"2", "3"=>"3", "4"=>"4", "5"=>"5", "6"=>"6", "7"=>"7", "8"=>"8", "9"=>"9", "10"=>"10", "11"=>"11", "12"=>"12", "13"=>"13", "14"=>"14", "15"=>"15", "16"=>"16", "17"=>"17", "18"=>"18", "19"=>"19", "20"=>"20", "21"=>"21", "22"=>"22", "23"=>"23", "24"=>"24", "25"=>"25", "26"=...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_union_numbers.rb
Ruby
mit
4,915
master
12,071
a1 = [4768, 4964, 4266, 4872, 4231, 4017, 4565, 4793, 4298, 4135, 4639, 4780, 4237, 4548, 4655, 4153, 4654, 4922, 4563, 4042, 4329, 4699, 4352, 4127, 4544, 4906, 4814, 4948, 4977, 4830, 4405, 4642, 4666, 4402, 4679, 4465, 4401, 4155, 4767, 4510, 4747, 4993, 4508, 4697, 4758, 4133, 4348, 4200, 4442, 4970, 4452, 4041, 41...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_dispatch_bind_table.rb
Ruby
mit
4,915
master
1,255
class BindTableDispatch attr_reader :event_log def initialize @event_log = [] end def self.method_added_cheat(method_name) if method_name.to_s =~ /^handle_(.+)$/ handler_methods[$1.to_sym] = instance_method(method_name) end # Cheating here, because Opal does not support method_added hook...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_intersection_strings.rb
Ruby
mit
4,915
master
16,075
a1 = ['4768', '4964', '4266', '4872', '4231', '4017', '4565', '4793', '4298', '4135', '4639', '4780', '4237', '4548', '4655', '4153', '4654', '4922', '4563', '4042', '4329', '4699', '4352', '4127', '4544', '4906', '4814', '4948', '4977', '4830', '4405', '4642', '4666', '4402', '4679', '4465', '4401', '4155', '4767', '4...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_hash_merge_object.rb
Ruby
mit
4,915
master
237
h1 = {} h2 = {} a = [] 1.upto(5_000) do |i| a[i] = Object.new h1[a[i]] = nil end 2_501.upto(7_500) do |i| a[i] = Object.new h2[a[i]] = nil end 500.times do h1.merge!(h2) end 500.times do h2.merge!(h1){|k, v, v2| 42} end
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_uniq_bang_strings.rb
Ruby
mit
4,915
master
8,042
a = ['4768', '4964', '4266', '4872', '4231', '4017', '4565', '4793', '4298', '4135', '4639', '4780', '4237', '4548', '4655', '4153', '4654', '4922', '4563', '4042', '4329', '4699', '4352', '4127', '4544', '4906', '4814', '4948', '4977', '4830', '4405', '4642', '4666', '4402', '4679', '4465', '4401', '4155', '4767', '45...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_minus_objects.rb
Ruby
mit
4,915
master
24,083
a1 = [Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Ob...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_constant_lookup_small.rb
Ruby
mit
4,915
master
1,448
module Scope0 CONST0 = 0 module Scope1 CONST1 = 1 CONST0 module Scope2 CONST2 = 2 CONST1 module Scope3 CONST3 = 3 CONST0 module Scope4 CONST4 = 4 CONST0 module Scope5 CONST5 = 5 CONST4 module Scop...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_uniq_strings.rb
Ruby
mit
4,915
master
8,045
a = ['4768', '4964', '4266', '4872', '4231', '4017', '4565', '4793', '4298', '4135', '4639', '4780', '4237', '4548', '4655', '4153', '4654', '4922', '4563', '4042', '4329', '4699', '4352', '4127', '4544', '4906', '4814', '4948', '4977', '4830', '4405', '4642', '4666', '4402', '4679', '4465', '4401', '4155', '4767', '45...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_hash_literal_mixed_large.rb
Ruby
mit
4,915
master
18,360
1000.times do h = {Object.new => '0', '1' => '1', Object.new => '2', '3' => '3', Object.new => '4', '5' => '5', Object.new => '6', '7' => '7', Object.new => '8', '9' => '9', Object.new => '10', '11' => '11', Object.new => '12', '13' => '13', Object.new => '14', '15' => '15', Object.new => '16', '17' => '17', Object.n...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_constant_lookup_big.rb
Ruby
mit
4,915
master
168,248
module Scope0 CONST0 = 0 module Scope1 CONST1 = 1 CONST0 module Scope2 CONST2 = 2 CONST0 module Scope3 CONST3 = 3 CONST1 module Scope4 CONST4 = 4 CONST0 module Scope5 CONST5 = 5 CONST2 module Scop...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_minus_numbers.rb
Ruby
mit
4,915
master
12,071
a1 = [4768, 4964, 4266, 4872, 4231, 4017, 4565, 4793, 4298, 4135, 4639, 4780, 4237, 4548, 4655, 4153, 4654, 4922, 4563, 4042, 4329, 4699, 4352, 4127, 4544, 4906, 4814, 4948, 4977, 4830, 4405, 4642, 4666, 4402, 4679, 4465, 4401, 4155, 4767, 4510, 4747, 4993, 4508, 4697, 4758, 4133, 4348, 4200, 4442, 4970, 4452, 4041, 41...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_uniq_bang_objects.rb
Ruby
mit
4,915
master
12,046
a = [Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Obj...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_minus_strings.rb
Ruby
mit
4,915
master
16,075
a1 = ['4768', '4964', '4266', '4872', '4231', '4017', '4565', '4793', '4298', '4135', '4639', '4780', '4237', '4548', '4655', '4153', '4654', '4922', '4563', '4042', '4329', '4699', '4352', '4127', '4544', '4906', '4814', '4948', '4977', '4830', '4405', '4642', '4666', '4402', '4679', '4465', '4401', '4155', '4767', '4...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_uniq_objects.rb
Ruby
mit
4,915
master
12,049
a = [Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Object.new, Obj...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_module_definition_big.rb
Ruby
mit
4,915
master
83,490
module Scope0 module Scope1 module Scope2 module Scope3 module Scope4 module Scope5 module Scope6 module Scope7 module Scope8 module Scope9 module Scope10 module Scope11 ...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_uniq_bang_numbers.rb
Ruby
mit
4,915
master
6,040
a = [4768, 4964, 4266, 4872, 4231, 4017, 4565, 4793, 4298, 4135, 4639, 4780, 4237, 4548, 4655, 4153, 4654, 4922, 4563, 4042, 4329, 4699, 4352, 4127, 4544, 4906, 4814, 4948, 4977, 4830, 4405, 4642, 4666, 4402, 4679, 4465, 4401, 4155, 4767, 4510, 4747, 4993, 4508, 4697, 4758, 4133, 4348, 4200, 4442, 4970, 4452, 4041, 410...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_array_uniq_numbers.rb
Ruby
mit
4,915
master
6,043
a = [4768, 4964, 4266, 4872, 4231, 4017, 4565, 4793, 4298, 4135, 4639, 4780, 4237, 4548, 4655, 4153, 4654, 4922, 4563, 4042, 4329, 4699, 4352, 4127, 4544, 4906, 4814, 4948, 4977, 4830, 4405, 4642, 4666, 4402, 4679, 4465, 4401, 4155, 4767, 4510, 4747, 4993, 4508, 4697, 4758, 4133, 4348, 4200, 4442, 4970, 4452, 4041, 410...
github
opal/opal
https://github.com/opal/opal
benchmark/bm_module_definition_small.rb
Ruby
mit
4,915
master
695
module Scope0 module Scope1 module Scope2 module Scope3 module Scope4 module Scope5 module Scope6 module Scope7 module Scope8 module Scope9 module Scope10 module Scope11 ...
github
opal/opal
https://github.com/opal/opal
opal/opal.rb
Ruby
mit
4,915
master
788
::Object.require 'opal/base' ::Object.require 'opal/mini' ::Object.require 'corelib/kernel/format' ::Object.require 'corelib/string/encoding' ::Object.autoload :Math, 'corelib/math' ::Object.require 'corelib/complex/base' ::Object.autoload :Complex, 'corelib/complex' ::Object.require 'corelib/rational/base' ::Object.a...
github
opal/opal
https://github.com/opal/opal
opal/opal/base.rb
Ruby
mit
4,915
master
280
::Object.require 'runtime/runtime' ::Object.require 'corelib/module' ::Object.require 'corelib/class' ::Object.require 'corelib/basic_object' ::Object.require 'corelib/kernel' ::Object.require 'corelib/main' ::Object.require 'corelib/error' ::Object.require 'corelib/constants'
github
opal/opal
https://github.com/opal/opal
opal/opal/mini.rb
Ruby
mit
4,915
master
667
::Object.require 'opal/base' ::Object.require 'corelib/nil' ::Object.require 'corelib/boolean' ::Object.require 'corelib/comparable' ::Object.require 'corelib/regexp' ::Object.require 'corelib/string' ::Object.require 'corelib/enumerable' ::Object.require 'corelib/enumerator' ::Object.require 'corelib/array' ::Object....
github
opal/opal
https://github.com/opal/opal
opal/opal/full.rb
Ruby
mit
4,915
master
575
::Object.autoload :Marshal, 'corelib/marshal' ::Object.require 'corelib/string/encoding/dummy' ::Object.require 'corelib/string/encoding/eucjp' ::Object.require 'corelib/string/encoding/jis' ::Object.require 'corelib/string/encoding/sjis' ::Object.require 'corelib/string/unpack' ::Object.require 'corelib/array/pack' ::...
github
opal/opal
https://github.com/opal/opal
opal/corelib/trace_point.rb
Ruby
mit
4,915
master
1,454
# backtick_javascript: true class ::TracePoint # partial implementation of TracePoint # supports :class and :end events def self.trace(event, &block) new(event, &block).enable end attr_reader :event def initialize(event, &block) unless event == :class || event == :end ::Kernel.raise 'Only t...
github
opal/opal
https://github.com/opal/opal
opal/corelib/basic_object.rb
Ruby
mit
4,915
master
3,327
# use_strict: true # backtick_javascript: true class ::BasicObject def initialize(*) end def ==(other) `self === other` end def eql?(other) self == other end alias equal? == def __id__ %x{ if (self.$$id != null) { return self.$$id; } Opal.prop(self, '$$id', Opa...
github
opal/opal
https://github.com/opal/opal
opal/corelib/io.rb
Ruby
mit
4,915
master
6,400
# backtick_javascript: true class ::IO self::SEEK_SET = 0 self::SEEK_CUR = 1 self::SEEK_END = 2 self::SEEK_DATA = 3 self::SEEK_HOLE = 4 self::READABLE = 1 self::WRITABLE = 4 attr_reader :eof attr_accessor :read_proc, :sync, :tty, :write_proc def initialize(fd, flags = 'r') @fd = fd @fl...
github
opal/opal
https://github.com/opal/opal
opal/corelib/array.rb
Ruby
mit
4,915
master
56,691
# helpers: truthy, falsy, yield1, hash_get, hash_put, hash_delete, coerce_to, respond_to, deny_frozen_access, freeze, opal32_init, opal32_add # backtick_javascript: true require 'corelib/enumerable' require 'corelib/numeric' class ::Array < `Array` include ::Enumerable # Mark all javascript arrays as being valid...
github
opal/opal
https://github.com/opal/opal
opal/corelib/rational.rb
Ruby
mit
4,915
master
7,253
# backtick_javascript: true require 'corelib/numeric' require 'corelib/rational/base' class ::Rational < ::Numeric def self.reduce(num, den) num = num.to_i den = den.to_i if den == 0 ::Kernel.raise ::ZeroDivisionError, 'divided by 0' elsif den < 0 num = -num den = -den elsif d...
github
opal/opal
https://github.com/opal/opal
opal/corelib/kernel.rb
Ruby
mit
4,915
master
19,998
# helpers: truthy, coerce_to, respond_to, Opal, deny_frozen_access, freeze, freeze_props, jsid, each_ivar, slice # use_strict: true # backtick_javascript: true module ::Kernel def =~(obj) false end def !~(obj) !(self =~ obj) end def ===(other) object_id == other.object_id || self == other end...
github
opal/opal
https://github.com/opal/opal
opal/corelib/pattern_matching.rb
Ruby
mit
4,915
master
3,654
require 'corelib/pattern_matching/base' # A "userland" implementation of pattern matching for Opal class ::PatternMatching def self.call(from, pattern) pm = new(from, pattern) pm.match || (return nil) pm.returns end def initialize(from, pattern) @from, @pattern = from, pattern @returns = []...
github
opal/opal
https://github.com/opal/opal
opal/corelib/module.rb
Ruby
mit
4,915
master
20,689
# helpers: truthy, coerce_to, const_set, Object, return_ivar, assign_ivar, ivar, deny_frozen_access, freeze, prop, jsid, each_ivar # backtick_javascript: true # use_strict: true class ::Module %x{ function ensure_symbol_or_string(name) { if (name.$$is_string) { return name; }; var conve...
github
opal/opal
https://github.com/opal/opal
opal/corelib/numeric.rb
Ruby
mit
4,915
master
6,591
# backtick_javascript: true # use_strict: true require 'corelib/comparable' class ::Numeric include ::Comparable def coerce(other) if other.instance_of? self.class return [other, self] end [::Kernel.Float(other), ::Kernel.Float(self)] end def __coerced__(method, other) if other.respon...
github
opal/opal
https://github.com/opal/opal
opal/corelib/constants.rb
Ruby
mit
4,915
master
424
::RUBY_PLATFORM = 'opal' ::RUBY_ENGINE = 'opal' ::RUBY_VERSION = '3.2.0' ::RUBY_ENGINE_VERSION = '2.0.0dev' ::RUBY_RELEASE_DATE = '2023-11-16' ::RUBY_PATCHLEVEL = 0 ::RUBY_REVISION = '0' ::RUBY_COPYRIGHT = 'opal - Copyright (C) 2011-2023 Adam Beynon and the Opal contributors' ::RUB...
github
opal/opal
https://github.com/opal/opal
opal/corelib/range.rb
Ruby
mit
4,915
master
8,837
# backtick_javascript: true # use_strict: true require 'corelib/enumerable' class ::Range include ::Enumerable `self.$$prototype.$$is_range = true` attr_reader :begin, :end def initialize(first, last, exclude = false) ::Kernel.raise ::NameError, "'initialize' called twice" if @begin ::Kernel.raise ...
github
opal/opal
https://github.com/opal/opal
opal/corelib/marshal.rb
Ruby
mit
4,915
master
333
require 'corelib/marshal/read_buffer' require 'corelib/marshal/write_buffer' module ::Marshal MAJOR_VERSION = 4 MINOR_VERSION = 8 class << self def dump(object) self::WriteBuffer.new(object).write end def load(marshaled) self::ReadBuffer.new(marshaled).read end alias restore lo...
github
opal/opal
https://github.com/opal/opal
opal/corelib/time.rb
Ruby
mit
4,915
master
19,507
# helpers: slice, deny_frozen_access # backtick_javascript: true # use_strict: true require 'corelib/comparable' class ::Time < `Date` include ::Comparable %x{ var days_of_week = #{%w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday]}, short_days = #{%w[Sun Mon Tue Wed Thu Fri Sat]},...
github
opal/opal
https://github.com/opal/opal
opal/corelib/main.rb
Ruby
mit
4,915
master
329
# backtick_javascript: true class << self def to_s 'main' end def include(mod) ::Object.include mod end def autoload(*args) `Opal.Object.$autoload.apply(Opal.Object, args)` end # Compiler overrides this method def using(mod) ::Kernel.raise 'main.using is permitted only at toplevel' ...
github
opal/opal
https://github.com/opal/opal
opal/corelib/regexp.rb
Ruby
mit
4,915
master
12,747
# helpers: coerce_to, prop, freeze, annotate_regexp, escape_metacharacters # backtick_javascript: true # use_strict: true class ::RegexpError < ::StandardError; end class ::Regexp < `RegExp` self::IGNORECASE = 1 self::EXTENDED = 2 self::MULTILINE = 4 # Not supported: self::FIXEDENCODING = 16 self::NOENCOD...
github
opal/opal
https://github.com/opal/opal
opal/corelib/comparable.rb
Ruby
mit
4,915
master
2,511
# helpers: truthy # backtick_javascript: true module ::Comparable %x{ function normalize(what) { if (Opal.is_a(what, Opal.Integer)) { return what; } if (#{`what` > 0}) { return 1; } if (#{`what` < 0}) { return -1; } return 0; } function fail_comparison(lhs, rhs) { var clas...
github
opal/opal
https://github.com/opal/opal
opal/corelib/math.rb
Ruby
mit
4,915
master
6,251
# helpers: type_error # backtick_javascript: true # use_strict: true module ::Math self::E = `Math.E` self::PI = `Math.PI` self::DomainError = ::Class.new(::StandardError) def self.checked(method, *args) %x{ if (isNaN(args[0]) || (args.length == 2 && isNaN(args[1]))) { return NaN; } ...
github
opal/opal
https://github.com/opal/opal
opal/corelib/struct.rb
Ruby
mit
4,915
master
7,988
# backtick_javascript: true require 'corelib/enumerable' class ::Struct include ::Enumerable def self.new(const_name, *args, keyword_init: false, &block) if const_name if const_name.class == ::String && const_name[0].upcase != const_name[0] # Fast track so that we skip needlessly going thru exc...
github
opal/opal
https://github.com/opal/opal
opal/corelib/process.rb
Ruby
mit
4,915
master
1,987
# backtick_javascript: true module ::Process @__clocks__ = [] def self.__register_clock__(name, func) const_set name, @__clocks__.size @__clocks__ << func end __register_clock__ :CLOCK_REALTIME, `function() { return Date.now() }` monotonic = false %x{ if (Opal.global.performance) { mon...
github
opal/opal
https://github.com/opal/opal
opal/corelib/unsupported.rb
Ruby
mit
4,915
master
2,077
# backtick_javascript: true # use_strict: true class ::String `var ERROR = "String#%s not supported. Mutable String methods are currently not supported in Opal."` %i[ << []= append_as_bytes bytesplice capitalize! chomp! chop! clear concat delete! delete_prefix! delete_suffix! downcase! encode! gsub! inser...
github
opal/opal
https://github.com/opal/opal
opal/corelib/random.rb
Ruby
mit
4,915
master
2,007
# helpers: truthy # backtick_javascript: true # use_strict: true require 'corelib/random/formatter' class ::Random attr_reader :seed, :state def self._verify_count(count) %x{ if (!$truthy(count)) count = 16; if (typeof count !== "number") count = #{`count`.to_int}; if (count < 0) #{::Kernel...
github
opal/opal
https://github.com/opal/opal
opal/corelib/string.rb
Ruby
mit
4,915
master
70,837
# helpers: coerce_to, respond_to, global_regexp, prop, opal32_init, opal32_add, transform_regexp, str # backtick_javascript: true # depends on: # require 'corelib/comparable' # required by mini # require 'corelib/regexp' # required by mini class ::String < `String` include ::Comparable attr_reader :encoding,...
github
opal/opal
https://github.com/opal/opal
opal/corelib/error.rb
Ruby
mit
4,915
master
9,496
# backtick_javascript: true # use_strict: true class ::Exception < `Error` `Opal.prop(self.$$prototype, '$$is_exception', true)` `var stack_trace_limit` `Error.stackTraceLimit = 100` def self.new(*args) %x{ var message = (args.length > 0) ? args[0] : nil; var error = new self.$$construc...
github
opal/opal
https://github.com/opal/opal
opal/corelib/enumerator.rb
Ruby
mit
4,915
master
2,977
# helpers: slice, coerce_to, deny_frozen_access # backtick_javascript: true # use_strict: true require 'corelib/enumerable' class ::Enumerator include ::Enumerable `self.$$prototype.$$is_enumerator = true` def self.for(object, method = :each, *args, &block) %x{ var obj = #{allocate}; obj.obje...
github
opal/opal
https://github.com/opal/opal
opal/corelib/binding.rb
Ruby
mit
4,915
master
1,422
# backtick_javascript: true class ::Binding # @private def initialize(jseval, scope_variables = [], receiver = undefined, source_location = nil) @jseval, @scope_variables, @receiver, @source_location = \ jseval, scope_variables, receiver, source_location receiver = js_eval('self') if `typeof receive...