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/lib/opal/cli_runners/server.rb
lib/opal/cli_runners/server.rb
# frozen_string_literal: true require 'opal/simple_server' module Opal module CliRunners class Server def self.call(data) runner = new(data) runner.run runner.exit_status end def initialize(data) options = data[:options] || {} @builder = data[:builder] ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/cli_runners/deno.rb
lib/opal/cli_runners/deno.rb
# frozen_string_literal: true require 'shellwords' require 'opal/paths' require 'opal/cli_runners/system_runner' require 'opal/os' module Opal module CliRunners class Deno def self.call(data) argv = data[:argv].dup.to_a SystemRunner.call(data) do |tempfile| opts = Shellwords.she...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/cli_runners/gjs.rb
lib/opal/cli_runners/gjs.rb
# frozen_string_literal: true require 'opal/paths' require 'opal/cli_runners/system_runner' require 'shellwords' module Opal module CliRunners # Gjs is GNOME's JavaScript runtime based on Mozilla SpiderMonkey class Gjs def self.call(data) exe = ENV['GJS_PATH'] || 'gjs' builder = data[:...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/builder/directory.rb
lib/opal/builder/directory.rb
# frozen_string_literal: true module Opal class Builder # This module is included into Builder, provides abstracted data about a new # paradigm of compiling Opal applications into a directory. module Directory def version_prefix "opal/#{Opal::VERSION_MAJOR_MINOR}" end def sourc...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/builder/processor.rb
lib/opal/builder/processor.rb
# frozen_string_literal: true require 'opal/compiler' require 'opal/erb' require 'erb' module Opal class Builder class Processor def initialize(source, filename, abs_path = nil, options = {}) options = abs_path if abs_path.is_a? Hash source += "\n" unless source.end_with?("\n") @s...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/builder/scheduler.rb
lib/opal/builder/scheduler.rb
# frozen_string_literal: true require 'opal/os' unless RUBY_ENGINE == 'opal' module Opal class Builder class Scheduler def initialize(builder) @builder = builder end attr_accessor :builder # Prefork is not deterministic. This module corrects an order of processed # files ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/builder/post_processor.rb
lib/opal/builder/post_processor.rb
# frozen_string_literal: true module Opal class Builder class PostProcessor @postprocessors = [] def self.register(klass) @postprocessors << klass end def self.call(processed, builder) @postprocessors.each do |postprocessor| processed = postprocessor.new(process...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/builder/scheduler/threaded.rb
lib/opal/builder/scheduler/threaded.rb
# frozen_string_literal: true module Opal class Builder class Scheduler class Threaded < Scheduler def initialize(builder) super(builder) @threads = [] @threads_mutex = Thread::Mutex.new init_thread_args end # We hook into the process_require...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/builder/scheduler/sequential.rb
lib/opal/builder/scheduler/sequential.rb
# frozen_string_literal: true module Opal class Builder class Scheduler class Sequential < Scheduler def process_requires(rel_path, requires, autoloads, options) requires.map { |r| builder.process_require(r, autoloads, options) } rescue Builder::MissingRequire => error r...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/builder/scheduler/prefork.rb
lib/opal/builder/scheduler/prefork.rb
# frozen_string_literal: true require 'etc' require 'set' module Opal class Builder class Scheduler class Prefork < Scheduler # We hook into the process_requires method def process_requires(rel_path, requires, autoloads, options) return if requires.empty? if @in_fork ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/builder/post_processor/dce.rb
lib/opal/builder/post_processor/dce.rb
# frozen_string_literal: true require 'opal/builder/post_processor/dce/call_tree' module Opal class Builder class PostProcessor class DCE < PostProcessor def self.enabled?(builder) builder.dce? end def initialize(_, _) super reset end ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/builder/post_processor/dce/call_tree.rb
lib/opal/builder/post_processor/dce/call_tree.rb
# frozen_string_literal: true # rubocop:disable Style/CaseEquality module Opal class Builder class PostProcessor class DCE < PostProcessor # CallTree records a tree of definitions and calls, like # so: # # (root): # - definitions: # - CallTree: # ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/cache/file_cache.rb
lib/opal/cache/file_cache.rb
# frozen_string_literal: true require 'fileutils' require 'zlib' module Opal module Cache class FileCache def initialize(dir: nil, max_size: nil) @dir = dir || self.class.find_dir # Store at most 32MB of cache - de facto this 32MB is larger, # as we don't account for inode size for...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/masgn.rb
lib/opal/nodes/masgn.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class MassAssignNode < Base SIMPLE_ASSIGNMENT = %i[lvasgn ivasgn lvar gvasgn cdecl casgn].freeze handle :masgn children :lhs, :rhs def compile with_temp do |array| if rhs.type == :array ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/singleton_class.rb
lib/opal/nodes/singleton_class.rb
# frozen_string_literal: true require 'opal/nodes/scope' module Opal module Nodes class SingletonClassNode < ScopeNode handle :sclass children :object, :body def compile push '(function(self, $parent_nesting) {' in_scope do body_stmt = stmt(compiler.returns(body)) ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/node_with_args.rb
lib/opal/nodes/node_with_args.rb
# frozen_string_literal: true require 'opal/nodes/scope' require 'opal/nodes/args/parameters' require 'opal/nodes/node_with_args/shortcuts' module Opal module Nodes class NodeWithArgs < ScopeNode attr_reader :used_kwargs attr_accessor :arity attr_reader :original_args def initialize(*) ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/while.rb
lib/opal/nodes/while.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class WhileNode < Base handle :while children :test, :body def compile test_code = js_truthy(test) @redo_var = scope.new_temp if uses_redo? compiler.in_while do while_loop[:cl...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/top.rb
lib/opal/nodes/top.rb
# frozen_string_literal: true require 'pathname' require 'json' require 'opal/version' require 'opal/nodes/scope' module Opal module Nodes # Generates code for an entire file, i.e. the base sexp class TopNode < ScopeNode handle :top children :body def compile compiler.top_scope =...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/literal.rb
lib/opal/nodes/literal.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/regexp_transpiler' module Opal module Nodes class ValueNode < Base handle :true, :false, :nil def compile push type.to_s end def self.truthy_optimize? true end end class SelfNode < Base...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/variables.rb
lib/opal/nodes/variables.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class LocalVariableNode < Base handle :lvar children :var_name def using_irb? compiler.irb? && scope.top? end def compile return push(var_name.to_s) unless using_irb? with_t...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/array.rb
lib/opal/nodes/array.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class ArrayNode < Base handle :array def compile return push('[]') if children.empty? code, work = [], [] children.each do |child| splat = child.type == :splat part = expr...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/def.rb
lib/opal/nodes/def.rb
# frozen_string_literal: true require 'opal/nodes/node_with_args' module Opal module Nodes class DefNode < NodeWithArgs handle :def children :mid, :inline_args, :stmts def compile compile_body_or_shortcut blockopts = {} blockopts["$$arity"] = arity if arity < 0 ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/constants.rb
lib/opal/nodes/constants.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class ConstNode < Base handle :const children :const_scope, :name def compile push dce_use(name, type: :const) if magical_data_const? push('$__END__') elsif optimized_access? ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/x_string.rb
lib/opal/nodes/x_string.rb
# frozen_string_literal: true module Opal module Nodes class XStringNode < Base handle :xstr def compile if compiler.backtick_javascript_or_warn? compile_javascript else compile_send end end def compile_send sexp = s(:send, nil, :`, s(...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/arglist.rb
lib/opal/nodes/arglist.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes # FIXME: needs rewrite class ArglistNode < Base handle :arglist def compile code, work = [], [] children.each do |current| splat = current.type == :splat arg = expr(current) ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/helpers.rb
lib/opal/nodes/helpers.rb
# frozen_string_literal: true require 'opal/regexp_anchors' module Opal module Nodes module Helpers def property(name) valid_name?(name) ? ".#{name}" : "[#{name.inspect}]" end def valid_name?(name) Opal::Rewriters::JsReservedWords.valid_name?(name) end # Converts ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/defs.rb
lib/opal/nodes/defs.rb
# frozen_string_literal: true require 'opal/nodes/def' module Opal module Nodes class DefsNode < DefNode handle :defs children :recvr, :mid, :inline_args, :stmts def wrap_with_definition if compiler.runtime_mode? unshift "Opal.$#{mid} = Opal.#{mid} = " else ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/defined.rb
lib/opal/nodes/defined.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class DefinedNode < Base handle :defined? children :value def compile case value.type when :self, :nil, :false, :true push value.type.to_s.inspect when :lvasgn, :ivasgn, :gvasgn...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/definitions.rb
lib/opal/nodes/definitions.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class UndefNode < Base handle :undef children :value def compile helper :udef children.each do |child| push dce_def_begin(child.children.first) if child.type == :sym line "$u...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/base.rb
lib/opal/nodes/base.rb
# frozen_string_literal: true require 'opal/nodes/helpers' require 'opal/nodes/closure' require 'opal/builder/post_processor' module Opal module Nodes class Base include Helpers include Closure::NodeSupport include Builder::PostProcessor::NodeSupport include Builder::PostProcessor::DCE::...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/yield.rb
lib/opal/nodes/yield.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class BaseYieldNode < Base def compile_call yielding_scope = find_yielding_scope yielding_scope.uses_block! yielding_scope.block_name ||= '$yield' block_name = yielding_scope.block_name ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/scope.rb
lib/opal/nodes/scope.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class ScopeNode < Base # Every scope can have a parent scope attr_accessor :parent # The class or module name if this scope is a class scope attr_accessor :name # The given block name for a def scope...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/class.rb
lib/opal/nodes/class.rb
# frozen_string_literal: true require 'opal/nodes/module' module Opal module Nodes class ClassNode < ModuleNode handle :class children :cid, :sup, :body def compile name, base = name_and_base helper :klass_def if body.nil? # Empty body: rely on runtime $kla...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/closure.rb
lib/opal/nodes/closure.rb
# frozen_string_literal: true module Opal module Nodes # This module takes care of providing information about the # closure stack that we have for the nodes during compile time. # This is not a typical node. # # Also, while loops are not closures per se, this module also # takes a note about...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/rescue.rb
lib/opal/nodes/rescue.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class EnsureNode < Base handle :ensure children :begn, :ensr def compile push_closure if wrap_in_closure? push 'try {' in_ensure do line stmt(body_sexp) end l...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args.rb
lib/opal/nodes/args.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/nodes/args/arg' require 'opal/nodes/args/arity_check' require 'opal/nodes/args/ensure_kwargs_are_kwargs' require 'opal/nodes/args/extract_block_arg' require 'opal/nodes/args/extract_kwarg' require 'opal/nodes/args/extract_kwargs' require 'opal/node...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/super.rb
lib/opal/nodes/super.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes # This base class is used just to child the find_super_dispatcher method # body. This is then used by actual super calls, or a defined?(super) style # call. class BaseSuperNode < CallNode def initialize(*) ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/module.rb
lib/opal/nodes/module.rb
# frozen_string_literal: true require 'opal/nodes/scope' module Opal module Nodes class ModuleNode < ScopeNode handle :module children :cid, :body def compile if compiler.runtime_mode? # Skip class/module generation line stmt(body) return end ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/iter.rb
lib/opal/nodes/iter.rb
# frozen_string_literal: true require 'opal/nodes/node_with_args' module Opal module Nodes class IterNode < NodeWithArgs handle :iter children :inline_args, :stmts def compile is_lambda! if scope.lambda_definition? compile_body_or_shortcut blockopts = {} blo...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/if.rb
lib/opal/nodes/if.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/ast/matcher' require 'thread' if RUBY_ENGINE == 'opal' module Opal module Nodes class IfNode < Base handle :if children :test, :true_body, :false_body def compile if should_compile_as_simple_expression? i...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/hash.rb
lib/opal/nodes/hash.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class HashNode < Base handle :hash attr_accessor :has_kwsplat, :keys, :values def initialize(*) super @has_kwsplat = false @keys = [] @values = [] children.each do |child...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/call.rb
lib/opal/nodes/call.rb
# frozen_string_literal: true require 'set' require 'pathname' require 'opal/nodes/base' module Opal module Nodes class CallNode < Base handle :send, :csend attr_reader :recvr, :meth, :arglist, :iter SPECIALS = {} # Operators that get optimized by compiler OPERATORS = { :+ => :p...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/logic.rb
lib/opal/nodes/logic.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes class NextNode < Base handle :next def compile thrower(:next, value) end def value case children.size when 0 s(:nil) when 1 children.first else ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/lambda.rb
lib/opal/nodes/lambda.rb
# frozen_string_literal: true require 'opal/nodes/call' module Opal module Nodes class LambdaNode < Base handle :lambda children :iter def compile helper :lambda scope.defines_lambda do push '$lambda(', expr(iter), ')' end end end end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/call/match3.rb
lib/opal/nodes/call/match3.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/nodes/call' module Opal module Nodes # Handles match_with_lvasgn nodes which represent matching a regular expression # with a right-hand side value and assigning the match result to a left-hand side variable. class Match3Node < Base ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/call/dce.rb
lib/opal/nodes/call/dce.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/nodes/call' module Opal module Nodes class CallNode def dce_matcher(methods) case methods.length when 0 when 1 methods.first else methods end end def dce_symbol_ar...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/call/reflection.rb
lib/opal/nodes/call/reflection.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/nodes/call' module Opal module Nodes class CallNode add_special :__callee__ do if scope.def? push fragment scope.mid.to_s.inspect else push fragment 'nil' end end add_special :__m...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/call/require.rb
lib/opal/nodes/call/require.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/nodes/call' module Opal module Nodes class CallNode add_special :require do |compile_default| str = DependencyResolver.new(compiler, arglist.children[0]).resolve compiler.track_require str unless str.nil? compile...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/call/eval.rb
lib/opal/nodes/call/eval.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/nodes/call' module Opal module Nodes class CallNode # This can be refactored in terms of binding, but it would need 'corelib/binding' # to be required in existing code. add_special :eval do |compile_default| # Catch ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/call/js_property.rb
lib/opal/nodes/call/js_property.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/nodes/call' module Opal module Nodes # recvr.JS[:prop] # => recvr.prop class JsAttrNode < Base handle :jsattr children :recvr, :property def compile push recv(recvr), '[', expr(property), ']' end e...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/node_with_args/shortcuts.rb
lib/opal/nodes/node_with_args/shortcuts.rb
# frozen_string_literal: true module Opal module Nodes class NodeWithArgs < ScopeNode # Shortcuts for the simplest kinds of methods Shortcut = Struct.new(:name, :for, :when, :transform) do def match?(node) node.instance_exec(&self.when) end def compile(node) ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/arg.rb
lib/opal/nodes/args/arg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # Compiles a single inline required argument # def m(a); end # ^ class ArgNode < Base handle :arg children :name def compile scope.add_arg name ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/prepare_post_args.rb
lib/opal/nodes/args/prepare_post_args.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # A utility node responsible for preparing # post-argument for :extract_post_* nodes class PreparePostArgs < Base handle :prepare_post_args children :offset def compile ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/extract_kwoptarg.rb
lib/opal/nodes/args/extract_kwoptarg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # This node is responsible for extracting a single # optional keyword argument from $kwargs # # $kwargs always exist (as argument when inlining is possible # and as a local variable when it...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/extract_kwrestarg.rb
lib/opal/nodes/args/extract_kwrestarg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # This node is responsible for extracting a single # splat keyword argument from $kwargs # # $kwargs always exist (as argument when inlining is possible # and as a local variable when it's ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/extract_block_arg.rb
lib/opal/nodes/args/extract_block_arg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # Compiles extraction of the block argument # def m(&block); end # ^^^^^^ # # This node doesn't exist in the original AST, # InlineArgs rewriter creates it to simplify compilati...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/arity_check.rb
lib/opal/nodes/args/arity_check.rb
# frozen_string_literal: true require 'opal/nodes/base' require 'opal/rewriters/arguments' module Opal module Nodes class ArityCheckNode < Base handle :arity_check children :args_node def initialize(*) super arguments = Rewriters::Arguments.new(args_node.children) @a...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/extract_restarg.rb
lib/opal/nodes/args/extract_restarg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # This node is responsible for extracting a splat argument from post-arguments # # args_to_keep is the number of required post-arguments # # def m(*a, b, c, d); end # becomes someth...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/initialize_iterarg.rb
lib/opal/nodes/args/initialize_iterarg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # This node is responsible for initializing a single # required block arg # # proc { |a| } # # Procs don't have arity checking and code like # proc { |a| }.call # must...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/extract_post_optarg.rb
lib/opal/nodes/args/extract_post_optarg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # This node is responsible for extracting a single # optional post-argument # # args_to_keep is the number of required post-arguments # # def m(a = 1, b, c, d); end # becomes ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/extract_kwarg.rb
lib/opal/nodes/args/extract_kwarg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # This node is responsible for extracting a single # required keyword argument from $kwargs # # $kwargs always exist (as argument when inlining is possible # and as a local variable when it...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/initialize_shadowarg.rb
lib/opal/nodes/args/initialize_shadowarg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # This node is responsible for initializing a shadow arg # # proc { |;a| } # class InitializeShadowarg < Base handle :initialize_shadowarg children :name def compil...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/parameters.rb
lib/opal/nodes/args/parameters.rb
# frozen_string_literal: true module Opal module Nodes module Args class Parameters def initialize(args) @args = args.children end def to_code stringified_parameters = @args.map do |arg| public_send(:"on_#{arg.type}", arg) end "[...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/ensure_kwargs_are_kwargs.rb
lib/opal/nodes/args/ensure_kwargs_are_kwargs.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # A utility node responsible for compiling # a runtime validation for kwargs. # # This node is used for both inline and post-kwargs # class EnsureKwargsAreKwargs < Base handle...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/extract_post_arg.rb
lib/opal/nodes/args/extract_post_arg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # This node is responsible for extracting a single # required post-argument from $post_args # class ExtractPostArg < Base handle :extract_post_arg children :name def comp...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/extract_kwargs.rb
lib/opal/nodes/args/extract_kwargs.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # A utility node responsible for extracting # post-kwargs from post-arguments. # # This node is used when kwargs cannot be inlined: # def m(a = 1, kw:); end # # This node is N...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/extract_optarg.rb
lib/opal/nodes/args/extract_optarg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # Compiles extraction of a single inline optional argument # def m(a = 1); end # ^^^^^ # # This node doesn't exist in the original AST, # InlineArgs rewriter creates it to simpl...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/nodes/args/fake_arg.rb
lib/opal/nodes/args/fake_arg.rb
# frozen_string_literal: true require 'opal/nodes/base' module Opal module Nodes module Args # Compiles a fake argument produced by the InlineArgs rewriter. # # This argument represents an argument from the # Ruby code that gets initialized later in the function body. # # def...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/source_map/vlq.rb
lib/opal/source_map/vlq.rb
# Ported from http://github.com/maccman/sourcemap # # Adopted from ConradIrwin/ruby-source_map # https://github.com/ConradIrwin/ruby-source_map/blob/master/lib/source_map/vlq.rb # # Resources # # http://en.wikipedia.org/wiki/Variable-length_quantity # https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFz...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/source_map/index.rb
lib/opal/source_map/index.rb
# frozen_string_literal: true class Opal::SourceMap::Index include Opal::SourceMap::Map attr_reader :source_maps # @param source_maps [Opal::SourceMap::File] # @param join: the string used to join the sources, empty by default, Opal::Builder uses "\n" def initialize(source_maps, join: nil) @source_maps...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/source_map/file.rb
lib/opal/source_map/file.rb
# frozen_string_literal: true class Opal::SourceMap::File include Opal::SourceMap::Map attr_reader :fragments attr_reader :file attr_reader :source def initialize(fragments, file, source, generated_code = nil) @fragments = fragments @file = file @source = source @names_map = Hash.new { |has...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/source_map/map.rb
lib/opal/source_map/map.rb
# frozen_string_literal: true require 'base64' require 'json' module Opal::SourceMap::Map def to_h @to_h || map end def to_json map = to_h map.to_json rescue Encoding::UndefinedConversionError map[:sections].each do |i| i.to_json rescue Encoding::UndefinedConversionError map[:...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/ast/node.rb
lib/opal/ast/node.rb
# frozen_string_literal: true require 'ast' require 'parser/ast/node' module Opal module AST class Node < ::Parser::AST::Node attr_reader :meta def assign_properties(properties) if meta = properties[:meta] meta = meta.dup if meta.frozen? @meta.merge!(meta) else ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/ast/matcher.rb
lib/opal/ast/matcher.rb
# frozen_string_literal: true require 'ast' require 'parser/ast/node' module Opal module AST class Matcher def initialize(&block) @root = instance_exec(&block) end def s(type, *children) Node.new(type, children) end def cap(capture) Node.new(:capture, [cap...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/ast/builder.rb
lib/opal/ast/builder.rb
# frozen_string_literal: true require 'opal/ast/node' require 'parser/ruby32' module Opal module AST class Builder < ::Parser::Builders::Default self.emit_lambda = true def n(type, children, location) ::Opal::AST::Node.new(type, children, location: location) end end end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/parser/default_config.rb
lib/opal/parser/default_config.rb
# frozen_string_literal: true module Opal module Parser module DefaultConfig module ClassMethods attr_accessor :diagnostics_consumer def default_parser parser = super parser.diagnostics.all_errors_are_fatal = true parser.diagnostics.ignore_warnings = fals...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/parser/patch.rb
lib/opal/parser/patch.rb
# backtick_javascript: true # frozen_string_literal: true if RUBY_ENGINE == 'opal' class Parser::Lexer def source_buffer=(source_buffer) @source_buffer = source_buffer if @source_buffer source = @source_buffer.source # Force UTF8 unpacking even if JS works with UTF-16/UCS-2 #...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/parser/with_ruby_lexer.rb
lib/opal/parser/with_ruby_lexer.rb
# frozen_string_literal: true class Opal::Parser::WithRubyLexer < Parser::Ruby32 include Opal::Parser::DefaultConfig Opal::Parser.default_parser_class = self end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/lib/opal/parser/source_buffer.rb
lib/opal/parser/source_buffer.rb
# frozen_string_literal: true module Opal module Parser class SourceBuffer < ::Parser::Source::Buffer def self.recognize_encoding(string) super || Encoding::UTF_8 end end end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/quickjs.rb
stdlib/quickjs.rb
# backtick_javascript: true `/* global std, scriptArgs */` require 'quickjs/io' require 'quickjs/kernel'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/open-uri.rb
stdlib/open-uri.rb
# frozen_string_literal: true # backtick_javascript: true # Copied from https://raw.githubusercontent.com/ruby/ruby/373babeaac8c3e663e1ded74a9f06ac94a671ed9/lib/open-uri.rb require 'stringio' require 'corelib/array/pack' module Kernel private alias open_uri_original_open open # :nodoc: class << self alias ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/thread.rb
stdlib/thread.rb
# This shim implementation of Thread is meant to only appease code that tries # to be safe in the presence of threads, but does not actually utilize them, # e.g., uses thread- or fiber-local variables. class ThreadError < StandardError end class Thread def self.current unless @current @current = allocate ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/securerandom.rb
stdlib/securerandom.rb
# backtick_javascript: true require 'corelib/random/formatter' module SecureRandom extend Random::Formatter %x{ var gen_random_bytes; if ((Opal.global.crypto && Opal.global.crypto.getRandomValues) || (Opal.global.msCrypto && Opal.global.msCrypto.getRandomValues)) { // This method is avai...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/js.rb
stdlib/js.rb
# backtick_javascript: true require 'opal/raw' warn '[Opal] JS module has been renamed to Opal::Raw and will change semantics in Opal 2.1. ' \ 'In addition, you will need to require "opal/raw" instead of "js". ' \ 'To ensure forward compatibility, please update your calls.' module JS extend Opal::Raw i...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/optparse.rb
stdlib/optparse.rb
# frozen_string_literal: true # # optparse.rb - command-line option analysis with the OptionParser class. # # Author:: Nobu Nakada # Documentation:: Nobu Nakada and Gavin Sinclair. # # See OptionParser for documentation. # #-- # == Developer Documentation (not for RDoc output) # # === Class tree # # - OptionParser:: ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
true
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/stringio.rb
stdlib/stringio.rb
class StringIO < IO VERSION = "0" def self.open(string = "", mode = nil, &block) io = new(string, mode) res = block.call(io) io.close res end attr_accessor :string def initialize(string = "", mode = 'rw') @string = string @position = 0 super(nil, mode) end def eof? ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/logger.rb
stdlib/logger.rb
# backtick_javascript: true class Logger module Severity DEBUG = 0 INFO = 1 WARN = 2 ERROR = 3 FATAL = 4 UNKNOWN = 5 end include Severity SEVERITY_LABELS = Severity.constants.map { |s| [(Severity.const_get s), s.to_s] }.to_h class Formatter MESSAGE_FORMAT = "%s, [%s] %5s -- %s: ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/ruby2_keywords.rb
stdlib/ruby2_keywords.rb
# This file ended up in Opal as a port of: # https://github.com/ruby/ruby2_keywords/blob/master/lib/ruby2_keywords.rb class Module unless private_method_defined?(:ruby2_keywords) private # call-seq: # ruby2_keywords(method_name, ...) # # Does nothing. def ruby2_keywords(name, *) # ni...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/opal-source-maps.rb
stdlib/opal-source-maps.rb
require 'opal/source_map'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/ostruct.rb
stdlib/ostruct.rb
# backtick_javascript: true class OpenStruct def initialize(hash = nil) @table = {} if hash hash.each_pair do |key, value| @table[new_ostruct_member(key)] = value end end end def [](name) @table[name.to_sym] end def []=(name, value) @table[new_ostruct_member(name)] ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/benchmark.rb
stdlib/benchmark.rb
#-- # benchmark.rb - a performance benchmarking library # # $Id$ # # Created by Gotoken (gotoken@notwork.org). # # Documentation by Gotoken (original RD), Lyle Johnson (RDoc conversion), and # Gavin Sinclair (editing). #++ # # == Overview # # The Benchmark module provides methods for benchmarking Ruby code, giving # de...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/math.rb
stdlib/math.rb
warn 'DEPRECATION: math is now part of the core library, requiring it is deprecated'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/set.rb
stdlib/set.rb
# Set has been moved to corelib
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/time.rb
stdlib/time.rb
# backtick_javascript: true class Time def self.parse(str) %x{ var d = Date.parse(str); if (d !== d) { // parsing failed, d is a NaN // probably str is not in ISO 8601 format, which is the only format, required to be supported by Javascript // try to make the format more like ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/file.rb
stdlib/file.rb
warn "File is already part of corelib now, you don't need to require it anymore."
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/fileutils.rb
stdlib/fileutils.rb
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/observer.rb
stdlib/observer.rb
# # Implementation of the _Observer_ object-oriented design pattern. The # following documentation is copied, with modifications, from "Programming # Ruby", by Hunt and Thomas; http://www.ruby-doc.org/docs/ProgrammingRuby/html/lib_patterns.html. # # See Observable for more info. # The Observer pattern (also known as ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/yaml.rb
stdlib/yaml.rb
warn "REMOVED: use `require 'nodejs/yaml'` instead"
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/console.rb
stdlib/console.rb
# backtick_javascript: true require 'native' # Manipulate the browser console. # # @see https://developer.mozilla.org/en-US/docs/Web/API/console class Console include Native::Wrapper # Clear the console. def clear `#{@native}.clear()` end # Print a stacktrace from the call site. def trace `#{@na...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/iconv.rb
stdlib/iconv.rb
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false