add HasAuxTable

This commit is contained in:
Dylan Knutson
2025-07-18 05:57:35 +00:00
parent c27b0c952d
commit e67eb94e44
30 changed files with 3750 additions and 455 deletions

View File

@@ -9,13 +9,13 @@ RUN \
cmake
WORKDIR /usr/src/app
RUN gem install bundler -v '2.5.6'
RUN gem install bundler -v '2.6.2'
COPY gems gems
WORKDIR /usr/src/app/gems/xdiff-rb
RUN bundle _2.5.6_ install
RUN bundle install
RUN rake compile
WORKDIR /usr/src/app/gems/rb-bsdiff
RUN bundle _2.5.6_ install
RUN bundle install
RUN rake compile
# Primary image
@@ -69,7 +69,9 @@ COPY --from=native-gems /usr/src/app/gems/rb-bsdiff /gems/rb-bsdiff
WORKDIR /usr/src/app
COPY Gemfile Gemfile.lock ./
RUN bundle _2.5.6_ install
RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
RUN bundle config --local frozen 1
RUN --mount=type=ssh bundle install
# install js dependencies
COPY package.json yarn.lock ./

View File

@@ -5,6 +5,9 @@ ruby "~> 3.2"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.2"
gem "has_aux_table",
git: "ssh://git@git.dy.mk:2221/dymk/has_aux_table.git",
branch: "main"
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

View File

@@ -34,6 +34,16 @@ PATH
specs:
xdiff (0.0.1)
GIT
remote: ssh://git@git.dy.mk:2221/dymk/has_aux_table.git
revision: 40fca92530bae65fa2092b1e4174ee955de5ce15
branch: main
specs:
has_aux_table (0.1.0)
activerecord (>= 7.0)
activesupport (>= 7.0)
sorbet-runtime (~> 0.5)
GEM
remote: https://rubygems.org/
specs:
@@ -112,10 +122,10 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
attr_json (2.5.0)
activerecord (>= 6.0.0, < 8.1)
base64 (0.2.0)
base64 (0.3.0)
bcrypt (3.1.20)
benchmark (0.4.0)
bigdecimal (3.1.9)
benchmark (0.4.1)
bigdecimal (3.2.2)
bindex (0.8.1)
binding_of_caller (1.0.1)
debug_inspector (>= 1.2.0)
@@ -144,7 +154,7 @@ GEM
concurrent-ruby (~> 1.3)
concurrent-ruby-ext (1.3.4)
concurrent-ruby (= 1.3.4)
connection_pool (2.4.1)
connection_pool (2.5.3)
crass (1.0.6)
cssbundling-rails (1.4.1)
railties (>= 6.0.0)
@@ -178,7 +188,7 @@ GEM
nokogiri (~> 1.13, >= 1.13.0)
rubyzip (~> 2.0)
domain_name (0.6.20240107)
drb (2.2.1)
drb (2.2.3)
enumerable-statistics (2.0.8)
erubi (1.13.1)
et-orbi (1.2.11)
@@ -235,7 +245,7 @@ GEM
http-cookie (1.0.8)
domain_name (~> 0.5)
http-form_data (2.3.0)
i18n (1.14.6)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-console (0.8.0)
irb (1.14.3)
@@ -266,7 +276,7 @@ GEM
llhttp-ffi (0.5.0)
ffi-compiler (~> 1.0)
rake (~> 13.0)
logger (1.6.4)
logger (1.7.0)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
@@ -280,7 +290,7 @@ GEM
memory_profiler (1.1.0)
method_source (1.1.0)
mini_mime (1.1.5)
minitest (5.25.4)
minitest (5.25.5)
mmh3 (1.2.0)
msgpack (1.7.5)
multi_json (1.15.0)
@@ -692,6 +702,7 @@ DEPENDENCIES
faiss
ffmpeg!
good_job (~> 4.6)
has_aux_table!
htmlbeautifier
http (~> 5.2)
http-cookie

View File

@@ -208,7 +208,7 @@ class Domain::Inkbunny::Job::UpdatePostsJob < Domain::Inkbunny::Job::Base
# pagecount.
file ||=
post.files.create do |file|
md5_initial.present? ? file.state_ok! : file.state_terminal_error!
file.state = md5_initial.present? ? "ok" : "terminal_error"
file.ib_id = ib_file_id
file.ib_created_at = Time.zone.parse(file_json["create_datetime"])
file.file_order = file_json["submission_file_order"]&.to_i

View File

@@ -82,6 +82,11 @@ class Domain::E621::TagUtil
e621_post.sources_array = post_json["sources"]
e621_post.tags_array = post_json["tags"]
begin
file.save!
rescue StandardError
puts "error saving file"
end
e621_post
end

View File

@@ -133,7 +133,6 @@ class Tasks::Fa::BackfillFavsAndDatesTask < Tasks::InterruptableTask
log(
"error handling log entry #{hle.id} / #{hle.uri_path}: #{e.message}",
)
binding.pry
ensure
break if interrupted?
end

View File

@@ -90,7 +90,8 @@ module ActiveRecord::Calculations
sig { params(field: T.untyped).returns(T.untyped) }
def aggregate_column(field)
return super(field) if field == :all
field = field.to_s if field.is_a?(Symbol) || field.frozen?
field = field.to_s if field.is_a?(Symbol)
field = field.dup if field.frozen?
field.instance_variable_set(:"@_is_order_field", true)
ret = super(field)
field.instance_variable_set(:"@_is_order_field", nil)

View File

@@ -1,6 +1,7 @@
# typed: strict
class Domain::PostFile < ReduxApplicationRecord
include AttrJsonRecordAliases
include HasAuxTable
self.table_name = "domain_post_files"
belongs_to :post,
@@ -24,12 +25,6 @@ class Domain::PostFile < ReduxApplicationRecord
dependent: :destroy,
inverse_of: :post_file
attr_json :state, :string
attr_json :url_str, :string
attr_json :error_message, :string
attr_json :last_status_code, :integer
attr_json :retry_count, :integer
scope :for_post_type,
->(post_klass) do
post_klass = T.cast(post_klass, T.class_of(Domain::Post))

View File

@@ -1,13 +1,16 @@
# typed: strict
class Domain::PostFile::InkbunnyPostFile < Domain::PostFile
attr_json :ib_id, :integer
attr_json :ib_detail_raw, ActiveModel::Type::Value.new
attr_json :ib_created_at, ActiveModelUtcTimeValue.new
attr_json :file_name, :string
attr_json :md5_initial, :string
attr_json :md5_full, :string
attr_json :md5s, ActiveModel::Type::Value.new
attr_json :file_order, :integer
# attr_json :ib_id, :integer
# attr_json :ib_detail_raw, ActiveModel::Type::Value.new
# attr_json :ib_created_at, ActiveModelUtcTimeValue.new
# attr_json :file_name, :string
# attr_json :md5_initial, :string
# attr_json :md5_full, :string
# attr_json :md5s, ActiveModel::Type::Value.new
# attr_json :file_order, :integer
aux_table :inkbunny
validates :ib_id, presence: true, uniqueness: true
sig { returns(Integer) }
def retry_count

View File

@@ -144,11 +144,7 @@ class Domain::PostFile::Thumbnail < ReduxApplicationRecord
media.write_frame_thumbnail(frame, thumb_file_path, options)
end
begin
thumbnail.save!
rescue StandardError
binding.pry
end
thumbnail.save!
thumbnails << thumbnail
end
end

View File

@@ -0,0 +1,43 @@
class MigratePostFilesToHasAuxTable < ActiveRecord::Migration[7.2]
def change
mirai_tablespace!
create_aux_table :domain_post_files, :inkbunny do |t|
t.integer :ib_id, index: true
t.jsonb :ib_detail_raw, default: {}
t.integer :file_order
t.datetime :ib_created_at
t.string :file_name
t.string :md5_initial
t.string :md5_full
t.jsonb :md5s, default: []
end
# `ib_created_at` string is in format like `2019-10-11T16:57:19.945Z` - aka iso8601 zulu time
# so we need to convert it to utc time
up_only { execute <<-SQL }
INSERT INTO domain_post_files_inkbunny_aux (
base_table_id,
ib_id,
ib_detail_raw,
file_order, ib_created_at,
file_name,
md5_initial,
md5_full,
md5s
)
SELECT
id as base_table_id,
(json_attributes->>'ib_id')::integer as ib_id,
(json_attributes->>'ib_detail_raw')::jsonb as ib_detail_raw,
(json_attributes->>'file_order')::integer as file_order,
(json_attributes->>'ib_created_at')::timestamp as ib_created_at,
(json_attributes->>'file_name')::text as file_name,
(json_attributes->>'md5_initial')::text as md5_initial,
(json_attributes->>'md5_full')::text as md5_full,
(json_attributes->>'md5s')::jsonb as md5s
FROM domain_post_files
WHERE type = 'Domain::PostFile::InkbunnyPostFile'
SQL
end
end

View File

@@ -0,0 +1,22 @@
class AddColumnsToPostFiles < ActiveRecord::Migration[7.2]
def change
change_table :domain_post_files do |t|
t.string :state
t.string :url_str
t.string :error_message
t.integer :last_status_code
t.integer :retry_count, default: 0
end
up_only { execute <<-SQL }
UPDATE domain_post_files
SET state = json_attributes->>'state',
url_str = json_attributes->>'url_str',
error_message = json_attributes->>'error_message',
last_status_code = (json_attributes->>'last_status_code')::integer,
retry_count = COALESCE((json_attributes->>'retry_count')::integer, 0)
SQL
change_column_null :domain_post_files, :state, false
end
end

View File

@@ -2823,7 +2823,12 @@ CREATE TABLE public.domain_post_files (
blob_sha256 bytea,
json_attributes jsonb DEFAULT '{}'::jsonb,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
updated_at timestamp(6) without time zone NOT NULL,
state character varying NOT NULL,
url_str character varying,
error_message character varying,
last_status_code integer,
retry_count integer DEFAULT 0
);
@@ -2846,6 +2851,42 @@ CREATE SEQUENCE public.domain_post_files_id_seq
ALTER SEQUENCE public.domain_post_files_id_seq OWNED BY public.domain_post_files.id;
--
-- Name: domain_post_files_inkbunny_aux; Type: TABLE; Schema: public; Owner: -; Tablespace: mirai
--
CREATE TABLE public.domain_post_files_inkbunny_aux (
base_table_id bigint NOT NULL,
ib_id integer,
ib_detail_raw jsonb DEFAULT '{}'::jsonb,
file_order integer,
ib_created_at timestamp(6) without time zone,
file_name character varying,
md5_initial character varying,
md5_full character varying,
md5s jsonb DEFAULT '[]'::jsonb
);
--
-- Name: domain_post_files_inkbunny_aux_base_table_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.domain_post_files_inkbunny_aux_base_table_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: domain_post_files_inkbunny_aux_base_table_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.domain_post_files_inkbunny_aux_base_table_id_seq OWNED BY public.domain_post_files_inkbunny_aux.base_table_id;
--
-- Name: domain_post_group_joins; Type: TABLE; Schema: public; Owner: -; Tablespace: mirai
--
@@ -4824,6 +4865,13 @@ ALTER TABLE ONLY public.domain_post_file_thumbnails ALTER COLUMN id SET DEFAULT
ALTER TABLE ONLY public.domain_post_files ALTER COLUMN id SET DEFAULT nextval('public.domain_post_files_id_seq'::regclass);
--
-- Name: domain_post_files_inkbunny_aux base_table_id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.domain_post_files_inkbunny_aux ALTER COLUMN base_table_id SET DEFAULT nextval('public.domain_post_files_inkbunny_aux_base_table_id_seq'::regclass);
--
-- Name: domain_post_groups id; Type: DEFAULT; Schema: public; Owner: -
--
@@ -5639,6 +5687,14 @@ ALTER TABLE ONLY public.domain_post_file_thumbnails
SET default_tablespace = mirai;
--
-- Name: domain_post_files_inkbunny_aux domain_post_files_inkbunny_aux_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: mirai
--
ALTER TABLE ONLY public.domain_post_files_inkbunny_aux
ADD CONSTRAINT domain_post_files_inkbunny_aux_pkey PRIMARY KEY (base_table_id);
--
-- Name: domain_post_files domain_post_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: mirai
--
@@ -7379,6 +7435,20 @@ CREATE INDEX index_domain_post_file_bit_fingerprints_on_fingerprint_value ON pub
SET default_tablespace = mirai;
--
-- Name: index_domain_post_files_inkbunny_aux_on_base_table_id; Type: INDEX; Schema: public; Owner: -; Tablespace: mirai
--
CREATE INDEX index_domain_post_files_inkbunny_aux_on_base_table_id ON public.domain_post_files_inkbunny_aux USING btree (base_table_id);
--
-- Name: index_domain_post_files_inkbunny_aux_on_ib_id; Type: INDEX; Schema: public; Owner: -; Tablespace: mirai
--
CREATE INDEX index_domain_post_files_inkbunny_aux_on_ib_id ON public.domain_post_files_inkbunny_aux USING btree (ib_id);
--
-- Name: index_domain_post_files_on_blob_sha256; Type: INDEX; Schema: public; Owner: -; Tablespace: mirai
--
@@ -9138,6 +9208,14 @@ ALTER TABLE ONLY public.domain_user_user_follows
ADD CONSTRAINT fk_rails_b45e6e3979 FOREIGN KEY (to_id) REFERENCES public.domain_users(id);
--
-- Name: domain_post_files_inkbunny_aux fk_rails_b4f96e5241; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.domain_post_files_inkbunny_aux
ADD CONSTRAINT fk_rails_b4f96e5241 FOREIGN KEY (base_table_id) REFERENCES public.domain_post_files(id);
--
-- Name: domain_inkbunny_posts fk_rails_c2d9f4b382; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@@ -9273,6 +9351,8 @@ ALTER TABLE ONLY public.domain_twitter_tweets
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
('20250717204152'),
('20250716164417'),
('20250711014943'),
('20250710204708'),
('20250709235107'),

