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
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/http_proxy.rb
cli/dinghy/http_proxy.rb
require 'stringio' require 'dinghy/machine' require 'dinghy/constants' class HttpProxy CONTAINER_NAME = "dinghy_http_proxy" IMAGE_NAME = "codekitchen/dinghy-http-proxy:2.6" RESOLVER_DIR = Pathname("/etc/resolver") attr_reader :machine, :resolver_file, :dinghy_domain def initialize(machine, dinghy_domain) ...
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/daemon.rb
cli/dinghy/daemon.rb
require 'fileutils' require 'daemons' module Dinghy module Daemon def up puts starting_message unless root? # remove any old logfile sitting around FileUtils.rm(daemon.output_logfile) if File.file?(daemon.output_logfile) File.open(logfile, 'a') do |log| log.write("=== Starting #{name} at #{Tim...
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/check_env.rb
cli/dinghy/check_env.rb
require 'dinghy/constants' class CheckEnv attr_reader :machine def initialize(machine) @machine = machine end def run if set? puts "\e[32mYour environment variables are already set correctly.\e[0m" else puts "\e[33mTo connect the Docker client to the Docker daemon, please set these en...
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/unfs.rb
cli/dinghy/unfs.rb
require 'forwardable' require 'timeout' require 'socket' require 'dinghy/unfs_root_daemon' class Unfs extend Forwardable attr_reader :machine, :port def_delegators :daemon, :name, :status, :running?, :logfile def initialize(machine, port) @machine = machine @port = port end # We have to jump th...
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/constants.rb
cli/dinghy/constants.rb
require 'pathname' require 'fileutils' MEM_DEFAULT=2048 CPU_DEFAULT=1 DISK_DEFAULT=20_000
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/fsevents_to_vm.rb
cli/dinghy/fsevents_to_vm.rb
require 'dinghy/daemon' class FseventsToVmRunner include Dinghy::Daemon attr_reader :machine def initialize(machine) @machine = machine end def up increase_inotify_limit super end def name "FsEvents" end protected def increase_inotify_limit machine.ssh("echo fs.inotify.max...
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/machine.rb
cli/dinghy/machine.rb
require 'dinghy/constants' require 'json' require 'shellwords' class Machine attr_reader :machine_name alias :name :machine_name def initialize(machine_name) @machine_name = machine_name || 'dinghy' end def create(options = {}) provider = options['provider'] system_print("create", "-d", provid...
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/system.rb
cli/dinghy/system.rb
module System class Failure < ::RuntimeError end def self.system_print(*args) Kernel.system(*args) if self.command_failed? raise(Failure, "Failure calling `#{args.join(' ')}`") end end def self.system(*args) out, err = self.capture_output { Kernel.system(*args) } if self....
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/unfs_root_daemon.rb
cli/dinghy/unfs_root_daemon.rb
require 'dinghy/daemon' class UnfsRootDaemon include Dinghy::Daemon attr_reader :dir, :command def initialize(var_dir, command_args) @dir = var_dir @command = command_args end def name "NFS" end end
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
codekitchen/dinghy
https://github.com/codekitchen/dinghy/blob/4a4dc0d57602c4c4af8d96d095bdba55bb57829c/cli/dinghy/machine/create_options.rb
cli/dinghy/machine/create_options.rb
module Machine::CreateOptions OPTION_NAMES = { 'virtualbox' => { memory: '--virtualbox-memory', cpus: '--virtualbox-cpu-count', disk: '--virtualbox-disk-size', no_share: '--virtualbox-no-share', boot2docker_url: '--virtualbox-boot2docker-url', engine_opt: '--engine-opt' }.f...
ruby
MIT
4a4dc0d57602c4c4af8d96d095bdba55bb57829c
2026-01-04T15:58:05.983041Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/country_spec.rb
spec/country_spec.rb
# frozen_string_literal: true require 'spec_helper' NUM_OF_COUNTRIES = 249 describe ISO3166::Country do before do ISO3166.configuration.locales = %i[en] ISO3166::Data.reset ISO3166.configuration.enable_currency_extension! end let(:country) { ISO3166::Country.search('US') } it 'handles respond_to_...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
true
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/configuration_spec.rb
spec/configuration_spec.rb
# frozen_string_literal: true require 'spec_helper' require 'i18n' describe 'ISO3166.configuration' do it 'has a configuration' do expect(ISO3166.configuration).to be_a ISO3166::Configuration end it 'locales can be changed' do ISO3166.configuration.locales = [:es] ISO3166.configuration.locales << :...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/data_spec.rb
spec/data_spec.rb
# frozen_string_literal: true require 'spec_helper' require 'benchmark' describe ISO3166::Data do it 'responds to call' do data = ISO3166::Data.new('US').call expect(data['translated_names']).to be_a Array end it 'can load selective locales' do # ISO3166::Data.update_cache ISO3166.configuration...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/00_global_spec.rb
spec/00_global_spec.rb
# frozen_string_literal: true describe 'global Country class', custom_order: :first do context "when loaded via 'iso3166' existence" do subject { defined?(Country) } it { is_expected.to be_falsey } end context "when loaded via 'global'" do before { require 'countries/global' } it 'does not pol...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/perf_spec.rb
spec/perf_spec.rb
# frozen_string_literal: true require 'spec_helper' ALL_LOCALES = %i[ af am ar as az be bg bn br bs ca cs cy da de dz el en eo es et eu fa fi fo fr ga gl gu he hi hr hu hy ia id is it ja ka kk km kn ko ku lt lv mi mk ml mn mr ms mt nb ne nl nn oc or pa pl ps pt ro ru rw si sk sl so sq sr sv sw ta te th ti...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/mongoid_spec.rb
spec/mongoid_spec.rb
# frozen_string_literal: true require 'spec_helper' require File.expand_path('../lib/countries/mongoid', __dir__) describe 'Mongoid support' do let(:britain) { ISO3166::Country.new('GB') } context 'instance methods' do describe 'mongoize' do it 'should delegate mongoization to the class method' do ...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/timezone_spec.rb
spec/timezone_spec.rb
# frozen_string_literal: true describe 'timezone Country class' do context "when loaded via 'timezone'" do require 'tzinfo' describe 'existence' do subject { defined?(TZInfo) } it { is_expected.to be_truthy } end describe 'GB' do subject { ISO3166::Country.new('GB') } it 'sh...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/subdivision_spec.rb
spec/subdivision_spec.rb
# frozen_string_literal: true require 'spec_helper' describe ISO3166::Subdivision do before do ISO3166::Data.reset end let(:countries) { ISO3166::Country.all } let(:available_types) { [Hash, NilClass] } describe 'translations' do it 'should be hash or nil' do countries.each do |country| ...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true require 'countries' require 'debug' require 'simplecov' SimpleCov.start RSpec.configure do |config| config.filter_run :focus config.run_all_when_everything_filtered = true config.filter_run_excluding perf: true config.example_status_persistence_file_path = 'spec/examples.txt' ...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/spec/thread_safety_spec.rb
spec/thread_safety_spec.rb
# frozen_string_literal: true describe 'Accessing ISO3166::Country instances data in multiple threads' do before do if Thread.respond_to?(:report_on_exception) @report_on_exception_value = Thread.report_on_exception Thread.report_on_exception = false end ISO3166::Data.reset end def crea...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries.rb
lib/countries.rb
# frozen_string_literal: true require 'countries/version' require 'countries/iso3166' require 'countries/mongoid' if defined?(Mongoid)
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/data.rb
lib/countries/data.rb
# frozen_string_literal: true module ISO3166 # Handles building the in memory store of countries data class Data extend SubdivisionMethods extend LocalesMethods @cache_dir = [File.dirname(__FILE__), 'cache'] @cache = {} @loaded_country_codes = [] @registered_data = {} @mutex = Mutex.ne...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/subdivision.rb
lib/countries/subdivision.rb
# frozen_string_literal: true module ISO3166 class Subdivision attr_accessor :name, :code, :unofficial_names, :geo, :translations, :comments, :type def initialize(attrs) attrs.each_pair do |key,...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/version.rb
lib/countries/version.rb
# frozen_string_literal: true module Countries VERSION = '8.1.0' end
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/iso3166.rb
lib/countries/iso3166.rb
# frozen_string_literal: true require 'yaml' require 'json' require 'countries/configuration' require 'countries/data/locales_methods' require 'countries/data/subdivision_methods' require 'countries/data' require 'countries/structure' require 'countries/translations' require 'countries/country/country_subdivision_met...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/sources.rb
lib/countries/sources.rb
# frozen_string_literal: true require_relative 'sources/local/cached_loader' require_relative 'sources/local/subdivision' require_relative 'sources/cldr/downloader' require_relative 'sources/cldr/subdivision' require_relative 'sources/cldr/subdivision_updater'
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/translations.rb
lib/countries/translations.rb
# frozen_string_literal: true module ISO3166 # Extend the hash class to allow locale lookup fall back behavior # # E.g. if a country has translations for +pt+, and the user looks up +pt-br+ fallback # to +pt+ to prevent from showing nil values # # Also allows "indifferent access" to the hash, so you can us...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/mongoid.rb
lib/countries/mongoid.rb
# frozen_string_literal: true module ISO3166 class Country def mongoize ISO3166::Country.mongoize(self) end class << self # Convert an +ISO3166::Country+ to the data that is stored by Mongoid. # :reek:NilCheck def mongoize(country) if country.is_a?(self) && !country.data....
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/country.rb
lib/countries/country.rb
# frozen_string_literal: true module ISO3166 # :reek:TooManyMethods class Country extend CountryClassMethods extend ConversionMethods extend CountryFinderMethods include Emoji include CountrySubdivisionMethods attr_reader :data ISO3166::DEFAULT_COUNTRY_HASH.each_key do |method_name| ...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/timezones.rb
lib/countries/timezones.rb
# frozen_string_literal: true module ISO3166 # Extend Country class with support for timezones. Requires the {tzinfo}[https://github.com/tzinfo/tzinfo] gem # # gem 'tzinfo' # module TimezoneExtensions # TODO: rename method to tz_country or something similar def timezones @timezones ||= TZInf...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/global.rb
lib/countries/global.rb
# frozen_string_literal: true require 'countries' # Some apps might not want to constantly call +ISO3166::Country+. This gem has a helper that can provide a Country class # # With global Country Helper enabled # # c = Country['US'] # # This will conflict with any existing Country constant # # To Use # # gem 'coun...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/configuration.rb
lib/countries/configuration.rb
# frozen_string_literal: true module ISO3166 class << self attr_writer :configuration end def self.configuration @configuration ||= Configuration.new end def self.reset @configuration = Configuration.new Data.reset end def self.configure yield(configuration) end class Configur...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/structure.rb
lib/countries/structure.rb
# frozen_string_literal: true module ISO3166 DEFAULT_COUNTRY_HASH = { 'address_format' => nil, 'alpha2' => nil, 'alpha3' => nil, 'continent' => nil, 'country_code' => nil, 'currency_code' => nil, 'distance_unit' => nil, 'gec' => nil, 'geo' => { 'latitude' => nil, 'long...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/sources/cldr/subdivision.rb
lib/countries/sources/cldr/subdivision.rb
# frozen_string_literal: true module Sources module CLDR # Auxiliary Subdivision class to support loading Unicode CLDR data to update local files class Subdivision attr_reader :xml, :language_code def initialize(language_code:, xml:) @language_code = language_code @xml = xml ...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/sources/cldr/subdivision_updater.rb
lib/countries/sources/cldr/subdivision_updater.rb
# frozen_string_literal: true require 'active_support' require 'active_support/core_ext/hash/deep_merge' require 'nokogiri' require 'pry' module Sources module CLDR # Updates local subdivision files with data from the Unicode CLDR repository class SubdivisionUpdater def call dirs = Dir['./tmp/...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/sources/cldr/downloader.rb
lib/countries/sources/cldr/downloader.rb
# frozen_string_literal: true require 'uri' require 'net/http' require 'nokogiri' require 'fileutils' require 'json' # Support code to allow updating subdivision data from the Unicode CLDR repository module Sources # Support code to allow updating subdivision data from the Unicode CLDR repository module CLDR ...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/sources/local/subdivision.rb
lib/countries/sources/local/subdivision.rb
# frozen_string_literal: true module Sources module Local # Auxiliary Subdivision class to support loading the local subdivision data to be updated with Unicode CLDR data class Subdivision attr_reader :code def initialize(code) @code = code end def load if File.exist...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/sources/local/cached_loader.rb
lib/countries/sources/local/cached_loader.rb
# frozen_string_literal: true module Sources # Support code to allow updating subdivision data from the Unicode CLDR repository module Local # Loader for locally-cached data, to allow merging Unicode CLDR data with existing local data class CachedLoader attr_reader :klass def initialize(klass)...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/country/class_methods.rb
lib/countries/country/class_methods.rb
# frozen_string_literal: true require 'unaccent' module ISO3166 UNSEARCHABLE_METHODS = [:translations].freeze def self.Country(country_data_or_country) case country_data_or_country when ISO3166::Country country_data_or_country when String, Symbol ISO3166::Country.search(country_data_or_co...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/country/emoji.rb
lib/countries/country/emoji.rb
# frozen_string_literal: true module ISO3166 module Emoji CODE_POINTS = { 'a' => '🇦', 'b' => '🇧', 'c' => '🇨', 'd' => '🇩', 'e' => '🇪', 'f' => '🇫', 'g' => '🇬', 'h' => '🇭', 'i' => '🇮', 'j' => '🇯', 'k' => '🇰', 'l' => '🇱', 'm' =...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/country/currency_methods.rb
lib/countries/country/currency_methods.rb
# frozen_string_literal: true require 'money' module ISO3166 # Optional extension which allows you to get back a +Money::Currency+ object with all the currency info. # This requires enabling the integration with the {Money}[https://github.com/RubyMoney/money] gem (See {ISO3166::Configuration#enable_currency_exten...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/country/conversion_methods.rb
lib/countries/country/conversion_methods.rb
# frozen_string_literal: true module ISO3166 module ConversionMethods # @param alpha2 [String] ISO 3166 alpha-2 country code. # @return [String] ISO 3166 alpha-3 country code. def from_alpha2_to_alpha3(alpha2) find_country_by_alpha2(alpha2)&.alpha3 end # @param alpha3 [String] ISO 3166 alp...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/country/country_subdivision_methods.rb
lib/countries/country/country_subdivision_methods.rb
# frozen_string_literal: true module ISO3166 module CountrySubdivisionMethods # @param subdivision_str [String] A subdivision name or code to search for. Search includes translated subdivision names. # @return [Subdivision] The first subdivision matching the provided string def find_subdivision_by_name(s...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/country/finder_methods.rb
lib/countries/country/finder_methods.rb
# frozen_string_literal: true module ISO3166 module CountryFinderMethods FIND_BY_REGEX = /^find_(all_)?(country_|countries_)?by_(.+)/ SEARCH_TERM_FILTER_REGEX = /\(|\)|\[\]|,/ # :reek:FeatureEnvy def search(query) query = query.to_s if query.is_a?(Symbol) query = query.upcase if query&.m...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/data/subdivision_methods.rb
lib/countries/data/subdivision_methods.rb
# frozen_string_literal: true module ISO3166 module SubdivisionMethods def subdivision_data(alpha2) data = load_data_for_alpha2(alpha2) locales = ISO3166.configuration.locales.map(&:to_s) data.each_value do |subdivision| subdivision['translations'] = subdivision['translations'].slice(*l...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
countries/countries
https://github.com/countries/countries/blob/8c026f5b49da93d7bf484d1c0ff59e14750970b1/lib/countries/data/locales_methods.rb
lib/countries/data/locales_methods.rb
# frozen_string_literal: true module ISO3166 module LocalesMethods private def locales_to_load requested_locales - loaded_locales end def locales_to_remove loaded_locales - requested_locales end # :reek:UtilityFunction def requested_locales ISO3166.configuration.local...
ruby
MIT
8c026f5b49da93d7bf484d1c0ff59e14750970b1
2026-01-04T15:56:34.174554Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/test_helper.rb
test/test_helper.rb
# frozen_string_literal: true require "minitest/autorun" require "minitest/focus" require "minitest/proveit" require "minitest/reporters" Minitest::Reporters.use!(Minitest::Reporters::DefaultReporter.new) require "warning" Warning.process do |msg| # This warning is issued by Zeitwerk itself, ignore it. if msg.in...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/support/on_teardown.rb
test/support/on_teardown.rb
# frozen_string_literal: true module OnTeardown def on_teardown define_singleton_method(:teardown) do yield super() end end end
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/support/test_macro.rb
test/support/test_macro.rb
# frozen_string_literal: true module TestMacro def test(description, &) method_name = "test_#{description}".gsub(/\W/, "_") define_method(method_name, &) end end
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/support/delete_loaded_feature.rb
test/support/delete_loaded_feature.rb
# frozen_string_literal: true module DeleteLoadedFeature def delete_loaded_feature(path) $LOADED_FEATURES.delete_if do |abspath| abspath.end_with?(path) end end end
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/support/loader_test.rb
test/support/loader_test.rb
# frozen_string_literal: true class LoaderTest < Minitest::Test TMP_DIR = File.expand_path("../tmp", __dir__) attr_reader :loader def setup @loader = new_loader(setup: false) end # We enable reloading in the reloaders of the test suite to have a robust # cleanup of constants. # # There are gems ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/support/remove_const.rb
test/support/remove_const.rb
# frozen_string_literal: true module RemoveConst def remove_const(cname, from: Object) from.__send__(:remove_const, cname) end end
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/test_null_inflector.rb
test/lib/test_null_inflector.rb
# frozen_string_literal: true require "test_helper" class TestNullInflector < Minitest::Test def camelize(str) Zeitwerk::NullInflector.new.camelize(str, nil) end test "does not change the basename" do assert_equal "user", camelize("user") end test "preserves case (camel case)" do assert_equal ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/test_cref_map.rb
test/lib/test_cref_map.rb
# frozen_string_literal: true require "test_helper" class TestCrefMap < Minitest::Test def setup @map = Zeitwerk::Cref::Map.new @m = Module.new @cref_mx = Zeitwerk::Cref.new(@m, :X) @cref_my = Zeitwerk::Cref.new(@m, :Y) @n = Module.new @cref_nx = Zeitwerk::Cref.new(@n, :X) @cref_ny = Z...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/test_gem_inflector.rb
test/lib/test_gem_inflector.rb
# frozen_string_literal: true require "test_helper" class TestGemInflector < LoaderTest def with_setup files = [ ["lib/my_gem.rb", <<-EOS], loader = Zeitwerk::Loader.for_gem loader.enable_reloading loader.setup module MyGem end EOS ["lib/my_gem/foo.rb",...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/test_inflector.rb
test/lib/test_inflector.rb
# frozen_string_literal: true require "test_helper" class TestInflector < Minitest::Test def camelize(str) Zeitwerk::Inflector.new.camelize(str, nil) end test "capitalizes the first letter" do assert_equal "User", camelize("user") end test "camelizes snake case basenames" do assert_equal "User...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/test_custom_inflector.rb
test/lib/test_custom_inflector.rb
# frozen_string_literal: true require "test_helper" class TestCustomInflector < LoaderTest test "raises TypeError if the inflector #camelize does not return a string" do with_files([["foo.rb", nil]]) do loader.inflector = Class.new(Zeitwerk::Inflector) do def camelize(_basename, _abspath) ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/test_real_mod_name.rb
test/lib/test_real_mod_name.rb
# frozen_string_literal: true require "test_helper" class TestRealModName < Minitest::Test include Zeitwerk::RealModName test "returns nil for anonymous classes and modules" do [Class.new, Module.new].each do |mod| assert_nil real_mod_name(mod) end end test "returns nil for anonymous classes a...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_exceptions.rb
test/lib/zeitwerk/test_exceptions.rb
# frozen_string_literal: true require "test_helper" class TestExceptions < LoaderTest # We cannot test error.message only because after # # https://github.com/ruby/ruby/commit/e94604966572bb43fc887856d54aa54b8e9f7719 # # error.message includes the line of code that raised. def assert_error_message(messa...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_load_file.rb
test/lib/zeitwerk/test_load_file.rb
require "pathname" require "test_helper" class TestLoadFile < LoaderTest test "loads a top-level file" do files = [["x.rb", "X = 1"]] with_setup(files) do loader.load_file("x.rb") assert required?(files[0]) end end test "loads a top-level file (Pathname)" do files = [["x.rb", "X = 1"...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_multiple_loaders.rb
test/lib/zeitwerk/test_multiple_loaders.rb
# frozen_string_literal: true require "test_helper" class TestMultipleLoaders < LoaderTest test "multiple independent loaders" do files = [ ["lib0/app0.rb", "module App0; end"], ["lib0/app0/foo.rb", "class App0::Foo; end"], ["lib1/app1/foo.rb", "class App1::Foo; end"], ["lib1/app1/foo/ba...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_sti_old_school_workaround.rb
test/lib/zeitwerk/test_sti_old_school_workaround.rb
# frozen_string_literal: true require "test_helper" # Rails applications are expected to preload STIs. Using requires is the old # school way to address this and it is somewhat tricky. Let's have a test to # make sure the circularity works. class TestOldSchoolWorkaroundSTI < LoaderTest def files [ ["a.rb"...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_nested_root_directories.rb
test/lib/zeitwerk/test_nested_root_directories.rb
# frozen_string_literal: true require "test_helper" class TestNestedRootDirectories < LoaderTest test "nested root directories do not autovivify modules" do files = [["concerns/pricing.rb", "module Pricing; end"]] with_setup(files, dirs: %w(. concerns)) do assert_raises(NameError) { Concerns } end...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_cpath_expected_at.rb
test/lib/zeitwerk/test_cpath_expected_at.rb
# frozen_string_literal: true require "pathname" require "test_helper" class TestCpathExpectedAtErrors < LoaderTest test "raises Zeitwerk::Error if the argument does not exist" do with_setup(dirs: ["."]) do error = assert_raises Zeitwerk::Error do loader.cpath_expected_at("does_not_exist.rb") ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_collapse.rb
test/lib/zeitwerk/test_collapse.rb
# frozen_string_literal: true require "test_helper" require "set" class TestCollapse < LoaderTest test "top-level directories can be collapsed" do files = [["collapsed/bar/x.rb", "Bar::X = true"]] with_setup(files) do assert Bar::X end end test "collapsed directories are ignored as namespaces...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_callbacks.rb
test/lib/zeitwerk/test_callbacks.rb
# frozen_string_literal: true require "test_helper" class TestCallbacks < LoaderTest module Namespace; end test "autoloading a file triggers on_file_autoloaded (Object)" do def loader.__on_file_autoloaded(file) if file == File.expand_path("x.rb") $on_file_autoloaded_called = true end ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_unload.rb
test/lib/zeitwerk/test_unload.rb
# frozen_string_literal: true require "test_helper" class TestUnload < LoaderTest module Namespace; end test "unload removes all autoloaded constants (Object)" do files = [ ["user.rb", "class User; end"], ["admin/root.rb", "class Admin::Root; end"] ] with_setup(files) do assert User...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_private_constants.rb
test/lib/zeitwerk/test_private_constants.rb
# frozen_string_literal: true require "test_helper" class TestPrivateConstants < LoaderTest test "lookup rules for relative private constants work as expected" do files = [["m/x.rb", <<~EOS1], ["c.rb", <<~EOS2]] module M X = :X private_constant :X end EOS1 class C i...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_autovivification.rb
test/lib/zeitwerk/test_autovivification.rb
# frozen_string_literal: true require "test_helper" class TestAutovivification < LoaderTest module Namespace; end test "autoloads a simple constant in an autovivified module (Object)" do files = [["admin/x.rb", "Admin::X = true"]] with_setup(files) do assert_kind_of Module, Admin assert Admin...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_for_gem.rb
test/lib/zeitwerk/test_for_gem.rb
# frozen_string_literal: true require "test_helper" require "fileutils" class TestForGem < LoaderTest MY_GEM = ["lib/my_gem.rb", <<~EOS] $for_gem_test_loader = Zeitwerk::Loader.for_gem $for_gem_test_loader.enable_reloading $for_gem_test_loader.setup module MyGem end EOS def with_my_gem(fil...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_explicit_namespace.rb
test/lib/zeitwerk/test_explicit_namespace.rb
# frozen_string_literal: true require "test_helper" class TestExplicitNamespace < LoaderTest module Namespace; end test "explicit namespaces are loaded correctly (directory first, Object)" do files = [ ["hotel.rb", "class Hotel; X = 1; end"], ["hotel/pricing.rb", "class Hotel::Pricing; end"] ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_on_unload.rb
test/lib/zeitwerk/test_on_unload.rb
# frozen_string_literal: true require "test_helper" class TestOnUnload < LoaderTest test "on_unload checks its argument type" do assert_raises(TypeError, "on_unload only accepts strings") do loader.on_unload(:X) {} end assert_raises(TypeError, "on_unload only accepts strings") do loader.on...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_on_load.rb
test/lib/zeitwerk/test_on_load.rb
# frozen_string_literal: true require "test_helper" class TestOnLoad < LoaderTest test "on_load checks its argument type" do assert_raises(TypeError, "on_load only accepts strings") do loader.on_load(:X) {} end assert_raises(TypeError, "on_load only accepts strings") do loader.on_load(Obje...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_reloading.rb
test/lib/zeitwerk/test_reloading.rb
# frozen_string_literal: true require "test_helper" require "fileutils" class TestReloading < LoaderTest module Namespace; end def silence_exceptions_in_threads original_report_on_exception = Thread.report_on_exception Thread.report_on_exception = false yield ensure Thread.report_on_exception =...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_eager_load_namespace.rb
test/lib/zeitwerk/test_eager_load_namespace.rb
require "test_helper" class TestEagerLoadNamespaceWithObjectRootNamespace < LoaderTest test "eager loads everything" do files = [["x.rb", "X = 1"], ["m/x.rb", "M::X = 1"]] with_setup(files) do loader.eager_load_namespace(Object) assert required?(files) end end test "shortcircuits if eag...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_ruby_compatibility.rb
test/lib/zeitwerk/test_ruby_compatibility.rb
# frozen_string_literal: true require "test_helper" require "pathname" class TestRubyCompatibility < LoaderTest # We decorate Kernel#require in lib/zeitwerk/kernel.rb be able to trigger # callbacks, autovivify implicit namespaces, keep track of what has been # autoloaded, and more. test "autoload calls Kernel...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_conflicting_directory.rb
test/lib/zeitwerk/test_conflicting_directory.rb
# frozen_string_literal: true require "test_helper" class TestConflictingDirectory < LoaderTest def dir __dir__ end def parent File.expand_path("..", dir) end def existing_loader @existing_loader ||= new_loader(setup: false) end def loader @loader ||= new_loader(setup: false) end ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_ancestors.rb
test/lib/zeitwerk/test_ancestors.rb
# frozen_string_literal: true require "test_helper" # The following properties are not supported by the classic Rails autoloader. class TestAncestors < LoaderTest test "autoloads a constant from an ancestor" do files = [ ["a.rb", "class A; end"], ["a/x.rb", "class A::X; end"], ["b.rb", "class ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_on_setup.rb
test/lib/zeitwerk/test_on_setup.rb
# frozen_string_literal: true require "test_helper" class TestOnSetup < LoaderTest test "on_setup callbacks are fired on setup, in order" do x = [] loader.on_setup { x << 0 } loader.on_setup { x << 1 } loader.setup assert_equal [0, 1], x end test "on_setup callbacks are fired if setup was ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_eager_load.rb
test/lib/zeitwerk/test_eager_load.rb
# frozen_string_literal: true require "test_helper" require "fileutils" class TestEagerLoad < LoaderTest module Namespace; end test "eager loads independent files (Object)" do loaders = [loader, new_loader(setup: false)] files = [ ["lib0/app0.rb", "module App0; end"], ["lib0/app0/foo.rb", "c...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_ignore.rb
test/lib/zeitwerk/test_ignore.rb
# frozen_string_literal: true require "test_helper" require "set" class TestIgnore < LoaderTest def this_dir @this_dir ||= __dir__ end def this_file @this_file ||= File.expand_path(__FILE__, this_dir) end def ascendant @dir_up ||= File.expand_path("#{this_dir}/../..") end test "ignored ro...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_logging.rb
test/lib/zeitwerk/test_logging.rb
# frozen_string_literal: true require "test_helper" class TestLogging < LoaderTest def setup super loader.logger = method(:print) end def teardown Zeitwerk::Loader.default_logger = nil loader.logger = nil super end def tagged_message(message) "Zeitwerk@#{loader.tag}: #{message}" ...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_eager_load_dir.rb
test/lib/zeitwerk/test_eager_load_dir.rb
# frozen_string_literal: true require "pathname" require "test_helper" class TestEagerLoadDir < LoaderTest test "eager loads all files" do files = [ ["x.rb", "X = 1"], ["y.rb", "Y = 1"], ["m/n/p.rb", "module M::N::P; end"], ["m/n/a.rb", "M::N::A = 1"], ["m/n/p/q/z.rb", "M::N::P::Q:...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_top_level.rb
test/lib/zeitwerk/test_top_level.rb
# frozen_string_literal: true require "test_helper" class TestTopLevel < LoaderTest module Namespace; end test "autoloads a simple constant in a top-level file (Object)" do files = [["x.rb", "X = true"]] with_setup(files) do assert X end end test "autoloads a simple constant in a top-level...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_require_interaction.rb
test/lib/zeitwerk/test_require_interaction.rb
# frozen_string_literal: true require "test_helper" require "pathname" class TestRequireInteraction < LoaderTest def assert_required(str) assert_equal true, require(str) end def assert_not_required(str) assert_equal false, require(str) end test "our decorated require returns true or false as expec...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_unloadable_cpath.rb
test/lib/zeitwerk/test_unloadable_cpath.rb
# frozen_string_literal: true require "test_helper" require "set" class TestUnloadableCpath < LoaderTest test "a loader that has loading nothing, has nothing to unload" do files = [["x.rb", "X = true"]] with_setup(files) do assert_empty loader.unloadable_cpaths assert !loader.unloadable_cpath?("...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_unregister.rb
test/lib/zeitwerk/test_unregister.rb
# frozen_string_literal: true require "test_helper" class TestUnregister < LoaderTest test "unregister removes the loader from internal state" do loader1 = Zeitwerk::Loader.new cref1 = Zeitwerk::Cref.new(Object, :"dummy1") registry = Zeitwerk::Registry registry.loaders.register(loader1) registry...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_shared_namespaces.rb
test/lib/zeitwerk/test_shared_namespaces.rb
# frozen_string_literal: true require "test_helper" class TestSharedNamespaces < LoaderTest test "autoloads from a shared implicit namespace" do on_teardown { remove_const :M } mod = Module.new ::M = mod files = [["m/x.rb", "M::X = true"]] with_setup(files) do assert M::X loader.re...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_all_expected_cpaths.rb
test/lib/zeitwerk/test_all_expected_cpaths.rb
# frozen_string_literal: true require "test_helper" class TestAllExpectedCpaths < LoaderTest module Namespace def self.name "overridden" end end test "returns an empty hash if there are no root directories" do with_setup do expected_cpaths({}) end end test "honors a real root m...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_push_dir.rb
test/lib/zeitwerk/test_push_dir.rb
# frozen_string_literal: true require "test_helper" require "pathname" class TesPushDir < LoaderTest module Namespace; end def check_dirs roots = loader.__roots non_ignored_roots = roots.reject { |dir, _| loader.send(:ignored_path?, dir) } dirs = loader.dirs assert_equal non_ignored_roots.keys,...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_cref.rb
test/lib/zeitwerk/test_cref.rb
# frozen_string_literal: true require "test_helper" class TestCref < LoaderTest def klass self.class end def new_cref(mod = klass, cname = :Foo) Zeitwerk::Cref.new(mod, cname) end test "#cname" do assert_equal :Foo, new_cref.cname end test "#path for Object" do assert_equal "Foo", new...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_all_dirs.rb
test/lib/zeitwerk/test_all_dirs.rb
# frozen_string_literal: true require "test_helper" class TestAllDirs < LoaderTest test "returns an empty array if no loaders are instantiated" do assert_empty Zeitwerk::Loader.all_dirs end test "returns an empty array if there are loaders but they have no root dirs" do 2.times { new_loader } asser...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_marshal.rb
test/lib/zeitwerk/test_marshal.rb
# frozen_string_literal: true require "test_helper" class TestMarshal < LoaderTest test "Marshal.load autoloads a top-level class" do files = [["c.rb", "class C; end"]] with_setup(files) do str = Marshal.dump(C.new) loader.reload assert_instance_of C, Marshal.load(str) end end tes...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_utf8.rb
test/lib/zeitwerk/test_utf8.rb
# frozen_string_literal: true require "test_helper" class TestUTF8 < LoaderTest # In CI, the codepage for the Windows file system for Ruby 2.5, 2.6, and 2.7 # is Windows-1252, and UTF-8 for Ruby >= 3.0. In Ubuntu, the file system is # encoded in UTF-8 for all supported Ruby versions. if Encoding::UTF_8 == Enc...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_for_gem_extension.rb
test/lib/zeitwerk/test_for_gem_extension.rb
# frozen_string_literal: true require "test_helper" class TestForGemExtension < LoaderTest ROOT_DIR = "lib/test_for_gem_extension" MY_GEM_EXTENSION = ["#{ROOT_DIR}/my_gem_extension.rb", <<~EOS] $for_gem_extension_test_loader = Zeitwerk::Loader.for_gem_extension(#{self}) $for_gem_extension_test_loader.enab...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/test/lib/zeitwerk/test_shadowed_files.rb
test/lib/zeitwerk/test_shadowed_files.rb
# frozen_string_literal: true require "test_helper" class TestShadowedFiles < LoaderTest test "does not autoload from a file shadowed by an existing constant" do on_teardown { remove_const :X } ::X = 1 files = [["x.rb", "X = 2"]] with_setup(files) do assert loader.__shadowed_file?(File.expan...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/lib/zeitwerk.rb
lib/zeitwerk.rb
# frozen_string_literal: true module Zeitwerk require_relative "zeitwerk/real_mod_name" require_relative "zeitwerk/internal" require_relative "zeitwerk/cref" require_relative "zeitwerk/loader" require_relative "zeitwerk/gem_loader" require_relative "zeitwerk/registry" require_relative "zeitwerk/inflector...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/lib/zeitwerk/gem_inflector.rb
lib/zeitwerk/gem_inflector.rb
# frozen_string_literal: true module Zeitwerk class GemInflector < Inflector #: (String) -> void def initialize(root_file) namespace = File.basename(root_file, ".rb") root_dir = File.dirname(root_file) @version_file = File.join(root_dir, namespace, "version.rb") end #: (St...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/lib/zeitwerk/version.rb
lib/zeitwerk/version.rb
# frozen_string_literal: true module Zeitwerk #: String VERSION = "2.7.4" end
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false
fxn/zeitwerk
https://github.com/fxn/zeitwerk/blob/f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9/lib/zeitwerk/inflector.rb
lib/zeitwerk/inflector.rb
# frozen_string_literal: true module Zeitwerk class Inflector # Very basic snake case -> camel case conversion. # # inflector = Zeitwerk::Inflector.new # inflector.camelize("post", ...) # => "Post" # inflector.camelize("users_controller", ...) # => "UsersController" # infl...
ruby
MIT
f66f8d2baad1ebc03e8d999254276f7f3e7d3dd9
2026-01-04T15:58:18.390796Z
false