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/stdlib/opal-builder.rb
stdlib/opal-builder.rb
require 'opal/builder' require 'opal/builder/processor' require 'corelib/string/unpack'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/json.rb
stdlib/json.rb
# backtick_javascript: true module JSON class JSONError < StandardError end class ParserError < JSONError end %x{ var $hasOwn = Opal.hasOwnProperty; function $parse(source) { try { return JSON.parse(source); } catch (e) { #{raise JSON::ParserError, `e.message`}; }...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/strscan.rb
stdlib/strscan.rb
# backtick_javascript: true class StringScanner attr_reader :pos, :matched def initialize(string) @string = string @pos = 0 @matched = nil @working = string @match = [] end attr_reader :string def beginning_of_line? `#{@pos} === 0 || #{@string}.charAt(#{@pos} - 1) === "\n"` ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/encoding.rb
stdlib/encoding.rb
warn 'DEPRECATION: encoding 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/base64.rb
stdlib/base64.rb
# backtick_javascript: true module Base64 # FROM https://github.com/davidchambers/Base64.js/blob/69262ec7e1fa4541de5700a1b0b03b0de0e3f5aa/base64.js %x{ var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var encode, decode; // encoder // [https://gist.github.com/999166...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/enumerator.rb
stdlib/enumerator.rb
# stub
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/dir.rb
stdlib/dir.rb
warn "Dir 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/uri.rb
stdlib/uri.rb
# backtick_javascript: true # frozen_string_literal: true module URI def self.decode_www_form(str, enc = undefined, separator: '&', use__charset_: false, isindex: false) raise ArgumentError, "the input of #{name}.#{__method__} must be ASCII only string" unless str.ascii_only? %x{ var ary = [], key, va...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs.rb
stdlib/nodejs.rb
require 'nodejs/base' require 'nodejs/kernel' require 'nodejs/process' require 'nodejs/file' require 'nodejs/dir' require 'nodejs/io' require 'nodejs/argf' require 'nodejs/open-uri' require 'nodejs/pathname' require 'nodejs/env' require 'nodejs/opal-paths'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/headless_browser.rb
stdlib/headless_browser.rb
# frozen_string_literal: true # backtick_javascript: true require 'headless_browser/base' require 'headless_browser/file'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/matrix.rb
stdlib/matrix.rb
# encoding: utf-8 # frozen_string_literal: false # # = matrix.rb # # An implementation of Matrix and Vector classes. # # See classes Matrix and Vector for documentation. # # Current Maintainer:: Marc-André Lafortune # Original Author:: Keiju ISHITSUKA # Original Documentation:: Gavin Sinclair (sourced from <i>Ruby in a...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
true
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/template.rb
stdlib/template.rb
class Template @_cache = {} def self.[](name) @_cache[name] || @_cache["templates/#{name}"] end def self.[]=(name, instance) @_cache[name] = instance end def self.paths @_cache.keys end attr_reader :body def initialize(name, &body) @name, @body = name, body Template[name] = sel...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/forwardable.rb
stdlib/forwardable.rb
module Forwardable def instance_delegate(hash) hash.each do |methods, accessor| methods = [methods] unless methods.respond_to? :each methods.each do |method| def_instance_delegator(accessor, method) end end end def def_instance_delegators(accessor, *methods) methods.each do...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/native.rb
stdlib/native.rb
# backtick_javascript: true # helpers: hash_put # Provides a complete set of tools to wrap native JavaScript # into nice Ruby objects. # # @example # # $$.document.querySelector('p').classList.add('blue') # # => adds "blue" class to <p> # # $$.location.href = 'https://google.com' # # => changes page location #...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/opal-platform.rb
stdlib/opal-platform.rb
# backtick_javascript: true `/* global GjsFileImporter, Deno, Bun */` browser = `typeof(document) !== "undefined"` bun = `typeof(Bun) === "object" && typeof(Bun.version) === "string"` deno = `typeof(Deno) === "object" && typeof(Deno.version) === "object"` node = `typeof(p...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/shellwords.rb
stdlib/shellwords.rb
# frozen-string-literal: true ## # == Manipulates strings like the UNIX Bourne shell # # This module manipulates strings according to the word parsing rules # of the UNIX Bourne shell. # # The shellwords() function was originally a port of shellwords.pl, # but modified to conform to the Shell & Utilities volume of the ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/pathname.rb
stdlib/pathname.rb
# backtick_javascript: true require 'corelib/comparable' # Portions from Author:: Tanaka Akira <akr@m17n.org> class Pathname include Comparable SEPARATOR_PAT = /#{Regexp.quote File::SEPARATOR}/ def initialize(path) if Pathname === path @path = path.path.to_s elsif path.respond_to?(:to_path) ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/prettyprint.rb
stdlib/prettyprint.rb
# frozen_string_literal: true # # This class implements a pretty printing algorithm. It finds line breaks and # nice indentations for grouped structure. # # By default, the class assumes that primitive elements are strings and each # byte in the strings have single column in width. But it can be used for # other situat...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/rbconfig.rb
stdlib/rbconfig.rb
module RbConfig versions = RUBY_VERSION.split('.') CONFIG = { 'ruby_version' => RUBY_VERSION, 'MAJOR' => versions[0], 'MINOR' => versions[1], 'TEENY' => versions[2], 'RUBY' => RUBY_ENGINE, 'RUBY_INSTALL_NAME' => RUBY_ENGINE, 'ruby_install_name' => RUBY_ENGINE...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/opal-parser.rb
stdlib/opal-parser.rb
# helpers: call, raise # backtick_javascript: true # parser uses String#unpack require 'corelib/string/unpack' require 'opal/compiler' require 'opal/erb' require 'opal/version' module Kernel def eval(str, binding = nil, file = nil, line = nil) str = ::Opal.coerce_to!(str, String, :to_str) default_eval_opti...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/erb.rb
stdlib/erb.rb
# backtick_javascript: true require 'template' class ERB module Util `var escapes = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;'};` `var escape_regexp = /[&<>"']/g;` def html_escape(str) `("" + str).replace(escape_regexp, function (m) { return escapes[m] })` end ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/opal-replutils.rb
stdlib/opal-replutils.rb
# backtick_javascript: true # await: true require 'await' require 'pp' require 'stringio' module REPLUtils module_function def ls(object, colorize) methods = imethods = object.methods ancestors = object.class.ancestors constants = [] ivs = object.instance_variables cvs = [] if [Class, M...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/cgi.rb
stdlib/cgi.rb
require 'cgi/util'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/promise.rb
stdlib/promise.rb
# {Promise} is used to help structure asynchronous code. # # It is available in the Opal standard library, and can be required in any Opal # application: # # require 'promise' # # ## Basic Usage # # Promises are created and returned as objects with the assumption that they # will eventually be resolved or rejected,...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/await.rb
stdlib/await.rb
# helpers: coerce_to # await: await # backtick_javascript: true %x{ var AsyncFunction = Object.getPrototypeOf(async function() {}).constructor; } require 'promise/v2' class Array def map_await(&block) i = 0 results = [] while i < `self.length` results << yield(self[i]).await i += 1 en...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/bigdecimal.rb
stdlib/bigdecimal.rb
# backtick_javascript: true class BigDecimal < Numeric; end require 'opal/raw' require 'bigdecimal/bignumber' module Kernel def BigDecimal(initial, digits = 0) bigdecimal = BigDecimal.allocate bigdecimal.initialize(initial, digits) bigdecimal end end def BigDecimal.new(*args, **kwargs) warn 'BigDe...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/delegate.rb
stdlib/delegate.rb
# frozen_string_literal: true # helpers: freeze, freeze_props # backtick_javascript: true # = delegate -- Support for the Delegation Pattern # # This file ended up in Opal as a port of the following file: # https://github.com/ruby/ruby/blob/master/lib/delegate.rb # # Documentation by James Edward Gray II and Gavin Sin...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/singleton.rb
stdlib/singleton.rb
module Singleton def clone raise TypeError, "can't clone instance of singleton #{self.class}" end def dup raise TypeError, "can't dup instance of singleton #{self.class}" end module SingletonClassMethods def clone Singleton.__init__(super) end def inherited(sub_klass) super ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/date.rb
stdlib/date.rb
# backtick_javascript: true require 'forwardable' require 'date/infinity' require 'time' class Date include Comparable extend Forwardable JULIAN = Infinity.new GREGORIAN = -Infinity.new ITALY = 2_299_161 # 1582-10-15 ENGLAND = 2_361_222 # 1752-09-14 MONTHNAMES = [n...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/buffer.rb
stdlib/buffer.rb
# backtick_javascript: true require 'native' require 'buffer/array' require 'buffer/view' class Buffer include Native::Wrapper def self.supported? !$$[:ArrayBuffer].nil? end def self.name_for(bits, type) part = case type when :unsigned then 'Uint' when :signed then 'Int' ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/pp.rb
stdlib/pp.rb
# frozen_string_literal: true # backtick_javascript: true # Opal: load stdlib/thread.rb require 'thread' require 'stringio' require 'prettyprint' ## # A pretty-printer for Ruby objects. # ## # == What PP Does # # Standard output by #p returns this: # #<PP:0x81fedf0 @genspace=#<Proc:0x81feda0>, @group_queue=#<Pretty...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/gjs.rb
stdlib/gjs.rb
require 'gjs/io' require 'gjs/kernel'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/e2mmap.rb
stdlib/e2mmap.rb
# frozen_string_literal: true # #-- # e2mmap.rb - for Ruby 1.1 # $Release Version: 2.0$ # $Revision: 1.10 $ # by Keiju ISHITSUKA # #++ # # Helper module for easily defining exceptions with predefined messages. # # == Usage # # 1. # class Foo # extend Exception2MessageMapper # def_e2message...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/cgi/util.rb
stdlib/cgi/util.rb
# backtick_javascript: true # This file contains parts of https://github.com/ruby/ruby/blob/master/lib/cgi/util.rb # licensed under a Ruby license. class CGI module Util # URL-encode a string into application/x-www-form-urlencoded. # Space characters (+" "+) are encoded with plus signs (+"+"+) # url_e...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/opal/platform.rb
stdlib/opal/platform.rb
require 'opal-platform' case OPAL_PLATFORM when 'gjs' then require 'gjs' when 'quickjs' then require 'quickjs' when 'deno' then require 'deno/base' when 'nodejs' then require 'nodejs/base' when 'headless-chrome' then require 'headless_browser/base' when 'headless-firefox' t...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/opal/raw.rb
stdlib/opal/raw.rb
# backtick_javascript: true # The Opal::Raw module provides syntax sugar for calling native javascript # operators (e.g. typeof, instanceof, new, delete) and global functions # (e.g. parseFloat, parseInt). module ::Opal module Raw # Use delete to remove a property from an object. def delete(object, property)...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/opal/miniracer.rb
stdlib/opal/miniracer.rb
# backtick_javascript: true `/* global opalminiracer */` # Compatibility utilities for the API we provide in # lib/opal/cli_runners/mini_racer ARGV = `opalminiracer.argv` `Opal.exit = opalminiracer.exit`
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/opal/repl_js.rb
stdlib/opal/repl_js.rb
require 'opal/platform' require 'opal-replutils' require 'json' REPLUtils.js_repl
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/io.rb
stdlib/nodejs/io.rb
# backtick_javascript: true require 'nodejs/file' %x{ function executeIOAction(action) { try { return action(); } catch (error) { if (error.code === 'EACCES' || error.code === 'EISDIR' || error.code === 'EMFILE' || error.code === 'ENOENT' || error.code ===...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/open-uri.rb
stdlib/nodejs/open-uri.rb
# backtick_javascript: true module OpenURI @__xmlhttprequest__ = `require('unxhr')` `var __XMLHttpRequest__ = #{@__xmlhttprequest__}.XMLHttpRequest` def self.request(uri) %x{ var xhr = new __XMLHttpRequest__(); xhr.open('GET', uri, false); xhr.responseType = 'arraybuffer'; xhr.send()...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/stacktrace.rb
stdlib/nodejs/stacktrace.rb
warn <<-WARN, uplevel: 1 Requiring nodejs/stacktrace has been deprecated, if you use the default Node.js runner stack-traces will have source-map support out of the box. WARN
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/file.rb
stdlib/nodejs/file.rb
# backtick_javascript: true require 'corelib/file' %x{ var warnings = {}, errno_codes = #{Errno.constants}; function handle_unsupported_feature(message) { switch (Opal.config.unsupported_features_severity) { case 'error': #{Kernel.raise NotImplementedError, `message`} break; case 'warning...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/fileutils.rb
stdlib/nodejs/fileutils.rb
# backtick_javascript: true module FileUtils extend self `var __fs__ = #{File}.__fs__` def chmod(mode, file_list) raise NotImplementedError, 'symbolic mode is not supported, use numeric mode' if String === mode Array(file_list).each do |file| `__fs__.chmodSync(mode, file)` end end def cp(...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/yaml.rb
stdlib/nodejs/yaml.rb
# backtick_javascript: true require 'native' require 'nodejs/js-yaml-3-6-1' module YAML @__yaml__ = `globalThis.jsyaml` `var __yaml__ = #{@__yaml__}` def self.load_path(path) load(`#{File}.__fs__.readFileSync(#{path}, 'utf8')`) end def self.load(data) loaded = `__yaml__.safeLoad(data)` loaded ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/env.rb
stdlib/nodejs/env.rb
# backtick_javascript: true ENV = Object.new class << ENV def [](name) `process.env[#{name}] || nil` end def []=(name, value) `process.env[#{name.to_s}] = #{value.to_s}` end def key?(name) `process.env.hasOwnProperty(#{name})` end def empty? `Object.keys(process.env).length === 0` e...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/kernel.rb
stdlib/nodejs/kernel.rb
# backtick_javascript: true require 'buffer' require 'corelib/process/status' module Kernel @__child_process__ = `require('node:child_process')` @__cluster__ = `require('node:cluster')` @__process__ = `require('node:process')` `var __child_process__ = #{@__child_process__}` `var __cluster__ = #{@__cluster_...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/argf.rb
stdlib/nodejs/argf.rb
ARGF = Object.new class << ARGF include Enumerable def inspect 'ARGF' end def argv ARGV end def file fn = filename if fn == '-' $stdin else @file ||= File.open(fn, 'r') end end def filename return @filename if @filename if argv == ['-'] '-' elsi...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/dir.rb
stdlib/nodejs/dir.rb
# backtick_javascript: true class Dir @__pm__ = `require('picomatch')` @__fs__ = `require('fs')` @__path__ = `require('path')` @__os__ = `require('os')` `var __pm__ = #{@__pm__}` `var __fs__ = #{@__fs__}` `var __path__ = #{@__path__}` `var __os__ = #{@__os__}` %x{ function pwd() { return p...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/base.rb
stdlib/nodejs/base.rb
# backtick_javascript: true module NodeJS VERSION = `process.version` end `Opal.exit = process.exit` ARGV = `process.argv.slice(2)` ARGV.shift if ARGV.first == '--' STDOUT.write_proc = ->(string) { `process.stdout.write(string)` } STDERR.write_proc = ->(string) { `process.stderr.write(string)` } `var __fs__ = re...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/process.rb
stdlib/nodejs/process.rb
# backtick_javascript: true module ::Process def self.pid `Opal.Kernel.__process__.pid` end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/require.rb
stdlib/nodejs/require.rb
# backtick_javascript: true require 'opal-parser' module Kernel def __prepare_require__(path) name = `Opal.normalize(#{path})` full_path = name.end_with?('.rb') ? name : name + '.rb' if `!Opal.modules[#{name}]` ruby = File.read(full_path) compiler = Opal::Compiler.new(ruby, requirable: true...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/pathname.rb
stdlib/nodejs/pathname.rb
# backtick_javascript: true require 'pathname' class Pathname include Comparable @__path__ = `require('path')` `var __path__ = #{@__path__}` def absolute? `__path__.isAbsolute(#{@path.to_str})` end def relative? !absolute? end def to_path @path end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/nodejs/tmpdir.rb
stdlib/nodejs/tmpdir.rb
class Dir def self.mktmpdir(prefix_suffix = nil, *_rest, **_options) if `prefix_suffix.$$is_array` prefix = prefix_suffix.join('') elsif `prefix_suffix.$$is_string` prefix = prefix_suffix else prefix = 'd' end path = `#@__fs__.mkdtempSync(prefix)` if block_given? res =...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/date/formatters.rb
stdlib/date/formatters.rb
class Date def self.def_formatter(*args, **kwargs) Time.def_formatter(*args, **kwargs, on: self) end def_formatter :asctime, '%c' alias ctime asctime def_formatter :iso8601, '%F' alias xmlschema iso8601 def_formatter :rfc3339, '%FT%T%:z' def_formatter :rfc2822, '%a, %-d %b %Y %T %z' alias rfc822 ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/date/infinity.rb
stdlib/date/infinity.rb
class Date class Infinity < Numeric include Comparable def initialize(d = 1) @d = d <=> 0 end attr_reader :d def zero? false end def finite? false end def infinite? d.nonzero? end def nan? d.zero? end def abs self.class.new...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/date/date_time.rb
stdlib/date/date_time.rb
# backtick_javascript: true class DateTime < Date class << self def now wrap Time.now end def parse(str) wrap Time.parse(str) end end def initialize(year = -4712, month = 1, day = 1, hours = 0, minutes = 0, seconds = 0, offset = 0, start = ITALY) %x{ // Because of Gregoria...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/rbconfig/sizeof.rb
stdlib/rbconfig/sizeof.rb
# This file is not intended for real checks, # but just to make happy libraries needing it. require_relative '../rbconfig' RbConfig::SIZEOF = { 'clock_t' => 8, 'double _Complex' => 16, 'double' => 8, 'float _Complex' => 8, 'float' => 4, 'int' ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/optparse/version.rb
stdlib/optparse/version.rb
# frozen_string_literal: false # OptionParser internal utility class << OptionParser def show_version(*pkgs) progname = ARGV.options.program_name result = false show = proc do |klass, cname, version| str = progname.to_s unless (klass == ::Object) && (cname == :VERSION) version = versi...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/optparse/time.rb
stdlib/optparse/time.rb
# frozen_string_literal: false require 'optparse' require 'time' OptionParser.accept(Time) do |s,| if s (begin Time.httpdate(s) rescue Time.parse(s) end) end rescue raise OptionParser::InvalidArgument, s end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/optparse/kwargs.rb
stdlib/optparse/kwargs.rb
# frozen_string_literal: true require 'optparse' class OptionParser # :call-seq: # define_by_keywords(options, method, **params) # # :include: ../../doc/optparse/creates_option.rdoc # def define_by_keywords(options, meth, **opts) meth.parameters.each do |type, name| case type when :key, :...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/optparse/uri.rb
stdlib/optparse/uri.rb
# frozen_string_literal: false # -*- ruby -*- require 'optparse' require 'uri' OptionParser.accept(URI) { |s,| URI.parse(s) if s }
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/optparse/shellwords.rb
stdlib/optparse/shellwords.rb
# frozen_string_literal: false # -*- ruby -*- require 'shellwords' require 'optparse' OptionParser.accept(Shellwords) { |s,| Shellwords.shellwords(s) }
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/optparse/date.rb
stdlib/optparse/date.rb
# frozen_string_literal: false require 'optparse' require 'date' OptionParser.accept(DateTime) do |s,| DateTime.parse(s) if s rescue ArgumentError raise OptionParser::InvalidArgument, s end OptionParser.accept(Date) do |s,| Date.parse(s) if s rescue ArgumentError raise OptionParser::InvalidArgument, s end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/optparse/ac.rb
stdlib/optparse/ac.rb
# frozen_string_literal: false require 'optparse' class OptionParser::AC < OptionParser private def _check_ac_args(name, block) unless /\A\w[-\w]*\z/ =~ name raise ArgumentError, name end unless block raise ArgumentError, 'no block given', ParseError.filter_backtrace(caller) end end ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/matrix/eigenvalue_decomposition.rb
stdlib/matrix/eigenvalue_decomposition.rb
# frozen_string_literal: false class Matrix # Adapted from JAMA: http://math.nist.gov/javanumerics/jama/ # Eigenvalues and eigenvectors of a real matrix. # # Computes the eigenvalues and eigenvectors of a matrix A. # # If A is diagonalizable, this provides matrices V and D # such that A = V*D*V.inv, wher...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/matrix/lup_decomposition.rb
stdlib/matrix/lup_decomposition.rb
# frozen_string_literal: false class Matrix # Adapted from JAMA: http://math.nist.gov/javanumerics/jama/ # # For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n # unit lower triangular matrix L, an n-by-n upper triangular matrix U, # and a m-by-m permutation matrix P so that L*U = P*A. # ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/headless_browser/file.rb
stdlib/headless_browser/file.rb
# frozen_string_literal: true # backtick_javascript: true class File def self.write(path, data) # This is only to enable CDP runners to write the benchmark results %x{ var http = new XMLHttpRequest(); http.open("POST", "/File.write"); http.setRequestHeader("Content-Type", "application/json"...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/headless_browser/base.rb
stdlib/headless_browser/base.rb
# backtick_javascript: true %x{ // Inhibit the default exit behavior window.OPAL_EXIT_CODE = "noexit"; Opal.exit = function(code) { // The first call to Opal.exit should save an exit code. // All next invocations must be ignored. // Then we send an event to Chrome CDP Interface that we are finished ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/bigdecimal/util.rb
stdlib/bigdecimal/util.rb
# frozen_string_literal: false # backtick_javascript: true # #-- # bigdecimal/util extends various native classes to provide the #to_d method, # and provides BigDecimal#to_d and BigDecimal#to_digits. #++ require 'bigdecimal' class Integer < Numeric # call-seq: # int.to_d -> bigdecimal # # Returns the val...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/bigdecimal/bignumber.js.rb
stdlib/bigdecimal/bignumber.js.rb
# backtick_javascript: true class BigDecimal < Numeric %x{ var define = function (f) { Opal.const_set(self, 'BigNumber', f()); }; define.amd = true; /* eslint-disable */ /* bignumber.js v2.1.4 https://github.com/MikeMcl/bignumber.js/LICENCE */ !function(e){"use strict";function n(e){function E(e...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/quickjs/io.rb
stdlib/quickjs/io.rb
# backtick_javascript: true %x{ Opal.gvars.stdout.write_proc = function(s) { std.out.printf("%s", s); std.out.flush(); } Opal.gvars.stderr.write_proc = function(s) { std.err.printf("%s", s); std.err.flush(); } Opal.gvars.stdin.read_proc = function(s) { if (std.in.eof()) { return n...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/quickjs/file.rb
stdlib/quickjs/file.rb
class File def self.read(path) %x{ const body = std.loadFile(path); if (body === null) { throw new Error(`Unable to read "${path}"`); } return body; } end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/quickjs/kernel.rb
stdlib/quickjs/kernel.rb
# backtick_javascript: true ARGV = `scriptArgs` `Opal.exit = std.exit`
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/gjs/io.rb
stdlib/gjs/io.rb
# backtick_javascript: true `/* global imports */` # Basic version, appends \n: # $stdout.write_proc = `function(s){print(s)}` # $stderr.write_proc = `function(s){printerr(s)}` # Advanced version: %x{ var GLib = imports.gi.GLib; var ByteArray = imports.byteArray; var stdin = GLib.IOChannel.unix_new(0); var ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/gjs/kernel.rb
stdlib/gjs/kernel.rb
# backtick_javascript: true `/* global ARGV */` ARGV = `ARGV` `Opal.exit = imports.system.exit`
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/bun/file.rb
stdlib/bun/file.rb
require 'nodejs/file'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/bun/base.rb
stdlib/bun/base.rb
`/* global Bun */` module Bun VERSION = `Bun.version` end `Opal.exit = process.exit` ARGV = `process.argv.slice(2)` ARGV.shift if ARGV.first == '--' $stdout.write_proc = ->(string) { `process.stdout.write(string)` } $stderr.write_proc = ->(string) { `process.stderr.write(string)` } `var __fs__ = require('fs')` $...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/racc/parser.rb
stdlib/racc/parser.rb
# Opal port of racc/parser.rb. # # Original license: # # frozen_string_literal: false #-- # $originalId: parser.rb,v 1.8 2006/07/06 11:42:07 aamine Exp $ # # Copyright (c) 1999-2006 Minero Aoki # # This program is free software. # You can distribute/modify this program under the same terms of ruby. # # As a special exc...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/promise/v1.rb
stdlib/promise/v1.rb
require 'promise'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/promise/v2.rb
stdlib/promise/v2.rb
# backtick_javascript: true # {Promise} is used to help structure asynchronous code. # # It is available in the Opal standard library, and can be required in any Opal # application: # # require 'promise/v2' # # ## Basic Usage # # Promises are created and returned as objects with the assumption that they # will eve...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/deno/file.rb
stdlib/deno/file.rb
# backtick_javascript: true `/* global Deno */` require 'corelib/file' %x{ var warnings = {}, errno_codes = #{Errno.constants}; function handle_unsupported_feature(message) { switch (Opal.config.unsupported_features_severity) { case 'error': #{Kernel.raise NotImplementedError, `message`} brea...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/deno/base.rb
stdlib/deno/base.rb
# backtick_javascript: true `/* global Deno */` module Deno VERSION = `Deno.version.deno` end `Opal.exit = Deno.exit` ARGV = `Deno.args.slice(2)` ARGV.shift if ARGV.first == '--' STDOUT.write_proc = ->(string) { `Deno.stdout.write(new TextEncoder().encode(string))` } STDERR.write_proc = ->(string) { `Deno.stderr...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/buffer/array.rb
stdlib/buffer/array.rb
# backtick_javascript: true class Buffer class Array include Native::Wrapper def self.for(bits, type) $$["#{Buffer.name_for bits, type}Array"] end include Enumerable attr_reader :buffer, :type def initialize(buffer, bits = nil, type = nil) if Native == buffer super(buf...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/stdlib/buffer/view.rb
stdlib/buffer/view.rb
# backtick_javascript: true class Buffer class View include Native::Wrapper def self.supported? !$$[:DataView].nil? end attr_reader :buffer, :offset def initialize(buffer, offset = nil, length = nil) if native?(buffer) super(buffer) elsif offset && length supe...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/vendored-minitest/minitest.rb
vendored-minitest/minitest.rb
# 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...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/vendored-minitest/minitest/test.rb
vendored-minitest/minitest/test.rb
# 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::...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/vendored-minitest/minitest/assertions.rb
vendored-minitest/minitest/assertions.rb
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 ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/vendored-minitest/minitest/benchmark.rb
vendored-minitest/minitest/benchmark.rb
# 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...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/vendored-minitest/minitest/expectations.rb
vendored-minitest/minitest/expectations.rb
## # 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 # ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/vendored-minitest/minitest/spec.rb
vendored-minitest/minitest/spec.rb
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...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/vendored-minitest/minitest/autorun.rb
vendored-minitest/minitest/autorun.rb
# begin # require "rubygems" # gem "minitest" # rescue Gem::LoadError # # do nothing # end require "minitest" require "minitest/spec" require "minitest/mock" Minitest.autorun
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/vendored-minitest/minitest/mock.rb
vendored-minitest/minitest/mock.rb
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...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/vendored-minitest/test/unit.rb
vendored-minitest/test/unit.rb
# 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...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
sparklemotion/mechanize
https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/test/test_mechanize_page_link.rb
test/test_mechanize_page_link.rb
# coding: utf-8 # frozen_string_literal: true require 'mechanize/test_case' puts "Nokogiri::VERSION_INFO: #{Nokogiri::VERSION_INFO}" class TestMechanizePageLink < Mechanize::TestCase WINDOWS_1255 = <<-HTML <meta http-equiv="content-type" content="text/html; charset=windows-1255"> <title>hi</title> HTML BAD =...
ruby
MIT
4e192760df6c2311d54e527c2b07a5fa4826c5fb
2026-01-04T15:46:19.932284Z
false
sparklemotion/mechanize
https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/test/test_mechanize_form_check_box.rb
test/test_mechanize_form_check_box.rb
# frozen_string_literal: true require 'mechanize/test_case' class TestMechanizeFormCheckBox < Mechanize::TestCase def setup super @page = @mech.get('http://localhost/tc_checkboxes.html') end def test_search form = @page.forms.first checkbox = form.checkbox_with(name: 'green') assert_equal...
ruby
MIT
4e192760df6c2311d54e527c2b07a5fa4826c5fb
2026-01-04T15:46:19.932284Z
false
sparklemotion/mechanize
https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/test/test_mechanize_cookie_jar.rb
test/test_mechanize_cookie_jar.rb
# frozen_string_literal: true require 'mechanize/test_case' require 'fileutils' class TestMechanizeCookieJar < Mechanize::TestCase def setup super @jar = Mechanize::CookieJar.new @jar.extend Minitest::Assertions def @jar.add(*args) capture_io { super } end def @jar.jar(*args) ...
ruby
MIT
4e192760df6c2311d54e527c2b07a5fa4826c5fb
2026-01-04T15:46:19.932284Z
false
sparklemotion/mechanize
https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/test/test_mechanize_file_saver.rb
test/test_mechanize_file_saver.rb
# frozen_string_literal: true require 'mechanize/test_case' class TestMechanizeFileSaver < Mechanize::TestCase def setup super @uri = URI 'http://example' @io = StringIO.new 'hello world' end def test_initialize in_tmpdir do Mechanize::FileSaver.new @uri, nil, @io, 200 assert File...
ruby
MIT
4e192760df6c2311d54e527c2b07a5fa4826c5fb
2026-01-04T15:46:19.932284Z
false
sparklemotion/mechanize
https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/test/test_mechanize_link.rb
test/test_mechanize_link.rb
# frozen_string_literal: true require 'mechanize/test_case' class TestMechanizeLink < Mechanize::TestCase def test_search page = @mech.get("http://localhost/find_link.html") link = page.link_with(text: "Form Test") assert_equal('Form Test', link.text) link_with_search = page.link_with(search: "//*...
ruby
MIT
4e192760df6c2311d54e527c2b07a5fa4826c5fb
2026-01-04T15:46:19.932284Z
false
sparklemotion/mechanize
https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/test/test_mechanize_parser.rb
test/test_mechanize_parser.rb
# frozen_string_literal: true require 'mechanize/test_case' class TestMechanizeParser < Mechanize::TestCase class P include Mechanize::Parser attr_accessor :filename attr_accessor :response attr_accessor :uri def initialize @uri = URI 'http://example' @full_path = false end e...
ruby
MIT
4e192760df6c2311d54e527c2b07a5fa4826c5fb
2026-01-04T15:46:19.932284Z
false
sparklemotion/mechanize
https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/test/test_mechanize_page_encoding.rb
test/test_mechanize_page_encoding.rb
# -*- coding: utf-8 -*- # frozen_string_literal: true require 'mechanize/test_case' # tests for Page encoding and charset and parsing class TestMechanizePageEncoding < Mechanize::TestCase MECH_ASCII_ENCODING = 'US-ASCII' def setup super @uri = URI('http://localhost/') @response_headers = { 'content...
ruby
MIT
4e192760df6c2311d54e527c2b07a5fa4826c5fb
2026-01-04T15:46:19.932284Z
false