View File

@@ -110,13 +110,13 @@ class ActionController::Parameters
sig { params(key: T.any(String, Symbol)).returns(T.untyped) }
def [](key); end
sig { params(key: T.any(String, Symbol)).returns(ActionController::Parameters) }
sig { params(key: T::Array[T.any(String, Symbol)]).returns(T::Array[ActionController::Parameters]) }
sig { params(key: T.any(String, Symbol)).returns(T.untyped) }
sig { params(key: T::Array[T.any(String, Symbol)]).returns(T::Array[T.untyped]) }
def require(key); end
# required is an alias of require
sig { params(key: T.any(String, Symbol)).returns(ActionController::Parameters) }
sig { params(key: T::Array[T.any(String, Symbol)]).returns(T::Array[ActionController::Parameters]) }
sig { params(key: T.any(String, Symbol)).returns(T.untyped) }
sig { params(key: T::Array[T.any(String, Symbol)]).returns(T::Array[T.untyped]) }
def required(key); end
sig { params(other_hash: T.untyped).returns(ActionController::Parameters) }

View File

@@ -193,6 +193,12 @@ class DateTime
def present?; end
end
module Enumerable
# @version >= 7.0.0
sig { returns(Elem) }
def sole; end
end
class NilClass
sig { returns(TrueClass) }
def blank?; end
@@ -455,3 +461,8 @@ class ActiveSupport::ErrorReporter
sig { params(error: T.any(Exception, String), severity: T.nilable(Symbol), context: T::Hash[Symbol, T.untyped], source: T.nilable(String)).void }
def unexpected(error, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end
end
module ActiveSupport::Testing::Assertions
sig { type_parameters(:Block).params(block: T.proc.returns(T.type_parameter(:Block))).returns(T.type_parameter(:Block)) }
def assert_nothing_raised(&block); end
end

View File

@@ -21,27 +21,6 @@ class Domain::PostFile
def to_ary; end
class << self
sig do
params(
name: Symbol,
type: T.any(Symbol, ActiveModel::Type::Value),
options: T.nilable(T::Hash[Symbol, T.untyped])
).void
end
def attr_json(name, type, options = nil); end
sig do
params(
default_container_attribute: T.nilable(Symbol),
bad_cast: T.nilable(Symbol),
unknown_key: T.nilable(Symbol)
).void
end
def attr_json_config(default_container_attribute: nil, bad_cast: nil, unknown_key: nil); end
sig { returns(T::Array[Symbol]) }
def attr_json_registry; end
sig { returns(ColorLogger) }
def logger; end

View File

@@ -21,27 +21,6 @@ class Domain::PostFile::InkbunnyPostFile
def to_ary; end
class << self
sig do
params(
name: Symbol,
type: T.any(Symbol, ActiveModel::Type::Value),
options: T.nilable(T::Hash[Symbol, T.untyped])
).void
end
def attr_json(name, type, options = nil); end
sig do
params(
default_container_attribute: T.nilable(Symbol),
bad_cast: T.nilable(Symbol),
unknown_key: T.nilable(Symbol)
).void
end
def attr_json_config(default_container_attribute: nil, bad_cast: nil, unknown_key: nil); end
sig { returns(T::Array[Symbol]) }
def attr_json_registry; end
sig { returns(ColorLogger) }
def logger; end
@@ -477,6 +456,9 @@ class Domain::PostFile::InkbunnyPostFile
sig { params(args: T.untyped, blk: T.untyped).returns(::BlobFile) }
def build_blob(*args, &blk); end
sig { params(args: T.untyped, blk: T.untyped).returns(::DomainPostFilesInkbunnyAux) }
def build_domain_post_files_inkbunny_aux(*args, &blk); end
sig { params(args: T.untyped, blk: T.untyped).returns(::HttpLogEntry) }
def build_log_entry(*args, &blk); end
@@ -489,6 +471,12 @@ class Domain::PostFile::InkbunnyPostFile
sig { params(args: T.untyped, blk: T.untyped).returns(::BlobFile) }
def create_blob!(*args, &blk); end
sig { params(args: T.untyped, blk: T.untyped).returns(::DomainPostFilesInkbunnyAux) }
def create_domain_post_files_inkbunny_aux(*args, &blk); end
sig { params(args: T.untyped, blk: T.untyped).returns(::DomainPostFilesInkbunnyAux) }
def create_domain_post_files_inkbunny_aux!(*args, &blk); end
sig { params(args: T.untyped, blk: T.untyped).returns(::HttpLogEntry) }
def create_log_entry(*args, &blk); end
@@ -501,6 +489,12 @@ class Domain::PostFile::InkbunnyPostFile
sig { params(args: T.untyped, blk: T.untyped).returns(::Domain::Post) }
def create_post!(*args, &blk); end
sig { returns(T.nilable(::DomainPostFilesInkbunnyAux)) }
def domain_post_files_inkbunny_aux; end
sig { params(value: T.nilable(::DomainPostFilesInkbunnyAux)).void }
def domain_post_files_inkbunny_aux=(value); end
sig { returns(T.nilable(::HttpLogEntry)) }
def log_entry; end
@@ -516,6 +510,9 @@ class Domain::PostFile::InkbunnyPostFile
sig { returns(T.nilable(::BlobFile)) }
def reload_blob; end
sig { returns(T.nilable(::DomainPostFilesInkbunnyAux)) }
def reload_domain_post_files_inkbunny_aux; end
sig { returns(T.nilable(::HttpLogEntry)) }
def reload_log_entry; end
@@ -525,6 +522,9 @@ class Domain::PostFile::InkbunnyPostFile
sig { void }
def reset_blob; end
sig { void }
def reset_domain_post_files_inkbunny_aux; end
sig { void }
def reset_log_entry; end
@@ -989,16 +989,16 @@ class Domain::PostFile::InkbunnyPostFile
sig { void }
def file_order_will_change!; end
sig { returns(T.nilable(::Time)) }
sig { returns(T.nilable(::ActiveSupport::TimeWithZone)) }
def ib_created_at; end
sig { params(value: T.nilable(::Time)).returns(T.nilable(::Time)) }
sig { params(value: T.nilable(::ActiveSupport::TimeWithZone)).returns(T.nilable(::ActiveSupport::TimeWithZone)) }
def ib_created_at=(value); end
sig { returns(T::Boolean) }
def ib_created_at?; end
sig { returns(T.nilable(::Time)) }
sig { returns(T.nilable(::ActiveSupport::TimeWithZone)) }
def ib_created_at_before_last_save; end
sig { returns(T.untyped) }
@@ -1007,28 +1007,38 @@ class Domain::PostFile::InkbunnyPostFile
sig { returns(T::Boolean) }
def ib_created_at_came_from_user?; end
sig { returns(T.nilable([T.nilable(::Time), T.nilable(::Time)])) }
sig { returns(T.nilable([T.nilable(::ActiveSupport::TimeWithZone), T.nilable(::ActiveSupport::TimeWithZone)])) }
def ib_created_at_change; end
sig { returns(T.nilable([T.nilable(::Time), T.nilable(::Time)])) }
sig { returns(T.nilable([T.nilable(::ActiveSupport::TimeWithZone), T.nilable(::ActiveSupport::TimeWithZone)])) }
def ib_created_at_change_to_be_saved; end
sig { params(from: T.nilable(::Time), to: T.nilable(::Time)).returns(T::Boolean) }
sig do
params(
from: T.nilable(::ActiveSupport::TimeWithZone),
to: T.nilable(::ActiveSupport::TimeWithZone)
).returns(T::Boolean)
end
def ib_created_at_changed?(from: T.unsafe(nil), to: T.unsafe(nil)); end
sig { returns(T.nilable(::Time)) }
sig { returns(T.nilable(::ActiveSupport::TimeWithZone)) }
def ib_created_at_in_database; end
sig { returns(T.nilable([T.nilable(::Time), T.nilable(::Time)])) }
sig { returns(T.nilable([T.nilable(::ActiveSupport::TimeWithZone), T.nilable(::ActiveSupport::TimeWithZone)])) }
def ib_created_at_previous_change; end
sig { params(from: T.nilable(::Time), to: T.nilable(::Time)).returns(T::Boolean) }
sig do
params(
from: T.nilable(::ActiveSupport::TimeWithZone),
to: T.nilable(::ActiveSupport::TimeWithZone)
).returns(T::Boolean)
end
def ib_created_at_previously_changed?(from: T.unsafe(nil), to: T.unsafe(nil)); end
sig { returns(T.nilable(::Time)) }
sig { returns(T.nilable(::ActiveSupport::TimeWithZone)) }
def ib_created_at_previously_was; end
sig { returns(T.nilable(::Time)) }
sig { returns(T.nilable(::ActiveSupport::TimeWithZone)) }
def ib_created_at_was; end
sig { void }
@@ -1670,7 +1680,7 @@ class Domain::PostFile::InkbunnyPostFile
sig { returns(T::Boolean) }
def saved_change_to_file_order?; end
sig { returns(T.nilable([T.nilable(::Time), T.nilable(::Time)])) }
sig { returns(T.nilable([T.nilable(::ActiveSupport::TimeWithZone), T.nilable(::ActiveSupport::TimeWithZone)])) }
def saved_change_to_ib_created_at; end
sig { returns(T::Boolean) }

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
# typed: strict
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `base64` gem.
@@ -7,7 +7,7 @@
# \Module \Base64 provides methods for:
#
# - Encoding a binary string (containing non-ASCII characters)
# - \Encoding a binary string (containing non-ASCII characters)
# as a string of printable ASCII characters.
# - Decoding such an encoded string.
#
@@ -32,7 +32,7 @@
#
# require 'base64'
#
# == Encoding Character Sets
# == \Encoding Character Sets
#
# A \Base64-encoded string consists only of characters from a 64-character set:
#
@@ -145,7 +145,7 @@
# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567"
# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError
#
# \Method Base64.urlsafe_decode64 allows padding in +str+,
# \Method Base64.urlsafe_decode64 allows padding in the encoded string,
# which if present, must be correct:
# see {Padding}[Base64.html#module-Base64-label-Padding], above:
#
@@ -190,28 +190,34 @@
module Base64
private
# :call-seq:
# Base64.decode(encoded_string) -> decoded_string
#
# Returns a string containing the decoding of an RFC-2045-compliant
# \Base64-encoded string +str+:
# \Base64-encoded string +encoded_string+:
#
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
# Base64.decode64(s) # => "This is line 1\nThis is line 2\n"
#
# Non-\Base64 characters in +str+ are ignored;
# Non-\Base64 characters in +encoded_string+ are ignored;
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
# these include newline characters and characters <tt>-</tt> and <tt>/</tt>:
#
# Base64.decode64("\x00\n-_") # => ""
#
# Padding in +str+ (even if incorrect) is ignored:
# Padding in +encoded_string+ (even if incorrect) is ignored:
#
# Base64.decode64("MDEyMzQ1Njc") # => "01234567"
# Base64.decode64("MDEyMzQ1Njc=") # => "01234567"
# Base64.decode64("MDEyMzQ1Njc==") # => "01234567"
#
# source://base64//lib/base64.rb#241
# source://base64//lib/base64.rb#247
def decode64(str); end
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +bin+.
# :call-seq:
# Base64.encode64(string) -> encoded_string
#
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +string+.
#
# Per RFC 2045, the returned string may contain the URL-unsafe characters
# <tt>+</tt> or <tt>/</tt>;
@@ -240,16 +246,19 @@ module Base64
# s = "This is line 1\nThis is line 2\n"
# Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
#
# source://base64//lib/base64.rb#219
# source://base64//lib/base64.rb#222
def encode64(bin); end
# :call-seq:
# Base64.strict_decode64(encoded_string) -> decoded_string
#
# Returns a string containing the decoding of an RFC-2045-compliant
# \Base64-encoded string +str+:
# \Base64-encoded string +encoded_string+:
#
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
# Base64.strict_decode64(s) # => "This is line 1\nThis is line 2\n"
#
# Non-\Base64 characters in +str+ not allowed;
# Non-\Base64 characters in +encoded_string+ are not allowed;
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
# these include newline characters and characters <tt>-</tt> and <tt>/</tt>:
#
@@ -257,16 +266,19 @@ module Base64
# Base64.strict_decode64('-') # Raises ArgumentError
# Base64.strict_decode64('_') # Raises ArgumentError
#
# Padding in +str+, if present, must be correct:
# Padding in +encoded_string+, if present, must be correct:
#
# Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError
# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567"
# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError
#
# source://base64//lib/base64.rb#297
# source://base64//lib/base64.rb#309
def strict_decode64(str); end
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +bin+.
# :call-seq:
# Base64.strict_encode64(string) -> encoded_string
#
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +string+.
#
# Per RFC 2045, the returned string may contain the URL-unsafe characters
# <tt>+</tt> or <tt>/</tt>;
@@ -294,29 +306,35 @@ module Base64
# s = "This is line 1\nThis is line 2\n"
# Base64.strict_encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
#
# source://base64//lib/base64.rb#273
# source://base64//lib/base64.rb#282
def strict_encode64(bin); end
# Returns the decoding of an RFC-4648-compliant \Base64-encoded string +str+:
# :call-seq:
# Base64.urlsafe_decode64(encoded_string) -> decoded_string
#
# +str+ may not contain non-Base64 characters;
# Returns the decoding of an RFC-4648-compliant \Base64-encoded string +encoded_string+:
#
# +encoded_string+ may not contain non-Base64 characters;
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
#
# Base64.urlsafe_decode64('+') # Raises ArgumentError.
# Base64.urlsafe_decode64('/') # Raises ArgumentError.
# Base64.urlsafe_decode64("\n") # Raises ArgumentError.
#
# Padding in +str+, if present, must be correct:
# Padding in +encoded_string+, if present, must be correct:
# see {Padding}[Base64.html#module-Base64-label-Padding], above:
#
# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567"
# Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567"
# Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError.
#
# source://base64//lib/base64.rb#351
# source://base64//lib/base64.rb#369
def urlsafe_decode64(str); end
# Returns the RFC-4648-compliant \Base64-encoding of +bin+.
# :call-seq:
# Base64.urlsafe_encode64(string) -> encoded_string
#
# Returns the RFC-4648-compliant \Base64-encoding of +string+.
#
# Per RFC 4648, the returned string will not contain the URL-unsafe characters
# <tt>+</tt> or <tt>/</tt>,
@@ -343,32 +361,38 @@ module Base64
# Base64.urlsafe_encode64('*' * 46)
# # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg=="
#
# source://base64//lib/base64.rb#328
# source://base64//lib/base64.rb#343
def urlsafe_encode64(bin, padding: T.unsafe(nil)); end
class << self
# :call-seq:
# Base64.decode(encoded_string) -> decoded_string
#
# Returns a string containing the decoding of an RFC-2045-compliant
# \Base64-encoded string +str+:
# \Base64-encoded string +encoded_string+:
#
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
# Base64.decode64(s) # => "This is line 1\nThis is line 2\n"
#
# Non-\Base64 characters in +str+ are ignored;
# Non-\Base64 characters in +encoded_string+ are ignored;
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
# these include newline characters and characters <tt>-</tt> and <tt>/</tt>:
#
# Base64.decode64("\x00\n-_") # => ""
#
# Padding in +str+ (even if incorrect) is ignored:
# Padding in +encoded_string+ (even if incorrect) is ignored:
#
# Base64.decode64("MDEyMzQ1Njc") # => "01234567"
# Base64.decode64("MDEyMzQ1Njc=") # => "01234567"
# Base64.decode64("MDEyMzQ1Njc==") # => "01234567"
#
# source://base64//lib/base64.rb#241
# source://base64//lib/base64.rb#247
def decode64(str); end
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +bin+.
# :call-seq:
# Base64.encode64(string) -> encoded_string
#
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +string+.
#
# Per RFC 2045, the returned string may contain the URL-unsafe characters
# <tt>+</tt> or <tt>/</tt>;
@@ -397,16 +421,19 @@ module Base64
# s = "This is line 1\nThis is line 2\n"
# Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
#
# source://base64//lib/base64.rb#219
# source://base64//lib/base64.rb#222
def encode64(bin); end
# :call-seq:
# Base64.strict_decode64(encoded_string) -> decoded_string
#
# Returns a string containing the decoding of an RFC-2045-compliant
# \Base64-encoded string +str+:
# \Base64-encoded string +encoded_string+:
#
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
# Base64.strict_decode64(s) # => "This is line 1\nThis is line 2\n"
#
# Non-\Base64 characters in +str+ not allowed;
# Non-\Base64 characters in +encoded_string+ are not allowed;
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
# these include newline characters and characters <tt>-</tt> and <tt>/</tt>:
#
@@ -414,16 +441,19 @@ module Base64
# Base64.strict_decode64('-') # Raises ArgumentError
# Base64.strict_decode64('_') # Raises ArgumentError
#
# Padding in +str+, if present, must be correct:
# Padding in +encoded_string+, if present, must be correct:
#
# Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError
# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567"
# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError
#
# source://base64//lib/base64.rb#297
# source://base64//lib/base64.rb#309
def strict_decode64(str); end
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +bin+.
# :call-seq:
# Base64.strict_encode64(string) -> encoded_string
#
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +string+.
#
# Per RFC 2045, the returned string may contain the URL-unsafe characters
# <tt>+</tt> or <tt>/</tt>;
@@ -451,29 +481,35 @@ module Base64
# s = "This is line 1\nThis is line 2\n"
# Base64.strict_encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
#
# source://base64//lib/base64.rb#273
# source://base64//lib/base64.rb#282
def strict_encode64(bin); end
# Returns the decoding of an RFC-4648-compliant \Base64-encoded string +str+:
# :call-seq:
# Base64.urlsafe_decode64(encoded_string) -> decoded_string
#
# +str+ may not contain non-Base64 characters;
# Returns the decoding of an RFC-4648-compliant \Base64-encoded string +encoded_string+:
#
# +encoded_string+ may not contain non-Base64 characters;
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
#
# Base64.urlsafe_decode64('+') # Raises ArgumentError.
# Base64.urlsafe_decode64('/') # Raises ArgumentError.
# Base64.urlsafe_decode64("\n") # Raises ArgumentError.
#
# Padding in +str+, if present, must be correct:
# Padding in +encoded_string+, if present, must be correct:
# see {Padding}[Base64.html#module-Base64-label-Padding], above:
#
# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567"
# Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567"
# Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError.
#
# source://base64//lib/base64.rb#351
# source://base64//lib/base64.rb#369
def urlsafe_decode64(str); end
# Returns the RFC-4648-compliant \Base64-encoding of +bin+.
# :call-seq:
# Base64.urlsafe_encode64(string) -> encoded_string
#
# Returns the RFC-4648-compliant \Base64-encoding of +string+.
#
# Per RFC 4648, the returned string will not contain the URL-unsafe characters
# <tt>+</tt> or <tt>/</tt>,
@@ -500,7 +536,7 @@ module Base64
# Base64.urlsafe_encode64('*' * 46)
# # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg=="
#
# source://base64//lib/base64.rb#328
# source://base64//lib/base64.rb#343
def urlsafe_encode64(bin, padding: T.unsafe(nil)); end
end
end

View File

@@ -1,4 +1,4 @@
# typed: strict
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `benchmark` gem.
@@ -19,8 +19,9 @@
#
# 0.350000 0.400000 0.750000 ( 0.835234)
#
# This report shows the user CPU time, system CPU time, the sum of
# the user and system CPU times, and the elapsed real time. The unit
# This report shows the user CPU time, system CPU time, the total time
# (sum of user CPU time, system CPU time, children's user CPU time,
# and children's system CPU time), and the elapsed real time. The unit
# of time is seconds.
#
# * Do some experiments sequentially using the #bm method:
@@ -108,7 +109,7 @@
# >total: 2.880000 0.000000 2.880000 ( 2.883764)
# >avg: 0.960000 0.000000 0.960000 ( 0.961255)
#
# source://benchmark//lib/benchmark.rb#122
# source://benchmark//lib/benchmark.rb#123
module Benchmark
private
@@ -153,7 +154,7 @@ module Benchmark
# >total: 2.930000 0.000000 2.930000 ( 2.932889)
# >avg: 0.976667 0.000000 0.976667 ( 0.977630)
#
# source://benchmark//lib/benchmark.rb#170
# source://benchmark//lib/benchmark.rb#171
def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end
# A simple interface to the #benchmark method, #bm generates sequential
@@ -176,7 +177,7 @@ module Benchmark
# times: 0.960000 0.000000 0.960000 ( 0.960423)
# upto: 0.950000 0.000000 0.950000 ( 0.954864)
#
# source://benchmark//lib/benchmark.rb#215
# source://benchmark//lib/benchmark.rb#216
def bm(label_width = T.unsafe(nil), *labels, &blk); end
# Sometimes benchmark results are skewed because code executed
@@ -216,7 +217,7 @@ module Benchmark
# #bmbm yields a Benchmark::Job object and returns an array of
# Benchmark::Tms objects.
#
# source://benchmark//lib/benchmark.rb#257
# source://benchmark//lib/benchmark.rb#258
def bmbm(width = T.unsafe(nil)); end
# Returns the time used to execute the given block as a
@@ -235,7 +236,7 @@ module Benchmark
#
# 0.220000 0.000000 0.220000 ( 0.227313)
#
# source://benchmark//lib/benchmark.rb#302
# source://benchmark//lib/benchmark.rb#303
def measure(label = T.unsafe(nil)); end
# Returns the elapsed real time used to execute the given block.
@@ -244,7 +245,7 @@ module Benchmark
# Benchmark.realtime { "a" * 1_000_000_000 }
# #=> 0.5098029999935534
#
# source://benchmark//lib/benchmark.rb#321
# source://benchmark//lib/benchmark.rb#322
def realtime; end
class << self
@@ -289,7 +290,7 @@ module Benchmark
# >total: 2.930000 0.000000 2.930000 ( 2.932889)
# >avg: 0.976667 0.000000 0.976667 ( 0.977630)
#
# source://benchmark//lib/benchmark.rb#170
# source://benchmark//lib/benchmark.rb#171
def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end
# A simple interface to the #benchmark method, #bm generates sequential
@@ -312,7 +313,7 @@ module Benchmark
# times: 0.960000 0.000000 0.960000 ( 0.960423)
# upto: 0.950000 0.000000 0.950000 ( 0.954864)
#
# source://benchmark//lib/benchmark.rb#215
# source://benchmark//lib/benchmark.rb#216
def bm(label_width = T.unsafe(nil), *labels, &blk); end
# Sometimes benchmark results are skewed because code executed
@@ -352,7 +353,7 @@ module Benchmark
# #bmbm yields a Benchmark::Job object and returns an array of
# Benchmark::Tms objects.
#
# source://benchmark//lib/benchmark.rb#257
# source://benchmark//lib/benchmark.rb#258
def bmbm(width = T.unsafe(nil)); end
# Returns the time used to execute the given block as a
@@ -371,7 +372,7 @@ module Benchmark
#
# 0.220000 0.000000 0.220000 ( 0.227313)
#
# source://benchmark//lib/benchmark.rb#302
# source://benchmark//lib/benchmark.rb#303
def measure(label = T.unsafe(nil)); end
# Returns the elapsed real time used to execute the given block.
@@ -380,7 +381,7 @@ module Benchmark
# Benchmark.realtime { "a" * 1_000_000_000 }
# #=> 0.5098029999935534
#
# source://benchmark//lib/benchmark.rb#321
# source://benchmark//lib/benchmark.rb#322
def realtime; end
end
end
@@ -388,7 +389,7 @@ end
# A Job is a sequence of labelled blocks to be processed by the
# Benchmark.bmbm method. It is of little direct interest to the user.
#
# source://benchmark//lib/benchmark.rb#333
# source://benchmark//lib/benchmark.rb#334
class Benchmark::Job
# Returns an initialized Job instance.
# Usually, one doesn't call this method directly, as new
@@ -398,38 +399,38 @@ class Benchmark::Job
#
# @return [Job] a new instance of Job
#
# source://benchmark//lib/benchmark.rb#341
# source://benchmark//lib/benchmark.rb#342
def initialize(width); end
# Registers the given label and block pair in the job list.
#
# @raise [ArgumentError]
#
# source://benchmark//lib/benchmark.rb#349
# source://benchmark//lib/benchmark.rb#350
def item(label = T.unsafe(nil), &blk); end
# An array of 2-element arrays, consisting of label and block pairs.
#
# source://benchmark//lib/benchmark.rb#361
# source://benchmark//lib/benchmark.rb#362
def list; end
# Registers the given label and block pair in the job list.
#
# @raise [ArgumentError]
#
# source://benchmark//lib/benchmark.rb#349
# source://benchmark//lib/benchmark.rb#350
def report(label = T.unsafe(nil), &blk); end
# Length of the widest label in the #list.
#
# source://benchmark//lib/benchmark.rb#364
# source://benchmark//lib/benchmark.rb#365
def width; end
end
# This class is used by the Benchmark.benchmark and Benchmark.bm methods.
# It is of little direct interest to the user.
#
# source://benchmark//lib/benchmark.rb#371
# source://benchmark//lib/benchmark.rb#372
class Benchmark::Report
# Returns an initialized Report instance.
# Usually, one doesn't call this method directly, as new
@@ -439,43 +440,43 @@ class Benchmark::Report
#
# @return [Report] a new instance of Report
#
# source://benchmark//lib/benchmark.rb#379
# source://benchmark//lib/benchmark.rb#380
def initialize(width = T.unsafe(nil), format = T.unsafe(nil)); end
# An array of Benchmark::Tms objects representing each item.
#
# source://benchmark//lib/benchmark.rb#398
# source://benchmark//lib/benchmark.rb#399
def format; end
# Prints the +label+ and measured time for the block,
# formatted by +format+. See Tms#format for the
# formatting rules.
#
# source://benchmark//lib/benchmark.rb#388
# source://benchmark//lib/benchmark.rb#389
def item(label = T.unsafe(nil), *format, &blk); end
# An array of Benchmark::Tms objects representing each item.
#
# source://benchmark//lib/benchmark.rb#398
# source://benchmark//lib/benchmark.rb#399
def list; end
# Prints the +label+ and measured time for the block,
# formatted by +format+. See Tms#format for the
# formatting rules.
#
# source://benchmark//lib/benchmark.rb#388
# source://benchmark//lib/benchmark.rb#389
def report(label = T.unsafe(nil), *format, &blk); end
# An array of Benchmark::Tms objects representing each item.
#
# source://benchmark//lib/benchmark.rb#398
# source://benchmark//lib/benchmark.rb#399
def width; end
end
# A data object, representing the times associated with a benchmark
# measurement.
#
# source://benchmark//lib/benchmark.rb#407
# source://benchmark//lib/benchmark.rb#408
class Benchmark::Tms
# Returns an initialized Tms object which has
# +utime+ as the user CPU time, +stime+ as the system CPU time,
@@ -484,13 +485,13 @@ class Benchmark::Tms
#
# @return [Tms] a new instance of Tms
#
# source://benchmark//lib/benchmark.rb#442
# source://benchmark//lib/benchmark.rb#443
def initialize(utime = T.unsafe(nil), stime = T.unsafe(nil), cutime = T.unsafe(nil), cstime = T.unsafe(nil), real = T.unsafe(nil), label = T.unsafe(nil)); end
# Returns a new Tms object obtained by memberwise multiplication
# of the individual times for this Tms object by +x+.
#
# source://benchmark//lib/benchmark.rb#490
# source://benchmark//lib/benchmark.rb#491
def *(x); end
# Returns a new Tms object obtained by memberwise summation
@@ -498,27 +499,27 @@ class Benchmark::Tms
# Tms object.
# This method and #/() are useful for taking statistics.
#
# source://benchmark//lib/benchmark.rb#477
# source://benchmark//lib/benchmark.rb#478
def +(other); end
# Returns a new Tms object obtained by memberwise subtraction
# of the individual times for the +other+ Tms object from those of this
# Tms object.
#
# source://benchmark//lib/benchmark.rb#484
# source://benchmark//lib/benchmark.rb#485
def -(other); end
# Returns a new Tms object obtained by memberwise division
# of the individual times for this Tms object by +x+.
# This method and #+() are useful for taking statistics.
#
# source://benchmark//lib/benchmark.rb#497
# source://benchmark//lib/benchmark.rb#498
def /(x); end
# Returns a new Tms object whose times are the sum of the times for this
# Tms object, plus the time required to execute the code block (+blk+).
#
# source://benchmark//lib/benchmark.rb#451
# source://benchmark//lib/benchmark.rb#452
def add(&blk); end
# An in-place version of #add.
@@ -526,17 +527,17 @@ class Benchmark::Tms
# for this Tms object, plus the time required to execute
# the code block (+blk+).
#
# source://benchmark//lib/benchmark.rb#461
# source://benchmark//lib/benchmark.rb#462
def add!(&blk); end
# System CPU time of children
#
# source://benchmark//lib/benchmark.rb#425
# source://benchmark//lib/benchmark.rb#426
def cstime; end
# User CPU time of children
#
# source://benchmark//lib/benchmark.rb#422
# source://benchmark//lib/benchmark.rb#423
def cutime; end
# Returns the contents of this Tms object as
@@ -545,7 +546,7 @@ class Benchmark::Tms
# accepts the following extensions:
#
# <tt>%u</tt>:: Replaced by the user CPU time, as reported by Tms#utime.
# <tt>%y</tt>:: Replaced by the system CPU time, as reported by #stime (Mnemonic: y of "s*y*stem")
# <tt>%y</tt>:: Replaced by the system CPU time, as reported by Tms#stime (Mnemonic: y of "s*y*stem")
# <tt>%U</tt>:: Replaced by the children's user CPU time, as reported by Tms#cutime
# <tt>%Y</tt>:: Replaced by the children's system CPU time, as reported by Tms#cstime
# <tt>%t</tt>:: Replaced by the total CPU time, as reported by Tms#total
@@ -553,24 +554,24 @@ class Benchmark::Tms
# <tt>%n</tt>:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame")
#
# If +format+ is not given, FORMAT is used as default value, detailing the
# user, system and real elapsed time.
# user, system, total and real elapsed time.
#
# source://benchmark//lib/benchmark.rb#516
# source://benchmark//lib/benchmark.rb#517
def format(format = T.unsafe(nil), *args); end
# Label
#
# source://benchmark//lib/benchmark.rb#434
# source://benchmark//lib/benchmark.rb#435
def label; end
# Elapsed real time
#
# source://benchmark//lib/benchmark.rb#428
# source://benchmark//lib/benchmark.rb#429
def real; end
# System CPU time
#
# source://benchmark//lib/benchmark.rb#419
# source://benchmark//lib/benchmark.rb#420
def stime; end
# Returns a new 6-element array, consisting of the
@@ -578,27 +579,27 @@ class Benchmark::Tms
# user CPU time, children's system CPU time and elapsed
# real time.
#
# source://benchmark//lib/benchmark.rb#541
# source://benchmark//lib/benchmark.rb#542
def to_a; end
# Returns a hash containing the same data as `to_a`.
#
# source://benchmark//lib/benchmark.rb#548
# source://benchmark//lib/benchmark.rb#549
def to_h; end
# Same as #format.
#
# source://benchmark//lib/benchmark.rb#531
# source://benchmark//lib/benchmark.rb#532
def to_s; end
# Total time, that is +utime+ + +stime+ + +cutime+ + +cstime+
#
# source://benchmark//lib/benchmark.rb#431
# source://benchmark//lib/benchmark.rb#432
def total; end
# User CPU time
#
# source://benchmark//lib/benchmark.rb#416
# source://benchmark//lib/benchmark.rb#417
def utime; end
protected
@@ -610,9 +611,9 @@ class Benchmark::Tms
# +op+ can be a mathematical operation such as <tt>+</tt>, <tt>-</tt>,
# <tt>*</tt>, <tt>/</tt>
#
# source://benchmark//lib/benchmark.rb#569
# source://benchmark//lib/benchmark.rb#570
def memberwise(op, x); end
end
# source://benchmark//lib/benchmark.rb#124
# source://benchmark//lib/benchmark.rb#125
Benchmark::VERSION = T.let(T.unsafe(nil), String)

View File

@@ -1,4 +1,4 @@
# typed: strict
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `bigdecimal` gem.

View File

@@ -44,12 +44,12 @@ class ConnectionPool
# Automatically drop all connections after fork
#
# source://connection_pool//lib/connection_pool.rb#166
# source://connection_pool//lib/connection_pool.rb#170
def auto_reload_after_fork; end
# Number of pool entries available for checkout at this instant.
#
# source://connection_pool//lib/connection_pool.rb#169
# source://connection_pool//lib/connection_pool.rb#173
def available; end
# source://connection_pool//lib/connection_pool.rb#129
@@ -58,23 +58,34 @@ class ConnectionPool
# source://connection_pool//lib/connection_pool.rb#119
def checkout(options = T.unsafe(nil)); end
# Number of pool entries created and idle in the pool.
#
# source://connection_pool//lib/connection_pool.rb#178
def idle; end
# Reaps idle connections that have been idle for over +idle_seconds+.
# +idle_seconds+ defaults to 60.
#
# source://connection_pool//lib/connection_pool.rb#163
def reap(idle_seconds = T.unsafe(nil), &block); end
# Reloads the ConnectionPool by passing each connection to +block+ and then
# removing it the pool. Subsequent checkouts will create new connections as
# needed.
#
# source://connection_pool//lib/connection_pool.rb#159
# source://connection_pool//lib/connection_pool.rb#157
def reload(&block); end
# Shuts down the ConnectionPool by passing each connection to +block+ and
# then removing it from the pool. Attempting to checkout a connection after
# shutdown will raise +ConnectionPool::PoolShuttingDownError+.
#
# source://connection_pool//lib/connection_pool.rb#150
# source://connection_pool//lib/connection_pool.rb#149
def shutdown(&block); end
# Size of this connection pool
#
# source://connection_pool//lib/connection_pool.rb#164
# source://connection_pool//lib/connection_pool.rb#168
def size; end
# source://connection_pool//lib/connection_pool.rb#105
@@ -110,6 +121,10 @@ ConnectionPool::INSTANCES = T.let(T.unsafe(nil), ObjectSpace::WeakMap)
# source://connection_pool//lib/connection_pool.rb#7
class ConnectionPool::PoolShuttingDownError < ::ConnectionPool::Error; end
# The TimedStack manages a pool of homogeneous connections (or any resource
# you wish to manage). Connections are created lazily up to a given maximum
# number.
#
# Examples:
#
# ts = TimedStack.new(1) { MyConnection.new }
@@ -124,56 +139,68 @@ class ConnectionPool::PoolShuttingDownError < ::ConnectionPool::Error; end
# ts.pop timeout: 5
# #=> raises ConnectionPool::TimeoutError after 5 seconds
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#20
# source://connection_pool//lib/connection_pool/timed_stack.rb#19
class ConnectionPool::TimedStack
# Creates a new pool with +size+ connections that are created from the given
# +block+.
#
# @return [TimedStack] a new instance of TimedStack
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#27
# source://connection_pool//lib/connection_pool/timed_stack.rb#25
def initialize(size = T.unsafe(nil), &block); end
# Returns +obj+ to the stack. +options+ is ignored in TimedStack but may be
# Returns +obj+ to the stack. +options+ is ignored in TimedStack but may be
# used by subclasses that extend TimedStack.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#41
# source://connection_pool//lib/connection_pool/timed_stack.rb#38
def <<(obj, options = T.unsafe(nil)); end
# Returns +true+ if there are no available connections.
#
# @return [Boolean]
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#104
# source://connection_pool//lib/connection_pool/timed_stack.rb#121
def empty?; end
# The number of connections created and available on the stack.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#133
def idle; end
# The number of connections available on the stack.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#111
# source://connection_pool//lib/connection_pool/timed_stack.rb#127
def length; end
# Returns the value of attribute max.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#21
# source://connection_pool//lib/connection_pool/timed_stack.rb#20
def max; end
# Retrieves a connection from the stack. If a connection is available it is
# immediately returned. If no connection is available within the given
# Retrieves a connection from the stack. If a connection is available it is
# immediately returned. If no connection is available within the given
# timeout a ConnectionPool::TimeoutError is raised.
#
# +:timeout+ is the only checked entry in +options+ and is preferred over
# the +timeout+ argument (which will be removed in a future release). Other
# the +timeout+ argument (which will be removed in a future release). Other
# options may be used by subclasses that extend TimedStack.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#63
# source://connection_pool//lib/connection_pool/timed_stack.rb#60
def pop(timeout = T.unsafe(nil), options = T.unsafe(nil)); end
# Returns +obj+ to the stack. +options+ is ignored in TimedStack but may be
# Returns +obj+ to the stack. +options+ is ignored in TimedStack but may be
# used by subclasses that extend TimedStack.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#41
# source://connection_pool//lib/connection_pool/timed_stack.rb#38
def push(obj, options = T.unsafe(nil)); end
# Reaps connections that were checked in more than +idle_seconds+ ago.
#
# @raise [ArgumentError]
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#101
def reap(idle_seconds, &block); end
# Shuts down the TimedStack by passing each connection to +block+ and then
# removing it from the pool. Attempting to checkout a connection after
# shutdown will raise +ConnectionPool::PoolShuttingDownError+ unless
@@ -181,7 +208,7 @@ class ConnectionPool::TimedStack
#
# @raise [ArgumentError]
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#89
# source://connection_pool//lib/connection_pool/timed_stack.rb#87
def shutdown(reload: T.unsafe(nil), &block); end
private
@@ -192,31 +219,48 @@ class ConnectionPool::TimedStack
#
# @return [Boolean]
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#126
# source://connection_pool//lib/connection_pool/timed_stack.rb#157
def connection_stored?(options = T.unsafe(nil)); end
# source://connection_pool//lib/connection_pool/timed_stack.rb#117
# source://connection_pool//lib/connection_pool/timed_stack.rb#139
def current_time; end
# This is an extension point for TimedStack and is called with a mutex.
#
# This method must return a connection from the stack.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#135
# source://connection_pool//lib/connection_pool/timed_stack.rb#165
def fetch_connection(options = T.unsafe(nil)); end
# This is an extension point for TimedStack and is called with a mutex.
#
# Returns true if the first connection in the stack has been idle for more than idle_seconds
#
# @return [Boolean]
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#197
def idle_connections?(idle_seconds); end
# This is an extension point for TimedStack and is called with a mutex.
#
# This method returns the oldest idle connection if it has been idle for more than idle_seconds.
# This requires that the stack is kept in order of checked in time (oldest first).
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#185
def reserve_idle_connection(idle_seconds); end
# This is an extension point for TimedStack and is called with a mutex.
#
# This method must shut down all connections on the stack.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#144
# source://connection_pool//lib/connection_pool/timed_stack.rb#173
def shutdown_connections(options = T.unsafe(nil)); end
# This is an extension point for TimedStack and is called with a mutex.
#
# This method must return +obj+ to the stack.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#157
# source://connection_pool//lib/connection_pool/timed_stack.rb#205
def store_connection(obj, options = T.unsafe(nil)); end
# This is an extension point for TimedStack and is called with a mutex.
@@ -224,8 +268,17 @@ class ConnectionPool::TimedStack
# This method must create a connection if and only if the total number of
# connections allowed has not been met.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#167
# source://connection_pool//lib/connection_pool/timed_stack.rb#214
def try_create(options = T.unsafe(nil)); end
# This is an extension point for TimedStack and is called with a mutex.
#
# This method must returns a connection from the stack if one exists. Allows
# subclasses with expensive match/search algorithms to avoid double-handling
# their stack.
#
# source://connection_pool//lib/connection_pool/timed_stack.rb#149
def try_fetch_connection(options = T.unsafe(nil)); end
end
# source://connection_pool//lib/connection_pool.rb#9

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,470 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `has_aux_table` gem.
# Please instead update this file by running `bin/tapioca gem has_aux_table`.
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#58
class ActiveRecord::Migration
include ::HasAuxTable::MigrationExtensions
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#803
def initialize(name = T.unsafe(nil), version = T.unsafe(nil)); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1008
def announce(message); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1039
def connection; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1043
def connection_pool; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1064
def copy(destination, sources, options = T.unsafe(nil)); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#790
def disable_ddl_transaction; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#960
def down; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#988
def exec_migration(conn, direction); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#810
def execution_strategy; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1047
def method_missing(method, *arguments, **_arg2, &block); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#967
def migrate(direction); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#801
def name; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#801
def name=(_arg0); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1131
def next_migration_number(number); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1122
def proper_table_name(name, options = T.unsafe(nil)); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#912
def reversible; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#855
def revert(*migration_classes, &block); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#872
def reverting?; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#940
def run(*migration_classes); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1016
def say(message, subitem = T.unsafe(nil)); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1022
def say_with_time(message); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1032
def suppress_messages; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1141
def table_name_options(config = T.unsafe(nil)); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#954
def up; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#931
def up_only(&block); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#800
def verbose; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#800
def verbose=(val); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#801
def version; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#801
def version=(_arg0); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1004
def write(text = T.unsafe(nil)); end
private
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1173
def command_recorder; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1149
def execute_block; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1157
def format_arguments(arguments); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#1169
def internal_option?(option_name); end
class << self
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#632
def [](version); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#700
def check_all_pending!; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#752
def check_pending_migrations; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#636
def current_version; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#691
def delegate; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#691
def delegate=(_arg0); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#692
def disable_ddl_transaction; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#748
def disable_ddl_transaction!; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#692
def disable_ddl_transaction=(_arg0); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#620
def inherited(subclass); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#716
def load_schema_if_pending!; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#730
def maintain_test_schema!; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#736
def method_missing(name, *_arg1, **_arg2, &_arg3); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#740
def migrate(direction); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#694
def nearest_delegate; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#642
def valid_version_format?(version_string); end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#800
def verbose; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#800
def verbose=(val); end
private
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#761
def any_schema_needs_update?; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#767
def db_configs_in_current_env; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#785
def env; end
# source://activerecord/7.2.2.1/lib/active_record/migration.rb#771
def pending_migrations; end
end
end
# source://has_aux_table//lib/has_aux_table/key_type.rb#4
module HasAuxTable
extend ::ActiveSupport::Concern
mixes_in_class_methods ::HasAuxTable::ClassMethods
end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#113
class HasAuxTable::AuxTableConfig < ::T::Struct
const :aux_table_name, ::Symbol
const :aux_association_name, ::Symbol
const :main_association_name, ::Symbol
const :main_class, T.class_of(ActiveRecord::Base)
const :aux_class, T.class_of(ActiveRecord::Base)
const :foreign_key, T.any(::String, ::Symbol, T::Array[T.any(::String, ::Symbol)])
const :primary_key, T.any(::String, ::Symbol, T::Array[T.any(::String, ::Symbol)])
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#203
sig do
params(
relation: T.any(::ActiveRecord::Relation, T.class_of(ActiveRecord::Base)),
conditions: T::Hash[::String, T.untyped]
).returns(::ActiveRecord::Relation)
end
def apply_split_conditions!(relation, conditions); end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#130
sig { returns(::HasAuxTable::ModelClassHelper) }
def aux; end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#180
sig do
params(
name: ::Symbol,
value: T.untyped,
block: T.proc.params(arel_attr: T.untyped, aux_bind: T.untyped).returns(::Arel::Nodes::Node)
).returns(::Arel::Nodes::Node)
end
def aux_bind_attribute(name, value, &block); end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#156
sig { params(main_instance: ::ActiveRecord::Base).returns(::ActiveRecord::Base) }
def aux_model_for(main_instance); end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#188
sig { params(method_name: ::Symbol).void }
def define_aux_attribute_delegate(method_name); end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#125
sig { void }
def load_aux_schema; end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#142
sig { returns(::HasAuxTable::ModelClassHelper) }
def main; end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#218
sig { params(conditions: T::Hash[::String, T.untyped]).returns(T::Hash[::String, T.untyped]) }
def remap_conditions(conditions); end
private
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#227
sig { returns(T::Set[::String]) }
def aux_rejected_column_names; end
class << self
# source://sorbet-runtime/0.5.12221/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#5
class HasAuxTable::BaseTableDefinition
# @return [BaseTableDefinition] a new instance of BaseTableDefinition
#
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#8
def initialize(schema, base_table_name, inner); end
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#14
def create_aux(aux_name, **options, &block); end
# source://activesupport/7.2.2.1/lib/active_support/delegation.rb#187
def method_missing(method, *_arg1, **_arg2, &_arg3); end
private
# Returns the value of attribute inner.
#
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#20
def inner; end
# source://activesupport/7.2.2.1/lib/active_support/delegation.rb#179
def respond_to_missing?(name, include_private = T.unsafe(nil)); end
# Returns the value of attribute schema.
#
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#20
def schema; end
end
# source://has_aux_table//lib/has_aux_table.rb#32
module HasAuxTable::ClassMethods
include ::HasAuxTable::RelationExtensions
requires_ancestor { T.class_of(ActiveRecord::Base) }
# Main DSL method for defining auxiliary tables
#
# source://has_aux_table//lib/has_aux_table.rb#41
sig { params(aux_name: T.any(::String, ::Symbol)).returns(::HasAuxTable::AuxTableConfig) }
def aux_table(aux_name); end
private
# source://has_aux_table//lib/has_aux_table.rb#199
sig { params(load_schema_method: ::Method, config: ::HasAuxTable::AuxTableConfig).void }
def aux_config_load_schema!(load_schema_method, config); end
# source://has_aux_table//lib/has_aux_table.rb#319
sig { params(aux_table_name: ::Symbol, main_columns: T::Array[::String], aux_columns: T::Array[::String]).void }
def check_for_overlapping_columns!(aux_table_name, main_columns, aux_columns); end
# Generate auxiliary model class dynamically
#
# source://has_aux_table//lib/has_aux_table.rb#74
sig do
params(
aux_name: ::Symbol,
foreign_key: T.any(::String, ::Symbol, T::Array[T.any(::String, ::Symbol)]),
primary_key: T.any(::String, ::Symbol, T::Array[T.any(::String, ::Symbol)])
).returns(::HasAuxTable::AuxTableConfig)
end
def generate_aux_config(aux_name, foreign_key: T.unsafe(nil), primary_key: T.unsafe(nil)); end
# source://has_aux_table//lib/has_aux_table.rb#233
sig { params(config: ::HasAuxTable::AuxTableConfig).void }
def setup_attribute_getter_setter_hooks!(config); end
# source://has_aux_table//lib/has_aux_table.rb#142
sig { params(config: ::HasAuxTable::AuxTableConfig).void }
def setup_attribute_types_hook!(config); end
# source://has_aux_table//lib/has_aux_table.rb#301
sig { params(config: ::HasAuxTable::AuxTableConfig).void }
def setup_attributes_hook!(config); end
# source://has_aux_table//lib/has_aux_table.rb#255
sig { params(config: ::HasAuxTable::AuxTableConfig).void }
def setup_initialize_hook!(config); end
# Hook into schema loading to generate attribute accessors when schema is loaded
#
# source://has_aux_table//lib/has_aux_table.rb#183
sig { params(config: ::HasAuxTable::AuxTableConfig).void }
def setup_load_schema_hook!(config); end
# source://has_aux_table//lib/has_aux_table.rb#283
sig { params(config: ::HasAuxTable::AuxTableConfig).void }
def setup_reload_hook!(config); end
# source://has_aux_table//lib/has_aux_table.rb#266
sig { params(config: ::HasAuxTable::AuxTableConfig).void }
def setup_save_hook!(config); end
end
# source://has_aux_table//lib/has_aux_table/key_type.rb#5
HasAuxTable::KeyType = T.type_alias { T.any(::String, ::Symbol, T::Array[T.any(::String, ::Symbol)]) }
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#23
module HasAuxTable::MigrationExtensions
requires_ancestor { ActiveRecord::Migration }
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#36
def change_base_table(name, **options); end
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#42
def create_aux_table(base_table, name, **options); end
# source://has_aux_table//lib/has_aux_table/migration_extensions.rb#28
def create_base_table(name, type: T.unsafe(nil), **options); end
end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#5
class HasAuxTable::ModelClassHelper < ::T::Struct
const :klass, T.class_of(ActiveRecord::Base)
const :rejected_column_names, T::Set[::String]
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#40
sig { returns(T::Hash[::String, ::ActiveModel::Type]) }
def attribute_types; end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#63
sig { params(instance: ::ActiveRecord::Base).returns(T::Hash[::String, T.untyped]) }
def attributes_on(instance); end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#17
sig { returns(T::Array[::String]) }
def column_names; end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#31
sig { returns(T::Hash[::String, ::ActiveRecord::ConnectionAdapters::Column]) }
def columns_hash; end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#49
sig { returns(T::Hash[::String, ::ActiveModel::Attribute]) }
def default_attributes; end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#12
sig { params(name: T.any(::String, ::Symbol)).returns(T::Boolean) }
def is_column?(name); end
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#93
sig do
type_parameters(:K, :T)
.params(
hash: T::Hash[T.all(T.any(::String, ::Symbol), T.type_parameter(:K)), T.type_parameter(:T)]
).returns([T::Hash[T.all(T.any(::String, ::Symbol), T.type_parameter(:K)), T.type_parameter(:T)], T::Hash[T.all(T.any(::String, ::Symbol), T.type_parameter(:K)), T.type_parameter(:T)]])
end
def partition_by_columns(hash); end
private
# source://has_aux_table//lib/has_aux_table/aux_table_config.rb#108
sig do
type_parameters(:T)
.params(
hash: T::Hash[::String, T.type_parameter(:T)]
).returns(T::Hash[::String, T.type_parameter(:T)])
end
def slice_by_columns(hash); end
class << self
# source://sorbet-runtime/0.5.12221/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://has_aux_table//lib/has_aux_table/relation_extensions.rb#5
module HasAuxTable::RelationExtensions
# source://has_aux_table//lib/has_aux_table/relation_extensions.rb#15
sig { params(aux_config: ::HasAuxTable::AuxTableConfig).void }
def setup_main_class_extensions!(aux_config); end
# source://has_aux_table//lib/has_aux_table/relation_extensions.rb#10
sig { params(aux_config: ::HasAuxTable::AuxTableConfig).void }
def setup_relation_extensions!(aux_config); end
end
# source://has_aux_table//lib/has_aux_table/relation_extensions.rb#7
HasAuxTable::RelationExtensions::Util = HasAuxTable::Util
# source://has_aux_table//lib/has_aux_table/util.rb#5
module HasAuxTable::Util
class << self
# source://has_aux_table//lib/has_aux_table/util.rb#42
sig { params(aux_config: ::HasAuxTable::AuxTableConfig).returns(T::Array[::String]) }
def attributes_for_inspect(aux_config); end
# source://has_aux_table//lib/has_aux_table/util.rb#63
sig do
type_parameters(:T)
.params(
instance: T.all(::Object, T.type_parameter(:T)),
klass: T::Class[T.type_parameter(:T)]
).void
end
def ensure_is_instance_of!(instance, klass); end
# source://has_aux_table//lib/has_aux_table/util.rb#20
sig do
params(
target: T.any(T.class_of(ActiveRecord::Base), T.class_of(ActiveRecord::Relation)),
method_name: ::Symbol,
is_instance_method: T::Boolean,
hook_block: T.proc.params(args: T.untyped).void
).void
end
def hook_method(target, method_name, is_instance_method, &hook_block); end
end
end
# source://has_aux_table//lib/has_aux_table.rb#22
HasAuxTable::VERSION = T.let(T.unsafe(nil), String)

View File

@@ -369,10 +369,20 @@ class Logger
# - A string filepath: entries are to be written
# to the file at that path; if the file at that path exists,
# new entries are appended.
# - An IO stream (typically +$stdout+, +$stderr+. or an open file):
# entries are to be written to the given stream.
# - An IO stream (typically <tt>$stdout</tt>, <tt>$stderr</tt>. or
# an open file): entries are to be written to the given stream.
# - +nil+ or +File::NULL+: no entries are to be written.
#
# Argument +shift_age+ must be one of:
#
# - The number of log files to be in the rotation.
# See {Size-Based Rotation}[rdoc-ref:Logger@Size-Based+Rotation].
# - A string period indicator.
# See {Periodic Rotation}[rdoc-ref:Logger@Periodic+Rotation].
#
# Argument +shift_size+ is the maximum size (in bytes) of each log file.
# See {Size-Based Rotation}[rdoc-ref:Logger@Size-Based+Rotation].
#
# Examples:
#
# Logger.new('t.log')
@@ -392,22 +402,29 @@ class Logger
#
# - +formatter+: sets the entry formatter; default is +nil+.
# See {formatter=}[Logger.html#attribute-i-formatter].
#
# - +datetime_format+: sets the format for entry timestamp;
# default is +nil+.
# See #datetime_format=.
#
# - +binmode+: sets whether the logger writes in binary mode;
# default is +false+.
#
# - +shift_period_suffix+: sets the format for the filename suffix
# for periodic log file rotation; default is <tt>'%Y%m%d'</tt>.
# See {Periodic Rotation}[rdoc-ref:Logger@Periodic+Rotation].
#
# - +reraise_write_errors+: An array of exception classes, which will
# be reraised if there is an error when writing to the log device.
# The default is to swallow all exceptions raised.
# - +skip_header+: If +true+, prevents the logger from writing a header
# when creating a new log file. The default is +false+, meaning
# the header will be written as usual.
#
# @return [Logger] a new instance of Logger
#
# source://logger//lib/logger.rb#581
def initialize(logdev, shift_age = T.unsafe(nil), shift_size = T.unsafe(nil), level: T.unsafe(nil), progname: T.unsafe(nil), formatter: T.unsafe(nil), datetime_format: T.unsafe(nil), binmode: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), reraise_write_errors: T.unsafe(nil)); end
# source://logger//lib/logger.rb#598
def initialize(logdev, shift_age = T.unsafe(nil), shift_size = T.unsafe(nil), level: T.unsafe(nil), progname: T.unsafe(nil), formatter: T.unsafe(nil), datetime_format: T.unsafe(nil), binmode: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), reraise_write_errors: T.unsafe(nil), skip_header: T.unsafe(nil)); end
# Writes the given +msg+ to the log with no formatting;
# returns the number of characters written,
@@ -420,7 +437,7 @@ class Logger
#
# My message.
#
# source://logger//lib/logger.rb#689
# source://logger//lib/logger.rb#708
def <<(msg); end
# Creates a log entry, which may or may not be written to the log,
@@ -450,7 +467,7 @@ class Logger
# - #fatal.
# - #unknown.
#
# source://logger//lib/logger.rb#656
# source://logger//lib/logger.rb#675
def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil)); end
# Closes the logger; returns +nil+:
@@ -461,7 +478,7 @@ class Logger
#
# Related: Logger#reopen.
#
# source://logger//lib/logger.rb#736
# source://logger//lib/logger.rb#755
def close; end
# Returns the date-time format; see #datetime_format=.
@@ -482,7 +499,7 @@ class Logger
# Equivalent to calling #add with severity <tt>Logger::DEBUG</tt>.
#
# source://logger//lib/logger.rb#695
# source://logger//lib/logger.rb#714
def debug(progname = T.unsafe(nil), &block); end
# Sets the log level to Logger::DEBUG.
@@ -502,7 +519,7 @@ class Logger
# Equivalent to calling #add with severity <tt>Logger::ERROR</tt>.
#
# source://logger//lib/logger.rb#713
# source://logger//lib/logger.rb#732
def error(progname = T.unsafe(nil), &block); end
# Sets the log level to Logger::ERROR.
@@ -522,7 +539,7 @@ class Logger
# Equivalent to calling #add with severity <tt>Logger::FATAL</tt>.
#
# source://logger//lib/logger.rb#719
# source://logger//lib/logger.rb#738
def fatal(progname = T.unsafe(nil), &block); end
# Sets the log level to Logger::FATAL.
@@ -610,7 +627,7 @@ class Logger
# Equivalent to calling #add with severity <tt>Logger::INFO</tt>.
#
# source://logger//lib/logger.rb#701
# source://logger//lib/logger.rb#720
def info(progname = T.unsafe(nil), &block); end
# Sets the log level to Logger::INFO.
@@ -675,7 +692,7 @@ class Logger
# - #fatal.
# - #unknown.
#
# source://logger//lib/logger.rb#656
# source://logger//lib/logger.rb#675
def log(severity, message = T.unsafe(nil), progname = T.unsafe(nil)); end
# Program name to include in log messages.
@@ -711,8 +728,8 @@ class Logger
# # "E, [2022-05-12T14:21:27.596726 #22428] ERROR -- : one\n",
# # "E, [2022-05-12T14:23:05.847241 #22428] ERROR -- : three\n"]
#
# source://logger//lib/logger.rb#624
def reopen(logdev = T.unsafe(nil)); end
# source://logger//lib/logger.rb#642
def reopen(logdev = T.unsafe(nil), shift_age = T.unsafe(nil), shift_size = T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil)); end
# Logging severity threshold (e.g. <tt>Logger::INFO</tt>).
#
@@ -736,12 +753,12 @@ class Logger
# Equivalent to calling #add with severity <tt>Logger::UNKNOWN</tt>.
#
# source://logger//lib/logger.rb#725
# source://logger//lib/logger.rb#744
def unknown(progname = T.unsafe(nil), &block); end
# Equivalent to calling #add with severity <tt>Logger::WARN</tt>.
#
# source://logger//lib/logger.rb#707
# source://logger//lib/logger.rb#726
def warn(progname = T.unsafe(nil), &block); end
# Sets the log level to Logger::WARN.
@@ -770,18 +787,18 @@ class Logger
private
# source://logger//lib/logger.rb#758
# source://logger//lib/logger.rb#786
def format_message(severity, datetime, progname, msg); end
# source://logger//lib/logger.rb#745
# source://logger//lib/logger.rb#764
def format_severity(severity); end
# source://logger//lib/logger.rb#754
# source://logger//lib/logger.rb#782
def level_key; end
# Guarantee the existence of this ivar even when subclasses don't call the superclass constructor.
#
# source://logger//lib/logger.rb#750
# source://logger//lib/logger.rb#769
def level_override; end
end
@@ -834,9 +851,9 @@ class Logger::LogDevice
# @return [LogDevice] a new instance of LogDevice
#
# source://logger//lib/logger/log_device.rb#14
def initialize(log = T.unsafe(nil), shift_age: T.unsafe(nil), shift_size: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil), reraise_write_errors: T.unsafe(nil)); end
def initialize(log = T.unsafe(nil), shift_age: T.unsafe(nil), shift_size: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil), reraise_write_errors: T.unsafe(nil), skip_header: T.unsafe(nil)); end
# source://logger//lib/logger/log_device.rb#43
# source://logger//lib/logger/log_device.rb#38
def close; end
# Returns the value of attribute dev.
@@ -849,54 +866,60 @@ class Logger::LogDevice
# source://logger//lib/logger/log_device.rb#11
def filename; end
# source://logger//lib/logger/log_device.rb#53
def reopen(log = T.unsafe(nil)); end
# source://logger//lib/logger/log_device.rb#48
def reopen(log = T.unsafe(nil), shift_age: T.unsafe(nil), shift_size: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil)); end
# source://logger//lib/logger/log_device.rb#32
# source://logger//lib/logger/log_device.rb#27
def write(message); end
private
# source://logger//lib/logger/log_device.rb#143
# source://logger//lib/logger/log_device.rb#156
def add_log_header(file); end
# source://logger//lib/logger/log_device.rb#149
# source://logger//lib/logger/log_device.rb#162
def check_shift_log; end
# source://logger//lib/logger/log_device.rb#119
# source://logger//lib/logger/log_device.rb#132
def create_logfile(filename); end
# source://logger//lib/logger/log_device.rb#91
def fixup_mode(dev, filename); end
# source://logger//lib/logger/log_device.rb#104
def fixup_mode(dev); end
# source://logger//lib/logger/log_device.rb#135
# source://logger//lib/logger/log_device.rb#148
def handle_write_errors(mesg); end
# source://logger//lib/logger/log_device.rb#164
# source://logger//lib/logger/log_device.rb#177
def lock_shift_log; end
# source://logger//lib/logger/log_device.rb#106
# source://logger//lib/logger/log_device.rb#119
def open_logfile(filename); end
# source://logger//lib/logger/log_device.rb#76
# source://logger//lib/logger/log_device.rb#78
def set_dev(log); end
# source://logger//lib/logger/log_device.rb#193
# source://logger//lib/logger/log_device.rb#92
def set_file(shift_age, shift_size, shift_period_suffix); end
# source://logger//lib/logger/log_device.rb#207
def shift_log_age; end
# source://logger//lib/logger/log_device.rb#205
# source://logger//lib/logger/log_device.rb#232
def shift_log_file(shifted); end
# source://logger//lib/logger/log_device.rb#216
def shift_log_period(period_end); end
end
# :stopdoc:
#
# source://logger//lib/logger/log_device.rb#72
# source://logger//lib/logger/log_device.rb#69
Logger::LogDevice::MODE = T.let(T.unsafe(nil), Integer)
# source://logger//lib/logger/log_device.rb#74
# source://logger//lib/logger/log_device.rb#76
Logger::LogDevice::MODE_TO_CREATE = T.let(T.unsafe(nil), Integer)
# source://logger//lib/logger/log_device.rb#73
# source://logger//lib/logger/log_device.rb#72
Logger::LogDevice::MODE_TO_OPEN = T.let(T.unsafe(nil), Integer)
# source://logger//lib/logger/period.rb#4
@@ -923,7 +946,7 @@ Logger::Period::SiD = T.let(T.unsafe(nil), Integer)
# \Severity label for logging (max 5 chars).
#
# source://logger//lib/logger.rb#743
# source://logger//lib/logger.rb#762
Logger::SEV_LABEL = T.let(T.unsafe(nil), Array)
# Logging severity.

