repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_fetch_string.rb | benchmark/bm_hash_fetch_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
1_000.times do |i|
h.fetch(i.to_s)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_rehash_object.rb | benchmark/bm_hash_rehash_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
1_000.times do
h.rehash
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_uniq_objects.rb | benchmark/bm_array_uniq_objects.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_hash_object.rb | benchmark/bm_hash_hash_object.rb | h = {}
1_000.times do |i|
h[Object.new] = nil
end
100.times do |i|
h.hash
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_module_definition_big.rb | benchmark/bm_module_definition_big.rb | module Scope0
module Scope1
module Scope2
module Scope3
module Scope4
module Scope5
module Scope6
module Scope7
module Scope8
module Scope9
module Scope10
module Scope11
... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | true |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_key_object.rb | benchmark/bm_hash_key_object.rb | h = {}
10_000.times do |i|
h[Object.new] = i
end
1_000.times do |i|
h.key(i)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_values_string.rb | benchmark/bm_hash_values_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
1_000.times do
h.values
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_uniq_bang_strings.rb | benchmark/bm_array_uniq_bang_strings.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_minus_numbers.rb | benchmark/bm_array_minus_numbers.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_each_value_object.rb | benchmark/bm_hash_each_value_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
1_000.times do |i|
h.each_value{|v| nil}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_flatten_string.rb | benchmark/bm_hash_flatten_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
1_000.times do
h.flatten
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_inspect_string.rb | benchmark/bm_hash_inspect_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
100.times do
h.inspect
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_rehash_string.rb | benchmark/bm_hash_rehash_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
1_000.times do
h.rehash
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_literal_mixed_small.rb | benchmark/bm_hash_literal_mixed_small.rb | 10_000.times do
h = {'a' => 'b', Object.new => 'd', 'e' => 'f', Object.new => 'h', 'i' => 'j', Object.new => 'l', 'm' => 'n', Object.new => 'p'}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_to_h_string.rb | benchmark/bm_hash_to_h_string.rb | class MyHash < Hash; end
h = MyHash.new
10_000.times do |i|
h[i.to_s] = nil
end
1_000.times do
h.to_h
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_flatten_object.rb | benchmark/bm_hash_flatten_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
1_000.times do
h.flatten
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_to_h_object.rb | benchmark/bm_hash_to_h_object.rb | class MyHash < Hash; end
h = MyHash.new
10_000.times do |i|
h[Object.new] = nil
end
1_000.times do
h.to_h
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_equal_value_object.rb | benchmark/bm_hash_equal_value_object.rb | h1 = {}
h2 = {}
a = []
10_000.times do |i|
a[i] = Object.new
h1[a[i]] = nil
h2[a[i]] = nil
end
1_000.times do
h1 == h2
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_literal_string_large.rb | benchmark/bm_hash_literal_string_large.rb | 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"=... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_module_definition_small.rb | benchmark/bm_module_definition_small.rb | module Scope0
module Scope1
module Scope2
module Scope3
module Scope4
module Scope5
module Scope6
module Scope7
module Scope8
module Scope9
module Scope10
module Scope11
... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_uniq_numbers.rb | benchmark/bm_array_uniq_numbers.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_constant_lookup_big.rb | benchmark/bm_constant_lookup_big.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | true |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_fetch_object.rb | benchmark/bm_hash_fetch_object.rb | h = {}
a = []
10_000.times do |i|
a[i] = Object.new
h[a[i]] = nil
end
1_000.times do |i|
h.fetch(a[i])
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_element_set_object.rb | benchmark/bm_hash_element_set_object.rb | h = {}
100_000.times do |i|
h[Object.new] = nil
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_reject_bang_string.rb | benchmark/bm_hash_reject_bang_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = i
end
10_000.times do |i|
h.reject!{|k, v| v <= i}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_union_strings.rb | benchmark/bm_array_union_strings.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_uniq_bang_objects.rb | benchmark/bm_array_uniq_bang_objects.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_element_reference_string.rb | benchmark/bm_hash_element_reference_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
10_000.times do |i|
h[i.to_s]
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_clone_object.rb | benchmark/bm_hash_clone_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
100.times do |i|
h.clone
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_union_objects.rb | benchmark/bm_array_union_objects.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_element_reference_object.rb | benchmark/bm_hash_element_reference_object.rb | h = {}
a = []
10_000.times do |i|
a[i] = Object.new
h[a[i]] = nil
end
10_000.times do |i|
h[a[i]]
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_constant_lookup_small.rb | benchmark/bm_constant_lookup_small.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_keys_object.rb | benchmark/bm_hash_keys_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
5_000.times do
h.keys
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_dispatch_send.rb | benchmark/bm_dispatch_send.rb | 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
... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_each_value_string.rb | benchmark/bm_hash_each_value_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
1_000.times do |i|
h.each_value{|v| nil}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_literal_object_large.rb | benchmark/bm_hash_literal_object_large.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_reject_string.rb | benchmark/bm_hash_reject_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = i
end
100.times do |i|
h.reject{|k, v| v % 2 == 0}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_dispatch_send_table.rb | benchmark/bm_dispatch_send_table.rb | 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
#... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_assoc_string.rb | benchmark/bm_hash_assoc_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
10_000.times do |i|
k, v = h.assoc(i.to_s)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_select_object.rb | benchmark/bm_hash_select_object.rb | h = {}
10_000.times do |i|
h[Object.new] = i
end
100.times do |i|
h.select{|k, v| v % 2 == 0}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_to_a_object.rb | benchmark/bm_hash_to_a_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
5_000.times do
h.to_a
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_rassoc_object.rb | benchmark/bm_hash_rassoc_object.rb | h = {}
10_000.times do |i|
h[Object.new] = i
end
1_000.times do |i|
k, v = h.rassoc(i)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_element_set_string.rb | benchmark/bm_hash_element_set_string.rb | h = {}
100_000.times do |i|
h[i.to_s] = nil
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_replace_object.rb | benchmark/bm_hash_replace_object.rb | 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
1_000.times do
h1.replace(h2)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_values_object.rb | benchmark/bm_hash_values_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
1_000.times do
h.values
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_flatten.rb | benchmark/bm_array_flatten.rb | a = []
1000.times do |i|
a << [i]
end
1000.times do
a.flatten
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_inspect_object.rb | benchmark/bm_hash_inspect_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
100.times do
h.inspect
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_invert_string.rb | benchmark/bm_hash_invert_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
100.times do
h.invert
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_keys_string.rb | benchmark/bm_hash_keys_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
5_000.times do
h.keys
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_select_bang_object.rb | benchmark/bm_hash_select_bang_object.rb | h = {}
10_000.times do |i|
h[Object.new] = i
end
10_000.times do |i|
h.select!{|k, v| v > i}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_intersection_numbers.rb | benchmark/bm_array_intersection_numbers.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_intersection_strings.rb | benchmark/bm_array_intersection_strings.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_has_value_string.rb | benchmark/bm_hash_has_value_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = i * 2
end
1_000.times do |i|
h.has_value?(i * 2)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_invert_object.rb | benchmark/bm_hash_invert_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
100.times do
h.invert
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_key_string.rb | benchmark/bm_hash_key_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = i
end
1_000.times do |i|
h.key(i)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_rassoc_string.rb | benchmark/bm_hash_rassoc_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = i
end
1_000.times do |i|
k, v = h.rassoc(i)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_to_a_string.rb | benchmark/bm_hash_to_a_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
5_000.times do
h.to_a
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_union_numbers.rb | benchmark/bm_array_union_numbers.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_merge_object.rb | benchmark/bm_hash_merge_object.rb | 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
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_each_key_object.rb | benchmark/bm_hash_each_key_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
1_000.times do |i|
h.each_key{|k| nil}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_each_string.rb | benchmark/bm_hash_each_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
1_000.times do |i|
h.each{|k, v| nil}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_select_string.rb | benchmark/bm_hash_select_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = i
end
100.times do |i|
h.select{|k, v| v % 2 == 0}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_literal_mixed_large.rb | benchmark/bm_hash_literal_mixed_large.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_select_bang_string.rb | benchmark/bm_hash_select_bang_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = i
end
10_000.times do |i|
h.select!{|k, v| v > i}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_minus_objects.rb | benchmark/bm_array_minus_objects.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_reject_object.rb | benchmark/bm_hash_reject_object.rb | h = {}
10_000.times do |i|
h[Object.new] = i
end
100.times do |i|
h.reject{|k, v| v % 2 == 0}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_dispatch_bind_table.rb | benchmark/bm_dispatch_bind_table.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/run.rb | benchmark/run.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_clone_string.rb | benchmark/bm_hash_clone_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
100.times do |i|
h.clone
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_equal_value_string.rb | benchmark/bm_hash_equal_value_string.rb | h1 = {}
h2 = {}
10_000.times do |i|
h1[i.to_s] = nil
h2[i.to_s] = nil
end
1_000.times do
h1 == h2
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_delete_string.rb | benchmark/bm_hash_delete_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
10_000.times do |i|
h.delete(i.to_s)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_keep_if_object.rb | benchmark/bm_hash_keep_if_object.rb | h = {}
10_000.times do |i|
h[Object.new] = i
end
1_000.times do
h.keep_if{|k, v| v % 2 == 0}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_dispatch_hardcoded.rb | benchmark/bm_dispatch_hardcoded.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_shift_string.rb | benchmark/bm_hash_shift_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
1_000_000.times do
k, v = h.shift
h[k] = v
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_minus_strings.rb | benchmark/bm_array_minus_strings.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_each_object.rb | benchmark/bm_hash_each_object.rb | h = {}
10_000.times do |i|
h[Object.new] = nil
end
1_000.times do |i|
h.each{|k, v| nil}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_join_ary.rb | benchmark/bm_array_join_ary.rb | a = []
1000.times do |i|
a << [i]
end
1000.times do
a.join
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_replace_string.rb | benchmark/bm_hash_replace_string.rb | h1 = {}
h2 = {}
1.upto(5_000) do |i|
h1[i.to_s] = nil
end
2_501.upto(7_500) do |i|
h2[i.to_s] = nil
end
1_000.times do
h1.replace(h2)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_merge_string.rb | benchmark/bm_hash_merge_string.rb | h1 = {}
h2 = {}
1.upto(5_000) do |i|
h1[i.to_s] = nil
end
2_501.upto(7_500) do |i|
h2[i.to_s] = nil
end
500.times do
h1.merge!(h2)
end
500.times do
h2.merge!(h1){|k, v, v2| 42}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_uniq_strings.rb | benchmark/bm_array_uniq_strings.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_dispatch_code_gen.rb | benchmark/bm_dispatch_code_gen.rb | 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
... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_keep_if_string.rb | benchmark/bm_hash_keep_if_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = i
end
1_000.times do
h.keep_if{|k, v| v % 2 == 0}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_delete_object.rb | benchmark/bm_hash_delete_object.rb | h = {}
a = []
10_000.times do |i|
a[i] = Object.new
h[a[i]] = nil
end
10_000.times do |i|
h.delete(a[i])
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_each_key_string.rb | benchmark/bm_hash_each_key_string.rb | h = {}
10_000.times do |i|
h[i.to_s] = nil
end
1_000.times do |i|
h.each_key{|k| nil}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_dispatch_code_gen_if.rb | benchmark/bm_dispatch_code_gen_if.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_hash_string.rb | benchmark/bm_hash_hash_string.rb | h = {}
1_000.times do |i|
h[i.to_s] = nil
end
100.times do |i|
h.hash
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_array_intersection_objects.rb | benchmark/bm_array_intersection_objects.rb | 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... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/benchmark/bm_hash_literal_object_small.rb | benchmark/bm_hash_literal_object_small.rb | 10_000.times do
h = {Object.new => 'b', Object.new => 'd', Object.new => 'f', Object.new => 'h', Object.new => 'j', Object.new => 'l', Object.new => 'n', Object.new => 'p'}
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/http_server.rb | test/opal/http_server.rb | require 'sinatra'
cat_image = File.open(File.join(File.dirname(__FILE__), 'cat.png'), 'rb').read
get '/' do
headers \
'Access-Control-Allow-Origin' => '*'
'Ready!'
end
get '/plain_text' do
status 200
headers(
'Content-Type' => 'text/plain',
'Access-Control-Allow-Origin' => '*' )
body 'plain tex... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/test_openuri.rb | test/opal/test_openuri.rb | # frozen_string_literal: false
require "test/unit"
require "open-uri"
class TestOpenURI < Test::Unit::TestCase
def test_open_http_plain_text
open("http://localhost:4567/plain_text") {|f|
assert_match(/plain text/, f.read)
assert_equal('text/plain', f.content_type)
}
end
def test_open_http_ht... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/test_keyword.rb | test/opal/test_keyword.rb | # Copied from cruby and modified to skip unsupported syntaxes
require 'test/unit'
class TestKeywordArguments < Test::Unit::TestCase
def f1(str: "foo", num: 424242)
[str, num]
end
def test_f1
skip %{TypeError: no implicit conversion of NilClass into String}
assert_equal(["foo", 424242], f1)
asse... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/test_io_buffer.rb | test/opal/test_io_buffer.rb | # frozen_string_literal: false
require 'tempfile'
require 'corelib/io/buffer'
class TestIOBuffer < Test::Unit::TestCase
def assert_negative(value)
assert(value < 0, "Expected #{value} to be negative!")
end
def assert_positive(value)
assert(value > 0, "Expected #{value} to be positive!")
end
def te... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/test_matrix.rb | test/opal/test_matrix.rb | # frozen_string_literal: false
require 'test/unit'
require 'matrix'
class SubMatrix < Matrix
end
class TestMatrix < Test::Unit::TestCase
def setup
@m1 = Matrix[[1,2,3], [4,5,6]]
@m2 = Matrix[[1,2,3], [4,5,6]]
@m3 = @m1.clone
@m4 = Matrix[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]
@n1 = Matrix[[2,3,4], [5... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/test_base64.rb | test/opal/test_base64.rb | # coding: ascii-8bit
# frozen_string_literal: false
require "test/unit"
require "base64"
class TestBase64 < Test::Unit::TestCase
def test_sample
assert_equal("U2VuZCByZWluZm9yY2VtZW50cw==\n", Base64.encode64('Send reinforcements'))
assert_equal('Send reinforcements', Base64.decode64("U2VuZCByZWluZm9yY2VtZW50... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/unsupported_and_bugs.rb | test/opal/unsupported_and_bugs.rb | class Test::Unit::TestCase
#
# @example
# class TestBase64
# unsupported :test_urlsafe_encode64
# unsupported :test_strict_encode64
# end
#
def self.unsupported name, message = 'unsupported'
define_method name do
skip message
end
end
#
# @example
# class TestBase64
... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/test_uri.rb | test/opal/test_uri.rb | # frozen_string_literal: false
require 'uri'
module URI
class TestCommon < Test::Unit::TestCase
def test_decode_www_form
assert_equal([%w[a 1], %w[a 2]], URI.decode_www_form("a=1&a=2"))
assert_equal([%w[a 1;a=2]], URI.decode_www_form("a=1;a=2"))
assert_equal([%w[a 1], ['', ''], %w[a 2]], URI.d... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/promisev2/test_trace.rb | test/opal/promisev2/test_trace.rb | require 'test/unit'
require 'promise/v2'
class TestPromiseTrace < Test::Unit::TestCase
def test_calls_the_block_with_all_the_previous_results
x = 42
PromiseV2.value(1)
.then { 2 }
.then { 3 }
.trace {|a, b, c| x = a + b + c }
.always { assert_equal(x, 6) }
end
def test_calls_the... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/promisev2/test_when.rb | test/opal/promisev2/test_when.rb | require 'test/unit'
require 'promise/v2'
class TestPromiseWhen < Test::Unit::TestCase
def test_calls_the_block_with_all_promises_results
a = PromiseV2.new
b = PromiseV2.new
x = 42
p = PromiseV2.when(a, b).then {|y, z|
x = y + z
}
a.resolve(1)
b.resolve(2)
p.always { assert_e... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/promisev2/test_rescue.rb | test/opal/promisev2/test_rescue.rb | require 'test/unit'
require 'promise/v2'
class TestPromiseRescue < Test::Unit::TestCase
def test_calls_the_block_when_the_promise_has_already_been_rejected
x = 42
PromiseV2.error(23)
.rescue { |v| x = v }
.always { assert_equal(x, 23) }
end
def test_calls_the_block_when_the_promise_is_reject... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/promisev2/test_error.rb | test/opal/promisev2/test_error.rb | require 'test/unit'
require 'promise/v2'
class TestPromiseError < Test::Unit::TestCase
def test_rejects_the_promise_with_the_given_error
prom = PromiseV2.error(23)
assert_equal(prom.error, 23)
prom.rescue{} # Needed, otherwise we have an uncaught exception
end
def test_marks_the_promise_as_realized
... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.