View File

@@ -5,6 +5,50 @@
# Please instead update this file by running `bin/tapioca gem minitest`.
# Kernel extensions for minitest
#
# source://minitest//lib/minitest/spec.rb#46
module Kernel
private
# Describe a series of expectations for a given target +desc+.
#
# Defines a test class subclassing from either Minitest::Spec or
# from the surrounding describe's class. The surrounding class may
# subclass Minitest::Spec manually in order to easily share code:
#
# class MySpec < Minitest::Spec
# # ... shared code ...
# end
#
# class TestStuff < MySpec
# it "does stuff" do
# # shared code available here
# end
# describe "inner stuff" do
# it "still does stuff" do
# # ...and here
# end
# end
# end
#
# For more information on getting started with writing specs, see:
#
# http://www.rubyinside.com/a-minitestspec-tutorial-elegant-spec-style-testing-that-comes-with-ruby-5354.html
#
# For some suggestions on how to improve your specs, try:
#
# https://betterspecs.org
#
# but do note that several items there are debatable or specific to
# rspec.
#
# For more information about expectations, see Minitest::Expectations.
#
# source://minitest//lib/minitest/spec.rb#82
def describe(desc, *additional_desc, &block); end
end
# The top-level namespace for Minitest. Also the location of the main
# runtime. See +Minitest.run+ for more information.
#
@@ -268,6 +312,11 @@ module Minitest::Assertions
# source://minitest//lib/minitest/assertions.rb#287
def assert_match(matcher, obj, msg = T.unsafe(nil)); end
# Assert that the mock verifies correctly and fail if not.
#
# source://minitest//lib/minitest/mock.rb#253
def assert_mock(mock, msg = T.unsafe(nil)); end
# Fails unless +obj+ is nil
#
# source://minitest//lib/minitest/assertions.rb#299
@@ -719,6 +768,254 @@ module Minitest::Compress
def compress(orig); end
end
# source://minitest//lib/minitest/spec.rb#41
class Minitest::Expectation < ::Struct
def ctx; end
def ctx=(_); end
# source://minitest//lib/minitest/spec.rb#25
def must_be(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_be_close_to(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_be_empty(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_be_instance_of(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_be_kind_of(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_be_nil(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_be_same_as(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_be_silent(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_be_within_delta(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_be_within_epsilon(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_equal(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_include(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_match(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_output(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_pattern_match(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_raise(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_respond_to(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_throw(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def must_verify(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def path_must_exist(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def path_wont_exist(*args, **_arg1); end
def target; end
def target=(_); end
# source://minitest//lib/minitest/spec.rb#25
def wont_be(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_be_close_to(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_be_empty(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_be_instance_of(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_be_kind_of(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_be_nil(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_be_same_as(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_be_within_delta(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_be_within_epsilon(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_equal(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_include(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_match(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_pattern_match(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#25
def wont_respond_to(*args, **_arg1); end
class << self
def [](*_arg0); end
def inspect; end
def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
# 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 or the new
# _(value) wrapper. For example:
#
# it "should still work in threads" do
# my_threaded_thingy do
# (1+1).must_equal 2 # bad
# assert_equal 2, 1+1 # good
# _(1 + 1).must_equal 2 # good
# value(1 + 1).must_equal 2 # good, also #expect
# _ { 1 + "1" }.must_raise TypeError # good
# end
# end
#
# source://minitest//lib/minitest/expectations.rb#20
module Minitest::Expectations
# source://minitest//lib/minitest/spec.rb#15
def must_be(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_be_close_to(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_be_empty(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_be_instance_of(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_be_kind_of(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_be_nil(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_be_same_as(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_be_silent(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_be_within_delta(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_be_within_epsilon(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_equal(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_include(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_match(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_output(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_pattern_match(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_raise(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_respond_to(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_throw(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def must_verify(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def path_must_exist(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def path_wont_exist(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_be(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_be_close_to(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_be_empty(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_be_instance_of(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_be_kind_of(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_be_nil(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_be_same_as(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_be_within_delta(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_be_within_epsilon(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_equal(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_include(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_match(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_pattern_match(*args, **_arg1); end
# source://minitest//lib/minitest/spec.rb#15
def wont_respond_to(*args, **_arg1); end
end
# Provides a simple set of guards that you can use in your tests
# to skip execution if it is not applicable. These methods are
# mixed into Test as both instance and class methods so you
@@ -778,6 +1075,106 @@ module Minitest::Guard
def windows?(platform = T.unsafe(nil)); end
end
# A simple and clean mock object framework.
#
# All mock objects are an instance of Mock
#
# source://minitest//lib/minitest/mock.rb#10
class Minitest::Mock
# @return [Mock] a new instance of Mock
#
# source://minitest//lib/minitest/mock.rb#53
def initialize(delegator = T.unsafe(nil)); end
# source://minitest//lib/minitest/mock.rb#34
def ===(*args, **kwargs, &b); end
# source://minitest//lib/minitest/mock.rb#125
def __call(name, data); end
def __respond_to?(*_arg0); end
# source://minitest//lib/minitest/mock.rb#34
def class(*args, **kwargs, &b); end
# Expect that method +name+ is called, optionally with +args+ (and
# +kwargs+ or a +blk+), and returns +retval+.
#
# @mock.expect(:meaning_of_life, 42)
# @mock.meaning_of_life # => 42
#
# @mock.expect(:do_something_with, true, [some_obj, true])
# @mock.do_something_with(some_obj, true) # => true
#
# @mock.expect(:do_something_else, true) do |a1, a2|
# a1 == "buggs" && a2 == :bunny
# end
#
# +args+ is compared to the expected args using case equality (ie, the
# '===' operator), allowing for less specific expectations.
#
# @mock.expect(:uses_any_string, true, [String])
# @mock.uses_any_string("foo") # => true
# @mock.verify # => true
#
# @mock.expect(:uses_one_string, true, ["foo"])
# @mock.uses_one_string("bar") # => raises MockExpectationError
#
# If a method will be called multiple times, specify a new expect for each one.
# They will be used in the order you define them.
#
# @mock.expect(:ordinal_increment, 'first')
# @mock.expect(:ordinal_increment, 'second')
#
# @mock.ordinal_increment # => 'first'
# @mock.ordinal_increment # => 'second'
# @mock.ordinal_increment # => raises MockExpectationError "No more expects available for :ordinal_increment"
#
# source://minitest//lib/minitest/mock.rb#96
def expect(name, retval, args = T.unsafe(nil), **kwargs, &blk); end
# source://minitest//lib/minitest/mock.rb#34
def inspect(*args, **kwargs, &b); end
# source://minitest//lib/minitest/mock.rb#34
def instance_eval(*args, **kwargs, &b); end
# source://minitest//lib/minitest/mock.rb#34
def instance_variables(*args, **kwargs, &b); end
# source://minitest//lib/minitest/mock.rb#155
def method_missing(sym, *args, **kwargs, &block); end
# source://minitest//lib/minitest/mock.rb#34
def object_id(*args, **kwargs, &b); end
# source://minitest//lib/minitest/mock.rb#34
def public_send(*args, **kwargs, &b); end
# @return [Boolean]
#
# source://minitest//lib/minitest/mock.rb#241
def respond_to?(sym, include_private = T.unsafe(nil)); end
# source://minitest//lib/minitest/mock.rb#34
def send(*args, **kwargs, &b); end
# source://minitest//lib/minitest/mock.rb#34
def to_s(*args, **kwargs, &b); end
# Verify that all methods were called as expected. Raises
# +MockExpectationError+ if the mock object was not called as
# expected.
#
# source://minitest//lib/minitest/mock.rb#145
def verify; end
private
# source://minitest//lib/minitest/mock.rb#34
def respond_to_missing?(*args, **kwargs, &b); end
end
# source://minitest//lib/minitest/parallel.rb#2
module Minitest::Parallel; end
@@ -1150,6 +1547,239 @@ class Minitest::Skip < ::Minitest::Assertion
def result_label; end
end
# Minitest::Spec -- The faster, better, less-magical spec framework!
#
# For a list of expectations, see Minitest::Expectations.
#
# source://minitest//lib/minitest/spec.rb#107
class Minitest::Spec < ::Minitest::Test
include ::Minitest::Spec::DSL::InstanceMethods
extend ::Minitest::Spec::DSL
# @return [Spec] a new instance of Spec
#
# source://minitest//lib/minitest/spec.rb#113
def initialize(name); end
class << self
# source://minitest//lib/minitest/spec.rb#109
def current; end
end
end
# Oh look! A Minitest::Spec::DSL module! Eat your heart out DHH.
#
# source://minitest//lib/minitest/spec.rb#121
module Minitest::Spec::DSL
# Define an 'after' action. Inherits the way normal methods should.
#
# NOTE: +type+ is ignored and is only there to make porting easier.
#
# Equivalent to Minitest::Test#teardown.
#
# source://minitest//lib/minitest/spec.rb#206
def after(_type = T.unsafe(nil), &block); end
# Define a 'before' action. Inherits the way normal methods should.
#
# NOTE: +type+ is ignored and is only there to make porting easier.
#
# Equivalent to Minitest::Test#setup.
#
# source://minitest//lib/minitest/spec.rb#192
def before(_type = T.unsafe(nil), &block); end
# source://minitest//lib/minitest/spec.rb#175
def children; end
# source://minitest//lib/minitest/spec.rb#271
def create(name, desc); end
# source://minitest//lib/minitest/spec.rb#292
def desc; end
# source://minitest//lib/minitest/spec.rb#171
def describe_stack; end
# Define an expectation with name +desc+. Name gets morphed to a
# proper test method name. For some freakish reason, people who
# write specs don't like class inheritance, so this goes way out of
# its way to make sure that expectations aren't inherited.
#
# This is also aliased to #specify and doesn't require a +desc+ arg.
#
# Hint: If you _do_ want inheritance, use minitest/test. You can mix
# and match between assertions and expectations as much as you want.
#
# source://minitest//lib/minitest/spec.rb#224
def it(desc = T.unsafe(nil), &block); end
# Essentially, define an accessor for +name+ with +block+.
#
# Why use let instead of def? I honestly don't know.
#
# @raise [ArgumentError]
#
# source://minitest//lib/minitest/spec.rb#248
def let(name, &block); end
# source://minitest//lib/minitest/spec.rb#284
def name; end
# source://minitest//lib/minitest/spec.rb#179
def nuke_test_methods!; end
# Register a new type of spec that matches the spec's description.
# This method can take either a Regexp and a spec class or a spec
# class and a block that takes the description and returns true if
# it matches.
#
# Eg:
#
# register_spec_type(/Controller$/, Minitest::Spec::Rails)
#
# or:
#
# register_spec_type(Minitest::Spec::RailsModel) do |desc|
# desc.superclass == ActiveRecord::Base
# end
#
# source://minitest//lib/minitest/spec.rb#147
def register_spec_type(*args, &block); end
# Figure out the spec class to use based on a spec's description. Eg:
#
# spec_type("BlahController") # => Minitest::Spec::Rails
#
# source://minitest//lib/minitest/spec.rb#161
def spec_type(desc, *additional); end
# Define an expectation with name +desc+. Name gets morphed to a
# proper test method name. For some freakish reason, people who
# write specs don't like class inheritance, so this goes way out of
# its way to make sure that expectations aren't inherited.
#
# This is also aliased to #specify and doesn't require a +desc+ arg.
#
# Hint: If you _do_ want inheritance, use minitest/test. You can mix
# and match between assertions and expectations as much as you want.
#
# source://minitest//lib/minitest/spec.rb#224
def specify(desc = T.unsafe(nil), &block); end
# Another lazy man's accessor generator. Made even more lazy by
# setting the name for you to +subject+.
#
# source://minitest//lib/minitest/spec.rb#267
def subject(&block); end
# source://minitest//lib/minitest/spec.rb#288
def to_s; end
class << self
# source://minitest//lib/minitest/spec.rb#336
def extended(obj); end
end
end
# Rdoc... why are you so dumb?
#
# source://minitest//lib/minitest/spec.rb#298
module Minitest::Spec::DSL::InstanceMethods
# Takes a value or a block and returns a value monad that has
# all of Expectations methods available to it.
#
# _(1 + 1).must_equal 2
#
# And for blocks:
#
# _ { 1 + "1" }.must_raise TypeError
#
# This method of expectation-based testing is preferable to
# straight-expectation methods (on Object) because it stores its
# test context, bypassing our hacky use of thread-local variables.
#
# NOTE: At some point, the methods on Object will be deprecated
# and then removed.
#
# It is also aliased to #value and #expect for your aesthetic
# pleasure:
#
# _(1 + 1).must_equal 2
# value(1 + 1).must_equal 2
# expect(1 + 1).must_equal 2
#
# source://minitest//lib/minitest/spec.rb#323
def _(value = T.unsafe(nil), &block); end
# source://minitest//lib/minitest/spec.rb#330
def before_setup; end
# Takes a value or a block and returns a value monad that has
# all of Expectations methods available to it.
#
# _(1 + 1).must_equal 2
#
# And for blocks:
#
# _ { 1 + "1" }.must_raise TypeError
#
# This method of expectation-based testing is preferable to
# straight-expectation methods (on Object) because it stores its
# test context, bypassing our hacky use of thread-local variables.
#
# NOTE: At some point, the methods on Object will be deprecated
# and then removed.
#
# It is also aliased to #value and #expect for your aesthetic
# pleasure:
#
# _(1 + 1).must_equal 2
# value(1 + 1).must_equal 2
# expect(1 + 1).must_equal 2
#
# source://minitest//lib/minitest/spec.rb#323
def expect(value = T.unsafe(nil), &block); end
# Takes a value or a block and returns a value monad that has
# all of Expectations methods available to it.
#
# _(1 + 1).must_equal 2
#
# And for blocks:
#
# _ { 1 + "1" }.must_raise TypeError
#
# This method of expectation-based testing is preferable to
# straight-expectation methods (on Object) because it stores its
# test context, bypassing our hacky use of thread-local variables.
#
# NOTE: At some point, the methods on Object will be deprecated
# and then removed.
#
# It is also aliased to #value and #expect for your aesthetic
# pleasure:
#
# _(1 + 1).must_equal 2
# value(1 + 1).must_equal 2
# expect(1 + 1).must_equal 2
#
# source://minitest//lib/minitest/spec.rb#323
def value(value = T.unsafe(nil), &block); end
end
# Contains pairs of matchers and Spec classes to be used to
# calculate the superclass of a top-level describe. This allows for
# automatically customizable spec types.
#
# See: register_spec_type and spec_type
#
# source://minitest//lib/minitest/spec.rb#129
Minitest::Spec::DSL::TYPES = T.let(T.unsafe(nil), Array)
# source://minitest//lib/minitest/spec.rb#343
Minitest::Spec::TYPES = T.let(T.unsafe(nil), Array)
# A reporter that gathers statistics about a test run. Does not do
# any IO because meant to be used as a parent class for a reporter
# that does.
@@ -1338,8 +1968,8 @@ end
#
# source://minitest//lib/minitest/test.rb#10
class Minitest::Test < ::Minitest::Runnable
include ::Minitest::Assertions
include ::Minitest::Reportable
include ::Minitest::Assertions
include ::Minitest::Test::LifecycleHooks
include ::Minitest::Guard
extend ::Minitest::Guard
@@ -1545,3 +2175,42 @@ end
# source://minitest//lib/minitest.rb#13
Minitest::VERSION = T.let(T.unsafe(nil), String)
# source://minitest//lib/minitest/mock.rb#1
class MockExpectationError < ::StandardError; end
# source://minitest//lib/minitest/spec.rb#3
class Module
# source://minitest//lib/minitest/spec.rb#4
def infect_an_assertion(meth, new_name, dont_flip = T.unsafe(nil)); end
end
# source://minitest//lib/minitest/spec.rb#348
class Object < ::BasicObject
include ::Kernel
include ::PP::ObjectMixin
include ::Minitest::Expectations
include ::MakeMakefile
# Add a temporary stubbed method replacing +name+ for the duration
# of the +block+. If +val_or_callable+ responds to #call, then it
# returns the result of calling it, otherwise returns the value
# as-is. If stubbed method yields a block, +block_args+ will be
# passed along. Cleans up the stub at the end of the +block+. The
# method +name+ must exist before stubbing.
#
# def test_stale_eh
# obj_under_test = Something.new
# refute obj_under_test.stale?
#
# Time.stub :now, Time.at(0) do
# assert obj_under_test.stale?
# end
# end
# --
# NOTE: keyword args in callables are NOT checked for correctness
# against the existing method. Too many edge cases to be worth it.
#
# source://minitest//lib/minitest/mock.rb#298
def stub(name, val_or_callable, *block_args, **block_kwargs, &block); end
end

View File

@@ -142,9 +142,11 @@ describe Domain::Inkbunny::Job::UpdatePostsJob do
file.reload
expect(file.md5_initial).to eq("fbeb553c483a346108beeada93d90086")
expect(file.state).to eq("ok")
expect(
SpecUtil.enqueued_job_args(Domain::Inkbunny::Job::StaticFileJob),
).to include(hash_including(file:, caused_by_entry: log_entries[0]))
job_args =
SpecUtil.enqueued_job_args(Domain::Inkbunny::Job::StaticFileJob)
expect(job_args).to include(
hash_including(file:, caused_by_entry: log_entries[0]),
)
end
it "throws an error when the md5_initial changes" do

View File

@@ -42,9 +42,7 @@ RSpec.describe Tasks::BlobFileMigrationTask do
result = migrator.run(start_sha256: "last")
expect(result).to eq(0)
expect(log_sink.string).to include(
"no saved progress found, starting from beginning",
)
expect(log_sink.string).to include("no saved progress")
expect(log_sink.string).to include("migrated 0 total blob entries")
end
end
@@ -71,9 +69,7 @@ RSpec.describe Tasks::BlobFileMigrationTask do
# Should skip the first 3 entries and migrate the remaining 2
expect(result).to be >= 0
expected_progress = HexUtil.bin2hex(blob_entries[2].sha256)
expect(log_sink.string).to include(
"resuming from saved progress: #{expected_progress}",
)
expect(log_sink.string).to include(expected_progress)
end
end

View File

@@ -76,14 +76,13 @@ class SpecUtil
.order(created_at: :asc)
.all
.map do |job|
args =
::ActiveJob::Arguments.deserialize(job.serialized_params["arguments"])
{
job: T.must(job.job_class).constantize,
queue: job.queue_name,
priority: job.priority,
args:
::ActiveJob::Arguments.deserialize(
job.serialized_params["arguments"],
),
args:,
good_job: job,
}
end