diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..3550a30f2 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f359a147..5eb29e31d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,40 @@ on: branches: [ master, bs4 ] workflow_dispatch: jobs: + sorbet: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16 + env: + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + RAILS_ENV: development + DATABASE_URL: postgres://postgres@localhost:5432/tmc-sorbet + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '4.0' + bundler-cache: true + - name: Type check + run: bundle exec srb tc + - name: Verify gem RBIs + run: bin/tapioca gem --verify + - name: Load database schema + run: bin/rake db:create db:schema:load + - name: Verify DSL RBIs + run: bin/tapioca dsl --verify + spec_v8: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 26fb03484..319f313a6 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -12,10 +12,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Ruby 3.0 + - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.0 + ruby-version: '4.0' - name: Cache gems uses: actions/cache@v4 with: @@ -29,3 +29,5 @@ jobs: bundle install --jobs 4 --retry 3 - name: Run RuboCop run: bundle exec rubocop + - name: Run Brakeman + run: bundle exec brakeman --no-pager --quiet --ensure-ignore-notes diff --git a/.gitignore b/.gitignore index e21f73f37..1f1a6f24a 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ # Ignore default active_storage storage/ + +# Nix / direnv +/.direnv diff --git a/.rubocop.yml b/.rubocop.yml index 9a57309cc..6a441525f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,16 +1,131 @@ +inherit_from: .rubocop_todo.yml + +plugins: + - rubocop-capybara + - rubocop-factory_bot + - rubocop-performance + - rubocop-rails + - rubocop-rspec + - rubocop-sorbet + - rubocop-thread_safety + inherit_gem: rubocop-rails_config: - config/rails.yml AllCops: SuggestExtensions: false - TargetRubyVersion: 2.5 + NewCops: enable + TargetRubyVersion: 4.0 + TargetRailsVersion: 8.1 Exclude: - 'ext/**/*' - 'db/**/*' - '**/vendor/**/*' +# rails_config sets DisabledByDefault; enabling a department opts in its default +# cops without turning off the rails_config ones. +Lint: + Enabled: true + +Security: + Enabled: true + +Performance: + Enabled: true + +Rails: + Enabled: true + +# Swagger docs are public and must skip ApplicationController's filters. +Rails/ApplicationController: + Exclude: + - 'app/controllers/api/v8/apidocs_controller.rb' + +# There is no ApplicationMailer to inherit from. +Rails/ApplicationMailer: + Enabled: false + +# SessionsHelper and AuthorizeCollectionHelper are controller mixins that hold request state. +Rails/HelperInstanceVariable: + Exclude: + - 'app/helpers/sessions_helper.rb' + - 'app/helpers/authorize_collection_helper.rb' + +# API v8 returns the not-found message, which find words differently from find_by!(id:). +Rails/FindById: + Enabled: false + +# Each association needs a data-retention decision, not a lint fix. +Rails/HasManyOrHasOneDependent: + Enabled: false + +# The UI is not localised. +Rails/I18nLocaleTexts: + Enabled: false + +# Each inverse_of needs testing against the association's callers. +Rails/InverseOf: + Enabled: false + +# Console-run maintenance methods and the init script installer print progress for the operator. +Rails/Output: + Exclude: + - 'app/models/kafka_batch_update_points.rb' + - 'lib/ruby_init_script.rb' + +# Brakeman's XSS checks cover html_safe and raw. +Rails/OutputSafety: + Enabled: false + +# Rake tasks here don't use the app, and loading it would require a database config. +Rails/RakeEnvironment: + Enabled: false + +# RemoteSandbox.all is a plain array of sandboxes, not a relation. +Rails/RedundantActiveRecordAllMethod: + AllowedReceivers: + - RemoteSandbox + +# Dropping the validation changes the error messages API clients receive. +Rails/RedundantPresenceValidationOnBelongsTo: + Enabled: false + +# Per-origin email templates live in config/email_templates, outside the view paths. +Rails/RenderInline: + Exclude: + - 'app/mailers/user_mailer.rb' + +# update_column/update_all skip callbacks on purpose for counters and bulk updates. +Rails/SkipsModelValidations: + Enabled: false + +# params.expect rejects shapes require/permit accept; each endpoint needs its own review. +Rails/StrongParametersExpect: + Enabled: false + +# Time.zone.now formats differently from Time.now; each call site needs its own review. +Rails/TimeZone: + Enabled: false + +# Needs unique indexes added in migrations, not a lint fix. +Rails/UniqueValidationWithoutIndex: + Enabled: false + +# Decision tables of literal or constant results (Solution#visible_to?) read better unmerged. +Lint/DuplicateBranch: + IgnoreLiteralBranches: true + IgnoreConstantBranches: true + +# Would rewrite the Swagger DSL's `key :'$ref'` to `key :$ref`. +Lint/SymbolConversion: + Enabled: false + # Style +# Ruby 3.1+ shorthand (`{ x: }`) would rewrite ~600 hashes; not worth the churn. +Style/HashSyntax: + EnforcedShorthandSyntax: either + Style/StringLiterals: Enabled: true EnforcedStyle: single_quotes @@ -47,5 +162,192 @@ Metrics/ParameterLists: Metrics/PerceivedComplexity: Enabled: false -Performance/RegexpMatch: - Enabled: false \ No newline at end of file +Style/MapToHash: + Enabled: true + +# Spec-only plugins: bug-finding cops on, style cops off. +RSpec: + Include: + - 'spec/**/*.rb' + +Capybara: + Include: + - 'spec/**/*.rb' + +FactoryBot: + Include: + - 'spec/**/*.rb' + +RSpec/Be: + Enabled: true + +RSpec/BeNil: + Enabled: true + +RSpec/ChangeByZero: + Enabled: true + +RSpec/DuplicatedMetadata: + Enabled: true + +RSpec/EmptyExampleGroup: + Enabled: true + +RSpec/ExpectActual: + Enabled: true + +RSpec/ExpectOutput: + Enabled: true + +RSpec/Focus: + Enabled: true + +RSpec/HooksBeforeExamples: + Enabled: true + +RSpec/IdenticalEqualityAssertion: + Enabled: true + +RSpec/LeakyLocalVariable: + Enabled: true + +RSpec/MissingExampleGroupArgument: + Enabled: true + +RSpec/MissingExpectationTargetMethod: + Enabled: true + +RSpec/NoExpectationExample: + Enabled: true + # Shared helpers that hold the expectations. + AllowedPatterns: + - ^expect_ + - ^assert_ + - ^should_be_ + - ^(all|users)_own_subs$ + - ^no_other_ + - ^two_(subs|courses)_by_ + - ^course_from_different_template$ + +RSpec/NotToNot: + Enabled: true + +RSpec/OverwritingSetup: + Enabled: true + +RSpec/PendingWithoutReason: + Enabled: true + +RSpec/RepeatedDescription: + Enabled: true + +RSpec/RepeatedExample: + Enabled: true + +RSpec/RepeatedExampleGroupBody: + Enabled: true + +RSpec/RepeatedExampleGroupDescription: + Enabled: true + +RSpec/RepeatedIncludeExample: + Enabled: true + +RSpec/RepeatedSubjectCall: + Enabled: true + +RSpec/ReturnFromStub: + Enabled: true + +RSpec/SkipBlockInsideExample: + Enabled: true + +RSpec/UnspecifiedException: + Enabled: true + +RSpec/VoidExpect: + Enabled: true + +Capybara/CurrentPathExpectation: + Enabled: true + +Capybara/RSpec/NegationMatcherAfterVisit: + Enabled: true + +Capybara/VisibilityMatcher: + Enabled: true + +FactoryBot/AttributeDefinedStatically: + Enabled: true + +FactoryBot/FactoryAssociationWithStrategy: + Enabled: true + +FactoryBot/FactoryClassName: + Enabled: true + +FactoryBot/RedundantFactoryOption: + Enabled: true + +# Specs and standalone scripts run single-threaded. +ThreadSafety: + Enabled: true + Include: + - 'app/**/*.rb' + - 'lib/**/*.rb' + - 'config/**/*.rb' + +Sorbet/ValidSigil: + Enabled: true + +Sorbet/EnforceSigilOrder: + Enabled: true + +Sorbet/StrictSigil: + Enabled: true + Include: + - 'app/**/*.rb' + - 'lib/**/*.rb' + - 'config/**/*.rb' + Exclude: + # DSL files read with instance_eval; Sorbet ignores them. + - 'config/extra_fields/*' + +Sorbet/EnforceSignatures: + Enabled: true + Include: + - 'app/**/*.rb' + - 'lib/**/*.rb' + - 'config/**/*.rb' + Exclude: + - 'config/extra_fields/*' + # Sigs live in sorbet/rbi/shims/lib_natsort.rbi. + - 'lib/natsort.rb' + +Sorbet/SignatureBuildOrder: + Enabled: true + +Sorbet/ConstantsFromStrings: + Enabled: true + +# Cops that catch code a Rails upgrade breaks or deprecates. +Rails/EnumSyntax: + Enabled: true + +Rails/EnumHash: + Enabled: true + +Rails/DeprecatedActiveModelErrorsMethods: + Enabled: true + +Rails/HttpPositionalArguments: + Enabled: true + +Rails/TransactionExitStatement: + Enabled: true + +Rails/ActionOrder: + Enabled: true + +Rails/ActiveRecordCallbacksOrder: + Enabled: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..03fd4ad91 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,30 @@ +# This configuration was generated by +# `rubocop --auto-gen-config --exclude-limit 1000 --no-auto-gen-timestamp` +# using RuboCop version 1.92.2. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 10 +ThreadSafety/ClassInstanceVariable: + Exclude: + - 'app/models/extra_field.rb' + - 'app/models/remote_sandbox.rb' + - 'app/models/site_setting.rb' + - 'lib/app_secrets.rb' + - 'lib/background_task_registry.rb' + - 'lib/tailoring.rb' + +# Offense count: 3 +# Configuration parameters: AllowCallWithBlock. +ThreadSafety/DirChdir: + Exclude: + - 'app/background_tasks/rust_langs_downloader_task.rb' + - 'app/models/course.rb' + - 'lib/doc_gen/shell_session.rb' + +# Offense count: 1 +ThreadSafety/NewThread: + Exclude: + - 'app/background_tasks/uncomputed_unlock_computor_task_backup.rb' diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 000000000..7919852fe --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +4.0.9 diff --git a/Contributing.md b/Contributing.md index 51b4490ff..75b431d1d 100644 --- a/Contributing.md +++ b/Contributing.md @@ -4,6 +4,14 @@ Check http://testmycode.github.io for contribution guidelines! +## Git hooks + +The Nix dev shell (`nix develop`) installs [lefthook](https://lefthook.dev) hooks. +On commit, `rubocop --autocorrect` runs on the staged Ruby files and the fixes are re-staged. +It never blocks a commit. Skip it with `LEFTHOOK=0 git commit ...`. + +Before opening a PR, run `bin/branch-ready-checks` (rubocop, brakeman, `srb tc`, and the tapioca verifications; needs a database). + ## Tips running tests It may take some time to run whole test suite, thus while developing one @@ -13,6 +21,9 @@ file. ##### To run all code style validations `bundle exec rubocop` +##### To run the security scan +`bundle exec brakeman`. Record a reviewed false positive, with a note saying why it is safe, through `bundle exec brakeman -I`. + ##### To run all tests `rvmsudo rake spec` diff --git a/Dockerfile b/Dockerfile index 8d88a267d..f35f69d58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM eu.gcr.io/moocfi-public/tmc-server-base:latest LABEL name=tmc-server RUN apt-get update \ - && apt-get -y install curl gnupg nodejs chromium \ + && apt-get -y install curl gnupg nodejs chromium libvips42t64 \ && rm -rf /var/lib/apt/lists/* ADD Gemfile /app/Gemfile diff --git a/DockerfileBase b/DockerfileBase index fabdc92f5..e2c7d28e1 100644 --- a/DockerfileBase +++ b/DockerfileBase @@ -1,24 +1,13 @@ -FROM ruby:3.3 -LABEL name tmc-server-base +FROM ruby:4.0-trixie +LABEL name=tmc-server-base -ENV PHANTOMJS_VERSION 2.1.1 -ENV MAVEN_VERSION 3.3.9 -ENV MAVEN_HOME /usr/share/maven -ENV M3_HOME /usr/share/maven +ENV MAVEN_HOME=/usr/share/maven +ENV M3_HOME=/usr/share/maven -RUN wget --no-check-certificate -O /tmp/phantomjs.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 && \ - tar -xjf /tmp/phantomjs.tar.bz2 -C /tmp && \ - rm -f /tmp/phantomjs.tar.bz2 && \ - mkdir -p /srv/var && \ - mv /tmp/phantomjs* /srv/var/phantomjs && \ - ln -s /srv/var/phantomjs/bin/phantomjs /usr/bin/phantomjs && \ - apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs vim lsof wget libfreetype6 libfontconfig bzip2 libfreetype6 libfontconfig bzip2 zip openjdk-17-jdk postgresql-client check python3 maven && \ +RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs vim lsof wget bzip2 zip openjdk-21-jdk postgresql-client check python3 maven && \ rm -rf /var/lib/apt/lists/* && \ mkdir /app &&\ git config --global user.name "TmcTest" && \ git config --global user.email "tmc@example.com" -# Phantomjs workaround -ENV OPENSSL_CONF /dev/null - WORKDIR /app diff --git a/Gemfile b/Gemfile index 483ac3252..4e447df03 100644 --- a/Gemfile +++ b/Gemfile @@ -4,77 +4,89 @@ source 'https://rubygems.org' # An alternative when rubygems.org is down # source 'http://production.cf.rubygems.org/' -gem 'rails', '~> 7.1', '>= 7.1.3.4' +gem 'rails', '~> 8.1.4' -gem 'mini_racer', '~> 0.19.2' -gem 'activerecord-import', '~> 1.7' -gem 'activerecord-session_store', '~> 2.1' -gem 'argon2', '~> 2.3' -gem 'bootstrap', '~> 4.6' # Held back to 4.6 -gem 'cancancan', '~> 3.6', '>= 3.6.1' -gem 'doorkeeper', '~> 5.7', '>= 5.7.1' -gem 'doorkeeper-openid_connect', '~> 1.8', '>= 1.8.9' -gem 'faraday', '~> 2.14' +gem 'mini_racer', '~> 0.22' +gem 'activerecord-import', '~> 3.0' +gem 'activerecord-session_store', '~> 2.3' +gem 'argon2', '~> 2.3', '>= 2.3.3' +gem 'bootstrap', '~> 4.6' # 5.x drops the jQuery plugins and markup the views rely on +gem 'cancancan', '~> 3.7' +gem 'doorkeeper', '~> 5.9', '>= 5.9.9' +gem 'doorkeeper-openid_connect', '~> 2.1' +gem 'faraday', '~> 2.15' gem 'file_validators', '~> 3.0' # Used to validate organization logo -gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.8' +gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.9' gem 'gravtastic', '~> 3.2', '>= 3.2.6' # Used to display user avatars -gem 'image_processing', '~> 1.12', '>= 1.12.2' # Used by active_storage to make logo 100x100 on the fly -gem 'logstasher', '~> 2.1', '>= 2.1.5' -gem 'natcmp', '~> 1.4', '>= 1.4.3' -gem 'newrelic_rpm', '~> 9.11' +gem 'image_processing', '~> 2.2' # Active Storage variants of organization logos +gem 'logstasher', '~> 3.0' +gem 'natcmp', '~> 1.4', '>= 1.4.4' +gem 'newrelic_rpm', '~> 10.9' gem 'pdfkit', '~> 0.8.7.3', require: false -gem 'pg', '~> 1.5', '>= 1.5.6' -gem 'pghero', '~> 3.5' -gem 'rack-attack', '~> 6.7', require: false -gem 'rack-cors', '~> 2.0', '>= 2.0.2' +gem 'pg', '~> 1.7' +gem 'pghero', '~> 4.1' +gem 'rack-attack', '~> 6.8', require: false +gem 'rack-cors', '~> 3.0' gem 'rack-timeout', '~> 0.7.0' -gem 'rack-mini-profiler', '~> 3.3', '>= 3.3.1' +gem 'rack-mini-profiler', '~> 5.0' gem 'rake', '~> 13.2', '>= 13.2.1' -gem 'responders', '~> 3.1', '>= 3.1.1' +gem 'responders', '~> 3.2' gem 'rest-client', '~> 2.1', require: false +gem 'ruby-vips', '~> 2.3', require: false # Active Storage loads it on first use, so booting needs no libvips gem 'swagger-blocks', '~> 3.0' -gem 'sassc-rails', '~> 2.1', '>= 2.1.2' +gem 'dartsass-sprockets', '~> 3.2' gem 'xml-simple', '~> 1.1', '>= 1.1.9', require: false -gem 'cgi', '~> 0.3.6' +gem 'cgi', '~> 0.5' +gem 'sorbet-runtime', '~> 0.6.13640' -gem 'hiredis', '~> 0.6.3' # Redis for caching -gem 'readthis', '~> 2.2' # Redis for caching -gem 'redis', '~> 4.5' # Redis for caching (TODO: Remove and migrate to rails cache) +# Bundled rather than default gems from Ruby 3.4/4.0 on, so Bundler must list them +gem 'benchmark', '~> 0.5.0' +gem 'csv', '~> 3.3', '>= 3.3.7' +gem 'ostruct', '~> 0.6.3' + +gem 'redis', '~> 6.0' # Rails.cache and Rack::MiniProfiler in production group :assets do - gem 'jquery-rails', '~> 4.6' - gem 'sprockets-rails', '~> 3.5', '>= 3.5.1', require: 'sprockets/railtie' - gem 'uglifier', '~> 4.2' + gem 'jquery-rails', '~> 4.6', '>= 4.6.1' + gem 'sprockets-rails', '~> 3.5', '>= 3.5.2', require: 'sprockets/railtie' + gem 'uglifier', '~> 4.2', '>= 4.2.1' end group :development, :test do gem 'capybara', '~> 3.40' - gem 'factory_bot_rails', '~> 6.4', '>= 6.4.3' - gem 'puma', '~> 6.4', '>= 6.4.2' - gem 'thin', '~> 1.8', '>= 1.8.2' # A transitive dependency, this forces the latest version + gem 'factory_bot_rails', '~> 6.5' + gem 'puma', '~> 8.0' # gem 'passenger', '~> 5.0', require: "phusion_passenger/rack_handler" - gem 'poltergeist', '~> 1.18', '>= 1.18.1' + gem 'cuprite', '~> 0.20' gem 'rspec', '~> 3.13' - gem 'rspec-activemodel-mocks', '~> 1.2' + gem 'rspec-activemodel-mocks', '~> 1.3' gem 'rspec-core', '~> 3.13' - gem 'rspec-rails', '~> 6.1', '>= 6.1.3' + gem 'rspec-rails', '~> 8.1' gem 'rails-controller-testing', '~> 1.0', '>= 1.0.5' # gem 'selenium-webdriver', '~> 2.44.0' - gem 'irb', '~> 1.14' - gem 'brakeman', '~> 6.1', '>= 6.1.2', require: false + gem 'irb', '~> 1.18' + gem 'brakeman', '~> 8.1', require: false gem 'bundler-audit', '~> 0.9.1' - gem 'pry', '~> 0.14.2' - gem 'pry-byebug', '~> 3.10', '>= 3.10.1' + gem 'pry', '~> 0.16' + gem 'pry-byebug', '~> 3.12' gem 'pry-rails', '~> 0.3.11' - gem 'database_cleaner', '~> 2.0', '>= 2.0.2' - gem 'launchy', '~> 3.0', '>= 3.0.1' # for capybara's save_and_open_page - gem 'mimic', '~> 0.4.4' + gem 'database_cleaner', '~> 2.1' + gem 'launchy', '~> 3.1' # for capybara's save_and_open_page gem 'railroady', '~> 1.6' # for doc/diagrams - gem 'rubocop', '~> 1.65', require: false - gem 'rubocop-rails_config', '~> 1.16' # Rubocop locked - gem 'ruby-prof', '~> 1.7' # for performance tests - gem 'simplecov', '~> 0.22.0', require: false + gem 'rubocop', '~> 1.92', require: false + gem 'rubocop-capybara', '~> 3.1', require: false + gem 'rubocop-factory_bot', '~> 2.28', require: false + gem 'rubocop-performance', '~> 1.27', require: false + gem 'rubocop-rails', '~> 2.38', require: false + gem 'rubocop-rails_config', '~> 1.17' + gem 'rubocop-rspec', '~> 3.10', require: false + gem 'rubocop-sorbet', '~> 0.17', require: false + gem 'rubocop-thread_safety', '~> 0.8', require: false + gem 'simplecov', '~> 1.3', require: false + gem 'sorbet', '~> 0.6.13640', require: false + gem 'spoom', '~> 1.8', require: false + gem 'tapioca', '~> 0.20.0', require: false end group :development do @@ -82,5 +94,5 @@ group :development do end group :test do - gem 'json-schema', '~> 4.3' + gem 'json-schema', '~> 6.2' end diff --git a/Gemfile.lock b/Gemfile.lock index 46ed5c02e..265b7b576 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,111 +1,111 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) + action_text-trix (2.1.19) + railties + actioncable (8.1.4.1) + actionpack (= 8.1.4.1) + activesupport (= 8.1.4.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.3.4) - actionpack (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (8.1.4.1) + actionpack (= 8.1.4.1) + activejob (= 8.1.4.1) + activerecord (= 8.1.4.1) + activestorage (= 8.1.4.1) + activesupport (= 8.1.4.1) + mail (>= 2.8.0) + actionmailer (8.1.4.1) + actionpack (= 8.1.4.1) + actionview (= 8.1.4.1) + activejob (= 8.1.4.1) + activesupport (= 8.1.4.1) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.3.4) - actionview (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionpack (8.1.4.1) + actionview (= 8.1.4.1) + activesupport (= 8.1.4.1) nokogiri (>= 1.8.5) - racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3.4) - actionpack (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + useragent (~> 0.16) + actiontext (8.1.4.1) + action_text-trix (~> 2.1.15) + actionpack (= 8.1.4.1) + activerecord (= 8.1.4.1) + activestorage (= 8.1.4.1) + activesupport (= 8.1.4.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.4) - activesupport (= 7.1.3.4) + actionview (8.1.4.1) + activesupport (= 8.1.4.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) - rails-html-sanitizer (~> 1.6) - activejob (7.1.3.4) - activesupport (= 7.1.3.4) + rails-html-sanitizer (~> 1.6, >= 1.7.2) + activejob (8.1.4.1) + activesupport (= 8.1.4.1) globalid (>= 0.3.6) - activemodel (7.1.3.4) - activesupport (= 7.1.3.4) - activerecord (7.1.3.4) - activemodel (= 7.1.3.4) - activesupport (= 7.1.3.4) + activemodel (8.1.4.1) + activesupport (= 8.1.4.1) + activerecord (8.1.4.1) + activemodel (= 8.1.4.1) + activesupport (= 8.1.4.1) timeout (>= 0.4.0) - activerecord-import (1.7.0) - activerecord (>= 4.2) - activerecord-session_store (2.1.0) - actionpack (>= 6.1) + activerecord-import (3.0.1) activerecord (>= 6.1) + activerecord-session_store (2.3.0) + actionpack (>= 7.1) + activerecord (>= 7.1) cgi (>= 0.3.6) - multi_json (~> 1.11, >= 1.11.2) rack (>= 2.0.8, < 4) - railties (>= 6.1) - activestorage (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activesupport (= 7.1.3.4) + railties (>= 7.1) + activestorage (8.1.4.1) + actionpack (= 8.1.4.1) + activejob (= 8.1.4.1) + activerecord (= 8.1.4.1) + activesupport (= 8.1.4.1) marcel (~> 1.0) - activesupport (7.1.3.4) + activesupport (8.1.4.1) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) - argon2 (2.3.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.9.2) + public_suffix (>= 2.0.2, < 8.0) + argon2 (2.3.3) ffi (~> 1.15) ffi-compiler (~> 1.0) - ast (2.4.2) - autoprefixer-rails (10.4.16.0) + ast (2.4.3) + autoprefixer-rails (10.6.1.0) execjs (~> 2) - base64 (0.2.0) - bigdecimal (3.1.8) - bootstrap (4.6.2) + base64 (0.3.0) + benchmark (0.5.0) + bigdecimal (4.1.3) + bootstrap (4.6.2.1) autoprefixer-rails (>= 9.1.0) popper_js (>= 1.16.1, < 2) - sassc-rails (>= 2.0.0) - brakeman (6.1.2) + brakeman (8.1.0) racc builder (3.3.0) - bundler-audit (0.9.1) - bundler (>= 1.2.0, < 3) + bundler-audit (0.9.3) + bundler (>= 1.2.0) thor (~> 1.0) - byebug (11.1.3) - cancancan (3.6.1) + byebug (13.0.0) + reline (>= 0.6.0) + cancancan (3.7.0) capybara (3.40.0) addressable matrix @@ -115,461 +115,559 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - cgi (0.3.6) - childprocess (5.0.0) - cliver (0.3.2) + cgi (0.5.2) + childprocess (5.1.0) + logger (~> 1.5) coderay (1.1.3) - concurrent-ruby (1.3.3) - connection_pool (2.4.1) - crass (1.0.6) - daemons (1.4.1) - database_cleaner (2.0.2) + concurrent-ruby (1.3.8) + connection_pool (3.0.2) + crass (1.0.8) + csv (3.3.7) + cuprite (0.20) + capybara (~> 3.0) + ferrum (~> 0.20.1) + dartsass-sprockets (3.2.1) + railties (>= 4.0.0) + sassc-embedded (~> 1.80.1) + sprockets (> 3.0) + sprockets-rails + tilt + database_cleaner (2.1.0) database_cleaner-active_record (>= 2, < 3) - database_cleaner-active_record (2.2.0) + database_cleaner-active_record (2.2.2) activerecord (>= 5.a) - database_cleaner-core (~> 2.0.0) - database_cleaner-core (2.0.1) - date (3.3.4) - diff-lcs (1.5.1) - docile (1.4.1) - domain_name (0.6.20240107) - doorkeeper (5.7.1) + database_cleaner-core (~> 2.0) + database_cleaner-core (2.1.0) + date (3.6.0) + diff-lcs (1.6.2) + domain_name (0.7.20261031) + doorkeeper (5.9.9) railties (>= 5) - doorkeeper-openid_connect (1.8.9) - doorkeeper (>= 5.5, < 5.8) + doorkeeper-openid_connect (2.1.0) + doorkeeper (>= 5.5, < 7.0) jwt (>= 2.5) - drb (2.2.1) - erubi (1.13.0) - eventmachine (1.2.7) - execjs (2.9.1) - factory_bot (6.4.6) - activesupport (>= 5.0.0) - factory_bot_rails (6.4.3) - factory_bot (~> 6.4) - railties (>= 5.0.0) - faraday (2.14.0) - faraday-net_http (>= 2.0, < 3.5) + drb (2.2.3) + erb (6.0.7) + erubi (1.13.1) + execjs (2.10.2) + json (>= 2) + factory_bot (6.6.0) + activesupport (>= 6.1.0) + factory_bot_rails (6.5.1) + factory_bot (~> 6.5) + railties (>= 6.1.0) + faraday (2.15.1) + faraday-net_http (>= 2.0, < 3.6) json logger - faraday-net_http (3.4.2) + faraday-net_http (3.5.0) net-http (~> 0.5) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-aarch64-linux-musl) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm-linux-musl) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86-linux-musl) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) - ffi (1.17.0-x86_64-linux-musl) - ffi-compiler (1.3.2) + ferrum (0.20.1) + addressable (~> 2.5) + base64 (~> 0.2) + concurrent-ruby (~> 1.1) + websocket-driver (~> 0.7) + ffi (1.17.4-aarch64-linux-gnu) + ffi (1.17.4-aarch64-linux-musl) + ffi (1.17.4-arm64-darwin) + ffi (1.17.4-x86_64-darwin) + ffi (1.17.4-x86_64-linux-gnu) + ffi (1.17.4-x86_64-linux-musl) + ffi-compiler (1.4.3) ffi (>= 1.15.5) rake file_validators (3.0.0) activemodel (>= 3.2) mime-types (>= 1.0) - font-awesome-rails (4.7.0.8) - railties (>= 3.2, < 8.0) - globalid (1.2.1) + font-awesome-rails (4.7.0.9) + railties (>= 3.2, < 9.0) + globalid (1.4.0) activesupport (>= 6.1) + google-protobuf (4.36.2-aarch64-linux-gnu) + bigdecimal + rake (~> 13.3) + google-protobuf (4.36.2-aarch64-linux-musl) + bigdecimal + rake (~> 13.3) + google-protobuf (4.36.2-arm64-darwin) + bigdecimal + rake (~> 13.3) + google-protobuf (4.36.2-x86_64-darwin) + bigdecimal + rake (~> 13.3) + google-protobuf (4.36.2-x86_64-linux-gnu) + bigdecimal + rake (~> 13.3) + google-protobuf (4.36.2-x86_64-linux-musl) + bigdecimal + rake (~> 13.3) gravtastic (3.2.6) - hiredis (0.6.3) http-accept (1.7.0) - http-cookie (1.0.6) + http-cookie (1.1.6) domain_name (~> 0.5) - i18n (1.14.5) + i18n (1.15.2) concurrent-ruby (~> 1.0) - image_processing (1.13.0) - mini_magick (>= 4.9.5, < 5) - ruby-vips (>= 2.0.17, < 3) - io-console (0.7.2) - irb (1.14.0) + image_processing (2.2.0) + io-console (0.9.5) + irb (1.18.0) + pp (>= 0.6.0) + prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - jquery-rails (4.6.0) + jquery-rails (4.6.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.7.2) - json-schema (4.3.1) - addressable (>= 2.8) - jwt (2.8.2) + json (3.1.0) + json-schema (6.2.1) + addressable (~> 2.8) + bigdecimal (>= 3.1, < 5) + jwt (3.3.0) base64 - language_server-protocol (3.17.0.3) - launchy (3.0.1) + kramdown (2.5.2) + rexml (>= 3.4.4) + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + language_server-protocol (3.17.0.6) + launchy (3.1.1) addressable (~> 2.8) childprocess (~> 5.0) + logger (~> 1.6) letter_opener (1.10.0) launchy (>= 2.2, < 4) - libv8-node (24.12.0.1) libv8-node (24.12.0.1-aarch64-linux) libv8-node (24.12.0.1-aarch64-linux-musl) libv8-node (24.12.0.1-arm64-darwin) libv8-node (24.12.0.1-x86_64-darwin) libv8-node (24.12.0.1-x86_64-linux) libv8-node (24.12.0.1-x86_64-linux-musl) - logger (1.6.0) - logstasher (2.1.5) - activesupport (>= 5.2) + lint_roller (1.1.0) + logger (1.7.0) + logstasher (3.0.0) + activesupport (>= 7.0) request_store - loofah (2.22.0) + loofah (2.25.3) crass (~> 1.0.2) - nokogiri (>= 1.12.0) - mail (2.8.1) + nokogiri (>= 1.19.5) + mail (2.9.1) + logger mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.4) - matrix (0.4.2) + marcel (1.2.1) + matrix (0.4.3) method_source (1.1.0) - mime-types (3.5.2) - mime-types-data (~> 3.2015) - mime-types-data (3.2024.0702) - mimic (0.4.4) - json - plist (~> 3.1.0) - rack - sinatra - thin - mini_magick (4.13.2) + mime-types (3.7.0) + logger + mime-types-data (~> 3.2025, >= 3.2025.0507) + mime-types-data (3.2026.1103) mini_mime (1.1.5) - mini_racer (0.19.2) + mini_racer (0.22.2) libv8-node (~> 24.12.0.1) - minitest (5.24.1) - multi_json (1.15.0) - mustermann (3.0.0) - ruby2_keywords (~> 0.0.1) - mutex_m (0.2.0) - natcmp (1.4.3) - net-http (0.8.0) + minitest (6.1.0) + drb (~> 2.0) + prism (>= 1.5, < 3) + natcmp (1.4.4) + net-http (0.10.0) + net-protocol (>= 0.3.0) uri (>= 0.11.1) - net-imap (0.4.14) + net-imap (0.6.8) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.2) + net-protocol (0.4.0) timeout - net-smtp (0.5.0) + net-smtp (0.5.2) net-protocol netrc (0.11.0) - newrelic_rpm (9.12.0) - nio4r (2.7.3) - nokogiri (1.16.7-aarch64-linux) + newrelic_rpm (10.9.1) + logger + nio4r (2.7.5) + nokogiri (1.19.7-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-arm-linux) + nokogiri (1.19.7-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.19.7-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86-linux) + nokogiri (1.19.7-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.19.7-x86_64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.19.7-x86_64-linux-musl) racc (~> 1.4) - parallel (1.25.1) - parser (3.3.4.0) + ostruct (0.6.3) + parallel (2.3.0) + parser (3.3.13.0) ast (~> 2.4.1) racc pdfkit (0.8.7.3) - pg (1.5.7) - pghero (3.5.0) - activerecord (>= 6) - plist (3.1.0) - poltergeist (1.18.1) - capybara (>= 2.1, < 4) - cliver (~> 0.3.1) - websocket-driver (>= 0.2.0) + pg (1.7.0-aarch64-linux) + pg (1.7.0-aarch64-linux-musl) + pg (1.7.0-arm64-darwin) + pg (1.7.0-x86_64-darwin) + pg (1.7.0-x86_64-linux) + pg (1.7.0-x86_64-linux-musl) + pghero (4.1.0) + activerecord (>= 7.2) popper_js (1.16.1) - pry (0.14.2) + pp (0.6.4) + prettyprint + prettyprint (0.2.1) + prism (1.9.0) + pry (0.16.1) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.10.1) - byebug (~> 11.0) - pry (>= 0.13, < 0.15) + reline (>= 0.6.0) + pry-byebug (3.12.0) + byebug (~> 13.0) + pry (>= 0.13, < 0.17) pry-rails (0.3.11) pry (>= 0.13.0) - psych (5.1.2) - stringio - public_suffix (6.0.1) - puma (6.4.2) + public_suffix (7.0.5) + puma (8.0.2) nio4r (~> 2.0) - racc (1.8.0) - rack (2.2.9) - rack-attack (6.7.0) + racc (1.8.1) + rack (3.2.8) + rack-attack (6.8.0) rack (>= 1.0, < 4) - rack-cors (2.0.2) - rack (>= 2.0.0) - rack-mini-profiler (3.3.1) + rack-cors (3.0.0) + logger + rack (>= 3.0.14) + rack-mini-profiler (5.0.0) rack (>= 1.2.0) - rack-protection (3.2.0) + rack-session (2.1.2) base64 (>= 0.1.0) - rack (~> 2.2, >= 2.2.4) - rack-session (1.0.2) - rack (< 3) - rack-test (2.1.0) + rack (>= 3.0.0) + rack-test (2.3.0) rack (>= 1.3) rack-timeout (0.7.0) - rackup (1.0.0) - rack (< 3) - webrick + rackup (2.3.1) + rack (>= 3) railroady (1.6.0) - rails (7.1.3.4) - actioncable (= 7.1.3.4) - actionmailbox (= 7.1.3.4) - actionmailer (= 7.1.3.4) - actionpack (= 7.1.3.4) - actiontext (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activemodel (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + rails (8.1.4.1) + actioncable (= 8.1.4.1) + actionmailbox (= 8.1.4.1) + actionmailer (= 8.1.4.1) + actionpack (= 8.1.4.1) + actiontext (= 8.1.4.1) + actionview (= 8.1.4.1) + activejob (= 8.1.4.1) + activemodel (= 8.1.4.1) + activerecord (= 8.1.4.1) + activestorage (= 8.1.4.1) + activesupport (= 8.1.4.1) bundler (>= 1.15.0) - railties (= 7.1.3.4) + railties (= 8.1.4.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.2.0) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) - loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) - irb + rails-html-sanitizer (1.7.2) + loofah (~> 2.25, >= 2.25.3) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.1.4.1) + actionpack (= 8.1.4.1) + activesupport (= 8.1.4.1) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.2.1) - rdoc (6.7.0) - psych (>= 4.0.0) - readthis (2.2.0) - connection_pool (~> 2.1) - redis (>= 3.0, < 5.0) - redis (4.8.1) - regexp_parser (2.9.2) - reline (0.5.9) + rake (13.4.2) + rbi (0.5.0) + prism (~> 1.0) + rbs (>= 4.0.1) + rbs (4.2.0) + logger + prism (>= 1.6.0) + tsort + rdoc (8.1.0) + erb + prism (>= 1.6.0) + rbs (>= 4.0.0) + tsort + redis (6.0.0) + redis-client (= 0.30.1) + redis-client (0.30.1) + connection_pool + regexp_parser (2.13.1) + reline (0.7.0) io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) - responders (3.1.1) - actionpack (>= 5.2) - railties (>= 5.2) + require-hooks (0.5.1) + responders (3.2.1) + actionpack (>= 7.0) + railties (>= 7.0) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.3.2) - strscan - rspec (3.13.0) + rexml (3.4.4) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-activemodel-mocks (1.2.0) + rspec-activemodel-mocks (1.3.0) activemodel (>= 3.0) activesupport (>= 3.0) rspec-mocks (>= 2.99, < 4.0) - rspec-core (3.13.0) + rspec-core (3.13.7) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) + rspec-mocks (3.13.9) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (6.1.3) - actionpack (>= 6.1) - activesupport (>= 6.1) - railties (>= 6.1) - rspec-core (~> 3.13) - rspec-expectations (~> 3.13) - rspec-mocks (~> 3.13) - rspec-support (~> 3.13) - rspec-support (3.13.1) - rubocop (1.65.0) - json (~> 2.3) - language_server-protocol (>= 3.17.0) - parallel (~> 1.10) + rspec-rails (8.1.0) + actionpack (>= 7.2) + activesupport (>= 7.2) + railties (>= 7.2) + rspec-core (>= 3.13.0, < 5.0.0) + rspec-expectations (>= 3.13.0, < 5.0.0) + rspec-mocks (>= 3.13.0, < 5.0.0) + rspec-support (>= 3.13.0, < 5.0.0) + rspec-support (3.13.8) + rubocop (1.92.2) + json (>= 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (>= 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.11.3, < 3.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) - parser (>= 3.3.1.0) - rubocop-md (1.2.2) - rubocop (>= 1.0) - rubocop-minitest (0.35.1) - rubocop (>= 1.61, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-packaging (0.5.2) - rubocop (>= 1.33, < 2.0) - rubocop-performance (1.21.1) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.25.1) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.50.0) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-capybara (3.1.0) + lint_roller (~> 1.1) + rubocop (~> 1.89) + rubocop-factory_bot (2.28.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-md (3.0.0) + kramdown (~> 2.4) + kramdown-parser-gfm (~> 1.1) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) + rubocop-minitest (0.41.0) + lint_roller (~> 1.1) + rubocop (>= 1.89.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-packaging (0.6.0) + lint_roller (~> 1.1.0) + rubocop (>= 1.72.1, < 2.0) + rubocop-performance (1.27.0) + lint_roller (~> 1.1) + rubocop (>= 1.89.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rails (2.38.0) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails_config (1.16.0) - rubocop (>= 1.57.0) - rubocop-ast (>= 1.26.0) + rubocop (>= 1.89.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rails_config (1.17.7) + rubocop (>= 1.74.0) + rubocop-ast (>= 1.38.0) rubocop-md - rubocop-minitest (~> 0.22) - rubocop-packaging (~> 0.5) - rubocop-performance (~> 1.11) - rubocop-rails (~> 2.0) - ruby-prof (1.7.0) + rubocop-minitest (~> 0.37) + rubocop-packaging (~> 0.6) + rubocop-performance (~> 1.24) + rubocop-rails (~> 2.30) + rubocop-rspec (3.10.2) + lint_roller (~> 1.1) + regexp_parser (>= 2.0) + rubocop (~> 1.86, >= 1.86.2) + rubocop-sorbet (0.17.2) + rbi (~> 0.4, >= 0.4.3) + rbs (>= 4.1.1) + spoom (~> 1.8) + rubocop-thread_safety (0.8.0) + lint_roller (~> 1.1) + rubocop (~> 1.89) + rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (1.13.0) - ruby-vips (2.2.2) + ruby-vips (2.3.0) ffi (~> 1.12) logger - ruby2_keywords (0.0.5) - sassc (2.4.0) - ffi (~> 1.9) - sassc-rails (2.1.2) - railties (>= 4.0.0) - sassc (>= 2.0) - sprockets (> 3.0) - sprockets-rails - tilt - simplecov (0.22.0) - docile (~> 1.1) - simplecov-html (~> 0.11) - simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) - simplecov_json_formatter (0.1.4) - sinatra (3.2.0) - mustermann (~> 3.0) - rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.2.0) - tilt (~> 2.0) - sprockets (4.2.1) - concurrent-ruby (~> 1.0) + rubydex (0.4.4-aarch64-linux) + rubydex (0.4.4-arm64-darwin) + rubydex (0.4.4-x86_64-darwin) + rubydex (0.4.4-x86_64-linux) + sass-embedded (1.108.1-aarch64-linux-gnu) + google-protobuf (~> 4.31) + sass-embedded (1.108.1-aarch64-linux-musl) + google-protobuf (~> 4.31) + sass-embedded (1.108.1-arm64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.108.1-x86_64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.108.1-x86_64-linux-gnu) + google-protobuf (~> 4.31) + sass-embedded (1.108.1-x86_64-linux-musl) + google-protobuf (~> 4.31) + sassc-embedded (1.80.10) + sass-embedded (~> 1.80) + securerandom (0.4.1) + simplecov (1.3.2) + sorbet (0.6.13640) + sorbet-static (= 0.6.13640) + sorbet-runtime (0.6.13640) + sorbet-static (0.6.13640-aarch64-linux) + sorbet-static (0.6.13640-universal-darwin) + sorbet-static (0.6.13640-x86_64-linux) + sorbet-static-and-runtime (0.6.13640) + sorbet (= 0.6.13640) + sorbet-runtime (= 0.6.13640) + spoom (1.8.13) + erubi (>= 1.10.0) + prism (>= 0.28.0) + rbi (>= 0.4.2) + rbs (>= 4.0.0.dev.5) + rexml (>= 3.2.6) + sorbet-static-and-runtime (>= 0.5.10187) + thor (>= 0.19.2) + sprockets (4.4.1) + concurrent-ruby (~> 1.1) + logger rack (>= 2.2.4, < 4) - sprockets-rails (3.5.1) + sprockets-rails (3.5.2) actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - stringio (3.1.1) - strscan (3.1.0) swagger-blocks (3.0.0) - thin (1.8.2) - daemons (~> 1.0, >= 1.0.9) - eventmachine (~> 1.0, >= 1.0.4) - rack (>= 1, < 3) - thor (1.3.1) - tilt (2.4.0) - timeout (0.4.1) + tapioca (0.20.0) + benchmark + bundler (>= 2.2.25) + netrc (>= 0.11.0) + parallel (>= 1.21.0) + rbi (>= 0.4.1) + require-hooks (>= 0.2.2) + rubydex (>= 0.1.0.beta10) + sorbet-static-and-runtime (>= 0.6.12698) + spoom (>= 1.7.16) + thor (>= 1.2.0) + tsort + thor (1.5.0) + tilt (2.9.0) + timeout (0.6.1) + tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uglifier (4.2.0) + uglifier (4.2.1) execjs (>= 0.3.0, < 3) - unicode-display_width (2.5.0) - uri (1.1.1) - webrick (1.8.1) - websocket-driver (0.7.6) + unicode-display_width (3.3.0) + unicode-emoji (~> 4.3) + unicode-emoji (4.3.0) + uri (1.1.2) + useragent (0.16.11) + websocket-driver (0.8.2) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xml-simple (1.1.9) rexml xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.16) + zeitwerk (2.8.3) PLATFORMS aarch64-linux aarch64-linux aarch64-linux-musl - arm-linux - arm-linux - arm-linux-musl arm64-darwin - x86-linux - x86-linux - x86-linux-musl x86_64-darwin x86_64-linux x86_64-linux-musl DEPENDENCIES - activerecord-import (~> 1.7) - activerecord-session_store (~> 2.1) - argon2 (~> 2.3) + activerecord-import (~> 3.0) + activerecord-session_store (~> 2.3) + argon2 (~> 2.3, >= 2.3.3) + benchmark (~> 0.5.0) bootstrap (~> 4.6) - brakeman (~> 6.1, >= 6.1.2) + brakeman (~> 8.1) bundler-audit (~> 0.9.1) - cancancan (~> 3.6, >= 3.6.1) + cancancan (~> 3.7) capybara (~> 3.40) - cgi (~> 0.3.6) - database_cleaner (~> 2.0, >= 2.0.2) - doorkeeper (~> 5.7, >= 5.7.1) - doorkeeper-openid_connect (~> 1.8, >= 1.8.9) - factory_bot_rails (~> 6.4, >= 6.4.3) - faraday (~> 2.14) + cgi (~> 0.5) + csv (~> 3.3, >= 3.3.7) + cuprite (~> 0.20) + dartsass-sprockets (~> 3.2) + database_cleaner (~> 2.1) + doorkeeper (~> 5.9, >= 5.9.9) + doorkeeper-openid_connect (~> 2.1) + factory_bot_rails (~> 6.5) + faraday (~> 2.15) file_validators (~> 3.0) - font-awesome-rails (~> 4.7, >= 4.7.0.8) + font-awesome-rails (~> 4.7, >= 4.7.0.9) gravtastic (~> 3.2, >= 3.2.6) - hiredis (~> 0.6.3) - image_processing (~> 1.12, >= 1.12.2) - irb (~> 1.14) - jquery-rails (~> 4.6) - json-schema (~> 4.3) - launchy (~> 3.0, >= 3.0.1) + image_processing (~> 2.2) + irb (~> 1.18) + jquery-rails (~> 4.6, >= 4.6.1) + json-schema (~> 6.2) + launchy (~> 3.1) letter_opener (~> 1.10) - logstasher (~> 2.1, >= 2.1.5) - mimic (~> 0.4.4) - mini_racer (~> 0.19.2) - natcmp (~> 1.4, >= 1.4.3) - newrelic_rpm (~> 9.11) + logstasher (~> 3.0) + mini_racer (~> 0.22) + natcmp (~> 1.4, >= 1.4.4) + newrelic_rpm (~> 10.9) + ostruct (~> 0.6.3) pdfkit (~> 0.8.7.3) - pg (~> 1.5, >= 1.5.6) - pghero (~> 3.5) - poltergeist (~> 1.18, >= 1.18.1) - pry (~> 0.14.2) - pry-byebug (~> 3.10, >= 3.10.1) + pg (~> 1.7) + pghero (~> 4.1) + pry (~> 0.16) + pry-byebug (~> 3.12) pry-rails (~> 0.3.11) - puma (~> 6.4, >= 6.4.2) - rack-attack (~> 6.7) - rack-cors (~> 2.0, >= 2.0.2) - rack-mini-profiler (~> 3.3, >= 3.3.1) + puma (~> 8.0) + rack-attack (~> 6.8) + rack-cors (~> 3.0) + rack-mini-profiler (~> 5.0) rack-timeout (~> 0.7.0) railroady (~> 1.6) - rails (~> 7.1, >= 7.1.3.4) + rails (~> 8.1.4) rails-controller-testing (~> 1.0, >= 1.0.5) rake (~> 13.2, >= 13.2.1) - readthis (~> 2.2) - redis (~> 4.5) - responders (~> 3.1, >= 3.1.1) + redis (~> 6.0) + responders (~> 3.2) rest-client (~> 2.1) rspec (~> 3.13) - rspec-activemodel-mocks (~> 1.2) + rspec-activemodel-mocks (~> 1.3) rspec-core (~> 3.13) - rspec-rails (~> 6.1, >= 6.1.3) - rubocop (~> 1.65) - rubocop-rails_config (~> 1.16) - ruby-prof (~> 1.7) - sassc-rails (~> 2.1, >= 2.1.2) - simplecov (~> 0.22.0) - sprockets-rails (~> 3.5, >= 3.5.1) + rspec-rails (~> 8.1) + rubocop (~> 1.92) + rubocop-capybara (~> 3.1) + rubocop-factory_bot (~> 2.28) + rubocop-performance (~> 1.27) + rubocop-rails (~> 2.38) + rubocop-rails_config (~> 1.17) + rubocop-rspec (~> 3.10) + rubocop-sorbet (~> 0.17) + rubocop-thread_safety (~> 0.8) + ruby-vips (~> 2.3) + simplecov (~> 1.3) + sorbet (~> 0.6.13640) + sorbet-runtime (~> 0.6.13640) + spoom (~> 1.8) + sprockets-rails (~> 3.5, >= 3.5.2) swagger-blocks (~> 3.0) - thin (~> 1.8, >= 1.8.2) - uglifier (~> 4.2) + tapioca (~> 0.20.0) + uglifier (~> 4.2, >= 4.2.1) xml-simple (~> 1.1, >= 1.1.9) BUNDLED WITH - 2.5.21 + 4.0.20 diff --git a/Installation.md b/Installation.md index 17fac6fbe..802fcf80b 100644 --- a/Installation.md +++ b/Installation.md @@ -14,7 +14,7 @@ sudo apt-get update ``` TMC-server dependencies ```bash -sudo apt-get install git build-essential zip unzip imagemagick maven make phantomjs bc postgresql postgresql-contrib chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev xfonts-75dpi libpq-dev +sudo apt-get install git build-essential zip unzip libvips42 maven make chromium bc postgresql postgresql-contrib chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev xfonts-75dpi libpq-dev ``` Ruby dependencies ```bash diff --git a/app/assets/stylesheets/organizations.scss b/app/assets/stylesheets/organizations.scss index 6fcaf6938..97268b89a 100644 --- a/app/assets/stylesheets/organizations.scss +++ b/app/assets/stylesheets/organizations.scss @@ -27,8 +27,8 @@ $image-size: 6rem; .small-organization-card .card-body img { margin-right: 1rem; - width: $image-size/2; - height: $image-size/2; + width: $image-size * 0.5; + height: $image-size * 0.5; } .cover-content { diff --git a/app/background_tasks/kafka_batch_update_points_task.rb b/app/background_tasks/kafka_batch_update_points_task.rb index f902811da..69fcb2495 100644 --- a/app/background_tasks/kafka_batch_update_points_task.rb +++ b/app/background_tasks/kafka_batch_update_points_task.rb @@ -1,19 +1,23 @@ +# typed: strict # frozen_string_literal: true require 'kafka_updater' class KafkaBatchUpdatePointsTask + extend T::Sig + sig { void } def initialize - @kafka_bridge_url = SiteSetting.value('kafka_bridge_url') - @kafka_bridge_secret = SiteSetting.value('kafka_bridge_secret') - @service_id = SiteSetting.value('moocfi_service_id') - @updater = KafkaUpdater.new(@kafka_bridge_url, @kafka_bridge_secret, @service_id) + @kafka_bridge_url = T.let(SiteSetting.value('kafka_bridge_url'), T.nilable(String)) + @kafka_bridge_secret = T.let(SiteSetting.value('kafka_bridge_secret'), T.nilable(String)) + @service_id = T.let(SiteSetting.value('moocfi_service_id'), T.nilable(String)) + @updater = T.let(KafkaUpdater.new(@kafka_bridge_url, @kafka_bridge_secret, @service_id), KafkaUpdater) end + sig { void } def run return unless @kafka_bridge_url && @kafka_bridge_secret && @service_id return if @kafka_bridge_url.empty? || @kafka_bridge_secret.empty? || @service_id.empty? - KafkaBatchUpdatePoints.where(realtime: false).each do |task| + KafkaBatchUpdatePoints.where(realtime: false).find_each do |task| finished_successfully = false begin type = @updater.task_type(task) @@ -35,12 +39,14 @@ def run end rescue => e Rails.logger.error("Task failed: #{e.class.name}: #{e.message}") - Rails.logger.error("Task failed backtrace: #{e.backtrace.join("\n")}") if e.backtrace + backtrace = e.backtrace + Rails.logger.error("Task failed backtrace: #{backtrace.join("\n")}") if backtrace end task.destroy! if finished_successfully end end + sig { returns(Integer) } def wait_delay 5 end diff --git a/app/background_tasks/kafka_realtime_update_points_task.rb b/app/background_tasks/kafka_realtime_update_points_task.rb index 4b18631c6..9099e8bc0 100644 --- a/app/background_tasks/kafka_realtime_update_points_task.rb +++ b/app/background_tasks/kafka_realtime_update_points_task.rb @@ -1,19 +1,23 @@ +# typed: strict # frozen_string_literal: true require 'kafka_updater' class KafkaRealtimeUpdatePointsTask + extend T::Sig + sig { void } def initialize - @kafka_bridge_url = SiteSetting.value('kafka_bridge_url') - @kafka_bridge_secret = SiteSetting.value('kafka_bridge_secret') - @service_id = SiteSetting.value('moocfi_service_id') - @updater = KafkaUpdater.new(@kafka_bridge_url, @kafka_bridge_secret, @service_id) + @kafka_bridge_url = T.let(SiteSetting.value('kafka_bridge_url'), T.nilable(String)) + @kafka_bridge_secret = T.let(SiteSetting.value('kafka_bridge_secret'), T.nilable(String)) + @service_id = T.let(SiteSetting.value('moocfi_service_id'), T.nilable(String)) + @updater = T.let(KafkaUpdater.new(@kafka_bridge_url, @kafka_bridge_secret, @service_id), KafkaUpdater) end + sig { void } def run return unless @kafka_bridge_url && @kafka_bridge_secret && @service_id return if @kafka_bridge_url.empty? || @kafka_bridge_secret.empty? || @service_id.empty? - KafkaBatchUpdatePoints.where(realtime: true).each do |task| + KafkaBatchUpdatePoints.where(realtime: true).find_each do |task| finished_successfully = false begin type = @updater.task_type(task) @@ -35,12 +39,14 @@ def run end rescue => e Rails.logger.error("Task failed: #{e.class.name}: #{e.message}") - Rails.logger.error("Task failed backtrace: #{e.backtrace.join("\n")}") if e.backtrace + backtrace = e.backtrace + Rails.logger.error("Task failed backtrace: #{backtrace.join("\n")}") if backtrace end task.destroy! if finished_successfully end end + sig { returns(Integer) } def wait_delay 5 end diff --git a/app/background_tasks/refresh_course_task.rb b/app/background_tasks/refresh_course_task.rb index 230194e1d..b9c2152b3 100644 --- a/app/background_tasks/refresh_course_task.rb +++ b/app/background_tasks/refresh_course_task.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'rust_langs_cli_executor' @@ -5,11 +6,14 @@ require 'course_refresh_database_updater' class RefreshCourseTask + extend T::Sig + sig { void } def initialize end + sig { void } def run - CourseTemplateRefresh.where(status: :not_started).each do |task| + CourseTemplateRefresh.where(status: :not_started).find_each do |task| channel_id = task.course_template_id task.status = :in_progress task.save! @@ -23,45 +27,47 @@ def run broadcast_to_channel(channel_id, 'Updating database', 0.95, '-') # Should we do this loop in CourseRefreshDatabaseUpdater? - courses.each do |course| - @refresh = CourseRefreshDatabaseUpdater.new.refresh_course(course, rust_output) - end + refresh = courses.map { |course| CourseRefreshDatabaseUpdater.new.refresh_course(course, rust_output) }.last broadcast_to_channel(channel_id, 'Generating refresh report', 0.98, '-') - CourseTemplateRefreshReport.create(course_template_refresh_id: task.id, refresh_errors: @refresh.errors, refresh_warnings: @refresh.warnings, refresh_notices: @refresh.notices, refresh_timings: @refresh.timings) + raise 'Template has no courses' unless refresh + CourseTemplateRefreshReport.create(course_template_refresh_id: task.id, refresh_errors: refresh.errors, refresh_warnings: refresh.warnings, refresh_notices: refresh.notices, refresh_timings: refresh.timings) broadcast_to_channel(channel_id, 'Cleaning up cache', 0.99, '-') if File.directory?(task.langs_refresh_output['output-data']['new-cache-path']) - old_cache_path = task.course_template.cache_path - task.course_template.increment_cached_version - task.course_template.save! - task.course_template.reload + course_template = T.must(task.course_template) + old_cache_path = course_template.cache_path + course_template.increment_cached_version + course_template.save! + course_template.reload courses.each(&:save!) FileUtils.rm_rf(old_cache_path) end broadcast_to_channel(channel_id, 'Refresh completed', 1, '-', task.id) task.status = :complete - task.percent_done = 1 + task.percent_done = BigDecimal('1') task.save! rescue => e Rails.logger.error("Course Refresh task #{task.id} failed:#{e}") - Rails.logger.error(e.backtrace.join("\n")) - CourseTemplateRefreshReport.create(course_template_refresh_id: task.id, refresh_errors: [e.backtrace.join("\n")], refresh_warnings: [], refresh_notices: [], refresh_timings: {}) - broadcast_to_channel(channel_id, 'Refresh crashed', 0, '-', task.id) + Rails.logger.error(T.must(e.backtrace).join("\n")) + CourseTemplateRefreshReport.create(course_template_refresh_id: task.id, refresh_errors: [T.must(e.backtrace).join("\n")], refresh_warnings: [], refresh_notices: [], refresh_timings: {}) + broadcast_to_channel(task.course_template_id, 'Refresh crashed', 0, '-', task.id) task.status = :crashed - task.percent_done = 0 + task.percent_done = BigDecimal('0') task.create_phase(e, 0) task.save! end end + sig { returns(Integer) } def wait_delay 5 end private + sig { params(id: Integer, msg: String, percent: Numeric, time: String, refresh_id: T.nilable(Integer)).void } def broadcast_to_channel(id, msg, percent, time, refresh_id = nil) Rails.logger.info("Broadcasting message: #{msg} to channel CourseTemplateRefreshChannel-#{id}, Percent done: #{percent}, Time: #{time}, Course Template Refresh ID: #{refresh_id}") ActionCable.server.broadcast("CourseTemplateRefreshChannel-#{id}", { diff --git a/app/background_tasks/rust_langs_downloader_task.rb b/app/background_tasks/rust_langs_downloader_task.rb index 2f9e561f0..868a563c8 100644 --- a/app/background_tasks/rust_langs_downloader_task.rb +++ b/app/background_tasks/rust_langs_downloader_task.rb @@ -1,13 +1,17 @@ +# typed: strict # frozen_string_literal: true require 'rust_langs_cli_executor' class RustLangsDownloaderTask - @@rust_langs_version = '0.39.8' + extend T::Sig + @@rust_langs_version = T.let('0.39.8', String) + sig { void } def initialize end + sig { void } def run Rails.logger.info('Creating directory vendor/tmc-langs-rust') unless File.directory?('vendor/tmc-langs-rust') Dir.mkdir('vendor/tmc-langs-rust') unless File.directory?('vendor/tmc-langs-rust') @@ -46,6 +50,7 @@ def run end end + sig { returns(Integer) } def wait_delay 1 end diff --git a/app/background_tasks/sandbox_status_fetcher_task.rb b/app/background_tasks/sandbox_status_fetcher_task.rb index 8332aa12f..f707c3849 100644 --- a/app/background_tasks/sandbox_status_fetcher_task.rb +++ b/app/background_tasks/sandbox_status_fetcher_task.rb @@ -1,16 +1,21 @@ +# typed: strict # frozen_string_literal: true require 'json' require 'benchmark' class SandboxStatusFetcherTask + extend T::Sig + + sig { void } def initialize - @sandboxes = RemoteSandbox.all + RemoteSandbox.all_experimental + @sandboxes = T.let(RemoteSandbox.all + RemoteSandbox.all_experimental, T::Array[RemoteSandbox]) end + sig { void } def run - data = @sandboxes.map do |sandbox| - data = nil + statuses = @sandboxes.map do |sandbox| + data = T.let({}, T::Hash[Symbol, T.untyped]) fetching_time = Benchmark.measure do data = { baseurl: sandbox.baseurl, @@ -21,9 +26,10 @@ def run data[:fetching_time] = fetching_time.real.round(2) data end - Rails.cache.write('sandbox-status-cache', data.to_json, expires_in: 1.minute) + Rails.cache.write('sandbox-status-cache', statuses.to_json, expires_in: 1.minute) end + sig { returns(Integer) } def wait_delay 1 end diff --git a/app/background_tasks/stats_fetcher_task.rb b/app/background_tasks/stats_fetcher_task.rb index 44def18bd..b81b6891d 100644 --- a/app/background_tasks/stats_fetcher_task.rb +++ b/app/background_tasks/stats_fetcher_task.rb @@ -1,17 +1,21 @@ +# typed: strict # frozen_string_literal: true class StatsFetcherTask + extend T::Sig + sig { void } def initialize end + sig { void } def run data = { high_priority_submissions_count: Submission.to_be_reprocessed.where(processing_priority: 0).count, sandbox_queue_length: Submission.to_be_reprocessed.count, unprocessed_submissions_count: Submission.where(processed: false).count, - submissions_count_minute: Submission.where(created_at: (Time.current - 1.minute)..Time.current).count, - submissions_count_five_minutes: Submission.where(created_at: (Time.current - 5.minute)..Time.current).count, - submissions_count_hour: Submission.where(created_at: (Time.current - 1.hour)..Time.current).count, + submissions_count_minute: Submission.where(created_at: 1.minute.ago..Time.current).count, + submissions_count_five_minutes: Submission.where(created_at: 5.minutes.ago..Time.current).count, + submissions_count_hour: Submission.where(created_at: 1.hour.ago..Time.current).count, submissions_count_today: Submission.where(created_at: Time.current.all_day).count, submissions_count_yesterday: Submission.where(created_at: Time.current.yesterday.all_day).count, submissions_count_week: Submission.where(created_at: Time.current.all_week).count, @@ -19,6 +23,7 @@ def run Rails.cache.write('submission-stats-cache', data.to_json, expires_in: 1.minute) end + sig { returns(Integer) } def wait_delay 5 end diff --git a/app/background_tasks/submission_long_queue_processor_task.rb b/app/background_tasks/submission_long_queue_processor_task.rb index 623db7b1e..60567a86e 100644 --- a/app/background_tasks/submission_long_queue_processor_task.rb +++ b/app/background_tasks/submission_long_queue_processor_task.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'submission_processor' @@ -6,10 +7,13 @@ # submissions to sandbox. This task uses reverse order in order to avoid # sending the same submission to sandbox multiple times class SubmissionLongQueueProcessorTask + extend T::Sig + sig { void } def initialize - @processor = SubmissionProcessor.new + @processor = T.let(SubmissionProcessor.new, SubmissionProcessor) end + sig { void } def run queue = Submission.to_be_reprocessed.where(processing_priority: 0).order(:created_at).reverse_order return if queue.length <= 10 @@ -21,6 +25,7 @@ def run end end + sig { returns(Integer) } def wait_delay 1 end diff --git a/app/background_tasks/submission_processor_task.rb b/app/background_tasks/submission_processor_task.rb index a67fc408e..e10da7940 100644 --- a/app/background_tasks/submission_processor_task.rb +++ b/app/background_tasks/submission_processor_task.rb @@ -1,16 +1,21 @@ +# typed: strict # frozen_string_literal: true require 'submission_processor' class SubmissionProcessorTask + extend T::Sig + sig { void } def initialize - @processor = SubmissionProcessor.new + @processor = T.let(SubmissionProcessor.new, SubmissionProcessor) end + sig { void } def run @processor.process_some_submissions end + sig { returns(Float) } def wait_delay 0.1 end diff --git a/app/background_tasks/uncomputed_unlock_computor_task.rb b/app/background_tasks/uncomputed_unlock_computor_task.rb index dae4f5275..d1b1fab15 100644 --- a/app/background_tasks/uncomputed_unlock_computor_task.rb +++ b/app/background_tasks/uncomputed_unlock_computor_task.rb @@ -1,20 +1,25 @@ +# typed: strict # frozen_string_literal: true require 'submission_processor' class UncomputedUnlockComputorTask + extend T::Sig + sig { void } def initialize end + sig { void } def run - UncomputedUnlock.order('id ASC').limit(1).each do |uncomputed_unlock| - course = uncomputed_unlock.course - user = uncomputed_unlock.user + UncomputedUnlock.order(:id).limit(1).each do |uncomputed_unlock| + course = T.must(uncomputed_unlock.course) + user = T.must(uncomputed_unlock.user) Rails.logger.info "Calculating unlocks for user #{user.id} and course #{course.name}. Queue length: #{UncomputedUnlock.count}." Unlock.refresh_unlocks(course, user) end end + sig { returns(Float) } def wait_delay 0.1 end diff --git a/app/background_tasks/uncomputed_unlock_computor_task_backup.rb b/app/background_tasks/uncomputed_unlock_computor_task_backup.rb index b0d0790b3..2e84b4887 100644 --- a/app/background_tasks/uncomputed_unlock_computor_task_backup.rb +++ b/app/background_tasks/uncomputed_unlock_computor_task_backup.rb @@ -1,25 +1,29 @@ +# typed: strict # frozen_string_literal: true require 'submission_processor' class UncomputedUnlockComputorTaskBackup + extend T::Sig + sig { void } def initialize end + sig { returns(T.nilable(T::Array[Thread])) } def run count = UncomputedUnlock.count return unless count > 3 threads = [7, count - 3].min limit = [threads * 5, count - 3].min - a = UncomputedUnlock.order('id DESC').limit(limit) + a = UncomputedUnlock.order(id: :desc).limit(limit) Rails.logger.info "Creating #{threads} threads to compute unlocks." workers = a.to_a.each_slice((a.size / threads.to_f).round).map do |uncomputed_unlocks| Thread.new do uncomputed_unlocks.each do |uncomputed_unlock| - course = uncomputed_unlock.course - user = uncomputed_unlock.user + course = T.must(uncomputed_unlock.course) + user = T.must(uncomputed_unlock.user) Rails.logger.info "Calculating unlocks for user #{user.id} and course #{course.name} with a backup task. Queue length: #{UncomputedUnlock.count}." Unlock.refresh_unlocks(course, user) end @@ -28,6 +32,7 @@ def run workers.map(&:join) end + sig { returns(Float) } def wait_delay 0.1 end diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 9aec23053..246da394a 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module ApplicationCable diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 051daf8d0..bff654d7e 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,20 +1,21 @@ +# typed: strict # frozen_string_literal: true module ApplicationCable class Connection < ActionCable::Connection::Base + extend T::Sig + identified_by :current_user + sig { void } def connect self.current_user = find_verified_user end private + sig { returns(User) } def find_verified_user - if verified_user = User.find_by(id: @request.session[:user_id]) - verified_user - else - reject_unauthorized_connection - end + User.find_by(id: request.session[:user_id]) || reject_unauthorized_connection end end end diff --git a/app/channels/course_template_refresh_channel.rb b/app/channels/course_template_refresh_channel.rb index b2c2bfab5..69225d53a 100644 --- a/app/channels/course_template_refresh_channel.rb +++ b/app/channels/course_template_refresh_channel.rb @@ -1,10 +1,15 @@ +# typed: strict # frozen_string_literal: true class CourseTemplateRefreshChannel < ApplicationCable::Channel + extend T::Sig + + sig { void } def subscribed stream_from "CourseTemplateRefreshChannel-#{params[:courseTemplateId]}" end + sig { void } def unsubscribed # Any cleanup needed when channel is unsubscribed end diff --git a/app/controllers/api.rb b/app/controllers/api.rb index e30e81f73..603fc34c0 100644 --- a/app/controllers/api.rb +++ b/app/controllers/api.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api diff --git a/app/controllers/api/beta.rb b/app/controllers/api/beta.rb index 60e6e6359..07443f1a2 100644 --- a/app/controllers/api/beta.rb +++ b/app/controllers/api/beta.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api diff --git a/app/controllers/api/beta/base_controller.rb b/app/controllers/api/beta/base_controller.rb index 37699d18a..fee736024 100644 --- a/app/controllers/api/beta/base_controller.rb +++ b/app/controllers/api/beta/base_controller.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true require 'json' class Api::Beta::BaseController < ApplicationController + extend T::Sig clear_respond_to respond_to :json @@ -12,13 +14,16 @@ class Api::Beta::BaseController < ApplicationController skip_authorization_check # we use doorkeeper in api, so let's skip cancancan rescue_from CanCan::AccessDenied do |e| + T.bind(self, Api::Beta::BaseController) render json: errors_json(e.message), status: :forbidden end rescue_from ActiveRecord::RecordNotFound do |e| + T.bind(self, Api::Beta::BaseController) render json: errors_json(e.message), status: :not_found end + sig { params(hash: T.untyped).void } def present(hash) if !!params[:pretty] render json: JSON.pretty_generate(hash) @@ -28,9 +33,10 @@ def present(hash) end private + sig { void } def authenticate_user! if doorkeeper_token - @current_user = User.find(doorkeeper_token.resource_owner_id) + @current_user = T.let(User.find(doorkeeper_token.resource_owner_id), T.nilable(User)) end return if @current_user @@ -38,8 +44,13 @@ def authenticate_user! render json: { errors: ['User is not authenticated!'] }, status: :unauthorized end - attr_reader :current_user + # Before authenticate_user! has run (ApplicationController's own before_actions), this is a Guest. + sig { returns(User) } + def current_user + @current_user || Guest.new + end + sig { params(messages: T.any(String, T::Array[String])).returns(T::Hash[Symbol, T::Array[String]]) } def errors_json(messages) { errors: [*messages] } end diff --git a/app/controllers/api/beta/course_id_information_controller.rb b/app/controllers/api/beta/course_id_information_controller.rb index 5cdfa81b4..518351149 100644 --- a/app/controllers/api/beta/course_id_information_controller.rb +++ b/app/controllers/api/beta/course_id_information_controller.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true class Api::Beta::CourseIdInformationController < Api::Beta::BaseController before_action :doorkeeper_authorize!, scopes: [:public] + sig { void } def index course_ids = Course.order(:id).where(hidden: false).enabled.pluck(:id) present(course_ids) diff --git a/app/controllers/api/beta/participant_controller.rb b/app/controllers/api/beta/participant_controller.rb index 0fb47402f..5398320d0 100644 --- a/app/controllers/api/beta/participant_controller.rb +++ b/app/controllers/api/beta/participant_controller.rb @@ -1,15 +1,19 @@ +# typed: strict # frozen_string_literal: true require 'course_list' class Api::Beta::ParticipantController < Api::Beta::BaseController + extend T::Sig + before_action :doorkeeper_authorize!, scopes: [:public] + sig { void } def courses user = User.where(id: params[:id]).first || current_user authorize! :read, user courses = user.courses_with_submissions - list = CourseList.new(current_user, view_context).course_list_data_no_organisation(Course.find(user.course_ids)) + list = CourseList.new(current_user, view_context).course_list_data_no_organisation(Course.find(T.let(user.course_ids, T::Array[Numeric]))) list.each do |course| course[:exercises] = courses[course[:id]] end @@ -17,6 +21,7 @@ def courses present(list) end + sig { void } def index user = current_user present(username: user.login, diff --git a/app/controllers/api/beta/stats_controller.rb b/app/controllers/api/beta/stats_controller.rb index 8d530ebbd..fb6ccd1ad 100644 --- a/app/controllers/api/beta/stats_controller.rb +++ b/app/controllers/api/beta/stats_controller.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true class Api::Beta::StatsController < Api::Beta::BaseController before_action :doorkeeper_authorize!, scopes: [:public] + sig { void } def submission_processing_times processing_began_at = Submission.arel_table[:processing_began_at] results = Submission @@ -14,15 +16,16 @@ def submission_processing_times res = results.map do |result| { - avg_duration: result.avg_duration, - stddev: result.stddev, - minute: result.minute, - count: result.count + avg_duration: result[:avg_duration], + stddev: result[:stddev], + minute: result[:minute], + count: result[:count] } end present(res) end + sig { void } def submission_queue_times created_at = Submission.arel_table[:created_at] results = Submission @@ -30,10 +33,10 @@ def submission_queue_times res = results.map do |result| { - avg_duration: result.avg_duration, - stddev: result.stddev, - minute: result.minute, - count: result.count + avg_duration: result[:avg_duration], + stddev: result[:stddev], + minute: result[:minute], + count: result[:count] } end present(res) diff --git a/app/controllers/api/v8.rb b/app/controllers/api/v8.rb index ae08a53e7..ea0271e96 100644 --- a/app/controllers/api/v8.rb +++ b/app/controllers/api/v8.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api diff --git a/app/controllers/api/v8/apidocs_controller.rb b/app/controllers/api/v8/apidocs_controller.rb index f8b984310..8758e309e 100644 --- a/app/controllers/api/v8/apidocs_controller.rb +++ b/app/controllers/api/v8/apidocs_controller.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true module Api module V8 class ApidocsController < ActionController::Base + extend T::Sig include Swagger::Blocks swagger_root do @@ -150,7 +152,7 @@ class ApidocsController < ActionController::Base # A list of all classes that have swagger_* declarations. # The order of the swagered_classes affects the order they are shown in swaggerUI - SWAGGERED_CLASSES = [ + SWAGGERED_CLASSES = T.let([ Api::V8::UsersController, Api::V8::CoursesController, Api::V8::Courses::PointsController, @@ -197,8 +199,9 @@ class ApidocsController < ActionController::Base Submission, User, self - ].freeze + ].freeze, T::Array[T::Class[T.anything]]) + sig { void } def index render json: Swagger::Blocks.build_root_json(SWAGGERED_CLASSES) end diff --git a/app/controllers/api/v8/application/credentials_controller.rb b/app/controllers/api/v8/application/credentials_controller.rb index e8058673d..c1676c9dc 100644 --- a/app/controllers/api/v8/application/credentials_controller.rb +++ b/app/controllers/api/v8/application/credentials_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -5,9 +6,10 @@ module V8 module Application class CredentialsController < Api::V8::BaseController skip_authorization_check + sig { void } def index valid_clients = SiteSetting.value('valid_clients') - .map { |o| o['name'] } + .pluck('name') return unless valid_clients.is_a?(Enumerable) return render json: 'Client not supported!', status: :forbidden unless valid_clients.include?(params[:application_name]) app = Doorkeeper::Application.create_with(redirect_uri: 'urn:ietf:wg:oauth:2.0:oob').find_or_create_by!(name: params[:application_name]) diff --git a/app/controllers/api/v8/base_controller.rb b/app/controllers/api/v8/base_controller.rb index c9b362808..19c3ab19b 100644 --- a/app/controllers/api/v8/base_controller.rb +++ b/app/controllers/api/v8/base_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'json' @@ -6,6 +7,7 @@ module Api module V8 class BaseController < ApplicationController + extend T::Sig clear_respond_to respond_to :json @@ -15,6 +17,7 @@ class BaseController < ApplicationController skip_before_action :verify_authenticity_token rescue_from CanCan::AccessDenied do |e| + T.bind(self, Api::V8::BaseController) if current_user.guest? respond_unauthorized(e.message) else @@ -23,14 +26,17 @@ class BaseController < ApplicationController end rescue_from CoursesMoocFiTokenIntrospector::Unavailable do |e| + T.bind(self, Api::V8::BaseController) Rails.logger.error("courses.mooc.fi token introspection unavailable: #{e.message}") respond_with_error('courses.mooc.fi could not verify your login right now. Try again later.', 503) end rescue_from ActiveRecord::RecordNotFound do |e| + T.bind(self, Api::V8::BaseController) render json: errors_json(e.message), status: :not_found end + sig { params(hash: T.untyped).void } def present(hash) if params[:pretty] render json: JSON.pretty_generate(hash) @@ -40,41 +46,52 @@ def present(hash) end private + sig { void } def authenticate_user! - return @current_user if @current_user + return if @current_user if doorkeeper_token - @current_user ||= User.find_by(id: doorkeeper_token.resource_owner_id) + @current_user = T.let(User.find_by(id: doorkeeper_token.resource_owner_id), T.nilable(User)) raise 'Invalid token' unless @current_user elsif Rails.configuration.x.accept_courses_mooc_fi_tokens @current_user = CoursesMoocFiAuthentication.user_for(request) - @auth_source = :courses_mooc_fi_token if @current_user + @auth_source = T.let(:courses_mooc_fi_token, T.nilable(Symbol)) if @current_user end @current_user ||= user_from_session || Guest.new end - attr_reader :current_user + # Before authenticate_user! has run (ApplicationController's own before_actions), this is a Guest. + sig { returns(User) } + def current_user + @current_user || Guest.new + end + sig { returns(::Ability) } def current_ability - @current_ability ||= ::Ability.new(current_user, auth_source: @auth_source) + @current_ability ||= T.let(::Ability.new(current_user, auth_source: @auth_source), T.nilable(::Ability)) end + sig { params(messages: T.any(String, T::Array[String])).returns(T::Hash[Symbol, T::Array[String]]) } def errors_json(messages) { errors: [*messages] } end + sig { params(msg: String).void } def respond_not_found(msg = 'Not Found') respond_with_error(msg, 404) end + sig { params(msg: String).void } def respond_forbidden(msg = 'Forbidden') respond_with_error(msg, 403) end + sig { params(msg: String).void } def respond_unauthorized(msg = 'Authentication required') respond_with_error(msg, 401) end - def respond_with_error(msg, code = 500, exception = nil, extra_json_keys = {}) + sig { params(msg: String, code: Integer, _exception: T.nilable(Exception), extra_json_keys: T::Hash[Symbol, T.untyped]).void } + def respond_with_error(msg, code = 500, _exception = nil, extra_json_keys = {}) respond_to do |format| format.html do render json: errors_json(msg), status: code @@ -87,6 +104,7 @@ def respond_with_error(msg, code = 500, exception = nil, extra_json_keys = {}) end end + sig { void } def check_client_version_api_v8 if should_check_for_client_version? begin @@ -110,6 +128,7 @@ def check_client_version_api_v8 end end + sig { returns(T::Boolean) } def should_check_for_client_version? params[:format] == 'json' && (params[:client].present? && params[:client_version].present?) && @@ -117,6 +136,7 @@ def should_check_for_client_version? (controller_name == 'submissions' && action_name == 'create') end + sig { params(client_name: T.untyped, client_version: T.untyped).void } def check_client_minimum_version(client_name, client_version) begin client_version = Version.new(client_version) unless client_version.nil? diff --git a/app/controllers/api/v8/core.rb b/app/controllers/api/v8/core.rb index ca589c3b8..4803504c9 100644 --- a/app/controllers/api/v8/core.rb +++ b/app/controllers/api/v8/core.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api diff --git a/app/controllers/api/v8/core/courses/reviews_controller.rb b/app/controllers/api/v8/core/courses/reviews_controller.rb index 04e34df6a..2eec1b4ce 100644 --- a/app/controllers/api/v8/core/courses/reviews_controller.rb +++ b/app/controllers/api/v8/core/courses/reviews_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'natsort' @@ -7,6 +8,7 @@ module V8 module Core module Courses class ReviewsController < Api::V8::BaseController + extend T::Sig include Swagger::Blocks swagger_path '/api/v8/core/courses/{course_id}/reviews' do @@ -53,6 +55,7 @@ class ReviewsController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! course = Course.find_by!(id: params[:course_id]) @@ -60,14 +63,15 @@ def index users_reviewed_submissions = course.submissions .where(user_id: current_user.id) .where('requests_review OR requires_review OR reviewed') - .order('created_at DESC') + .order(created_at: :desc) present Review.course_reviews_json(course, users_reviewed_submissions, view_context) end + sig { void } def update - fetch :review - authorize! :update, @review + review = fetch_review + authorize! :update, review if params[:review].present? && params[:review].has_key?(:review_body) update_review elsif params[:mark_as_read] @@ -77,69 +81,63 @@ def update end end + sig { void } def update_review - fetch :review - authorize! :update, @review - @review.review_body = params[:review][:review_body] + review = fetch_review + authorize! :update, review + review.review_body = params[:review][:review_body] begin - mark_as_reviewed - award_points - @review.submission.save! - @review.save! + mark_as_reviewed(review) + award_points(review) + T.must(review.submission).save! + review.save! rescue StandardError ::Rails.logger.error($!) respond_with_error('Failed to save code review.') else - present(status: 200) && return + present(status: 200) end end + sig { params(read: T::Boolean).void } def mark_as_read(read) - fetch :review - authorize!(read ? :mark_as_read : :mark_as_unread, @review) + review = fetch_review + authorize!(read ? :mark_as_read : :mark_as_unread, review) - @review.marked_as_read = read - present(status: 200) && return if @review.save + review.marked_as_read = read + present(status: 200) if review.save end - def fetch(*stuff) - if stuff.include? :course - @course = Course.find(params[:course_id]) - authorize! :read, @course - end - if stuff.include? :submission - @submission = Submission.find(params[:submission_id]) - authorize! :read, @submission - end - if stuff.include? :review - @review = Review.find(params[:id]) - authorize! :read, @review - end - return unless stuff.include? :files - @files = SourceFileList.for_submission(@submission) + sig { returns(Review) } + def fetch_review + review = Review.find(params[:id]) + authorize! :read, review + review end - def mark_as_reviewed - sub = @review.submission + sig { params(review: Review).void } + def mark_as_reviewed(review) + sub = T.must(review.submission) sub.reviewed = true sub.review_dismissed = false sub.of_same_kind .where('(requires_review OR requests_review) AND NOT reviewed') - .where(['created_at < ?', sub.created_at]) + .where(created_at: ...sub.created_at) .update_all(newer_submission_reviewed: true) end - def award_points - submission = @review.submission + sig { params(review: Review).void } + def award_points(review) + submission = T.must(review.submission) exercise = submission.exercise - course = exercise.course raise 'Exercise of submission has been moved or deleted' unless exercise + course = T.must(exercise.course) available_points = exercise.available_points.where(requires_review: true).map(&:name) previous_points = course.awarded_points.where(user_id: submission.user_id, name: available_points).map(&:name) - new_points = [] + new_points = T.let([], T::Array[String]) if params[:review][:points].respond_to?(:keys) params[:review][:points].keys.each do |point_name| unless exercise.available_points.where(name: point_name).any? @@ -157,7 +155,7 @@ def award_points end end - @review.points = (@review.points_list + new_points + previous_points).uniq.natsort.join(' ') + review.points = (review.points_list + new_points + previous_points).uniq.natsort.join(' ') submission.points = (submission.points_list + new_points + previous_points).uniq.natsort.join(' ') end end diff --git a/app/controllers/api/v8/core/courses/unlocks_controller.rb b/app/controllers/api/v8/core/courses/unlocks_controller.rb index 4ed46d0be..56286f51c 100644 --- a/app/controllers/api/v8/core/courses/unlocks_controller.rb +++ b/app/controllers/api/v8/core/courses/unlocks_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -29,6 +30,7 @@ class UnlocksController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def create unauthorize_guest! course = Course.find(params[:course_id]) diff --git a/app/controllers/api/v8/core/courses_controller.rb b/app/controllers/api/v8/core/courses_controller.rb index c494875ec..ab481874a 100644 --- a/app/controllers/api/v8/core/courses_controller.rb +++ b/app/controllers/api/v8/core/courses_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'course_info' @@ -32,6 +33,7 @@ class CoursesController < Api::V8::BaseController end end + sig { void } def show unauthorize_guest! course = Course.find_by!(id: params[:id]) diff --git a/app/controllers/api/v8/core/exercises/details_controller.rb b/app/controllers/api/v8/core/exercises/details_controller.rb index 784edfa4d..1eface8c7 100644 --- a/app/controllers/api/v8/core/exercises/details_controller.rb +++ b/app/controllers/api/v8/core/exercises/details_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -43,9 +44,10 @@ class DetailsController < Api::V8::BaseController skip_authorization_check + sig { void } def show exercise_ids = params[:ids] - return respond_not_found('Query param ids is empty. Example: ?ids=1,2,3') if !exercise_ids.present? || exercise_ids.empty? + return respond_not_found('Query param ids is empty. Example: ?ids=1,2,3') if exercise_ids.blank? || exercise_ids.empty? exercises = Exercise.where(id: exercise_ids.split(',')).includes(:course) authorize! :read, exercises @@ -53,9 +55,9 @@ def show { id: exercise.id, checksum: exercise.checksum, - course_name: exercise.course.name, + course_name: T.must(exercise.course).name, exercise_name: exercise.name, - hide_submission_results: (exercise.course.hide_submission_results || exercise.hide_submission_results), + hide_submission_results: (T.must(exercise.course).hide_submission_results || exercise.hide_submission_results), } end present exercises: data diff --git a/app/controllers/api/v8/core/exercises/solutions_controller.rb b/app/controllers/api/v8/core/exercises/solutions_controller.rb index 639fb1399..6736bd297 100644 --- a/app/controllers/api/v8/core/exercises/solutions_controller.rb +++ b/app/controllers/api/v8/core/exercises/solutions_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -27,6 +28,7 @@ class SolutionsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def download unauthorize_guest! exercise = Exercise.find_by!(id: params[:exercise_id]) diff --git a/app/controllers/api/v8/core/exercises/submissions_controller.rb b/app/controllers/api/v8/core/exercises/submissions_controller.rb index 8ff23ccff..c71273f58 100644 --- a/app/controllers/api/v8/core/exercises/submissions_controller.rb +++ b/app/controllers/api/v8/core/exercises/submissions_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'submission_processor' @@ -36,26 +37,27 @@ class SubmissionsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def create unauthorize_guest! - @exercise = Exercise.find(params[:exercise_id]) - authorize! :read, @exercise - @course = @exercise.course - authorize! :read, @course + exercise = Exercise.find(params[:exercise_id]) + authorize! :read, exercise + course = T.must(exercise.course) + authorize! :read, course if !params[:submission] || !params[:submission][:file] authorization_skip! return respond_not_found('No ZIP file selected or failed to receive it') end - unless @exercise.submittable_by?(current_user) + unless exercise.submittable_by?(current_user) authorization_skip! return respond_forbidden('Submissions for this exercise are no longer accepted.') end # Check if user has too many processing submissions for this exercise - processing_count = current_user.processing_submissions_count_for_exercise(@exercise.name, @course.id) + processing_count = current_user.processing_submissions_count_for_exercise(T.must(exercise.name), course.id) if processing_count >= 3 authorization_skip! return respond_forbidden("Too many submissions currently processing for this exercise. You have #{processing_count} submissions being processed. Please wait for them to complete before submitting again. All your submissions will eventually get processed and you will get your points.") @@ -76,10 +78,10 @@ def create low_priority = Submission.where(created_at: (Time.now - 10.minutes)..Time.now, user: current_user).count > 3 unless errormsg - @submission = Submission.new( + submission = Submission.new( user: current_user, - course: @course, - exercise: @exercise, + course: course, + exercise: exercise, return_file: file_contents, params_json: submission_params.to_json, requests_review: !params[:request_review].nil?, @@ -102,22 +104,22 @@ def create processing_priority: low_priority ? -100 : 0 ) - authorize! :create, @submission + authorize! :create, submission - unless @submission.save + unless submission.save errormsg = 'Failed to save submission.' - errormsg += " Errors: #{@submission.errors.messages}" + errormsg += " Errors: #{submission.errors.messages}" end end unless errormsg - # SubmissionProcessor.new.process_submission(@submission) + # SubmissionProcessor.new.process_submission(submission) end if !errormsg - render json: { submission_url: api_v8_core_submission_url(@submission), - paste_url: @submission.paste_key ? paste_url(@submission.paste_key) : '', - show_submission_url: submission_url(@submission) } + render json: { submission_url: api_v8_core_submission_url(submission), + paste_url: submission.paste_key ? paste_url(submission.paste_key) : '', + show_submission_url: submission_url(submission) } else render json: { error: errormsg } end diff --git a/app/controllers/api/v8/core/exercises_controller.rb b/app/controllers/api/v8/core/exercises_controller.rb index dcc30ab66..152f60eb2 100644 --- a/app/controllers/api/v8/core/exercises_controller.rb +++ b/app/controllers/api/v8/core/exercises_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'submission_list' @@ -49,6 +50,7 @@ class ExercisesController < Api::V8::BaseController end end + sig { void } def download exercise = Exercise.find(params[:id]) @@ -56,10 +58,11 @@ def download send_file exercise.stub_zip_file_path end + sig { void } def show unauthorize_guest! exercise = Exercise.find(params[:id]) - course = Course.find(exercise.course_id) + course = Course.find(T.must(exercise.course_id)) authorize! :read, course authorize! :read, exercise diff --git a/app/controllers/api/v8/core/organizations/courses_controller.rb b/app/controllers/api/v8/core/organizations/courses_controller.rb index 0f636f118..3cdaa4a83 100644 --- a/app/controllers/api/v8/core/organizations/courses_controller.rb +++ b/app/controllers/api/v8/core/organizations/courses_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -27,6 +28,7 @@ class CoursesController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! organization = Organization.find_by!(slug: params[:organization_slug]) @@ -34,7 +36,7 @@ def index courses = organization.courses.ongoing.order(ordering) courses = courses.select { |c| c.visible_to?(current_user) } authorize! :read, courses - present courses.map { |c| c.links_as_json(view_context) } + present(courses.map { |c| c.links_as_json(view_context) }) end end end diff --git a/app/controllers/api/v8/core/submissions/feedback_controller.rb b/app/controllers/api/v8/core/submissions/feedback_controller.rb index 4cdadae6f..384cabd08 100644 --- a/app/controllers/api/v8/core/submissions/feedback_controller.rb +++ b/app/controllers/api/v8/core/submissions/feedback_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -38,6 +39,7 @@ class FeedbackController < Api::V8::BaseController end end + sig { void } def create submission = Submission.find(params[:submission_id]) authorize! :read, submission diff --git a/app/controllers/api/v8/core/submissions/reviews_controller.rb b/app/controllers/api/v8/core/submissions/reviews_controller.rb index 8ccf4ab9f..d85800525 100644 --- a/app/controllers/api/v8/core/submissions/reviews_controller.rb +++ b/app/controllers/api/v8/core/submissions/reviews_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'natsort' @@ -7,6 +8,7 @@ module V8 module Core module Submissions class ReviewsController < Api::V8::BaseController + extend T::Sig include Swagger::Blocks swagger_path '/api/v8/core/submissions/{submission_id}/reviews' do @@ -33,12 +35,13 @@ class ReviewsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def create unauthorize_guest! submission = Submission.find(params[:submission_id]) authorize! :read, submission - @review = Review.new( + review = Review.new( submission_id: submission.id, reviewer_id: current_user.id, review_body: params[:review][:review_body] @@ -48,31 +51,32 @@ def create begin ActiveRecord::Base.connection.transaction do - award_points - mark_as_reviewed - @review.submission.save! - @review.save! + award_points(review) + mark_as_reviewed(review) + T.must(review.submission).save! + review.save! end rescue StandardError ::Rails.logger.error($!) respond_with_error('Failed to save code review.') else - send_email_about_new_review if params[:send_email] + send_email_about_new_review(review) if params[:send_email] present(status: 'ok') end end private - def award_points - submission = @review.submission + sig { params(review: Review).void } + def award_points(review) + submission = T.must(review.submission) exercise = submission.exercise - course = exercise.course raise 'Exercise of submission has been moved or deleted' unless exercise + course = T.must(exercise.course) available_points = exercise.available_points.where(requires_review: true).map(&:name) previous_points = course.awarded_points.where(user_id: submission.user_id, name: available_points).map(&:name) - new_points = [] + new_points = T.let([], T::Array[String]) if params[:review][:points].respond_to?(:keys) params[:review][:points].keys.each do |point_name| unless exercise.available_points.where(name: point_name).any? @@ -90,22 +94,24 @@ def award_points end end - @review.points = (@review.points_list + new_points + previous_points).uniq.natsort.join(' ') + review.points = (review.points_list + new_points + previous_points).uniq.natsort.join(' ') submission.points = (submission.points_list + new_points + previous_points).uniq.natsort.join(' ') end - def mark_as_reviewed - sub = @review.submission + sig { params(review: Review).void } + def mark_as_reviewed(review) + sub = T.must(review.submission) sub.reviewed = true sub.review_dismissed = false sub.of_same_kind .where('(requires_review OR requests_review) AND NOT reviewed') - .where(['created_at < ?', sub.created_at]) + .where(created_at: ...sub.created_at) .update_all(newer_submission_reviewed: true) end - def send_email_about_new_review - ReviewMailer.review_email(@review).deliver + sig { params(review: Review).void } + def send_email_about_new_review(review) + ReviewMailer.review_email(review).deliver_now end end end diff --git a/app/controllers/api/v8/core/submissions_controller.rb b/app/controllers/api/v8/core/submissions_controller.rb index ad3509d87..6d03da2bc 100644 --- a/app/controllers/api/v8/core/submissions_controller.rb +++ b/app/controllers/api/v8/core/submissions_controller.rb @@ -1,9 +1,11 @@ +# typed: strict # frozen_string_literal: true module Api module V8 module Core class SubmissionsController < Api::V8::BaseController + extend T::Sig include Swagger::Blocks swagger_path '/api/v8/core/submissions/{submission_id}/download' do @@ -26,73 +28,74 @@ class SubmissionsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def download unauthorize_guest! submission = Submission.find(params[:id]) authorize! :download, submission - send_data(submission.return_file, filename: "#{submission.user.login}-#{submission.exercise.name}-#{submission.id}.zip") + send_data(submission.return_file, filename: "#{T.must(submission.user).login}-#{submission.exercise_name}-#{submission.id}.zip") end + sig { void } def show - @submission = Submission.find_by!(id: params[:id]) - unless @submission.processed? + submission = Submission.find_by!(id: params[:id]) + unless submission.processed? authorization_skip! sandbox_status = :created - if @submission.processing_began_at + if submission.processing_began_at sandbox_status = :processing_on_sandbox - elsif @submission.processing_tried_at + elsif submission.processing_tried_at sandbox_status = :sending_to_sandbox end status = :processing - status = :hidden unless @submission.can_see_results?(current_user) + status = :hidden unless submission.can_see_results?(current_user) return render json: { status: status, sandbox_status: sandbox_status } end unauthorize_guest! - authorize! :read, @submission + authorize! :read, submission # This gets invalidated for the submitter when the results arrive so that they see the results right away. - output = Rails.cache.fetch("api_v8_core_submission_show_#{@submission.id}_user_#{current_user.id}", expires_in: 30.seconds) do - @course = @submission.course - @exercise = @submission.exercise - @organization = @course.organization - output = { + output = Rails.cache.fetch("api_v8_core_submission_show_#{submission.id}_user_#{current_user.id}", expires_in: 30.seconds) do + course = T.must(submission.course) + exercise = submission.exercise + submission_json = { api_version: ApiVersion::API_VERSION, - all_tests_passed: @submission.all_tests_passed?, - user_id: @submission.user_id, - login: @submission.user.login, - course: @course.name, - exercise_name: @submission.exercise.name, - status: @submission.status(current_user), - points: @submission.points_list, - validations: @submission.validations, - valgrind: @submission.valgrind, - submission_url: submission_url(@submission), - solution_url: @exercise.solution.visible_to?(current_user, true) ? view_context.exercise_solution_url(@exercise) : nil, - submitted_at: @submission.created_at, - processing_time: @submission.processing_time, - reviewed: @submission.reviewed?, - requests_review: @submission.requests_review?, - paste_url: @submission.paste_available ? paste_url(@submission.paste_key) : nil, - message_for_paste: @submission.paste_available ? @submission.message_for_paste : nil, - missing_review_points: @exercise.missing_review_points_for(@submission.user) + all_tests_passed: submission.all_tests_passed?, + user_id: submission.user_id, + login: T.must(submission.user).login, + course: course.name, + exercise_name: submission.exercise_name, + status: submission.status(current_user), + points: submission.points_list, + validations: submission.validations, + valgrind: submission.valgrind, + submission_url: submission_url(submission), + solution_url: exercise && exercise.solution.visible_to?(current_user, true) ? view_context.exercise_solution_url(exercise) : nil, + submitted_at: submission.created_at, + processing_time: submission.processing_time, + reviewed: submission.reviewed?, + requests_review: submission.requests_review?, + paste_url: submission.paste_available ? paste_url(submission.paste_key) : nil, + message_for_paste: submission.paste_available ? submission.message_for_paste : nil, + missing_review_points: exercise ? exercise.missing_review_points_for(T.must(submission.user)) : [] } - output = output.merge( - case @submission.status(current_user) + status_fields = + case submission.status(current_user) when :processing then { - submissions_before_this: @submission.unprocessed_submissions_before_this, + submissions_before_this: submission.unprocessed_submissions_before_this, total_unprocessed: Submission.unprocessed_count } when :ok then { - test_cases: @submission.test_case_records, - feedback_questions: @course.feedback_questions.order(:position).map(&:record_for_api), - feedback_answer_url: api_v8_core_submission_feedback_index_url(@submission, format: :json) + test_cases: submission.test_case_records, + feedback_questions: course.feedback_questions.order(:position).map(&:record_for_api), + feedback_answer_url: api_v8_core_submission_feedback_index_url(submission, format: :json) } when :fail then { - test_cases: @submission.test_case_records + test_cases: submission.test_case_records } when :hidden then { all_tests_passed: nil, @@ -102,32 +105,19 @@ def show valgrind: nil } when :error then { - error: @submission.pretest_error + error: submission.pretest_error } end - ) - output[:status] = :ok if output[:status] == :hidden && !can_handle_hidden_fields(params) + submission_json = submission_json.merge(T.must(status_fields)) + submission_json[:status] = :ok if submission_json[:status] == :hidden && !netbeans_plugin_at_least?('1.2.5') if !!params[:include_files] - output[:files] = SourceFileList.for_submission(@submission).map { |f| { path: f.path, contents: f.contents } } + submission_json[:files] = SourceFileList.for_submission(submission).map { |f| { path: f.path, contents: f.contents } } end - output + submission_json end render json: output end - - private - def can_handle_hidden_fields(params) - return false unless params[:client] == 'netbeans_plugin' - splitted = params[:client_version].split('.') - min_version = [1, 2, 5] - min_version.each_with_index do |version_number, i| - return false unless splitted[i] - return false if splitted[i].to_i < version_number - return true if splitted[i].to_i > version_number - end - true - end end end end diff --git a/app/controllers/api/v8/courses/all_courses_with_this_template_controller.rb b/app/controllers/api/v8/courses/all_courses_with_this_template_controller.rb index b481be2c6..445622c03 100644 --- a/app/controllers/api/v8/courses/all_courses_with_this_template_controller.rb +++ b/app/controllers/api/v8/courses/all_courses_with_this_template_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -35,6 +36,7 @@ class AllCoursesWithThisTemplateController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! course = Course.find_by!(id: params[:course_id]) diff --git a/app/controllers/api/v8/courses/exercises/points_controller.rb b/app/controllers/api/v8/courses/exercises/points_controller.rb index a6ecb8cc8..e55115399 100644 --- a/app/controllers/api/v8/courses/exercises/points_controller.rb +++ b/app/controllers/api/v8/courses/exercises/points_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -33,6 +34,7 @@ class PointsController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! course = Course.find_by!(id: params[:course_id]) @@ -42,7 +44,7 @@ def index course_id: course.id) authorize! :read, points - present(points.as_json_with_exercise_ids(course.exercises)) + present(AwardedPoint.as_json_with_exercise_ids(points, course.exercises)) end end end diff --git a/app/controllers/api/v8/courses/exercises/users/points_controller.rb b/app/controllers/api/v8/courses/exercises/users/points_controller.rb index eabed9ffd..320cb16dc 100644 --- a/app/controllers/api/v8/courses/exercises/users/points_controller.rb +++ b/app/controllers/api/v8/courses/exercises/users/points_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -61,6 +62,7 @@ class PointsController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! course = Course.find_by!(id: params[:course_id]) @@ -72,7 +74,7 @@ def index user_id: params[:user_id]) authorize! :read, points - present(points.as_json_with_exercise_ids(course.exercises)) + present(AwardedPoint.as_json_with_exercise_ids(points, course.exercises)) end end end diff --git a/app/controllers/api/v8/courses/exercises_controller.rb b/app/controllers/api/v8/courses/exercises_controller.rb index 0523b3399..1583218fb 100644 --- a/app/controllers/api/v8/courses/exercises_controller.rb +++ b/app/controllers/api/v8/courses/exercises_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -31,9 +32,10 @@ class ExercisesController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! - course = Course.find_by!(id: params[:course_id]) if params[:course_id] + course = Course.find_by!(id: params[:course_id]) can_see_everything = current_user.administrator? || current_user.teacher?(course.organization) || current_user.assistant?(course) authorize! :read, course @@ -59,7 +61,7 @@ def index points_visible = ex.points_visible_to?(current_user) available_points = ex.available_points available_points_names = available_points.map(&:name) - awarded_points = all_awarded_points.select { |awp| available_points_names.include?(awp.name) }.map(&:name) + awarded_points = all_awarded_points.filter_map { |awp| awp.name if available_points_names.include?(awp.name) } { id: ex.id, available_points: points_visible ? available_points : [], diff --git a/app/controllers/api/v8/courses/points_controller.rb b/app/controllers/api/v8/courses/points_controller.rb index a099a997c..15322d568 100644 --- a/app/controllers/api/v8/courses/points_controller.rb +++ b/app/controllers/api/v8/courses/points_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -26,11 +27,12 @@ class PointsController < Api::V8::BaseController end end + sig { void } def index course = Course.find_by!(id: params[:course_id]) points = course.awarded_points.includes(:submission) authorize_collection :read, points - present points.as_json_with_exercise_ids(course.exercises) + present AwardedPoint.as_json_with_exercise_ids(points, course.exercises) end end end diff --git a/app/controllers/api/v8/courses/submissions/last_hour_controller.rb b/app/controllers/api/v8/courses/submissions/last_hour_controller.rb index 4df2fd339..94924ed72 100644 --- a/app/controllers/api/v8/courses/submissions/last_hour_controller.rb +++ b/app/controllers/api/v8/courses/submissions/last_hour_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -29,6 +30,7 @@ class LastHourController < Api::V8::BaseController skip_authorization_check + sig { void } def index return respond_forbidden unless current_user.administrator? course = Course.find(params[:course_id]) diff --git a/app/controllers/api/v8/courses/submissions_controller.rb b/app/controllers/api/v8/courses/submissions_controller.rb index 680b8ef53..edb9ff043 100644 --- a/app/controllers/api/v8/courses/submissions_controller.rb +++ b/app/controllers/api/v8/courses/submissions_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -37,6 +38,7 @@ class SubmissionsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def index unauthorize_guest! course = Course.find_by!(id: params[:course_id]) diff --git a/app/controllers/api/v8/courses/users/points_controller.rb b/app/controllers/api/v8/courses/users/points_controller.rb index 26d27aeaa..e00f815fb 100644 --- a/app/controllers/api/v8/courses/users/points_controller.rb +++ b/app/controllers/api/v8/courses/users/points_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -48,12 +49,13 @@ class PointsController < Api::V8::BaseController end end + sig { void } def index course = Course.find_by!(id: params[:course_id]) params[:user_id] = current_user.id if params[:user_id] == 'current' points = course.awarded_points.includes(:submission).where(user_id: params[:user_id]) authorize_collection :read, points - present points.as_json_with_exercise_ids(course.exercises) + present AwardedPoint.as_json_with_exercise_ids(points, course.exercises) end end end diff --git a/app/controllers/api/v8/courses/users/submissions_controller.rb b/app/controllers/api/v8/courses/users/submissions_controller.rb index cd4e88a39..c4b6c6258 100644 --- a/app/controllers/api/v8/courses/users/submissions_controller.rb +++ b/app/controllers/api/v8/courses/users/submissions_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -68,6 +69,7 @@ class SubmissionsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def index unauthorize_guest! course = Course.find_by!(id: params[:course_id]) diff --git a/app/controllers/api/v8/courses_controller.rb b/app/controllers/api/v8/courses_controller.rb index c51c5979c..156974455 100644 --- a/app/controllers/api/v8/courses_controller.rb +++ b/app/controllers/api/v8/courses_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -24,6 +25,7 @@ class CoursesController < Api::V8::BaseController end end + sig { void } def show unauthorize_guest! course = Course.find_by!(id: params[:id]) diff --git a/app/controllers/api/v8/exercises/model_solutions_controller.rb b/app/controllers/api/v8/exercises/model_solutions_controller.rb index 63af57422..cb7c8e024 100644 --- a/app/controllers/api/v8/exercises/model_solutions_controller.rb +++ b/app/controllers/api/v8/exercises/model_solutions_controller.rb @@ -1,13 +1,15 @@ +# typed: strict # frozen_string_literal: true module Api module V8 module Exercises class ModelSolutionsController < Api::V8::BaseController + sig { void } def index unauthorize_guest! exercise = Exercise.find(params[:exercise_id]) - course = exercise.course + course = T.must(exercise.course) authorize! :read, exercise solution = exercise.solution begin diff --git a/app/controllers/api/v8/exercises/users/submissions_controller.rb b/app/controllers/api/v8/exercises/users/submissions_controller.rb index 391926c2a..3672e9b76 100644 --- a/app/controllers/api/v8/exercises/users/submissions_controller.rb +++ b/app/controllers/api/v8/exercises/users/submissions_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -58,6 +59,7 @@ class SubmissionsController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! exercise = Exercise.find_by!(id: params[:exercise_id]) diff --git a/app/controllers/api/v8/organizations/courses/exercises/points_controller.rb b/app/controllers/api/v8/organizations/courses/exercises/points_controller.rb index d01221218..d16b666f5 100644 --- a/app/controllers/api/v8/organizations/courses/exercises/points_controller.rb +++ b/app/controllers/api/v8/organizations/courses/exercises/points_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -35,6 +36,7 @@ class PointsController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:course_name]}") @@ -44,7 +46,7 @@ def index course_id: course.id) authorize! :read, points - present(points.as_json_with_exercise_ids(course.exercises)) + present(AwardedPoint.as_json_with_exercise_ids(points, course.exercises)) end end end diff --git a/app/controllers/api/v8/organizations/courses/exercises/users/points_controller.rb b/app/controllers/api/v8/organizations/courses/exercises/users/points_controller.rb index 1b48b88a8..5b256c3d8 100644 --- a/app/controllers/api/v8/organizations/courses/exercises/users/points_controller.rb +++ b/app/controllers/api/v8/organizations/courses/exercises/users/points_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -64,6 +65,7 @@ class PointsController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:course_name]}") @@ -75,7 +77,7 @@ def index user_id: params[:user_id]) authorize! :read, points - present(points.as_json_with_exercise_ids(course.exercises)) + present(AwardedPoint.as_json_with_exercise_ids(points, course.exercises)) end end end diff --git a/app/controllers/api/v8/organizations/courses/exercises_controller.rb b/app/controllers/api/v8/organizations/courses/exercises_controller.rb index ec8cff354..0b3f2728d 100644 --- a/app/controllers/api/v8/organizations/courses/exercises_controller.rb +++ b/app/controllers/api/v8/organizations/courses/exercises_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -52,6 +53,7 @@ class ExercisesController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:course_name]}") @@ -74,6 +76,7 @@ def index present(presentable) end + sig { void } def show authorization_skip! organization = Organization.find_by!(slug: params[:organization_slug]) @@ -106,7 +109,7 @@ def show end if grant_model_solution_token_every_nth_completed_exercise && grant_model_solution_token_every_nth_completed_exercise > 0 completed_exercises_count = course.submissions.where(all_tests_passed: true, user: current_user).distinct.select(:exercise_name).count - total_model_solution_tokens = completed_exercises_count / grant_model_solution_token_every_nth_completed_exercise + (course.initial_coin_stash || 0) + total_model_solution_tokens = (completed_exercises_count / grant_model_solution_token_every_nth_completed_exercise) + (course.initial_coin_stash || 0) tokens_used = if course.large_exercises_consume_more_coins? ModelSolutionTokenUsed.where(user: current_user, course: course).sum(:cost) @@ -140,6 +143,7 @@ def show ) end + sig { void } def download course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:course_name]}") exercise = Exercise.find_by!(name: params[:name], course_id: course.id) diff --git a/app/controllers/api/v8/organizations/courses/points_controller.rb b/app/controllers/api/v8/organizations/courses/points_controller.rb index 2155bae10..c06be0b7e 100644 --- a/app/controllers/api/v8/organizations/courses/points_controller.rb +++ b/app/controllers/api/v8/organizations/courses/points_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -28,11 +29,12 @@ class PointsController < Api::V8::BaseController end end + sig { void } def index course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:course_name]}") points = course.awarded_points.includes(:submission) authorize_collection :read, points - present points.as_json_with_exercise_ids(course.exercises) + present AwardedPoint.as_json_with_exercise_ids(points, course.exercises) end end end diff --git a/app/controllers/api/v8/organizations/courses/studyright_eligibility_controller.rb b/app/controllers/api/v8/organizations/courses/studyright_eligibility_controller.rb index 818b761ba..1aed52813 100644 --- a/app/controllers/api/v8/organizations/courses/studyright_eligibility_controller.rb +++ b/app/controllers/api/v8/organizations/courses/studyright_eligibility_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -30,6 +31,7 @@ class StudyrightEligibilityController < Api::V8::BaseController skip_authorization_check + sig { void } def eligible_students unauthorize_guest! @@ -41,11 +43,12 @@ def eligible_students applied_students = UserAppDatum.where(field_name: 'applies_for_study_right', value: 't', namespace: 'ohjelmoinnin-mooc-2019').pluck(:user_id) - groups = course.exercise_groups[0..6] + course.exercise_groups[7..13] - - cbu = course.exercise_group_completion_by_user - - user_ids = groups.flat_map { |group| ap = cbu[group.name][:available_points]; cbu[group.name][:points_by_user].map { |k, v| { k => (v.to_f / ap) } } }.group_by { |o| o.keys.first }.map { |k, v| { k => v.map { |o2| o2[k] } } }.inject(:merge).select { |_k, v| v.length == groups.length }.select { |_k, v| v.all? { |o2| o2 >= 0.8995 } }.map { |k, _v| k } + completion_by_group = course.exercise_group_completion_by_user + # Groups without available points are absent from the completion data and can't be failed. + completions = course.exercise_groups.first(14).filter_map { |group| completion_by_group[group.name] } + user_ids = completions.map do |completion| + completion[:points_by_user].select { |_user_id, points| points.to_f / completion[:available_points] >= 0.8995 }.keys + end.reduce(:&) || [] eligble_ids = (user_ids & applied_students) users = User.where(id: eligble_ids) @@ -66,10 +69,10 @@ def eligible_students } if user_id_to_extra_fields extra_fields = user_id_to_extra_fields[u.id] || [] - d[:extra_fields] = extra_fields.map { |o| [o.field_name, o.value] }.to_h + d[:extra_fields] = extra_fields.to_h { |o| [o.field_name, o.value] } end if params[:user_fields] - user_fields = u.user_field_values.map { |o| [o.field_name, o.value] }.to_h + user_fields = u.user_field_values.to_h { |o| [o.field_name, o.value] } d[:user_fields] = user_fields d[:student_number] = user_fields['organizational_id'] d[:first_name] = user_fields['first_name'] diff --git a/app/controllers/api/v8/organizations/courses/submissions_controller.rb b/app/controllers/api/v8/organizations/courses/submissions_controller.rb index f3ae4ead9..b2ff37a74 100644 --- a/app/controllers/api/v8/organizations/courses/submissions_controller.rb +++ b/app/controllers/api/v8/organizations/courses/submissions_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -39,6 +40,7 @@ class SubmissionsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def index unauthorize_guest! course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:course_name]}") diff --git a/app/controllers/api/v8/organizations/courses/users/points_controller.rb b/app/controllers/api/v8/organizations/courses/users/points_controller.rb index ee1534f25..1253e1a6f 100644 --- a/app/controllers/api/v8/organizations/courses/users/points_controller.rb +++ b/app/controllers/api/v8/organizations/courses/users/points_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -51,12 +52,13 @@ class PointsController < Api::V8::BaseController end end + sig { void } def index course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:course_name]}") params[:user_id] = current_user.id if params[:user_id] == 'current' points = course.awarded_points.includes(:submission).where(user_id: params[:user_id]) authorize_collection :read, points - present points.as_json_with_exercise_ids(course.exercises) + present AwardedPoint.as_json_with_exercise_ids(points, course.exercises) end end end diff --git a/app/controllers/api/v8/organizations/courses/users/progress_controller.rb b/app/controllers/api/v8/organizations/courses/users/progress_controller.rb index 98e43af65..d8a7fd265 100644 --- a/app/controllers/api/v8/organizations/courses/users/progress_controller.rb +++ b/app/controllers/api/v8/organizations/courses/users/progress_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -51,6 +52,7 @@ class ProgressController < Api::V8::BaseController end end + sig { void } def index unauthorize_guest! course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:course_name]}") @@ -64,7 +66,7 @@ def index { group: group, progress: info[:progress], - n_points: info[:awarded] + info[:late], + n_points: T.must(info[:awarded]) + T.must(info[:late]), max_points: info[:available_points], } end diff --git a/app/controllers/api/v8/organizations/courses/users/submissions_controller.rb b/app/controllers/api/v8/organizations/courses/users/submissions_controller.rb index 853589010..7aa792d96 100644 --- a/app/controllers/api/v8/organizations/courses/users/submissions_controller.rb +++ b/app/controllers/api/v8/organizations/courses/users/submissions_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -71,6 +72,7 @@ class SubmissionsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def index unauthorize_guest! course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:course_name]}") diff --git a/app/controllers/api/v8/organizations/courses_controller.rb b/app/controllers/api/v8/organizations/courses_controller.rb index 927be7147..6f420f530 100644 --- a/app/controllers/api/v8/organizations/courses_controller.rb +++ b/app/controllers/api/v8/organizations/courses_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -26,6 +27,7 @@ class CoursesController < Api::V8::BaseController end end + sig { void } def show unauthorize_guest! course = Course.find_by!(name: "#{params[:organization_slug]}-#{params[:name]}") diff --git a/app/controllers/api/v8/organizations/memberships_controller.rb b/app/controllers/api/v8/organizations/memberships_controller.rb index 99bc00803..dc0b1e6e3 100644 --- a/app/controllers/api/v8/organizations/memberships_controller.rb +++ b/app/controllers/api/v8/organizations/memberships_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -57,20 +58,7 @@ class MembershipsController < Api::V8::BaseController end end - def create - unauthorize_guest! - - organization = Organization.find_by!(slug: params[:organization_slug]) - authorize! :read, organization - - if organization.member?(current_user) - present(status: "#{current_user.email} is already a member of #{organization.name}") - else - OrganizationMembership.create! user: current_user, organization: organization - present(status: "Membership created to #{organization.name} for #{current_user.email}") - end - end - + sig { void } def index unauthorize_guest! @@ -85,6 +73,21 @@ def index end present(members: data) end + + sig { void } + def create + unauthorize_guest! + + organization = Organization.find_by!(slug: params[:organization_slug]) + authorize! :read, organization + + if organization.member?(current_user) + present(status: "#{current_user.email} is already a member of #{organization.name}") + else + OrganizationMembership.create! user: current_user, organization: organization + present(status: "Membership created to #{organization.name} for #{current_user.email}") + end + end end end end diff --git a/app/controllers/api/v8/organizations_controller.rb b/app/controllers/api/v8/organizations_controller.rb index 0b7163d1b..657c51ef6 100644 --- a/app/controllers/api/v8/organizations_controller.rb +++ b/app/controllers/api/v8/organizations_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -45,6 +46,7 @@ class OrganizationsController < Api::V8::BaseController end end + sig { void } def index orgs = Organization .visible_organizations @@ -60,6 +62,7 @@ def index present(orgs) end + sig { void } def show org = Organization.find_by!(slug: params[:slug]) authorize! :read, org diff --git a/app/controllers/api/v8/user_app_datum_controller.rb b/app/controllers/api/v8/user_app_datum_controller.rb index 52303c8a2..5abd1049d 100644 --- a/app/controllers/api/v8/user_app_datum_controller.rb +++ b/app/controllers/api/v8/user_app_datum_controller.rb @@ -1,9 +1,11 @@ +# typed: strict # frozen_string_literal: true module Api module V8 class UserAppDatumController < Api::V8::BaseController skip_authorization_check + sig { void } def index only_admins! diff --git a/app/controllers/api/v8/user_field_value_controller.rb b/app/controllers/api/v8/user_field_value_controller.rb index 489c97a41..2a8a581d1 100644 --- a/app/controllers/api/v8/user_field_value_controller.rb +++ b/app/controllers/api/v8/user_field_value_controller.rb @@ -1,9 +1,11 @@ +# typed: strict # frozen_string_literal: true module Api module V8 class UserFieldValueController < Api::V8::BaseController skip_authorization_check + sig { void } def index only_admins! diff --git a/app/controllers/api/v8/users/assistantships_controller.rb b/app/controllers/api/v8/users/assistantships_controller.rb index 2b7b6378d..4c66916c4 100644 --- a/app/controllers/api/v8/users/assistantships_controller.rb +++ b/app/controllers/api/v8/users/assistantships_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -66,6 +67,7 @@ class AssistantshipsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def index unauthorize_guest! @@ -73,7 +75,7 @@ def index user = User.find(params[:user_id]) authorize! :read, user - assisted_courses = user.assistantships.pluck(:course_id) + assisted_courses = T.let(user.assistantships.pluck(:course_id), T::Array[Integer]) readable = Course.find(assisted_courses).map do |c| { 'course_id': c.id, diff --git a/app/controllers/api/v8/users/basic_info_by_emails_controller.rb b/app/controllers/api/v8/users/basic_info_by_emails_controller.rb index e3b3572e6..1349f9b24 100644 --- a/app/controllers/api/v8/users/basic_info_by_emails_controller.rb +++ b/app/controllers/api/v8/users/basic_info_by_emails_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -58,11 +59,12 @@ class BasicInfoByEmailsController < Api::V8::BaseController skip_authorization_check + sig { void } def create return respond_forbidden unless current_user.administrator? - users = params[:emails].map do |email| + users = params[:emails].filter_map do |email| User.find_by('lower(email) = ?', email.downcase) - end.compact + end user_id_to_extra_fields = nil if params[:extra_fields] namespace = params[:extra_fields] @@ -78,10 +80,10 @@ def create } if user_id_to_extra_fields extra_fields = user_id_to_extra_fields[u.id] || [] - d[:extra_fields] = extra_fields.map { |o| [o.field_name, o.value] }.to_h + d[:extra_fields] = extra_fields.to_h { |o| [o.field_name, o.value] } end if params[:user_fields] - user_fields = u.user_field_values.map { |o| [o.field_name, o.value] }.to_h + user_fields = u.user_field_values.to_h { |o| [o.field_name, o.value] } d[:user_fields] = user_fields d[:student_number] = user_fields['organizational_id'] d[:first_name] = user_fields['first_name'] diff --git a/app/controllers/api/v8/users/basic_info_by_ids_controller.rb b/app/controllers/api/v8/users/basic_info_by_ids_controller.rb index b7f51e7b9..961608d75 100644 --- a/app/controllers/api/v8/users/basic_info_by_ids_controller.rb +++ b/app/controllers/api/v8/users/basic_info_by_ids_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -6,6 +7,7 @@ module Users class BasicInfoByIdsController < Api::V8::BaseController skip_authorization_check + sig { void } def create return respond_forbidden unless current_user.administrator? users = if params[:extra_fields] @@ -28,10 +30,10 @@ def create } if user_id_to_extra_fields extra_fields = user_id_to_extra_fields[u.id] || [] - d[:extra_fields] = extra_fields.map { |o| [o.field_name, o.value] }.to_h + d[:extra_fields] = extra_fields.to_h { |o| [o.field_name, o.value] } end if params[:user_fields] - user_fields = u.user_field_values.map { |o| [o.field_name, o.value] }.to_h + user_fields = u.user_field_values.to_h { |o| [o.field_name, o.value] } d[:user_fields] = user_fields d[:student_number] = user_fields['organizational_id'] d[:first_name] = user_fields['first_name'] diff --git a/app/controllers/api/v8/users/basic_info_by_usernames_controller.rb b/app/controllers/api/v8/users/basic_info_by_usernames_controller.rb index e8a2186f0..652f71415 100644 --- a/app/controllers/api/v8/users/basic_info_by_usernames_controller.rb +++ b/app/controllers/api/v8/users/basic_info_by_usernames_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -58,6 +59,7 @@ class BasicInfoByUsernamesController < Api::V8::BaseController skip_authorization_check + sig { void } def create return respond_forbidden unless current_user.administrator? users = if params[:extra_fields] @@ -80,10 +82,10 @@ def create } if user_id_to_extra_fields extra_fields = user_id_to_extra_fields[u.id] || [] - d[:extra_fields] = extra_fields.map { |o| [o.field_name, o.value] }.to_h + d[:extra_fields] = extra_fields.to_h { |o| [o.field_name, o.value] } end if params[:user_fields] - user_fields = u.user_field_values.map { |o| [o.field_name, o.value] }.to_h + user_fields = u.user_field_values.to_h { |o| [o.field_name, o.value] } d[:user_fields] = user_fields d[:student_number] = user_fields['organizational_id'] d[:first_name] = user_fields['first_name'] diff --git a/app/controllers/api/v8/users/password_reset_controller.rb b/app/controllers/api/v8/users/password_reset_controller.rb index 35f494b15..8acc23cea 100644 --- a/app/controllers/api/v8/users/password_reset_controller.rb +++ b/app/controllers/api/v8/users/password_reset_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -6,16 +7,17 @@ module Users class PasswordResetController < Api::V8::BaseController skip_authorization_check + sig { void } def create - @email = params['email'].to_s.strip - if @email.empty? + email = params['email'].to_s.strip + if email.empty? return render json: { success: false, errors: 'No email address provided' } end - user = User.find_by('lower(email) = ?', @email.downcase) + user = User.find_by('lower(email) = ?', email.downcase) unless user return render json: { success: false, @@ -25,7 +27,7 @@ def create key = ActionToken.generate_password_reset_key_for(user) # TODO: Whitelist origins - PasswordResetKeyMailer.reset_link_email(user, key, params['origin']).deliver + PasswordResetKeyMailer.reset_link_email(user, key, params['origin']).deliver_now render json: { success: true } diff --git a/app/controllers/api/v8/users/recently_changed_user_details_controller.rb b/app/controllers/api/v8/users/recently_changed_user_details_controller.rb index ff29f5d10..01efe0b09 100644 --- a/app/controllers/api/v8/users/recently_changed_user_details_controller.rb +++ b/app/controllers/api/v8/users/recently_changed_user_details_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -6,10 +7,11 @@ module Users class RecentlyChangedUserDetailsController < Api::V8::BaseController skip_authorization_check + sig { void } def index return respond_forbidden unless current_user.administrator? - RecentlyChangedUserDetail.deleted.where('created_at < ?', DateTime.now - 1.week).update(email: nil) - RecentlyChangedUserDetail.email_changed.where('created_at < ?', DateTime.now - 1.month).delete_all + RecentlyChangedUserDetail.deleted.where(created_at: ...(DateTime.now - 1.week)).update(:all, email: nil) + RecentlyChangedUserDetail.email_changed.where(created_at: ...(DateTime.now - 1.month)).delete_all render json: { changes: RecentlyChangedUserDetail.all } end end diff --git a/app/controllers/api/v8/users/request_deletion_controller.rb b/app/controllers/api/v8/users/request_deletion_controller.rb index c1baf2c2d..cf683195c 100644 --- a/app/controllers/api/v8/users/request_deletion_controller.rb +++ b/app/controllers/api/v8/users/request_deletion_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -6,6 +7,7 @@ module Users class RequestDeletionController < Api::V8::BaseController skip_authorization_check + sig { void } def create user = current_user user = User.find_by!(id: params[:user_id]) unless params[:user_id] == 'current' diff --git a/app/controllers/api/v8/users/teacherships_controller.rb b/app/controllers/api/v8/users/teacherships_controller.rb index 9469ad468..ad83061d4 100644 --- a/app/controllers/api/v8/users/teacherships_controller.rb +++ b/app/controllers/api/v8/users/teacherships_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module Api @@ -66,6 +67,7 @@ class TeachershipsController < Api::V8::BaseController around_action :wrap_transaction + sig { void } def index unauthorize_guest! @@ -73,7 +75,7 @@ def index user = User.find(params[:user_id]) authorize! :read, user - taught_organizations = user.teacherships.pluck(:organization_id) + taught_organizations = T.let(user.teacherships.pluck(:organization_id), T::Array[Integer]) readable = Organization.find(taught_organizations).map do |o| { 'organization_id': o.id, diff --git a/app/controllers/api/v8/users_controller.rb b/app/controllers/api/v8/users_controller.rb index 16d110f7d..40d491526 100644 --- a/app/controllers/api/v8/users_controller.rb +++ b/app/controllers/api/v8/users_controller.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true module Api module V8 class UsersController < Api::V8::BaseController + extend T::Sig include Swagger::Blocks swagger_path '/api/v8/users/{user_id}' do @@ -111,6 +113,7 @@ class UsersController < Api::V8::BaseController skip_authorization_check only: %i[set_password_managed_by_courses_mooc_fi destroy] + sig { void } def show unauthorize_guest! if current_user.guest? user = current_user @@ -125,7 +128,7 @@ def show } if params[:show_user_fields] - user_field = {} + user_field = T.let({}, T::Hash[String, T.any(String, T::Boolean)]) UserField.all.select { |f| f.visible_to?(current_user) }.each do |field| value_record = user.field_value_record(field) value = value_record.ruby_value @@ -135,9 +138,9 @@ def show end if params[:extra_fields] - extra_fields = {} + extra_fields = T.let({}, T::Hash[T.nilable(String), T.nilable(String)]) namespace = params[:extra_fields] - UserAppDatum.where(namespace: namespace, user: user).each do |datum| + UserAppDatum.where(namespace: namespace, user: user).find_each do |datum| extra_fields[datum.field_name] = datum.value end data[:extra_fields] = extra_fields @@ -145,71 +148,78 @@ def show render json: data end + sig { void } def create authorize! :create, User - @user = User.new + user = User.new - @user.login = SecureRandom.uuid + user.login = SecureRandom.uuid - set_email - set_password - set_user_fields - set_extra_data + set_email(user) + set_password(user) + set_user_fields(user) + set_extra_data(user) - if BannedEmail.banned?(@user.email) - return render json: build_success_response(params[:include_id]) + if BannedEmail.banned?(user.email) + return render json: build_success_response(user, params[:include_id]) end - if @user.errors.empty? && @user.save + if user.errors.empty? && user.save # TODO: Whitelist origins - UserMailer.email_confirmation(@user, params[:origin], params[:language]).deliver_now + UserMailer.email_confirmation(user, params[:origin], params[:language]).deliver_now # Post the new user to courses.mooc.fi for password management if params[:user][:password].present? - @user.post_new_user_to_courses_mooc_fi(params[:user][:password]) + user.post_new_user_to_courses_mooc_fi(params[:user][:password]) end - render json: build_success_response(params[:include_id]) + render json: build_success_response(user, params[:include_id]) else - errors = @user.errors - errors[:username] = errors.delete(:login) if errors.key?(:login) + errors = user.errors + errors.delete(:login)&.each { |message| errors.add(:username, message) } render json: { success: false, - errors: @user.errors + errors: user.errors } end end + sig { void } def update unauthorize_guest! if current_user.guest? - User.transaction do - @user = current_user - @user = User.find_by!(id: params[:id]) unless params[:id] == 'current' - @email_before = @user.email - authorize! :update, @user - set_user_fields - set_extra_data(true) - update_email - maybe_update_password - raise ActiveRecord::Rollback if !@user.errors.empty? || !@user.save + user = current_user + updated = User.transaction do + user = User.find_by!(id: params[:id]) unless params[:id] == 'current' + email_before = user.email + authorize! :update, user + set_user_fields(user) + set_extra_data(user, true) + update_email(user) + maybe_update_password(user) + raise ActiveRecord::Rollback if !user.errors.empty? || !user.save # Password changed locally: migrate the user to courses.mooc.fi - if params[:old_password].present? && params[:password].present? && !@user.managed_externally? - @user.post_new_user_to_courses_mooc_fi(params[:password]) + if params[:old_password].present? && params[:password].present? && !user.managed_externally? + user.post_new_user_to_courses_mooc_fi(params[:password]) end - RecentlyChangedUserDetail.email_changed.create!(old_value: @email_before, new_value: @user.email, username: @user.login, user_id: @user.id) unless @email_before.casecmp(@user.email).zero? - return render json: { + RecentlyChangedUserDetail.email_changed.create!(old_value: email_before, new_value: user.email, username: user.login, user_id: user.id) unless T.must(email_before.casecmp(user.email)).zero? + true + end + if updated + render json: { message: 'User details updated.' } + else + render json: { + errors: user.errors + }, status: :bad_request end - render json: { - errors: @user.errors - }, status: :bad_request end # courses.mooc.fi retries account deletion and keys off success/already_deleted/code, so a # user that is already gone must answer 200, never 404. + sig { void } def destroy return render_destroy_failure('not_authorized', 'Authentication required', :unauthorized) if current_user.guest? @@ -238,6 +248,7 @@ def destroy render_destroy_failure('internal_error', 'User deletion failed.', :internal_server_error) end + sig { void } def set_password_managed_by_courses_mooc_fi only_admins! @@ -249,22 +260,27 @@ def set_password_managed_by_courses_mooc_fi user = User.find_by!(id: params[:id]) authorize! :update, user - User.transaction do + updated = User.transaction do user.password_managed_by_courses_mooc_fi = true user.password_hash = nil user.salt = nil user.argon_hash = nil user.courses_mooc_fi_user_id = params[:courses_mooc_fi_user_id] raise ActiveRecord::Rollback if !user.errors.empty? || !user.save - return render json: { + true + end + if updated + render json: { status: 'Password managed by courses.mooc.fi set to true and password deleted.' } + else + render json: { + errors: user.errors + }, status: :bad_request end - render json: { - errors: user.errors - }, status: :bad_request end + sig { void } def get_user_with_email unauthorize_guest! if current_user.guest? @@ -283,78 +299,84 @@ def get_user_with_email end private + sig { params(code: String, messages: T.any(String, T::Array[String]), status: Symbol).void } def render_destroy_failure(code, messages, status) render json: { success: false, code: code, errors: [*messages] }, status: status end - def set_email + sig { params(user: User).void } + def set_email(user) user_params = params[:user] - return unless @user.new_record? + return unless user.new_record? if user_params[:email].blank? - @user.errors.add(:email, 'needed') + user.errors.add(:email, 'needed') else - @user.email = user_params[:email].strip + user.email = user_params[:email].strip end end - def update_email + sig { params(user: User).void } + def update_email(user) user_params = params[:user] return unless user_params[:email] new_email = user_params[:email].strip if new_email.blank? - @user.errors.add(:email, 'needed') - elsif @user.email.casecmp(new_email) != 0 - @user.email = new_email - @user.email_verified = false - UserMailer.email_confirmation(@user, params[:origin], params[:language]).deliver_now + user.errors.add(:email, 'needed') + elsif user.email.casecmp(new_email) != 0 + user.email = new_email + user.email_verified = false + UserMailer.email_confirmation(user, params[:origin], params[:language]).deliver_now end end - def set_password + sig { params(user: User).void } + def set_password(user) user_params = params[:user] if user_params[:password].blank? - @user.errors.add(:password, 'needed') + user.errors.add(:password, 'needed') elsif user_params[:password].length > 1000 - @user.errors.add(:password, 'cannot be over 1000 characters') + user.errors.add(:password, 'cannot be over 1000 characters') elsif user_params[:password] != user_params[:password_confirmation] - @user.errors.add(:password_confirmation, 'did not match') + user.errors.add(:password_confirmation, 'did not match') else - @user.password = user_params[:password] + user.password = user_params[:password] end end - def maybe_update_password + sig { params(user: User).void } + def maybe_update_password(user) if params[:old_password].present? && params[:password].present? - if @user.managed_externally? - unless @user.update_password_via_courses_mooc_fi(params[:old_password], params[:password]) - @user.errors.add(:password, 'could not be changed. Please check your current password and try again.') + if user.managed_externally? + unless user.update_password_via_courses_mooc_fi(params[:old_password], params[:password]) + user.errors.add(:password, 'could not be changed. Please check your current password and try again.') end return - elsif @user.externally_managed_without_target? - @user.errors.add(:base, 'This account is being migrated; password changes are temporarily unavailable.') + elsif user.externally_managed_without_target? + user.errors.add(:base, 'This account is being migrated; password changes are temporarily unavailable.') return end - if !@user.has_password?(params[:old_password]) - @user.errors.add(:old_password, 'incorrect') + if !user.has_password?(params[:old_password]) + user.errors.add(:old_password, 'incorrect') elsif params[:password] != params[:password_repeat] - @user.errors.add(:password_repeat, 'did not match') + user.errors.add(:password_repeat, 'did not match') elsif params[:password].blank? - @user.errors.add(:password, 'cannot be empty') + user.errors.add(:password, 'cannot be empty') elsif params[:password].length > 1000 - @user.errors.add(:password, 'cannot be over 1000 characters') + user.errors.add(:password, 'cannot be over 1000 characters') else - @user.password = params[:password] + user.password = params[:password] end end end - def set_user_fields + sig { params(user: User).returns(T.nilable(T::Hash[String, T::Hash[Symbol, T.any(String, T::Boolean)]])) } + def set_user_fields(user) return if params[:user_field].nil? - changes = {} + changes = T.let({}, T::Hash[String, T::Hash[Symbol, T.any(String, T::Boolean)]]) UserField.all.select { |f| f.visible_to?(current_user) }.each do |field| - value_record = @user.field_value_record(field) + value_record = user.field_value_record(field) old_value = value_record.ruby_value value_record.set_from_form(params[:user_field][field.name]) new_value = value_record.ruby_value @@ -363,26 +385,28 @@ def set_user_fields changes end - def set_extra_data(eager_save = false) + sig { params(user: User, eager_save: T::Boolean).void } + def set_extra_data(user, eager_save = false) return unless params['user'] extra_fields = params['user']['extra_fields'] return if extra_fields.nil? namespace = extra_fields['namespace'] raise 'Namespace not defined' unless namespace extra_fields['data'].each do |key, value| - datum = @user.user_app_data.find_or_initialize_by(namespace: namespace, field_name: key) + datum = user.user_app_data.find_or_initialize_by(namespace: namespace, field_name: key) datum.value = value datum.save! if eager_save end end - def build_success_response(include_id = false) - response = { + sig { params(user: User, include_id: T.untyped).returns(T::Hash[Symbol, T.untyped]) } + def build_success_response(user, include_id = false) + response = T.let({ success: true, message: 'User created.', - } + }, T::Hash[Symbol, T.untyped]) if include_id - response[:id] = @user.id + response[:id] = user.id end response end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4e307cb1d..071b8dcd5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'version' @@ -8,6 +9,7 @@ # Includes common parts like handling some exceptions as well as # various utility methods. class ApplicationController < ActionController::Base + extend T::Sig include BreadCrumbs helper :all @@ -20,13 +22,12 @@ class ApplicationController < ActionController::Base include BootstrapFlashHelper include FlashBlockHelper include SessionsHelper - include BreadcrumbHelpers - include EmbeddableHelper include AuthorizeCollectionHelper include ApplicationHelper check_authorization rescue_from CanCan::AccessDenied do |_exception| + T.bind(self, ApplicationController) if current_user.guest? redirect_to(login_path(return_to: return_to_link)) else @@ -35,18 +36,22 @@ class ApplicationController < ActionController::Base end rescue_from ActiveRecord::RecordNotFound do |exception| + T.bind(self, ApplicationController) respond_with_error('Not found', 404, exception) end rescue_from ActionController::MissingFile do |exception| + T.bind(self, ApplicationController) respond_with_error('File not found', 404, exception) end rescue_from Rack::Timeout::RequestTimeoutException do |exception| + T.bind(self, ApplicationController) respond_with_error('Request timed out', 504, exception) # status code 408 would be the correct status code, but when receiving 408 Firefox retries 10 times and then states the connection was reset instead of showing our error end rescue_from Rack::Timeout::RequestTimeoutError do |exception| + T.bind(self, ApplicationController) respond_with_error('Request timed out', 504, exception) # status code 408 would be the correct status code, but when receiving 408 Firefox retries 10 times and then states the connection was reset instead of showing our error end @@ -56,6 +61,17 @@ class ApplicationController < ActionController::Base before_action :set_controller_and_action_name before_action :setup_rack_mini_profiler + sig { void } + def initialize + super + # Declared here because the breadcrumb helpers read them; subclasses assign them. + @organization = T.let(nil, T.nilable(Organization)) + @course = T.let(nil, T.nilable(Course)) + @exercise = T.let(nil, T.nilable(Exercise)) + @submission = T.let(nil, T.nilable(Submission)) + end + + sig { returns(T::Hash[Symbol, T.untyped]) } def url_options if @bare_layout { bare_layout: '1' }.merge(super) @@ -65,14 +81,17 @@ def url_options end private + sig { returns(::Ability) } def current_ability - @current_ability ||= ::Ability.new(current_user) + @current_ability ||= T.let(::Ability.new(current_user), T.nilable(::Ability)) end + sig { void } def set_default_url_options Rails.application.routes.default_url_options[:host] = request.host_with_port end + sig { void } def check_api_version if should_check_api_version? if params[:api_version].blank? @@ -91,6 +110,7 @@ def check_api_version end end + sig { params(client_name: T.untyped, client_version: T.untyped).void } def check_client_version(client_name, client_version) begin client_version = Version.new(client_version) unless client_version.nil? @@ -111,6 +131,7 @@ def check_client_version(client_name, client_version) end end + sig { returns(T::Boolean) } def should_check_api_version? params[:format] == 'json' && controller_name != 'stats' && @@ -119,49 +140,65 @@ def should_check_api_version? !(controller_path.starts_with? 'api') end + sig { void } def set_bare_layout - @bare_layout = !!params[:bare_layout] + @bare_layout = T.let(!!params[:bare_layout], T.nilable(T::Boolean)) end + sig { void } + def remove_x_frame_options_header_when_bare_layout + response.headers.except! 'X-Frame-Options' if @bare_layout + end + + sig { void } def set_controller_and_action_name - @controller_name = controller_name - @action_name = action_name + @controller_name = T.let(controller_name, T.nilable(String)) + @action_name = T.let(action_name, T.nilable(String)) end + sig { void } def setup_rack_mini_profiler - if current_user && current_user.administrator? + if current_user.administrator? Rack::MiniProfiler.authorize_request end end + sig { params(message: T.nilable(String)).returns(T.noreturn) } def unauthorized!(message = nil) raise CanCan::AccessDenied, message end + sig { params(message: String).void } def unauthorize_guest!(message = 'Authentication required') unauthorized!(message) if current_user.guest? end + sig { void } def only_admins! unauthorized! unless current_user.administrator? end + sig { void } def authorization_skip! authorize! :read, nil end + sig { params(msg: String).void } def respond_not_found(msg = 'Not Found') respond_with_error(msg, 404) end + sig { params(msg: String).void } def respond_forbidden(msg = 'Forbidden') respond_with_error(msg, 403) end + sig { params(msg: String).void } def respond_unauthorized(msg = 'Authentication required') respond_with_error(msg, 401) end + sig { params(msg: String, code: Integer, exception: T.nilable(Exception), extra_json_keys: T::Hash[Symbol, T.untyped]).void } def respond_with_error(msg, code = 500, exception = nil, extra_json_keys = {}) respond_to do |format| format.html do @@ -190,16 +227,25 @@ def respond_with_error(msg, code = 500, exception = nil, extra_json_keys = {}) end # To support older versions of tmc-netbeans-plugin + sig { returns(T::Boolean) } def client_supports_http_basic_auth? - return true if params[:client].blank? - client = params[:client] + params[:client] != 'netbeans_plugin' || netbeans_plugin_at_least?('0.8.0') + end + + # Whether the request comes from tmc-netbeans-plugin +min_version+ or newer. + # A NetBeans plugin that sends no parseable version counts as older. + sig { params(min_version: String).returns(T::Boolean) } + def netbeans_plugin_at_least?(min_version) + return false unless params[:client] == 'netbeans_plugin' client_version = begin Version.new(params['client_version']) if params['client_version'].present? rescue StandardError + nil end - !(client == 'netbeans_plugin' && client_version < Version.new('0.8.0')) + !client_version.nil? && client_version >= Version.new(min_version) end + sig { returns(String) } def select_layout if params[:bare_layout] 'bare' @@ -208,16 +254,19 @@ def select_layout end end + # permitted: :all, or the field names without the prefix. + sig { params(prefix: String, permitted: T.any(Symbol, T::Array[String]), options: T::Hash[Symbol, T.untyped]).returns(T::Hash[String, T.untyped]) } def params_starting_with(prefix, permitted, options = {}) options = { remove_prefix: false }.merge(options) - permitted = permitted.map { |f| prefix + f } unless permitted == :all + permitted = permitted.map { |f| prefix + f } if permitted.is_a?(Array) - result = Hash[params.select do |k, v| - k.start_with?(prefix) && v.present? && (permitted == :all || permitted.include?(k)) - end.permit(permitted)] + selected = params.select do |k, v| + k.start_with?(prefix) && v.present? && (permitted == :all || (permitted.is_a?(Array) && permitted.include?(k))) + end + result = Hash[selected.permit(*selected.keys)] if options[:remove_prefix] result = result.transform_keys { |k| k.sub(/^#{prefix}/, '') } end @@ -226,6 +275,7 @@ def params_starting_with(prefix, permitted, options = {}) # To be called from a respond_to on csv. # http://stackoverflow.com/questions/94502/in-rails-how-to-return-records-as-a-csv-file + sig { params(options: T::Hash[Symbol, T.untyped]).void } def render_csv(options = {}) options = { filename: action_name @@ -250,7 +300,39 @@ def render_csv(options = {}) render render_options end + sig { params(block: T.proc.void).void } def wrap_transaction(&block) ActiveRecord::Base.transaction(requires_new: true, &block) end + + sig { void } + def add_organization_breadcrumb + organization = T.must(@organization) + add_breadcrumb "Organization #{organization.name}", organization_path(organization) + end + + sig { void } + def add_course_breadcrumb + add_organization_breadcrumb + course = T.must(@course) + add_breadcrumb "Course #{course.name}", organization_course_path(@organization, course) + end + + sig { void } + def add_exercise_breadcrumb + exercise = @exercise || @submission&.exercise + if exercise + add_breadcrumb "Exercise #{exercise.name}", exercise_path(exercise) + elsif @submission&.exercise_name + add_breadcrumb "(deleted exercise #{@submission.exercise_name})" + else + raise 'Neither @exercise nor @submission.exercise_name set' + end + end + + sig { void } + def add_submission_breadcrumb + submission = T.must(@submission) + add_breadcrumb "Submission ##{submission.id}", submission_path(submission) + end end diff --git a/app/controllers/auths_controller.rb b/app/controllers/auths_controller.rb index e79611689..859f3107c 100644 --- a/app/controllers/auths_controller.rb +++ b/app/controllers/auths_controller.rb @@ -1,13 +1,16 @@ +# typed: strict # frozen_string_literal: true # Provides an authentication service. class AuthsController < ApplicationController + extend T::Sig OK_MESSAGE = 'OK' FAIL_MESSAGE = 'FAIL' skip_authorization_check skip_before_action :verify_authenticity_token + sig { void } def show if params[:username].present? && params[:session_id].present? user = User.find_by(login: params[:username]) @@ -42,6 +45,7 @@ def show end private + sig { params(sid: T.untyped).returns(T.nilable(Session)) } def find_session_by_id(sid) # Can't say Session.find_by_session_id because of a nasty metaprogramming hax in AR's superclass. Session.where(session_id: sid).first diff --git a/app/controllers/breadcrumb_helpers.rb b/app/controllers/breadcrumb_helpers.rb deleted file mode 100644 index 06f98ae4f..000000000 --- a/app/controllers/breadcrumb_helpers.rb +++ /dev/null @@ -1,32 +0,0 @@ - -# frozen_string_literal: true - -# Helper methods for making breadcrumbs. -# -# See https://github.com/weppos/breadcrumbs_on_rails -module BreadcrumbHelpers # Included in ApplicationController - def add_organization_breadcrumb - add_breadcrumb "Organization #{@organization.name}", organization_path(@organization) - end - - def add_course_breadcrumb - add_organization_breadcrumb - add_breadcrumb "Course #{@course.name}", organization_course_path(@organization, @course) - end - - def add_exercise_breadcrumb - if @exercise - add_breadcrumb "Exercise #{@exercise.name}", exercise_path(@exercise) - elsif @submission&.exercise - add_breadcrumb "Exercise #{@submission.exercise.name}", exercise_path(@submission.exercise) - elsif @submission&.exercise_name - add_breadcrumb "(deleted exercise #{@submission.exercise_name}" - else - raise 'Neither @exercise nor @submission.exercise_name set' - end - end - - def add_submission_breadcrumb - add_breadcrumb "Submission ##{@submission.id}", submission_path(@submission) - end -end diff --git a/app/controllers/certificates_controller.rb b/app/controllers/certificates_controller.rb index afcbaeadf..479293108 100644 --- a/app/controllers/certificates_controller.rb +++ b/app/controllers/certificates_controller.rb @@ -1,21 +1,27 @@ +# typed: strict # frozen_string_literal: true class CertificatesController < ApplicationController + extend T::Sig before_action :set_user, except: [:show] before_action :set_courses, except: [:show] before_action :add_certificate_breadcrumbs, except: [:show] + sig { void } def index authorize! :read, @user - @certificates = @user.certificates.order(:created_at).includes(:course) - @names = @certificates.map(&:name).uniq.sort + certificates = T.must(@user).certificates.order(:created_at).includes(:course) + @certificates = T.let(certificates, T.nilable(ActiveRecord::Relation)) + @names = T.let(certificates.map(&:name).uniq.sort, T.nilable(T::Array[T.nilable(String)])) - @certificate = Certificate.new(user: @user) + certificate = Certificate.new(user: @user) + @certificate = T.let(certificate, T.nilable(Certificate)) - last_certificate = @certificates.last - @certificate.name = last_certificate.name if last_certificate + last_certificate = certificates.last + certificate.name = last_certificate.name if last_certificate end + sig { void } def show certificate = Certificate.find params[:id] authorize! :read, certificate @@ -23,6 +29,7 @@ def show send_data certificate.pdf, type: :pdf, disposition: 'inline' end + sig { void } def create @certificate = Certificate.new certificate_params authorize! :read, @certificate.user @@ -39,25 +46,31 @@ def create end private + sig { returns(ActionController::Parameters) } def certificate_params params.require(:certificate).permit(:name, :user_id, :course_id) end + sig { void } def set_user id = params[:participant_id] || params[:certificate][:user_id] - @user = User.find(id) + @user = T.let(User.find(id), T.nilable(User)) end + sig { void } def set_courses - @courses = current_user.administrator? ? Course.where(certificate_downloadable: true).order(:name) : Course.with_certificates_for(@user) + courses = current_user.administrator? ? Course.where(certificate_downloadable: true).order(:name) : Course.with_certificates_for(@user) + @courses = T.let(courses, T.nilable(T::Enumerable[Course])) end + sig { void } def add_certificate_breadcrumbs - if @user == current_user - add_breadcrumb 'My stats', participant_path(@user) + user = T.must(@user) + if user == current_user + add_breadcrumb 'My stats', participant_path(user) elsif current_user.administrator? add_breadcrumb 'Participants', :participants_path - add_breadcrumb @user.display_name, participant_path(@user) + add_breadcrumb user.display_name, participant_path(user) end add_breadcrumb 'Certificate' end diff --git a/app/controllers/course_notifications_controller.rb b/app/controllers/course_notifications_controller.rb index 167c1ea04..54803e0f0 100644 --- a/app/controllers/course_notifications_controller.rb +++ b/app/controllers/course_notifications_controller.rb @@ -1,26 +1,31 @@ +# typed: strict # frozen_string_literal: true # Handles emailing notification to every participant class CourseNotificationsController < ApplicationController + extend T::Sig before_action :set_organization + sig { void } def new course = Course.find(course_notification_params[:course_id]) authorize! :send_mail_to_participants, course - @notifier ||= CourseNotification.new + @notifier ||= T.let(CourseNotification.new, T.nilable(CourseNotification)) @course = Course.find_by(id: params[:course_id]) add_course_breadcrumb add_breadcrumb 'Course notification' end + sig { void } def create course = Course.find(course_notification_params[:course_id]) authorize! :send_mail_to_participants, course participants = User.course_students(course) - emails = participants.map(&:email).reject(&:blank?) + emails = participants.map(&:email).compact_blank - notifier = course.course_notifications.create(course_notification_params[:course_notification].merge(sender_id: current_user.id)) + notification_attributes = T.let(course_notification_params[:course_notification].merge(sender_id: current_user.id), ActionController::Parameters) + notifier = course.course_notifications.create(notification_attributes) if notifier.message.blank? flash[:error] = 'Cannot send a blank message.' @@ -29,7 +34,7 @@ def create failed_emails = [] emails.each do |email| - raise 'Invalid e-mail' unless email =~ /\S+@\S+/ + raise 'Invalid e-mail' unless /\S+@\S+/.match?(email) CourseNotificationMailer.notification_email( reply_to: current_user.email, to: email, @@ -46,11 +51,13 @@ def create end private + sig { returns(ActionController::Parameters) } def course_notification_params params.permit(:commit, :course_id, course_notification: %i[topic message]) end + sig { void } def set_organization - @organization = Organization.find_by(slug: params[:organization_id]) + @organization = Organization.find_by!(slug: params[:organization_id]) end end diff --git a/app/controllers/course_templates_controller.rb b/app/controllers/course_templates_controller.rb index b76a576ed..8467edae9 100644 --- a/app/controllers/course_templates_controller.rb +++ b/app/controllers/course_templates_controller.rb @@ -1,25 +1,30 @@ +# typed: strict # frozen_string_literal: true class CourseTemplatesController < ApplicationController + extend T::Sig before_action :set_course_template, except: %i[index new create list_for_teachers] + sig { void } def index authorize! :read, CourseTemplate ordering = Arel.sql('LOWER(name)') add_breadcrumb 'Course templates', course_templates_path - @course_templates = CourseTemplate.not_hidden.not_dummy.order(ordering) - @hidden_course_templates = CourseTemplate.hidden.not_dummy.order(ordering) + @course_templates = T.let(CourseTemplate.not_hidden.not_dummy.order(ordering), T.nilable(ActiveRecord::Relation)) + @hidden_course_templates = T.let(CourseTemplate.hidden.not_dummy.order(ordering), T.nilable(ActiveRecord::Relation)) if request.params[:generate_report] - @refresh_report = CourseTemplateRefresh.find(request.params[:generate_report]) + @refresh_report = T.let(CourseTemplateRefresh.find(request.params[:generate_report]), T.nilable(CourseTemplateRefresh)) end end + sig { void } def show authorize! :read, CourseTemplate add_breadcrumb 'Course templates', course_templates_path - add_breadcrumb @course_template.title.to_s + add_breadcrumb T.must(@course_template).title.to_s end + sig { void } def new authorize! :create, CourseTemplate add_breadcrumb 'Course templates', course_templates_path @@ -27,12 +32,14 @@ def new @course_template = CourseTemplate.new end + sig { void } def edit authorize! :edit, CourseTemplate add_breadcrumb 'Course templates', course_templates_path add_breadcrumb 'Edit Course template' end + sig { void } def create authorize! :create, CourseTemplate @course_template = CourseTemplate.new(course_template_params) @@ -44,46 +51,56 @@ def create end end + sig { void } def update authorize! :edit, CourseTemplate - if @course_template.update(course_template_params) - redirect_to course_templates_path, notice: "Course template '#{@course_template.name}' was successfully updated." + course_template = T.must(@course_template) + if course_template.update(course_template_params) + redirect_to course_templates_path, notice: "Course template '#{course_template.name}' was successfully updated." else render :edit end end + sig { returns(T.noreturn) } def destroy raise 'One does not destroy a course template' end + sig { void } def list_for_teachers - @organization = Organization.find_by(slug: params[:organization_id]) + @organization = Organization.find_by!(slug: params[:organization_id]) authorize! :teach, @organization add_organization_breadcrumb add_breadcrumb 'Course templates' @course_templates = CourseTemplate.available.order(Arel.sql('LOWER(title)')) end + sig { void } def toggle_hidden - @course_template.hidden = !@course_template.hidden - @course_template.save + course_template = T.must(@course_template) + course_template.hidden = !course_template.hidden + course_template.save redirect_to course_templates_path, notice: 'Course templates hidden status changed' end + sig { void } def refresh authorize! :create, CourseTemplate - notice = "Refresh initialized for course template #{@course_template.name}" - @course_template.refresh(current_user.id) - redirect_to course_templates_path(id: @course_template.id), notice: notice + course_template = T.must(@course_template) + notice = "Refresh initialized for course template #{course_template.name}" + course_template.refresh(current_user.id) + redirect_to course_templates_path(id: course_template.id), notice: notice end private + sig { void } def set_course_template authorize! params[:action].to_sym, CourseTemplate - @course_template = CourseTemplate.find(params[:id]) + @course_template = T.let(CourseTemplate.find(params[:id]), T.nilable(CourseTemplate)) end + sig { returns(ActionController::Parameters) } def course_template_params params.require(:course_template).permit(:name, :title, :description, :material_url, :source_url, :expires_at, :git_branch) end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 48fb55028..f057d2145 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'natsort' @@ -7,11 +8,13 @@ require 'course_info' class CoursesController < ApplicationController + extend T::Sig before_action :set_organization before_action :set_course, except: %i[help index show_json] skip_authorization_check only: [:index] + sig { void } def index ordering = Arel.sql('hidden, disabled_status, LOWER(name)') @@ -20,7 +23,8 @@ def index redirect_to organization_path(@organization) end format.json do - courses = @organization.courses.ongoing.order(ordering) + organization = T.must(@organization) + courses = organization.courses.ongoing.order(ordering) courses = courses.select { |c| c.visible_to?(current_user) } authorize! :read, courses return respond_unauthorized('Authentication required') if current_user.guest? @@ -28,19 +32,21 @@ def index data = { api_version: ApiVersion::API_VERSION, - courses: CourseList.new(current_user, view_context).course_list_data(@organization, courses, opts) + courses: CourseList.new(current_user, view_context).course_list_data(organization, courses, opts) } render json: data.to_json end end end + sig { void } def show authorize! :read, @course + course = T.must(@course) - if (request.params[:generate_report]) && (can? :teach, @course) + if (request.params[:generate_report]) && (can? :teach, course) report = CourseTemplateRefresh.find(request.params[:generate_report]) - @refresh_report = report if report.course_template_id == @course.course_template_id + @refresh_report = T.let(report, T.nilable(CourseTemplateRefresh)) if report.course_template_id == course.course_template_id end respond_to do |format| @@ -53,7 +59,7 @@ def show opts = { include_points: !!params[:show_points], include_unlock_conditions: !!params[:show_unlock_conditions] } data = { api_version: ApiVersion::API_VERSION, - course: CourseInfo.new(current_user, view_context).course_data(@organization, @course, opts) + course: CourseInfo.new(current_user, view_context).course_data(T.must(@organization), course, opts) } render json: data.to_json end @@ -61,6 +67,7 @@ def show end # Method for teacher to give a single course for students to select. + sig { void } def show_json course = [Course.find(params[:id])] authorize! :read, course @@ -68,41 +75,52 @@ def show_json data = { api_version: ApiVersion::API_VERSION, - courses: CourseList.new(current_user, view_context).course_list_data(@organization, course) + courses: CourseList.new(current_user, view_context).course_list_data(T.must(@organization), course) } render json: data.to_json end + sig { void } def refresh authorize! :refresh, @course - refresh_course(@course) - redirect_to(organization_course_path(@organization, @course), notice: 'Refresh initialized, please wait') + course = T.must(@course) + refresh_course(course) + redirect_to(organization_course_path(@organization, course), notice: 'Refresh initialized, please wait') end + sig { void } def enable authorize! :teach, @organization # should assistants be able to enable/disable? - @course.enabled! - redirect_to(organization_course_path(@organization, @course), notice: 'Course was successfully enabled.') + course = T.must(@course) + course.enabled! + redirect_to(organization_course_path(@organization, course), notice: 'Course was successfully enabled.') end + sig { void } def disable authorize! :teach, @organization - @course.disabled! - redirect_to(organization_course_path(@organization, @course), notice: 'Course was successfully disabled.') + course = T.must(@course) + course.disabled! + redirect_to(organization_course_path(@organization, course), notice: 'Course was successfully disabled.') end + sig { void } def toggle_hidden authorize! :teach, @organization - @course.update!(hidden: !@course.hidden) - redirect_to(organization_course_path(@organization, @course), notice: "Course is now #{@course.hidden? ? 'hidden' : 'visible'}.") + course = T.must(@course) + course.update!(hidden: !course.hidden) + redirect_to(organization_course_path(@organization, course), notice: "Course is now #{course.hidden? ? 'hidden' : 'visible'}.") end + sig { void } def toggle_code_review_requests authorize! :teach, @organization - @course.update!(code_review_requests_enabled: !@course.code_review_requests_enabled) - redirect_to(organization_course_path(@organization, @course), notice: "Code review requests are now #{@course.code_review_requests_enabled? ? 'enabled' : 'disabled'}.") + course = T.must(@course) + course.update!(code_review_requests_enabled: !course.code_review_requests_enabled) + redirect_to(organization_course_path(@organization, course), notice: "Code review requests are now #{course.code_review_requests_enabled? ? 'enabled' : 'disabled'}.") end + sig { void } def manage_deadlines authorize! :manage_deadlines, @course add_course_breadcrumb @@ -110,15 +128,18 @@ def manage_deadlines assign_show_view_vars end + sig { void } def save_deadlines authorize! :manage_deadlines, @course + course = T.must(@course) groups = group_params groups.each do |name, deadlines| - soft_deadlines = [deadlines[:soft][:static], deadlines[:soft][:unlock]].to_json - hard_deadlines = [deadlines[:hard][:static], deadlines[:hard][:unlock]].to_json - @course.exercise_group_by_name(name).soft_group_deadline = soft_deadlines - @course.exercise_group_by_name(name).hard_group_deadline = hard_deadlines + # The form may name groups that a refresh removed after it was rendered. + group = course.exercise_group_by_name(name) + next if group.nil? + group.soft_group_deadline = [deadlines[:soft][:static], deadlines[:soft][:unlock]].to_json + group.hard_group_deadline = [deadlines[:hard][:static], deadlines[:hard][:unlock]].to_json end exercises = params[:exercise] || {} @@ -126,18 +147,19 @@ def save_deadlines soft_deadlines = [deadlines[:soft][:static], deadlines[:soft][:unlock]].to_json hard_deadlines = [deadlines[:hard][:static], deadlines[:hard][:unlock]].to_json - exercise = Exercise.where(course_id: @course.id).find_by(name: name) + exercise = Exercise.where(course_id: course.id).find_by(name: name) next if exercise.nil? exercise.soft_deadline_spec = soft_deadlines exercise.deadline_spec = hard_deadlines exercise.save! end - redirect_to manage_deadlines_organization_course_path(@organization, @course), notice: 'Successfully saved deadlines.' + redirect_to manage_deadlines_organization_course_path(@organization, course), notice: 'Successfully saved deadlines.' rescue DeadlineSpec::InvalidSyntaxError => e - redirect_to manage_deadlines_organization_course_path(@organization, @course), alert: e.to_s + redirect_to manage_deadlines_organization_course_path(@organization, course), alert: e.to_s end + sig { void } def help @course = Course.find(params[:course_id]) authorize! :read, @course @@ -145,6 +167,7 @@ def help add_breadcrumb 'Help page' end + sig { void } def manage_unlocks authorize! :manage_unlocks, @course add_course_breadcrumb @@ -152,84 +175,100 @@ def manage_unlocks assign_show_view_vars end + sig { void } def save_unlocks authorize! :manage_unlocks, @course + course = T.must(@course) begin group_params.each do |name, conditions| - array = conditions.values.reject(&:blank?) - group = @course.exercise_group_by_name(name) - Rails.logger.info "Unlock conditions of #{@course.name}/#{name} set by user #{current_user.id}: #{group.exercises(false).first&.unlock_spec || '[]'} -> #{array.to_json}" + group = course.exercise_group_by_name(name) + next if group.nil? + array = conditions.values.compact_blank + Rails.logger.info "Unlock conditions of #{course.name}/#{name} set by user #{current_user.id}: #{group.exercises(false).first&.unlock_spec || '[]'} -> #{array.to_json}" group.group_unlock_conditions = array.to_json end ensure - UncomputedUnlock.create_all_for_course(@course) + UncomputedUnlock.create_all_for_course(course) end redirect_to manage_unlocks_organization_course_path, notice: 'Successfully set unlock dates.' rescue UnlockSpec::InvalidSyntaxError => e - redirect_to manage_unlocks_organization_course_path(@organization, @course), alert: e.to_s + redirect_to manage_unlocks_organization_course_path(@organization, course), alert: e.to_s end + sig { void } def manage_exercises authorize! :manage_exercises, @course + course = T.must(@course) add_course_breadcrumb add_breadcrumb 'Manage exercises' - @exercises = @course.exercises.natsort_by(&:name) - @exercises_id_map = @exercises.index_by { |e| e.id } + exercises = course.exercises.natsort_by(&:name) + @exercises = T.let(exercises, T.nilable(T::Array[Exercise])) + @exercises_id_map = T.let(exercises.index_by { |e| e.id }, T.nilable(T::Hash[Integer, Exercise])) end + sig { void } def toggle_submission_result_visibility authorize! :toggle_submission_result_visibility, @course - @course.toggle_submission_result_visiblity - redirect_to organization_course_path(@organization, @course), notice: "Exam mode is now #{@course.hide_submission_results ? 'enabled' : 'disabled'}" + course = T.must(@course) + course.toggle_submission_result_visiblity + redirect_to organization_course_path(@organization, course), notice: "Exam mode is now #{course.hide_submission_results ? 'enabled' : 'disabled'}" end private + sig { returns(ActionController::Parameters) } def course_params - if @course.custom? + if T.must(@course).custom? params.require(:course).permit(:title, :description, :material_url, :source_url, :git_branch, :external_scoreboard_url) else params.require(:course).permit(:title, :description, :material_url, :external_scoreboard_url) end end + sig { void } def assign_show_view_vars - @exercises = @course.exercises.includes(:course) - @exercises.preload(:unlocks).where(unlocks: { user: current_user }) - @exercises = @exercises.select { |ex| ex.visible_to?(current_user) } - .natsort_by(&:name) - @exercise_completion_status = ExerciseCompletionStatusGenerator.completion_status(current_user, @course) - @unlocks = @course.unlocked_exercise_names_for(current_user, @exercises) - - if can?(:teach, @course) - last_refresh = @course.course_template.course_template_refreshes.last - @refresh_initialized = last_refresh.status == 'in_progress' || last_refresh.status == 'not_started' if last_refresh + course = T.must(@course) + exercises = course.exercises.includes(:course) + exercises = exercises.select { |ex| ex.visible_to?(current_user) } + .natsort_by(&:name) + @exercises = exercises + @exercise_completion_status = T.let(ExerciseCompletionStatusGenerator.completion_status(current_user, course), T.nilable(T::Hash[Integer, T.nilable(Integer)])) + @unlocks = T.let(course.unlocked_exercise_names_for(current_user, exercises), T.nilable(T::Set[T.nilable(String)])) + + if can?(:teach, course) + last_refresh = T.must(course.course_template).course_template_refreshes.last + @refresh_initialized = T.let(last_refresh.status == 'in_progress' || last_refresh.status == 'not_started', T.nilable(T::Boolean)) if last_refresh end unless current_user.guest? max_submissions = 100 - @submissions = @course.submissions - @submissions = @submissions.where(user_id: current_user.id) unless can? :teach, @course - @submissions = @submissions.order('created_at DESC').includes(:user) - @total_submissions = if can?(:teach, @course) - @course.submissions_count + submissions = course.submissions + submissions = submissions.where(user_id: current_user.id) unless can? :teach, course + submissions = submissions.order(created_at: :desc).includes(:user) + total_submissions = if can?(:teach, course) + course.submissions_count else - @submissions.count + submissions.count end - @submissions = @submissions.limit(max_submissions) - Submission.eager_load_exercises(@submissions) + @total_submissions = T.let(total_submissions, T.nilable(Integer)) + submissions = submissions.limit(max_submissions) + @submissions = T.let(submissions, T.nilable(ActiveRecord::Relation)) + Submission.eager_load_exercises(submissions) end end + sig { void } def set_organization @organization = Organization.find_by!(slug: params[:organization_id]) unauthorized! unless @organization.visibility_allowed?(request, current_user) end + sig { void } def set_course @course = Course.find(params[:id]) end + sig { returns(T.any(ActionController::Parameters, T::Hash[T.untyped, T.untyped])) } def group_params sliced = params.slice(:group, :empty_group) groups = sliced[:group] || {} @@ -238,6 +277,7 @@ def group_params groups end + sig { params(course: Course).returns(CourseTemplateRefresh) } def refresh_course(course) course.refresh(current_user.id) end diff --git a/app/controllers/emails_controller.rb b/app/controllers/emails_controller.rb index 10420239e..1c1f78e9b 100644 --- a/app/controllers/emails_controller.rb +++ b/app/controllers/emails_controller.rb @@ -1,7 +1,10 @@ +# typed: strict # frozen_string_literal: true # Displays the raw list of participant e-mails, useful for mass-mailing scripts. class EmailsController < ApplicationController + extend T::Sig + sig { void } def index organization_id = params[:organization_id] course_id = params[:id] @@ -14,18 +17,21 @@ def index end private + sig { void } def index_global authorize! :view, :emails filter_params = params_starting_with('filter_', :all, remove_prefix: true) filter_params['include_administrators'] = '1' # Always include administrators. Could make this exclude_administrators instead - @emails = User.filter_by(filter_params).order(:email).map(&:email) + emails = User.filter_by(filter_params).order(:email).map(&:email) + @emails = T.let(emails, T.nilable(T::Array[String])) respond_to do |format| format.text do - render plain: @emails.join("\n") + render plain: emails.join("\n") end end end + sig { void } def index_course @course = Course.find(params[:id]) @organization = @course.organization @@ -35,12 +41,13 @@ def index_course add_course_breadcrumb add_breadcrumb('Students', organization_emails_path) - @students = User.course_students(@course) + students = User.course_students(@course) + @students = T.let(students, T.nilable(ActiveRecord::Relation)) respond_to do |format| format.html - format.text { render plain: @students.map { |s| s.email.to_s }.join("\n") } - format.csv { render plain: "Username,Email\n" + @students.map { |s| "#{s.username},#{s.email}" }.join("\n") } + format.text { render plain: students.map { |s| s.email.to_s }.join("\n") } + format.csv { render plain: "Username,Email\n" + students.map { |s| "#{s.username},#{s.email}" }.join("\n") } end end end diff --git a/app/controllers/exercise_status_controller.rb b/app/controllers/exercise_status_controller.rb index d5d87c74a..fa4fef7a8 100644 --- a/app/controllers/exercise_status_controller.rb +++ b/app/controllers/exercise_status_controller.rb @@ -1,23 +1,26 @@ +# typed: strict # frozen_string_literal: true class ExerciseStatusController < ApplicationController skip_authorization_check + sig { void } def show course_id = params[:course_id] user_id = params[:id] course = Course.where(id: course_id).first || Course.where(name: course_id).first - user = User.where(id: user_id).first || User.where(login: user_id).first - + return respond_not_found('Course not found') if course.nil? return respond_forbidden unless course.visible_to?(Guest.new) || current_user.administrator? + user = User.where(id: user_id).first || User.where(login: user_id).first + return respond_not_found('User not found') if user.nil? + user_subs = user.submissions.where(course_id: course.id).to_a.group_by(&:exercise_name) - user_subs.default = [] results = {} course.exercises.each do |ex| - ex.set_submissions_by!(user, user_subs[ex.name]) # used by completed_by? and attempted_by? + ex.set_submissions_by!(user, user_subs.fetch(T.must(ex.name), [])) # used by completed_by? and attempted_by? results[ex.name] = if ex.completed_by?(user) 'completed' elsif ex.attempted_by?(user) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index d9e634818..c9daeb2e2 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1,11 +1,13 @@ +# typed: strict # frozen_string_literal: true require 'submission_list' class ExercisesController < ApplicationController + sig { void } def show @exercise = Exercise.find(params[:id]) - @course = Course.lock('FOR SHARE').find(@exercise.course_id) + @course = Course.lock('FOR SHARE').find(T.must(@exercise.course_id)) @organization = @course.organization authorize! :read, @course authorize! :read, @exercise @@ -17,18 +19,19 @@ def show Course.transaction(requires_new: true) do if !current_user.guest? - @submissions = @exercise.submissions.order('submissions.created_at DESC') + submissions = @exercise.submissions.order('submissions.created_at DESC') - @submissions = @submissions.where(user_id: current_user.id) unless can? :teach, @course - @submissions = @submissions.includes(:awarded_points).includes(:user).includes(:course) - @submissions = @submissions.limit(50) unless !!params[:view_all] + submissions = submissions.where(user_id: current_user.id) unless can? :teach, @course + submissions = submissions.includes(:awarded_points).includes(:user).includes(:course) + submissions = submissions.limit(50) unless !!params[:view_all] + @submissions = T.let(submissions, T.nilable(ActiveRecord::Relation)) else @submissions = nil end authorize! :read, @submissions - @new_submission = Submission.new + @new_submission = T.let(Submission.new, T.nilable(Submission)) end end format.zip do @@ -60,6 +63,7 @@ def show end end + sig { void } def set_disabled_statuses @course = Course.find(params[:course_id]) @organization = @course.organization @@ -80,6 +84,7 @@ def set_disabled_statuses notice: 'Exercises successfully updated.' end + sig { void } def toggle_submission_result_visibility @exercise = Exercise.find(params[:id]) authorize! :toggle_submission_result_visibility, @exercise.course diff --git a/app/controllers/feedback_answers_charts_controller.rb b/app/controllers/feedback_answers_charts_controller.rb index 43be8e808..71407d3ee 100644 --- a/app/controllers/feedback_answers_charts_controller.rb +++ b/app/controllers/feedback_answers_charts_controller.rb @@ -1,6 +1,8 @@ +# typed: strict # frozen_string_literal: true class FeedbackAnswersChartsController < ApplicationController + sig { void } def show @course = Course.find(params[:course_id]) @organization = @course.organization @@ -25,9 +27,11 @@ def show end private + sig { void } def show_scatterplot - @questions = @course.feedback_questions.select(&:intrange?).sort_by(&:position) - if @questions.size == 2 + questions = T.must(@course).feedback_questions.select(&:intrange?).sort_by(&:position) + @questions = T.let(questions, T.nilable(T::Array[FeedbackQuestion])) + if questions.size == 2 render action: 'show_scatterplot', layout: 'bare' else respond_with_error('Scatterplot only available if there are exactly two numeric questions') diff --git a/app/controllers/feedback_answers_controller.rb b/app/controllers/feedback_answers_controller.rb index 203a8072a..7934abcde 100644 --- a/app/controllers/feedback_answers_controller.rb +++ b/app/controllers/feedback_answers_controller.rb @@ -1,17 +1,21 @@ +# typed: strict # frozen_string_literal: true class FeedbackAnswersController < ApplicationController + extend T::Sig + sig { void } def index if params[:course_id] @course = Course.find(params[:course_id]) - @parent = @course - @numeric_stats = @course.exercises.where(hidden: false).sort.map do |ex| + @parent = T.let(@course, T.nilable(T.any(Course, Exercise))) + numeric_stats = @course.exercises.where(hidden: false).sort.map do |ex| [ex, FeedbackAnswer.numeric_answer_averages(ex), ex.submissions_having_feedback.count] end - @title = @course.title + @numeric_stats = T.let(numeric_stats, T.nilable(T::Array[[Exercise, T::Hash[Integer, Float], Integer]])) + @title = T.let(@course.title, T.nilable(String)) elsif params[:exercise_id] @exercise = Exercise.find(params[:exercise_id]) - @course = @exercise.course + @course = T.must(@exercise.course) @parent = @exercise @numeric_stats = [[@exercise, FeedbackAnswer.numeric_answer_averages(@exercise), @exercise.submissions_having_feedback.count]] @title = @exercise.name @@ -28,7 +32,8 @@ def index add_breadcrumb 'Feedback', organization_course_feedback_answers_path end - @numeric_questions = @course.feedback_questions.where("kind LIKE 'intrange%'").order(:position) + numeric_questions = @course.feedback_questions.where("kind LIKE 'intrange%'").order(:position) + @numeric_questions = T.let(numeric_questions, T.nilable(ActiveRecord::Relation)) respond_to do |format| format.html do @@ -36,20 +41,20 @@ def index authorize! :read_feedback_questions, @parent authorize! :read_feedback_answers, @parent - @text_answers = @parent.feedback_answers + @text_answers = T.let(T.must(@parent).feedback_answers .joins(:feedback_question) .joins(:submission) .joins(submission: :user) # .joins(:exercise) # fails due to :conditions of belongs_to receiving incorrect self :( .where(feedback_questions: { kind: 'text' }) - .order('created_at DESC') - .all + .order(created_at: :desc) + .all, T.nilable(ActiveRecord::Relation)) end format.json do authorize! :read, @parent # We only deliver public statistics so no authorization required render json: { - numeric_questions: @numeric_questions.map do |q| + numeric_questions: numeric_questions.map do |q| { id: q.id, title: q.title, @@ -57,7 +62,7 @@ def index position: q.position } end, - numeric_stats: @numeric_stats.map do |ex, averages, answer_count| + numeric_stats: T.must(@numeric_stats).map do |ex, averages, answer_count| { exercise: { id: ex.id, @@ -73,14 +78,17 @@ def index end end + sig { void } def show - @answer = FeedbackAnswer.find(params[:id]) - authorize! :read, @answer - @course = @answer.course - @exercise = @answer.exercise + answer = FeedbackAnswer.find(params[:id]) + @answer = T.let(answer, T.nilable(FeedbackAnswer)) + authorize! :read, answer + @course = answer.course + @exercise = answer.exercise end # Create multiple answers at once + sig { void } def create submission = Submission.find(params[:submission_id]) authorize! :read, submission diff --git a/app/controllers/feedback_questions_controller.rb b/app/controllers/feedback_questions_controller.rb index b456dd014..7bcc23f78 100644 --- a/app/controllers/feedback_questions_controller.rb +++ b/app/controllers/feedback_questions_controller.rb @@ -1,26 +1,42 @@ +# typed: strict # frozen_string_literal: true # Handles the feedback question editing UI. class FeedbackQuestionsController < ApplicationController + extend T::Sig before_action :set_course before_action :set_organization + sig { void } def index add_course_breadcrumb add_breadcrumb 'Feedback questions' - @questions = @course.feedback_questions.order(:position) + @questions = T.let(T.must(@course).feedback_questions.order(:position), T.nilable(ActiveRecord::Relation)) authorize! :manage_feedback_questions, @course end + sig { void } + def show + @question = FeedbackQuestion.find(params[:id]) + @course = T.must(@question.course) + @organization = @course.organization + authorize! :manage_feedback_questions, @course + add_course_breadcrumb + add_breadcrumb 'Feedback questions', organization_course_feedback_questions_path(@organization, @course) + add_breadcrumb "Question #{@question.title}" + end + + sig { void } def new - @question = FeedbackQuestion.new(course: @course) + @question = T.let(FeedbackQuestion.new(course: @course), T.nilable(FeedbackQuestion)) authorize! :manage_feedback_questions, @course add_course_breadcrumb add_breadcrumb 'Feedback questions', organization_course_feedback_questions_path(@organization, @course) add_breadcrumb 'Add new question' end + sig { void } def create @question = FeedbackQuestion.new(feedback_question_params[:feedback_question]) @question.course = @course @@ -37,19 +53,10 @@ def create end end - def show - @question = FeedbackQuestion.find(params[:id]) - @course = @question.course - @organization = @course.organization - authorize! :manage_feedback_questions, @course - add_course_breadcrumb - add_breadcrumb 'Feedback questions', organization_course_feedback_questions_path(@organization, @course) - add_breadcrumb "Question #{@question.title}" - end - + sig { void } def update @question = FeedbackQuestion.find(params[:id]) - @course = @question.course + @course = T.must(@question.course) @organization = @course.organization authorize! :manage_feedback_questions, @course @@ -65,9 +72,10 @@ def update end end + sig { void } def destroy @question = FeedbackQuestion.find(params[:id]) - @course = @question.course + @course = T.must(@question.course) @organization = @course.organization authorize! :manage_feedback_questions, @course @@ -82,21 +90,25 @@ def destroy end private + sig { returns(ActionController::Parameters) } def feedback_question_params params.permit({ feedback_question: %i[question title kind] }, :intrange_min, :intrange_max, :commit, :course_id) end + sig { void } def set_course @course = Course.find(params[:course_id]) if params[:course_id] authorize! :read, @course end + sig { params(question: FeedbackQuestion).void } def fix_question_kind(question) return unless question.kind == 'intrange' question.kind += "[#{params[:intrange_min]}..#{params[:intrange_max]}]" end + sig { void } def set_organization - @organization = Organization.find_by(slug: params[:organization_id]) + @organization = Organization.find_by!(slug: params[:organization_id]) unless params[:organization_id].nil? end end diff --git a/app/controllers/feedback_replies_controller.rb b/app/controllers/feedback_replies_controller.rb index 5e6da6265..f6ac4be3d 100644 --- a/app/controllers/feedback_replies_controller.rb +++ b/app/controllers/feedback_replies_controller.rb @@ -1,7 +1,9 @@ +# typed: strict # frozen_string_literal: true # Handles replying to a feedback answer by e-mail. class FeedbackRepliesController < ApplicationController + sig { void } def create answer = FeedbackAnswer.find(params['answer_id']) authorize! :reply_feedback_answer, answer @@ -17,7 +19,7 @@ def create if request.referer.present? redirect_to request.referer, params: { notice: 'Reply to a review was mailed' } else - redirect_back fallback_location: root_path + redirect_back_or_to(root_path) end end end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index cc0f5f052..952e2a59d 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true # Shows the files of a submission. @@ -8,6 +9,7 @@ class FilesController < ApplicationController # This exists just to provide comapatability with old files url format # Cannot be redirected in routes, as rack_base_uri cannot be used for redirects. # - Jamox / 12.7.2014 + sig { void } def index redirect_to submission_path(params[:submission_id], anchor: 'files') end diff --git a/app/controllers/full_zip_controller.rb b/app/controllers/full_zip_controller.rb index 8ca87034a..4054ed41f 100644 --- a/app/controllers/full_zip_controller.rb +++ b/app/controllers/full_zip_controller.rb @@ -1,13 +1,16 @@ +# typed: strict # frozen_string_literal: true require 'submission_packager' class FullZipController < ApplicationController + sig { void } def index submission = Submission.find(params[:submission_id]) authorize! :download, submission - exercise = submission.exercise - base_name = "#{submission.user.login}-#{exercise.name}-#{submission.id}" + return respond_not_found("This submission's exercise has been removed") if submission.exercise.nil? + + base_name = "#{T.must(submission.user).login}-#{submission.exercise_name}-#{submission.id}" data = SubmissionPackager.new.get_full_zip(submission) send_data(data, filename: "#{base_name}_full.zip") end diff --git a/app/controllers/migrate_to_other_course_controller.rb b/app/controllers/migrate_to_other_course_controller.rb index 861b8bedd..eaaa73985 100644 --- a/app/controllers/migrate_to_other_course_controller.rb +++ b/app/controllers/migrate_to_other_course_controller.rb @@ -1,21 +1,27 @@ +# typed: strict # frozen_string_literal: true require 'student_submission_migrator' class MigrateToOtherCourseController < ApplicationController + extend T::Sig + sig { void } def show - @old_course = Course.find(params[:course_id]) - @to_course = Course.find(params[:id]) + old_course = Course.find(params[:course_id]) + to_course = Course.find(params[:id]) + @old_course = T.let(old_course, T.nilable(Course)) + @to_course = T.let(to_course, T.nilable(Course)) - authorize! :read, @to_course + authorize! :read, to_course authorize! :read, current_user - @already_migrated = already_migrated - @extra_alert_text = get_extra_text + @already_migrated = T.let(already_migrated, T.nilable(T::Boolean)) + @extra_alert_text = T.let(get_extra_text, T.nilable(String)) return respond_with_error('Please login to continue') if current_user.guest? - respond_with_error('This migration is not allowed') unless StudentSubmissionMigrator.new(@old_course, @to_course, current_user).migration_is_allowed + respond_with_error('This migration is not allowed') unless StudentSubmissionMigrator.new(old_course, to_course, current_user).migration_is_allowed end + sig { void } def migrate @old_course = Course.find(params[:course_id]) @to_course = Course.find(params[:id]) @@ -33,23 +39,26 @@ def migrate end private + sig { returns(T::Boolean) } def check_understanding! - params[:from_course_name].strip == @old_course.name && - params[:to_course_name].strip == @to_course.name && - !!params[:im_sure] && - !already_migrated + return false unless params[:from_course_name].strip == T.must(@old_course).name + return false unless params[:to_course_name].strip == T.must(@to_course).name + return false unless params[:im_sure] + + !already_migrated end + sig { returns(T::Boolean) } def already_migrated - MigratedSubmissions.where(to_course_id: @to_course.id, original_submission_id: current_user.submissions.where(course: @old_course).pluck(:id)).any? + MigratedSubmissions.where(to_course_id: T.must(@to_course).id, original_submission_id: current_user.submissions.where(course: @old_course).pluck(:id)).any? end + sig { returns(T.nilable(String)) } def get_extra_text allowed_migrations = SiteSetting.value(:allow_migrations_between_courses) return nil if allowed_migrations.nil? allowed_migrations.each do |allowed_pair| - puts allowed_pair - return allowed_pair['message'] if allowed_pair['from'] == @old_course.id && allowed_pair['to'] == @to_course.id + return allowed_pair['message'] if allowed_pair['from'] == T.must(@old_course).id && allowed_pair['to'] == T.must(@to_course).id end nil end diff --git a/app/controllers/model_solution_token_useds_controller.rb b/app/controllers/model_solution_token_useds_controller.rb index 28d1aa770..3dd9c734c 100644 --- a/app/controllers/model_solution_token_useds_controller.rb +++ b/app/controllers/model_solution_token_useds_controller.rb @@ -1,25 +1,32 @@ +# typed: strict # frozen_string_literal: true class ModelSolutionTokenUsedsController < ApplicationController - before_action :set_model_solution_token_used, only: [:show, :edit, :update, :destroy] - before_action :only_admins + extend T::Sig + skip_authorization_check + before_action :only_admins! + before_action :set_model_solution_token_used, only: [:show] # GET /model_solution_token_useds + sig { void } def index - @model_solution_token_useds = ModelSolutionTokenUsed.all + @model_solution_token_useds = T.let(ModelSolutionTokenUsed.all, T.nilable(ActiveRecord::Relation)) end # GET /model_solution_token_useds/1 + sig { void } def show end private # Use callbacks to share common setup or constraints between actions. + sig { void } def set_model_solution_token_used - @model_solution_token_used = ModelSolutionTokenUsed.find(params[:id]) + @model_solution_token_used = T.let(ModelSolutionTokenUsed.find(params[:id]), T.nilable(ModelSolutionTokenUsed)) end # Only allow a trusted parameter "white list" through. + sig { returns(ActionController::Parameters) } def model_solution_token_used_params params.require(:model_solution_token_used).permit(:user_id, :course_id, :exercise_name) end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 5dd27ff9f..29c379adf 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -1,135 +1,161 @@ +# typed: strict # frozen_string_literal: true require 'natsort' class OrganizationsController < ApplicationController - before_action :set_organization, only: %i[show destroy verify disable disable_reason_input toggle_visibility all_courses] + extend T::Sig + before_action :set_organization, only: %i[show verify disable disable_reason_input toggle_visibility all_courses] skip_authorization_check only: %i[index new all_courses] + sig { void } def index ordering = Arel.sql('hidden, LOWER(name)') - @organizations = Organization - .accepted_organizations - .with_attached_logo - .order(ordering) - .reject { |org| org.hidden? && !can?(:view_hidden_organizations, nil) || !org.visibility_allowed?(request, current_user) } - @my_organizations = Organization.taught_organizations(current_user).with_attached_logo.select { |org| org.visibility_allowed?(request, current_user) } - @my_organizations |= Organization.assisted_organizations(current_user).with_attached_logo.select { |org| org.visibility_allowed?(request, current_user) } - @my_organizations |= Organization.participated_organizations(current_user).with_attached_logo.select { |org| org.visibility_allowed?(request, current_user) } - @my_organizations.natsort_by!(&:name) - @courses_under_initial_refresh = Course.where(initial_refresh_ready: false) - @pinned_organizations = Organization - .accepted_organizations - .where(pinned: true) - .with_attached_logo - .order(ordering) - .select { |org| org.visibility_allowed?(request, current_user) } - .reject { |org| org.hidden? && !can?(:view_hidden_organizations, nil) } + organizations = Organization + .accepted_organizations + .with_attached_logo + .order(ordering) + .reject { |org| (org.hidden? && !can?(:view_hidden_organizations, nil)) || !org.visibility_allowed?(request, current_user) } + @organizations = T.let(organizations, T.nilable(T::Array[Organization])) + my_organizations = Organization.taught_organizations(current_user).with_attached_logo.select { |org| org.visibility_allowed?(request, current_user) } + my_organizations |= Organization.assisted_organizations(current_user).with_attached_logo.select { |org| org.visibility_allowed?(request, current_user) } + my_organizations |= Organization.participated_organizations(current_user).with_attached_logo.select { |org| org.visibility_allowed?(request, current_user) } + my_organizations.natsort_by!(&:name) + @my_organizations = T.let(my_organizations, T.nilable(T::Array[Organization])) + @courses_under_initial_refresh = T.let(Course.where(initial_refresh_ready: false), T.nilable(ActiveRecord::Relation)) + pinned_organizations = Organization + .accepted_organizations + .where(pinned: true) + .with_attached_logo + .order(ordering) + .select { |org| org.visibility_allowed?(request, current_user) } + .reject { |org| org.hidden? && !can?(:view_hidden_organizations, nil) } + @pinned_organizations = T.let(pinned_organizations, T.nilable(T::Array[Organization])) render layout: 'landing' end + sig { void } def show add_organization_breadcrumb + organization = T.must(@organization) ordering = Arel.sql('hidden, disabled_status, LOWER(courses.title)') - @my_assisted_courses = Course.assisted_courses(current_user, @organization).order(ordering).select { |c| c.visible_to?(current_user) } - @ongoing_courses = @organization - .courses - .ongoing - .enabled - .where(hidden: false) - .order(ordering) - .select { |c| c.visible_to?(current_user) } - .to_a - if can? :teach, @organization - recently_updated_disabled_courses = @organization.courses + my_assisted_courses = Course.assisted_courses(current_user, organization).order(ordering).select { |c| c.visible_to?(current_user) } + @my_assisted_courses = T.let(my_assisted_courses, T.nilable(T::Array[Course])) + ongoing_courses = organization + .courses + .ongoing + .enabled + .where(hidden: false) + .order(ordering) + .select { |c| c.visible_to?(current_user) } + .to_a + if can? :teach, organization + recently_updated_disabled_courses = organization.courses .ongoing .disabled .where(updated_at: Time.current.all_quarter) .to_a - @ongoing_courses += recently_updated_disabled_courses + ongoing_courses += recently_updated_disabled_courses end - authorize! :read, @ongoing_courses + @ongoing_courses = T.let(ongoing_courses, T.nilable(T::Array[Course])) + authorize! :read, ongoing_courses end + sig { void } def all_courses return respond_forbidden('This feature is only for teachers and administrators.') unless current_user.administrator? || current_user.teacher?(@organization) add_organization_breadcrumb add_breadcrumb 'All Courses' + organization = T.must(@organization) ordering = 'hidden, disabled_status, LOWER(courses.title)' - @my_assisted_courses = Course.assisted_courses(current_user, @organization).order(ordering).select { |c| c.visible_to?(current_user) } - @ongoing_courses = @organization.courses.ongoing.order(ordering).select { |c| c.visible_to?(current_user) } - @expired_courses = @organization.courses.expired.order(ordering).select { |c| c.visible_to?(current_user) } - authorize! :read, @ongoing_courses - authorize! :read, @expired_courses + @my_assisted_courses = Course.assisted_courses(current_user, organization).order(ordering).select { |c| c.visible_to?(current_user) } + ongoing_courses = organization.courses.ongoing.order(ordering).select { |c| c.visible_to?(current_user) } + expired_courses = organization.courses.expired.order(ordering).select { |c| c.visible_to?(current_user) } + @ongoing_courses = ongoing_courses + @expired_courses = T.let(expired_courses, T.nilable(T::Array[Course])) + authorize! :read, ongoing_courses + authorize! :read, expired_courses end + sig { void } def new redirect_to new_setup_organization_path end + sig { void } def list_requests authorize! :view, :unverified_organizations add_breadcrumb 'Unverified organizations' - @unverified_organizations = Organization.pending_organizations + @unverified_organizations = T.let(Organization.pending_organizations, T.nilable(ActiveRecord::Relation)) end + sig { void } def verify authorize! :verify, :unverified_organizations - if !@organization.verified - @organization.verified = true - @organization.verified_at = DateTime.now - @organization.save! - redirect_to organizations_path, notice: "Organization #{@organization.name} is now verified." + organization = T.must(@organization) + if !organization.verified + organization.verified = true + organization.verified_at = Time.current + organization.save! + redirect_to organizations_path, notice: "Organization #{organization.name} is now verified." else - redirect_to organization_path(@organization) + redirect_to organization_path(organization) end end + sig { void } def disable_reason_input authorize! :disable, Organization add_organization_breadcrumb add_breadcrumb 'Disable organization' end + sig { void } def disable authorize! :disable, Organization - if !@organization.disabled - @organization.disabled = true - @organization.disabled_reason = organization_params[:disabled_reason] - @organization.save - redirect_to list_requests_organizations_path, notice: "Organization #{@organization.name} successfully disabled." + organization = T.must(@organization) + if !organization.disabled + organization.disabled = true + organization.disabled_reason = organization_params[:disabled_reason] + organization.save + redirect_to list_requests_organizations_path, notice: "Organization #{organization.name} successfully disabled." else - redirect_to organization_path(@organization) + redirect_to organization_path(organization) end end + sig { void } def toggle_visibility authorize! :toggle_visibility, @organization - @organization.hidden = !@organization.hidden - @organization.save! - redirect_to organization_path, notice: "Organization is now #{@organization.hidden ? 'hidden to users' : 'visible to users'}" + organization = T.must(@organization) + organization.hidden = !organization.hidden + organization.save! + redirect_to organization_path, notice: "Organization is now #{organization.hidden ? 'hidden to users' : 'visible to users'}" end private + sig { params(courses: T.untyped, user: T.untyped).returns(T::Hash[T.untyped, T.untyped]) } def percent_completed_hash(courses, user) percent_completed = {} all_awarded = AwardedPoint.all_awarded(user) all_available = AvailablePoint.courses_points(courses).map(&:course_id) courses.each do |course| - awarded = all_awarded.select { |id| id == course.id }.length.to_f - available = all_available.select { |id| id == course.id }.length.to_f + awarded = all_awarded.count { |id| id == course.id }.to_f + available = all_available.count { |id| id == course.id }.to_f percent_completed[course.id] = 100 * (awarded / available) unless course.hide_submission_results end percent_completed end + sig { void } def set_organization @organization = Organization.find_by!(slug: params[:id]) unauthorized! unless @organization.visibility_allowed?(request, current_user) end + sig { returns(ActionController::Parameters) } def organization_params params.require(:organization).permit(:name, :information, :logo, :slug, :contact_information, :phone, :email, :disabled_reason) end diff --git a/app/controllers/participants_controller.rb b/app/controllers/participants_controller.rb index c4a738ebc..5008b0965 100644 --- a/app/controllers/participants_controller.rb +++ b/app/controllers/participants_controller.rb @@ -1,11 +1,14 @@ +# typed: strict # frozen_string_literal: true require 'csv' require 'natcmp' class ParticipantsController < ApplicationController + extend T::Sig before_action :set_organization, only: [:index] + sig { void } def index if @organization.nil? authorize! :view, :participants_list @@ -19,36 +22,47 @@ def index end add_breadcrumb 'Participants' - @ordinary_fields = %w[username email] - @extra_fields = UserField.all - valid_fields = @ordinary_fields + @extra_fields.map(&:name) + ['include_administrators'] - - @filter_params = params_starting_with('filter_', valid_fields, remove_prefix: true) - @raw_filter_params = params_starting_with('filter_', valid_fields, remove_prefix: false) - - @column_params = params_starting_with('column_', valid_fields, remove_prefix: true) - @raw_column_params = params_starting_with('column_', valid_fields, remove_prefix: false) - @visible_columns = - if @column_params.empty? - @ordinary_fields + @extra_fields.select(&:show_in_participant_list?).map(&:name) + ordinary_fields = %w[username email] + extra_fields = UserField.all + @ordinary_fields = T.let(ordinary_fields, T.nilable(T::Array[String])) + @extra_fields = T.let(extra_fields, T.nilable(T::Array[UserField])) + valid_fields = ordinary_fields + extra_fields.map(&:name) + ['include_administrators'] + + filter_params = params_starting_with('filter_', valid_fields, remove_prefix: true) + @filter_params = T.let(filter_params, T.nilable(T::Hash[String, T.untyped])) + @raw_filter_params = T.let(params_starting_with('filter_', valid_fields, remove_prefix: false), T.nilable(T::Hash[String, T.untyped])) + + column_params = params_starting_with('column_', valid_fields, remove_prefix: true) + @column_params = T.let(column_params, T.nilable(T::Hash[String, T.untyped])) + @raw_column_params = T.let(params_starting_with('column_', valid_fields, remove_prefix: false), T.nilable(T::Hash[String, T.untyped])) + visible_columns = + if column_params.empty? + ordinary_fields + extra_fields.filter_map { |field| field.name if field.show_in_participant_list? } else - @column_params.keys + column_params.keys end + @visible_columns = T.let(visible_columns, T.nilable(T::Array[String])) - @courses = courses.order(:name).to_a + @courses = T.let(courses.order(:name).to_a, T.nilable(T::Array[Course])) + group_completion_course = T.let(nil, T.nilable(Course)) + group_completion = T.let(nil, T.nilable(T::Hash[String, T::Hash[Symbol, T.untyped]])) if params['group_completion_course_id'].present? - @group_completion_course = courses.find(params['group_completion_course_id']) - @group_completion = @group_completion_course.exercise_group_completion_by_user + group_completion_course = courses.find(params['group_completion_course_id']) + group_completion = group_completion_course.exercise_group_completion_by_user end + @group_completion_course = T.let(group_completion_course, T.nilable(Course)) + @group_completion = T.let(group_completion, T.nilable(T::Hash[String, T::Hash[Symbol, T.untyped]])) - @participants = users.filter_by(@filter_params).order(:login) + # filter_by is a User class method, which relations delegate to. + participants = T.unsafe(users).filter_by(filter_params).order(:login) - if @group_completion && params['show_with_no_points'].blank? - @participants = @participants.includes(:awarded_points).to_a.select do |user| - user.awarded_points.to_a.any? { |ap| ap.course_id == @group_completion_course.id } + if group_completion_course && params['show_with_no_points'].blank? + participants = participants.includes(:awarded_points).to_a.select do |user| + user.awarded_points.to_a.any? { |ap| ap.course_id == group_completion_course.id } end end + @participants = T.let(participants, T.nilable(T.any(ActiveRecord::Relation, T::Array[User]))) respond_to do |format| format.html @@ -61,79 +75,88 @@ def index end end + sig { void } def show - @user = User.find(params[:id]) - authorize! :view_participant_information, @user + user = User.find(params[:id]) + @user = T.let(user, T.nilable(User)) + authorize! :view_participant_information, user # TODO: bit ugly -- and now it's even worse! - @awarded_points = - AwardedPoint.where(id: AwardedPoint.all_awarded(@user)) + awarded_points = + AwardedPoint.where(id: AwardedPoint.all_awarded(user)) .to_a .sort! .group_by(&:course_id).transform_values do |course_points| - { - awarded: course_points.reject(&:awarded_after_soft_deadline?).map(&:name), - late: course_points.select(&:awarded_after_soft_deadline?).map(&:name) - } + late, on_time = course_points.partition(&:awarded_after_soft_deadline?) + { awarded: on_time.map(&:name), late: late.map(&:name) } end - + @awarded_points = T.let(awarded_points, T.nilable(T::Hash[T.nilable(Integer), { awarded: T::Array[String], late: T::Array[String] }])) if current_user.administrator? add_breadcrumb 'Participants', :participants_path - add_breadcrumb @user.username, participant_path(@user) - @app_data = JSON.pretty_generate(JSON.parse(@user.user_app_data.to_json)) - @courses_mooc_fi_status = @user.courses_mooc_fi_migration_status - @courses_mooc_fi_status_label = courses_mooc_fi_status_label(@user, @courses_mooc_fi_status) - @courses_mooc_fi_force_migrate_available = !@user.managed_externally? || courses_mooc_fi_account_missing?(@courses_mooc_fi_status) + add_breadcrumb user.username, participant_path(user) + @app_data = T.let(JSON.pretty_generate(JSON.parse(user.user_app_data.to_json)), T.nilable(String)) + courses_mooc_fi_status = user.courses_mooc_fi_migration_status + @courses_mooc_fi_status = T.let(courses_mooc_fi_status, T.nilable(T::Hash[Symbol, T.untyped])) + @courses_mooc_fi_status_label = T.let(courses_mooc_fi_status_label(user, courses_mooc_fi_status), T.nilable(String)) + @courses_mooc_fi_force_migrate_available = T.let(!user.managed_externally? || courses_mooc_fi_account_missing?(courses_mooc_fi_status), T.nilable(T::Boolean)) else - add_breadcrumb 'My stats', participant_path(@user) + add_breadcrumb 'My stats', participant_path(user) end - @courses = [] - @missing_points = {} - @percent_completed = {} - @group_completion_counts = {} - @group_available_points = {} - for course_id in @awarded_points.keys + courses = T.let([], T::Array[Course]) + missing_points = T.let({}, T::Hash[T.nilable(Integer), T::Array[String]]) + percent_completed = T.let({}, T::Hash[T.nilable(Integer), Numeric]) + group_completion_counts = T.let({}, T::Hash[T.nilable(Integer), T::Hash[String, T::Hash[Symbol, Numeric]]]) + @courses = courses + @missing_points = T.let(missing_points, T.nilable(T::Hash[T.nilable(Integer), T::Array[String]])) + @percent_completed = T.let(percent_completed, T.nilable(T::Hash[T.nilable(Integer), Numeric])) + @group_completion_counts = T.let(group_completion_counts, T.nilable(T::Hash[T.nilable(Integer), T::Hash[String, T::Hash[Symbol, Numeric]]])) + @group_available_points = T.let({}, T.nilable(T::Hash[T.untyped, T.untyped])) + for course_id in awarded_points.keys course = Course.find(course_id) next if course.hide_submissions? - @courses << course + courses << course - awarded = @awarded_points[course.id] + awarded = T.must(awarded_points[course.id]) missing = AvailablePoint.course_points(course).order!.map(&:name) - awarded[:awarded] - awarded[:late] - @missing_points[course_id] = missing + missing_points[course_id] = missing - @percent_completed[course_id] = if awarded[:awarded].size + awarded[:late].size + missing.size > 0 - 100 * ((awarded[:awarded].size.to_f + awarded[:late].size.to_f * course.soft_deadline_point_multiplier) / (awarded[:awarded].size + awarded[:late].size + missing.size)) + percent_completed[course_id] = if awarded[:awarded].size + awarded[:late].size + missing.size > 0 + 100 * ((awarded[:awarded].size.to_f + (awarded[:late].size.to_f * course.soft_deadline_point_multiplier)) / (awarded[:awarded].size + awarded[:late].size + missing.size)) else 0 end - @group_completion_counts[course_id] = course.exercise_group_completion_counts_for_user(@user) + group_completion_counts[course_id] = course.exercise_group_completion_counts_for_user(user) end - @submissions = if current_user.administrator? || current_user.id == @user.id - @user.submissions.order('created_at DESC').includes(:user).includes(:course) + submissions = if current_user.administrator? || current_user.id == user.id + user.submissions.order(created_at: :desc).includes(:user).includes(:course) else # teacher and assistant sees only submissions for own teacherd courses - @user.submissions.order('created_at DESC').includes(:user, :course).where(course: current_user.teaching_in_courses) + user.submissions.order(created_at: :desc).includes(:user, :course).where(course: current_user.teaching_in_courses) end - @submission_count = @submissions.count - @submissions = @submissions.limit(100) unless !!params[:view_all] + @submission_count = T.let(submissions.count, T.nilable(Integer)) + submissions = submissions.limit(100) unless !!params[:view_all] + @submissions = T.let(submissions, T.nilable(ActiveRecord::Relation)) - Submission.eager_load_exercises(@submissions) + Submission.eager_load_exercises(submissions) end + sig { void } def me authorize! :view_participant_information, current_user redirect_to participant_path(current_user) end + sig { void } def password_reset_link @user = User.find(params[:id]) authorize! :view_participant_information, @user return respond_forbidden('This feature is disabled for admin accounts') if @user.administrator? - @password_reset_link = @user.generate_password_reset_link + @password_reset_link = T.let(@user.generate_password_reset_link, T.nilable(String)) end + sig { void } def force_migrate_to_courses_mooc_fi @user = User.find(params[:id]) authorize! :view_participant_information, @user @@ -157,10 +180,12 @@ def force_migrate_to_courses_mooc_fi private # nil means the live status is unknown (unreachable/unconfigured) -- trust the local flag # instead of treating the account as missing. + sig { params(status: T.nilable(T::Hash[Symbol, T.untyped])).returns(T::Boolean) } def courses_mooc_fi_account_missing?(status) status.present? && (!status[:shadow_user_exists] || status[:deleted_at].present?) end + sig { params(user: User, status: T.nilable(T::Hash[Symbol, T.untyped])).returns(String) } def courses_mooc_fi_status_label(user, status) return 'Broken: flagged as migrated locally but missing the target id' if user.externally_managed_without_target? if user.managed_externally? @@ -171,12 +196,14 @@ def courses_mooc_fi_status_label(user, status) 'Not migrated' end + sig { returns(T::Hash[Symbol, T.untyped]) } def index_json_data + visible_columns = T.must(@visible_columns) result = [] - @participants.each do |user| - record = { id: user.id, username: user.login, email: user.email } - @extra_fields.each do |field| - if @visible_columns.include?(field.name) + T.must(@participants).each do |user| + record = T.let({ id: user.id, username: user.login, email: user.email }, T::Hash[T.any(Symbol, String), T.untyped]) + T.must(@extra_fields).each do |field| + if visible_columns.include?(field.name) record[field.name] = user.field_ruby_value(field) end end @@ -200,31 +227,37 @@ def index_json_data } end + sig { returns(String) } def index_csv + ordinary_fields = T.must(@ordinary_fields) + extra_fields = T.must(@extra_fields) + visible_columns = T.must(@visible_columns) + group_completion = @group_completion CSV.generate(force_quotes: true) do |csv| - title_row = (@ordinary_fields + @extra_fields.map(&:name)).select { |f| @visible_columns.include?(f) }.map(&:humanize) + title_row = (ordinary_fields + extra_fields.map(&:name)).filter_map { |f| f.humanize if visible_columns.include?(f) } - if @group_completion - completion_cols = @group_completion.keys.sort { |a, b| Natcmp.natcmp(a, b) } + completion_cols = T.let([], T::Array[String]) + if group_completion + completion_cols = group_completion.keys.sort { |a, b| Natcmp.natcmp(a, b) } title_row += completion_cols end csv << title_row - @participants.each do |user| + T.must(@participants).each do |user| row = [] - for field in @ordinary_fields - row << user.send(field) if @visible_columns.include?(field) + for field in ordinary_fields + row << user.send(field) if visible_columns.include?(field) end - for field in @extra_fields - if @visible_columns.include?(field.name) + for field in extra_fields + if visible_columns.include?(field.name) row << user.field_ruby_value(field) end end - if @group_completion + if group_completion for group in completion_cols - group_data = @group_completion[group] + group_data = T.must(group_completion[group]) points = group_data[:points_by_user][user.id] || 0 total = group_data[:available_points] percentage = format('%.3f%%', (points.to_f / total.to_f) * 100) @@ -237,8 +270,8 @@ def index_csv end end - private + sig { void } def set_organization - @organization = Organization.find_by(slug: params[:organization_id]) unless params[:organization_id].nil? + @organization = Organization.find_by!(slug: params[:organization_id]) unless params[:organization_id].nil? end end diff --git a/app/controllers/password_reset_keys_controller.rb b/app/controllers/password_reset_keys_controller.rb index 53ff0b359..2d954fbbb 100644 --- a/app/controllers/password_reset_keys_controller.rb +++ b/app/controllers/password_reset_keys_controller.rb @@ -1,31 +1,38 @@ +# typed: strict # frozen_string_literal: true class PasswordResetKeysController < ApplicationController + extend T::Sig skip_authorization_check add_breadcrumb 'Forgot password', ->(*_a) { }, only: %i[new show] + sig { void } + def show + find_key_and_user + end + + sig { void } def new; end + sig { void } def create - @email = params['email'].to_s.strip - if @email.empty? + email = params['email'].to_s.strip + @email = T.let(email, T.nilable(String)) + if email.empty? return redirect_to(new_password_reset_key_path, alert: 'No e-mail address provided') end - user = User.find_by('lower(email) = ?', @email.downcase) + user = User.find_by('lower(email) = ?', email.downcase) unless user return redirect_to(new_password_reset_key_path, alert: 'No such e-mail address registered') end key = ActionToken.generate_password_reset_key_for(user) - PasswordResetKeyMailer.reset_link_email(user, key).deliver - end - - def show - find_key_and_user + PasswordResetKeyMailer.reset_link_email(user, key).deliver_now end + sig { void } def destroy find_key_and_user @@ -39,33 +46,35 @@ def destroy return render action: :show, status: :forbidden end - if @user.managed_externally? - success = @user.update_password_via_courses_mooc_fi(nil, params[:password]) + user = T.must(@user) + key = T.must(@key) + if user.managed_externally? + success = user.update_password_via_courses_mooc_fi(nil, params[:password]) if success - @key.destroy + key.destroy flash[:success] = 'Your password has been reset.' redirect_to root_path else flash.now[:alert] = 'Failed to reset password.' render action: :show, status: :forbidden end - elsif @user.externally_managed_without_target? + elsif user.externally_managed_without_target? # Flagged as managed by courses.mooc.fi but with no id to delegate to. Do not fall back to a # local reset (authentication would ignore it); surface the misconfiguration instead. - Rails.logger.error("Password reset for user #{@user.id}: managed by courses.mooc.fi but missing courses_mooc_fi_user_id") + Rails.logger.error("Password reset for user #{user.id}: managed by courses.mooc.fi but missing courses_mooc_fi_user_id") flash.now[:alert] = 'This account cannot be reset right now. Please contact support.' render action: :show, status: :forbidden else - @user.password = params[:password] - if @user.save + user.password = params[:password] + if user.save # Not yet managed by courses.mooc.fi: migrate the user there with the new password - @user.post_new_user_to_courses_mooc_fi(params[:password]) - @key.destroy + user.post_new_user_to_courses_mooc_fi(params[:password]) + key.destroy flash[:success] = 'Your password has been reset.' redirect_to root_path else - flash.now[:alert] = if @user.errors[:password] - 'Password ' + @user.errors[:password].join(', ') + flash.now[:alert] = if user.errors[:password].any? + 'Password ' + user.errors[:password].join(', ') else 'Failed to set password' end @@ -75,10 +84,12 @@ def destroy end private + sig { void } def find_key_and_user token = params['token'] - @key = ActionToken.find_by(token: token) - raise ActiveRecord::RecordNotFound, 'Invalid password reset key' if @key.nil? || @key.expired? - @user = @key.user + key = ActionToken.find_by(token: token) + @key = T.let(key, T.nilable(ActionToken)) + raise ActiveRecord::RecordNotFound, 'Invalid password reset key' if key.nil? || key.expired? + @user = T.let(key.user, T.nilable(User)) end end diff --git a/app/controllers/points_controller.rb b/app/controllers/points_controller.rb index 2d973091c..5faea6829 100644 --- a/app/controllers/points_controller.rb +++ b/app/controllers/points_controller.rb @@ -1,11 +1,14 @@ +# typed: strict # frozen_string_literal: true require 'natsort' # Shows the points summary table and exercise group-specific tables. class PointsController < ApplicationController + extend T::Sig include PointsHelper before_action :set_organization + sig { void } def index @course = Course.find(params[:course_id]) authorize! :see_points, @course @@ -14,7 +17,7 @@ def index add_breadcrumb 'Points' if can?(:teach, @course) - @user_fields = UserField.all.select(&:show_in_participant_list?) + @user_fields = T.let(UserField.all.select(&:show_in_participant_list?), T.nilable(T::Array[UserField])) end only_for_user = User.find_by(login: params[:username]) @@ -23,19 +26,19 @@ def index if only_for_user exercises = @course.exercises.enabled.where(exercises: { hidden: false, hide_submission_results: false }) sheets = @course.gdocs_sheets(exercises).natsort - @summary = summary_hash(@course, exercises, sheets, only_for_user) - sort_summary(@summary, params[:sort_by]) if params[:sort_by] - @summary + summary = summary_hash(@course, exercises, sheets, only_for_user) + @summary = T.let(summary, T.nilable(T::Hash[Symbol, T.untyped])) + sort_summary(summary, params[:sort_by]) if params[:sort_by] else - @summary = Rails.cache.fetch("points_#{@course.id}_admin_#{current_user.administrator?}/", expires_in: 1.minute) do - exercises = @course.exercises.enabled.where(exercises: { hidden: false }) - exercises = exercises.where(hide_submission_results: false) unless current_user.administrator? - sheets = @course.gdocs_sheets(exercises).natsort - @summary = summary_hash(@course, exercises, sheets) - - @summary + course = @course + summary = Rails.cache.fetch("points_#{course.id}_admin_#{current_user.administrator?}/", expires_in: 1.minute) do + visible_exercises = course.exercises.enabled.where(exercises: { hidden: false }) + visible_exercises = visible_exercises.where(hide_submission_results: false) unless current_user.administrator? + visible_sheets = course.gdocs_sheets(visible_exercises).natsort + summary_hash(course, visible_exercises, visible_sheets) end - sort_summary(@summary, params[:sort_by]) if params[:sort_by] + @summary = summary + sort_summary(summary, params[:sort_by]) if params[:sort_by] end respond_to do |format| @@ -47,8 +50,10 @@ def index end end + sig { void } def show - @sheetname = params[:id] + sheetname = T.let(params[:id], String) + @sheetname = T.let(sheetname, T.nilable(String)) @course = Course.find(params[:course_id]) authorize! :see_points, @course return respond_unauthorized('Authentication required') if current_user.guest? @@ -59,20 +64,23 @@ def show add_course_breadcrumb add_breadcrumb 'Points', organization_course_points_path(@organization, @course) - add_breadcrumb @sheetname + add_breadcrumb sheetname - @exercises = Exercise.course_gdocs_sheet_exercises(@course, @sheetname, current_user.administrator?).includes(:available_points).order!(:name) - @users_to_points = AwardedPoint.per_user_in_course_with_sheet(@course, @sheetname, hidden: current_user.administrator?) + exercises = Exercise.course_gdocs_sheet_exercises(@course, sheetname, current_user.administrator?).includes(:available_points).order!(:name) + @exercises = T.let(exercises, T.nilable(ActiveRecord::Relation)) + users_to_points = AwardedPoint.per_user_in_course_with_sheet(@course, sheetname, hidden: current_user.administrator?) + @users_to_points = T.let(users_to_points, T.nilable(T::Hash[String, T::Array[String]])) - @users = @course.users.includes(:user_field_values) + users = @course.users.includes(:user_field_values) if params[:sort_by] == 'points' - @users = @users.sort_by do |u| - [-@users_to_points[u.login].size, u.login.downcase] + users = users.sort_by do |u| + [-users_to_points.fetch(u.login, []).size, u.login.downcase] end else - @users.order! + users.order! end - @users = [current_user] unless can?(:teach, @course) + users = [current_user] unless can?(:teach, @course) + @users = T.let(users, T.nilable(T.any(ActiveRecord::Relation, T::Array[User]))) respond_to do |format| format.html format.json do @@ -86,17 +94,18 @@ def show end private + sig { params(course: Course, visible_exercises: T::Enumerable[Exercise], sheets: T::Array[String], only_for_user: T.nilable(User)).returns(T::Hash[Symbol, T.untyped]) } def summary_hash(course, visible_exercises, sheets, only_for_user = nil) per_user_and_sheet = AwardedPoint.count_per_user_in_course_with_sheet(course, sheets, only_for_user, current_user.administrator?) user_totals = {} for username, per_sheet in per_user_and_sheet user_totals[username] ||= 0 - user_totals[username] += per_sheet.values.reduce(0, &:+) + user_totals[username] += per_sheet.values.sum end include_admins = current_user.administrator? - users = User.select('login, email, users.id, administrator').where(login: per_user_and_sheet.keys.sort_by(&:downcase)).includes(:organizations).includes(:user_field_values).order('login ASC') + users = User.select('login, email, users.id, administrator').where(login: per_user_and_sheet.keys.sort_by(&:downcase)).includes(:organizations).includes(:user_field_values).order(:login) users = users.where(administrator: false) unless include_admins @@ -118,6 +127,7 @@ def summary_hash(course, visible_exercises, sheets, only_for_user = nil) } end + sig { params(summary: T::Hash[Symbol, T.untyped], sorting: String).void } def sort_summary(summary, sorting) if sorting == 'total_points' summary[:users] = summary[:users].sort_by { |user| [-summary[:total_for_user][user.login].to_i, user.login] } @@ -127,7 +137,8 @@ def sort_summary(summary, sorting) end end + sig { void } def set_organization - @organization = Organization.find_by(slug: params[:organization_id]) + @organization = Organization.find_by!(slug: params[:organization_id]) end end diff --git a/app/controllers/positions_controller.rb b/app/controllers/positions_controller.rb index 3bfc331c4..c67b47d4b 100644 --- a/app/controllers/positions_controller.rb +++ b/app/controllers/positions_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true # Handles feedback questions reordering @@ -5,11 +6,12 @@ # This is poorly named. Also, as noted in FeedbackQuestionsController, # the feedback question editor probably shouldn't exist. class PositionsController < ApplicationController + sig { void } def update if params[:feedback_question_id] record = FeedbackQuestion.find(params[:feedback_question_id]) authorize! :manage_feedback_questions, record.course - redirect_dest = organization_course_feedback_questions_path(record.course.organization, record.course) + redirect_dest = organization_course_feedback_questions_path(T.must(record.course).organization, record.course) else return respond_not_found('Unknown resource to move') end diff --git a/app/controllers/results_controller.rb b/app/controllers/results_controller.rb index e11391560..6327374e4 100644 --- a/app/controllers/results_controller.rb +++ b/app/controllers/results_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'test_run_grader' @@ -7,6 +8,7 @@ class ResultsController < ApplicationController skip_authorization_check + sig { void } def create submission = Submission.find(params[:submission_id]) @@ -17,7 +19,7 @@ def create end SandboxResultsSaver.save_results(submission, filtered_params) - Rails.cache.delete("api_v8_core_submission_show_#{submission.id}_user_#{submission.user.id}") + Rails.cache.delete("api_v8_core_submission_show_#{submission.id}_user_#{submission.user_id}") rescue SandboxResultsSaver::InvalidTokenError respond_unauthorized('Invalid or expired token') else diff --git a/app/controllers/reviewed_submissions_controller.rb b/app/controllers/reviewed_submissions_controller.rb index 69310984a..7a1f01230 100644 --- a/app/controllers/reviewed_submissions_controller.rb +++ b/app/controllers/reviewed_submissions_controller.rb @@ -1,7 +1,9 @@ +# typed: strict # frozen_string_literal: true # Shows for admin the list of submissions that have already been reviewed. class ReviewedSubmissionsController < ApplicationController + sig { void } def index @course = Course.find(params[:course_id]) @organization = @course.organization @@ -10,10 +12,11 @@ def index add_breadcrumb 'Code reviews', organization_course_reviews_path(@organization, @course) add_breadcrumb 'Reviewed submissions' - @submissions = @course.submissions - .where(reviewed: true) - .includes(reviews: :reviewer) - .includes(:user) - .order('created_at DESC') + submissions = @course.submissions + .where(reviewed: true) + .includes(reviews: :reviewer) + .includes(:user) + .order(created_at: :desc) + @submissions = T.let(submissions, T.nilable(ActiveRecord::Relation)) end end diff --git a/app/controllers/reviews_controller.rb b/app/controllers/reviews_controller.rb index 27ba84ab5..5e3768bbd 100644 --- a/app/controllers/reviews_controller.rb +++ b/app/controllers/reviews_controller.rb @@ -1,19 +1,24 @@ +# typed: strict # frozen_string_literal: true require 'natsort' # Presents the code review UI. class ReviewsController < ApplicationController + extend T::Sig before_action :set_organization, except: %i[new create] + sig { void } def index if params[:course_id] fetch :course - @organization = @course.organization - @my_reviews = @course.submissions - .where(user_id: current_user.id) - .where('requests_review OR requires_review OR reviewed') - .order('created_at DESC') + course = T.must(@course) + @organization = course.organization + my_reviews = course.submissions + .where(user_id: current_user.id) + .where('requests_review OR requires_review OR reviewed') + .order(created_at: :desc) + @my_reviews = T.let(my_reviews, T.nilable(ActiveRecord::Relation)) respond_to do |format| format.html do @@ -27,58 +32,67 @@ def index end else fetch :submission, :files - raise "Submission's exercise has been moved or deleted" unless @submission.exercise + submission = T.must(@submission) + return respond_not_found("This submission's exercise has been removed") unless submission.exercise - @course = @submission.course - @organization = @course.organization + course = T.must(submission.course) + @course = course + @organization = course.organization respond_to do |format| format.html do add_course_breadcrumb add_exercise_breadcrumb add_submission_breadcrumb - breadcrumb_label = @submission.reviews.count == 1 ? 'Code review' : 'Code reviews' - add_breadcrumb breadcrumb_label, submission_reviews_path(@submission) + breadcrumb_label = submission.reviews.count == 1 ? 'Code review' : 'Code reviews' + add_breadcrumb breadcrumb_label, submission_reviews_path(submission) render 'reviews/submission_index' end end end end + sig { void } def new fetch :submission, :files + submission = T.must(@submission) + return respond_not_found("This submission's exercise has been removed") unless submission.exercise - @show_page_presence = true + @show_page_presence = T.let(true, T.nilable(T::Boolean)) - @course = @submission.course - @organization = @course.organization + course = T.must(submission.course) + @course = course + @organization = course.organization add_course_breadcrumb - add_breadcrumb 'Code reviews', organization_course_reviews_path(@organization, @course) + add_breadcrumb 'Code reviews', organization_course_reviews_path(@organization, course) add_breadcrumb 'Code review editor' - @new_review = Review.new( - submission_id: @submission.id, + @new_review = T.let(Review.new( + submission_id: submission.id, reviewer_id: current_user.id - ) - authorize! :create_review, @course + ), T.nilable(Review)) + authorize! :create_review, course render 'reviews/submission_index' end + sig { void } def create fetch :submission - @review = Review.new( - submission_id: @submission.id, + submission = T.must(@submission) + review = Review.new( + submission_id: submission.id, reviewer_id: current_user.id, review_body: params[:review][:review_body] ) - authorize! :create_review, @submission.course + @review = review + authorize! :create_review, submission.course begin ActiveRecord::Base.connection.transaction do award_points mark_as_reviewed - @review.submission.save! - @review.save! + T.must(review.submission).save! + review.save! end rescue StandardError ::Rails.logger.error($!) @@ -86,12 +100,14 @@ def create else flash[:success] = 'Code review added.' send_email_about_new_review if params[:send_email] - @course = @submission.course - @organization = @course.organization - redirect_to organization_course_reviews_path(@organization, @course) + course = T.must(submission.course) + @course = course + @organization = course.organization + redirect_to organization_course_reviews_path(@organization, course) end end + sig { void } def update fetch :review authorize! :update, @review @@ -104,21 +120,24 @@ def update end end + sig { void } def destroy fetch :review authorize! :delete, @review - if @review.destroy + review = T.must(@review) + if review.destroy flash[:success] = 'Code review deleted.' - redirect_to new_submission_review_path(@review.submission_id) + redirect_to new_submission_review_path(review.submission_id) else respond_with_error('Failed to delete code review.') end end private + sig { returns(T::Hash[Symbol, T.untyped]) } def course_reviews_json - submissions = @my_reviews.includes(reviews: %i[reviewer submission]) - exercises = @course.exercises.index_by { |e| e.name } + submissions = T.must(@my_reviews).includes(reviews: %i[reviewer submission]) + exercises = T.must(@course).exercises.index_by { |e| e.name } reviews = submissions.map do |s| s.reviews.map do |r| { @@ -133,13 +152,15 @@ def course_reviews_json } end + sig { params(exercises: T::Hash[T.nilable(String), Exercise], review: Review).returns(T::Hash[Symbol, T.untyped]) } def review_json(exercises, review) - available_points = exercises[review.submission.exercise_name].available_points.where(requires_review: true).map(&:name) + exercise = exercises[T.must(review.submission).exercise_name] + available_points = exercise ? exercise.available_points.where(requires_review: true).map(&:name) : [] points_not_awarded = available_points - review.points_list { id: review.id, marked_as_read: review.marked_as_read, - reviewer_name: review.reviewer.display_name, + reviewer_name: review.reviewer&.display_name || '(deleted)', review_body: review.review_body, points: review.points_list.natsort, points_not_awarded: points_not_awarded.natsort, @@ -150,18 +171,20 @@ def review_json(exercises, review) } end + sig { params(read: T::Boolean).void } def mark_as_read(read) which = read ? 'read' : 'unread' fetch :review authorize! (read ? :mark_as_read : :mark_as_unread), @review + review = T.must(@review) - @review.marked_as_read = read - if @review.save + review.marked_as_read = read + if review.save respond_to do |format| format.html do flash[:success] = "Code review marked as #{which}." - redirect_to submission_reviews_path(@review.submission) + redirect_to submission_reviews_path(review.submission) end format.json do render json: { status: 'OK' } @@ -172,35 +195,39 @@ def mark_as_read(read) end end + sig { void } def update_review fetch :review authorize! :update, @review - @review.review_body = params[:review][:review_body] + review = T.must(@review) + review.review_body = params[:review][:review_body] begin mark_as_reviewed award_points - @review.submission.save! - @review.save! + T.must(review.submission).save! + review.save! rescue StandardError ::Rails.logger.error($!) respond_with_error('Failed to save code review.') else flash[:success] = 'Code review edited. (No notification sent).' - redirect_to new_submission_review_path(@review.submission_id) + redirect_to new_submission_review_path(review.submission_id) end end + sig { void } def mark_as_reviewed - sub = @review.submission + sub = T.must(T.must(@review).submission) sub.reviewed = true sub.review_dismissed = false sub.of_same_kind .where('(requires_review OR requests_review) AND NOT reviewed') - .where(['created_at < ?', sub.created_at]) + .where(created_at: ...sub.created_at) .update_all(newer_submission_reviewed: true) end + sig { params(stuff: Symbol).void } def fetch(*stuff) if stuff.include? :course @course = Course.find(params[:course_id]) @@ -211,21 +238,24 @@ def fetch(*stuff) authorize! :read, @submission end if stuff.include? :review - @review = Review.find(params[:id]) + @review = T.let(Review.find(params[:id]), T.nilable(Review)) authorize! :read, @review end - @files = SourceFileList.for_submission(@submission) if stuff.include? :files + @files = T.let(SourceFileList.for_submission(T.must(@submission)), T.nilable(SourceFileList)) if stuff.include? :files end + sig { void } def send_email_about_new_review - ReviewMailer.review_email(@review).deliver + ReviewMailer.review_email(T.must(@review)).deliver_now end + sig { void } def award_points - submission = @review.submission + review = T.must(@review) + submission = T.must(review.submission) exercise = submission.exercise - course = exercise.course raise 'Exercise of submission has been moved or deleted' unless exercise + course = T.must(exercise.course) available_points = exercise.available_points.where(requires_review: true).map(&:name) previous_points = course.awarded_points.where(user_id: submission.user_id, name: available_points).map(&:name) @@ -248,12 +278,12 @@ def award_points end end - @review.points = (@review.points_list + new_points + previous_points).uniq.natsort.join(' ') + review.points = (review.points_list + new_points + previous_points).uniq.natsort.join(' ') submission.points = (submission.points_list + new_points + previous_points).uniq.natsort.join(' ') end - private + sig { void } def set_organization - @organization = Organization.find_by(slug: params[:organization_id]) + @organization = Organization.find_by!(slug: params[:organization_id]) unless params[:organization_id].nil? end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 57d2b3034..13e0a93c5 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,28 +1,32 @@ +# typed: strict # frozen_string_literal: true # Handles login and logout. class SessionsController < ApplicationController skip_authorization_check + sig { void } def new - session[:return_to] ||= params[:return_to] + session[:return_to] ||= url_from(params[:return_to]) if signed_in? path = session[:return_to] ||= root_path redirect_to path end end + sig { void } def create begin clear_expired_sessions rescue StandardError + # Cleanup is best effort; it must not block logging in. end user, status = User.authenticate_with_status(params[:session][:login], params[:session][:password]) case status when :accepted - sign_in user + sign_in T.must(user) try_to_redirect_back when :unavailable try_to_redirect_incorrect_login(alert: 'Login is temporarily unavailable. Please try again shortly.') @@ -33,12 +37,14 @@ def create end end + sig { void } def destroy sign_out try_to_redirect_back(notice: 'Goodbye') end private + sig { params(redirect_params: T::Hash[Symbol, T.untyped]).void } def try_to_redirect_back(redirect_params = {}) if session[:return_to].present? return_to = session.delete(:return_to) @@ -52,6 +58,7 @@ def try_to_redirect_back(redirect_params = {}) end end + sig { params(redirect_params: T::Hash[Symbol, T.untyped]).void } def try_to_redirect_incorrect_login(redirect_params = {}) if request.referer.present? redirect_to request.referer, redirect_params @@ -62,6 +69,7 @@ def try_to_redirect_incorrect_login(redirect_params = {}) end end + sig { void } def clear_expired_sessions Session.delete_expired end diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index c874603f0..c8fa5ac1c 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -1,33 +1,39 @@ +# typed: strict # frozen_string_literal: true class SettingsController < ApplicationController + extend T::Sig skip_authorization_check before_action :set_user + sig { void } def show authorize! :read, @user end + sig { void } def update authorize! :update, @user + user = T.must(@user) User.transaction do - @email_before = @user.email + email_before = user.email + @email_before = T.let(email_before, T.nilable(String)) set_email - password_changed = maybe_update_password(@user, params[:user]) + password_changed = maybe_update_password(user, params[:user]) set_user_fields - if @user.errors.empty? && @user.save + if user.errors.empty? && user.save # Password changed locally: migrate the user to courses.mooc.fi - @user.post_new_user_to_courses_mooc_fi(params[:user][:password]) if password_changed && !@user.managed_externally? - RecentlyChangedUserDetail.email_changed.create!(old_value: @email_before, new_value: @user.email, username: @user.login, user_id: @user.id) unless @email_before.casecmp(@user.email).zero? + user.post_new_user_to_courses_mooc_fi(params[:user][:password]) if password_changed && !user.managed_externally? + RecentlyChangedUserDetail.email_changed.create!(old_value: email_before, new_value: user.email, username: user.login, user_id: user.id) unless T.must(email_before.casecmp(user.email)).zero? flash[:notice] = if password_changed 'Changes saved and password changed' else 'Changes saved' end - redirect_to participant_settings_path(@user) + redirect_to participant_settings_path(user) else flash.now[:error] = 'Failed to save profile' render action: :show, status: :forbidden @@ -35,6 +41,7 @@ def update end end + sig { void } def dangerously_destroy_user @user = authenticate_current_user_destroy if @user.submissions.length != 0 @@ -54,39 +61,46 @@ def dangerously_destroy_user redirect_to root_url, notice: "The account #{username} (#{email}) has been permanently destroyed." end + sig { void } def verify_dangerously_destroying_user @user = authenticate_current_user_destroy end + sig { void } def user_has_submissions @user = authenticate_current_user_destroy end private + sig { returns(User) } def authenticate_current_user_destroy user = User.find(params[:participant_id]) authorize! :destroy, user user end + sig { void } def set_user - @user = User.find(params[:participant_id]) + @user = T.let(User.find(params[:participant_id]), T.nilable(User)) end + sig { void } def set_email + user = T.must(@user) user_params = params[:user] - return if !@user.new_record? && user_params[:email_repeat].blank? + return if !user.new_record? && user_params[:email_repeat].blank? if user_params[:email].blank? - @user.errors.add(:email, 'needed') + user.errors.add(:email, 'needed') elsif user_params[:email] != user_params[:email_repeat] - @user.errors.add(:email_repeat, 'did not match') + user.errors.add(:email_repeat, 'did not match') else - @user.email = user_params[:email].strip + user.email = user_params[:email].strip end end + sig { params(user: User, user_params: T.untyped).returns(T::Boolean) } def maybe_update_password(user, user_params) if user_params[:old_password].present? || user_params[:password].present? if user.managed_externally? @@ -116,11 +130,12 @@ def maybe_update_password(user, user_params) end end + sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) } def set_user_fields return if params[:user_field].nil? changes = {} UserField.all.select { |f| f.visible_to?(current_user) }.each do |field| - value_record = @user.field_value_record(field) + value_record = T.must(@user).field_value_record(field) old_value = value_record.ruby_value value_record.set_from_form(params[:user_field][field.name]) new_value = value_record.ruby_value diff --git a/app/controllers/setup/course_assistants_controller.rb b/app/controllers/setup/course_assistants_controller.rb index e2f4a94df..61b64cef6 100644 --- a/app/controllers/setup/course_assistants_controller.rb +++ b/app/controllers/setup/course_assistants_controller.rb @@ -1,57 +1,64 @@ +# typed: strict # frozen_string_literal: true class Setup::CourseAssistantsController < Setup::SetupController before_action :set_course + sig { void } def index authorize! :modify_assistants, @course - @setup_in_progress = setup_in_progress? + course = T.must(@course) + @setup_in_progress = T.let(setup_in_progress?, T.nilable(T::Boolean)) - @assistants = @course.assistants - @assistantship = Assistantship.new + @assistants = T.let(course.assistants, T.nilable(ActiveRecord::Relation)) + @assistantship = T.let(Assistantship.new, T.nilable(Assistantship)) if setup_in_progress? print_setup_phases(3) else - add_breadcrumb("Assistants for course #{@course.title}") + add_breadcrumb("Assistants for course #{course.title}") end end + sig { void } def create authorize! :modify_assistants, @course + course = T.must(@course) if params[:commit] == 'Add new assistant' new_assistant = User.find_by('lower(email) = ?', assistant_params[:email].downcase) - @assistantship = Assistantship.new(user: new_assistant, course: @course) + @assistantship = Assistantship.new(user: new_assistant, course: course) if @assistantship.save - redirect_to setup_organization_course_course_assistants_path, notice: "Assistant #{new_assistant.email} added" + redirect_to setup_organization_course_course_assistants_path, notice: "Assistant #{T.must(new_assistant).email} added" else @setup_in_progress = setup_in_progress? - @assistants = @course.assistants + @assistants = course.assistants if setup_in_progress? print_setup_phases(3) else - add_breadcrumb("Assistants for course #{@course.title}") + add_breadcrumb("Assistants for course #{course.title}") end render :index end elsif params[:commit] == 'Continue' redirect_to setup_organization_course_course_finisher_index_path else - redirect_to organization_course_path(@organization, @course) + redirect_to organization_course_path(@organization, course) end end + sig { void } def destroy authorize! :modify_assistants, @course @assistantship = Assistantship.find(params[:id]) - destroyed_email = @assistantship.user.email + destroyed_email = T.must(@assistantship.user).email @assistantship.destroy! redirect_to setup_organization_course_course_assistants_path, notice: "Assistant #{destroyed_email} removed from course." end private + sig { returns(ActionController::Parameters) } def assistant_params params.permit(:email) end diff --git a/app/controllers/setup/course_chooser_controller.rb b/app/controllers/setup/course_chooser_controller.rb index 1e65d0800..a67a37c88 100644 --- a/app/controllers/setup/course_chooser_controller.rb +++ b/app/controllers/setup/course_chooser_controller.rb @@ -1,17 +1,21 @@ +# typed: strict # frozen_string_literal: true class Setup::CourseChooserController < Setup::SetupController + extend T::Sig before_action :set_course_from_session + sig { void } def index authorize! :teach, @organization save_wizard_to_session(1) print_setup_phases(1) - @course_templates = CourseTemplate.available.order(Arel.sql('LOWER(title)')) - @setup_in_progress = setup_in_progress? + @course_templates = T.let(CourseTemplate.available.order(Arel.sql('LOWER(title)')), T.nilable(ActiveRecord::Relation)) + @setup_in_progress = T.let(setup_in_progress?, T.nilable(T::Boolean)) end private + sig { void } def set_course_from_session if setup_in_progress? && !session[:ongoing_course_setup][:course_id].nil? @course = Course.find(session[:ongoing_course_setup][:course_id]) diff --git a/app/controllers/setup/course_details_controller.rb b/app/controllers/setup/course_details_controller.rb index f710770d4..af7001c51 100644 --- a/app/controllers/setup/course_details_controller.rb +++ b/app/controllers/setup/course_details_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'course_refresh_database_updater' @@ -5,50 +6,68 @@ class Setup::CourseDetailsController < Setup::SetupController before_action :set_course, except: %i[new create] + sig { void } def new authorize! :teach, @organization - @course_template = CourseTemplate.find(params[:template_id]) - authorize! :clone, @course_template + course_template = CourseTemplate.find(params[:template_id]) + @course_template = T.let(course_template, T.nilable(CourseTemplate)) + authorize! :clone, course_template print_setup_phases(2) - @course = Course.new_from_template(@course_template) + @course = Course.new_from_template(course_template) @course.organization = @organization end + sig { void } def custom authorize! :create_custom_course, @organization print_setup_phases(2) @course = Course.new @course.organization = @organization - @custom = true + @custom = T.let(true, T.nilable(T::Boolean)) render 'new' end + sig { void } + def edit + authorize! :teach, @organization + @setup_in_progress = T.let(setup_in_progress?, T.nilable(T::Boolean)) + if setup_in_progress? + print_setup_phases(2) + else + add_course_breadcrumb + add_breadcrumb('Edit details') + end + end + + sig { void } def create authorize! :teach, @organization custom = params[:course][:course_template_id].blank? authorize! :create_custom_course, @organization if custom + organization = T.must(@organization) + create_params = custom ? course_params_for_create_custom : course_params_for_create_from_template input_name = create_params[:name] - create_params[:name] = @organization.slug + '-' + input_name + create_params[:name] = T.must(organization.slug) + '-' + input_name @course = Course.new(create_params) @course.organization = @organization if @course.save # Do refresh if custom course and course_template first course - if custom || !@course.course_template.cache_exists? + if custom || !T.must(@course.course_template).cache_exists? refresh_course(@course) else - template_refresh = @course.course_template.course_template_refreshes.last + template_refresh = T.must(T.must(@course.course_template).course_template_refreshes.last) CourseRefreshDatabaseUpdater.new.refresh_course(@course, template_refresh[:langs_refresh_output]) end update_setup_course(@course.id) - redirect_to setup_organization_course_course_assistants_path(@organization.slug, @course.id) + redirect_to setup_organization_course_course_assistants_path(organization.slug, @course.id) else @course_template = @course.course_template unless custom @course.name = input_name @@ -58,25 +77,17 @@ def create end end - def edit - authorize! :teach, @organization - @setup_in_progress = setup_in_progress? - if setup_in_progress? - print_setup_phases(2) - else - add_course_breadcrumb - add_breadcrumb('Edit details') - end - end - + sig { void } def update authorize! :teach, @organization - if @course.update(course_params) + organization = T.must(@organization) + course = T.must(@course) + if course.update(course_params) if setup_in_progress? - redirect_to setup_organization_course_course_assistants_path(@organization.slug, @course.id), + redirect_to setup_organization_course_course_assistants_path(organization.slug, course.id), notice: 'Course details updated.' else - redirect_to organization_course_path(@organization, @course), notice: 'Course details updated.' + redirect_to organization_course_path(organization, course), notice: 'Course details updated.' end else render :edit @@ -84,20 +95,24 @@ def update end private + sig { params(course: Course).returns(CourseTemplateRefresh) } def refresh_course(course) course.refresh(current_user.id) end + sig { returns(ActionController::Parameters) } def course_params_for_create_from_template params.require(:course).permit(:name, :title, :description, :material_url, :course_template_id, :moocfi_id) end + sig { returns(ActionController::Parameters) } def course_params_for_create_custom params.require(:course).permit(:name, :title, :description, :material_url, :source_url, :git_branch, :source_backend, :moocfi_id) end + sig { returns(ActionController::Parameters) } def course_params - if @course.custom? + if T.must(@course).custom? params.require(:course).permit(:title, :description, :material_url, :source_url, :git_branch, :external_scoreboard_url, :moocfi_id) else params.require(:course).permit(:title, :description, :material_url, :external_scoreboard_url, :moocfi_id) diff --git a/app/controllers/setup/course_finisher_controller.rb b/app/controllers/setup/course_finisher_controller.rb index 519c788db..a6a2ef19e 100644 --- a/app/controllers/setup/course_finisher_controller.rb +++ b/app/controllers/setup/course_finisher_controller.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true class Setup::CourseFinisherController < Setup::SetupController before_action :set_course + sig { void } def index authorize! :teach, @organization unless setup_in_progress? @@ -11,18 +13,20 @@ def index print_setup_phases(4) end + sig { void } def create authorize! :teach, @organization + course = T.must(@course) if params[:commit] == 'Publish now' - @course.enabled! - @course.save! + course.enabled! + course.save! elsif params[:commit] == 'Finish and publish later' - @course.disabled! - @course.save! + course.disabled! + course.save! end reset_setup_session - redirect_to organization_course_path(@organization, @course) + redirect_to organization_course_path(@organization, course) end end diff --git a/app/controllers/setup/course_timings_controller.rb b/app/controllers/setup/course_timings_controller.rb index bd965f849..8e2910d83 100644 --- a/app/controllers/setup/course_timings_controller.rb +++ b/app/controllers/setup/course_timings_controller.rb @@ -1,13 +1,15 @@ +# typed: strict # frozen_string_literal: true # Deprecated class Setup::CourseTimingsController < Setup::SetupController before_action :set_course + sig { void } def show authorize! :teach, @organization - @setup_in_progress = setup_in_progress? + @setup_in_progress = T.let(setup_in_progress?, T.nilable(T::Boolean)) if setup_in_progress? print_setup_phases(3) else @@ -15,9 +17,10 @@ def show add_breadcrumb('Timing') end - @group_array = groups_as_array + @group_array = T.let(groups_as_array, T.nilable(T::Array[String])) end + sig { void } def update authorize! :teach, @organization @@ -69,83 +72,95 @@ def update else raise 'Wrong button' end - rescue UnlockSpec::InvalidSyntaxError => e - redirect_to setup_organization_course_course_timing_path, alert: e.to_s - rescue DeadlineSpec::InvalidSyntaxError => e + rescue UnlockSpec::InvalidSyntaxError, DeadlineSpec::InvalidSyntaxError => e redirect_to setup_organization_course_course_timing_path, alert: e.to_s end private + sig { void } def save_unlocks authorize! :manage_unlocks, @course + course = T.must(@course) groups = group_params groups.each do |name, unlock_data| + group = course.exercise_group_by_name(name) + next if group.nil? if unlock_data[:_unlock_option] == 'no_unlock' unlock_condition = '' elsif unlock_data[:_unlock_option] == 'percentage_from' unlock_condition = "#{unlock_data[:_percentage_required]}% from #{unlock_data[:_unlock_groupname]}" end - @course.exercise_group_by_name(name).group_unlock_conditions = Array(unlock_condition).to_json - UncomputedUnlock.create_all_for_course(@course) + group.group_unlock_conditions = Array(unlock_condition).to_json + UncomputedUnlock.create_all_for_course(course) end end + sig { void } def clear_all_unlocks authorize! :manage_unlocks, @course - @course.exercise_groups.each do |eg| + T.must(@course).exercise_groups.each do |eg| eg.group_unlock_conditions = [''].to_json end end + sig { params(percentage: T.any(String, Integer)).void } def unlocks_previous_set_completed(percentage = 80) authorize! :manage_unlocks, @course - prevname = nil - @course.exercise_groups.each do |eg| + prevname = T.let(nil, T.nilable(String)) + T.must(@course).exercise_groups.each do |eg| eg.group_unlock_conditions = Array("#{percentage}% from #{prevname}").to_json unless prevname.nil? prevname = eg.name end end + sig { void } def save_deadlines authorize! :manage_deadlines, @course + course = T.must(@course) groups = group_params groups.each do |name, deadlines| - hard_deadlines = [deadlines[:hard][:static], ''].to_json - @course.exercise_group_by_name(name).hard_group_deadline = hard_deadlines + group = course.exercise_group_by_name(name) + next if group.nil? + group.hard_group_deadline = [deadlines[:hard][:static], ''].to_json end end + sig { void } def clear_all_deadlines authorize! :manage_deadlines, @course - @course.exercise_groups.each do |eg| + T.must(@course).exercise_groups.each do |eg| eg.hard_group_deadline = ['', ''].to_json end end + # first_date: the first_set_date param, a one-element array of a date string. + sig { params(first_date: T.untyped, days: Integer).void } def fill_deadlines_with_interval(first_date, days = 7) authorize! :manage_deadlines, @course date = first_date - @course.exercise_groups.each do |eg| + T.must(@course).exercise_groups.each do |eg| eg.hard_group_deadline = date.to_json date = Array((DateTime.parse(date[0]) + days.days).strftime('%Y-%m-%d')) end end + sig { params(date: T.untyped).void } def fill_all_deadlines_with(date) authorize! :manage_deadlines, @course - @course.exercise_groups.each do |eg| + T.must(@course).exercise_groups.each do |eg| eg.hard_group_deadline = date.to_json end end - private + sig { returns(T::Array[String]) } def groups_as_array - @course.exercise_groups.each_with_object(['']) do |group, array| + T.must(@course).exercise_groups.each_with_object(['']) do |group, array| array << group.name end end + sig { returns(T.any(ActionController::Parameters, T::Hash[T.untyped, T.untyped])) } def group_params sliced = params.slice(:group, :empty_group) groups = sliced[:group] || {} diff --git a/app/controllers/setup/organizations_controller.rb b/app/controllers/setup/organizations_controller.rb index c979c907d..c1bbdaf8c 100644 --- a/app/controllers/setup/organizations_controller.rb +++ b/app/controllers/setup/organizations_controller.rb @@ -1,18 +1,32 @@ +# typed: strict # frozen_string_literal: true class Setup::OrganizationsController < Setup::SetupController + extend T::Sig skip_authorization_check only: %i[index new] + sig { void } def index redirect_to setup_start_index_path end + sig { void } def new return respond_unauthorized('Please log in first to create new organization') unless can? :request, :organization add_breadcrumb 'Create new organization' @organization = Organization.new end + sig { void } + def edit + authorize! :edit, @organization + + add_organization_breadcrumb + add_breadcrumb 'Edit details' + @cant_edit_slug = T.let(!current_user.administrator?, T.nilable(T::Boolean)) + end + + sig { void } def create authorize! :request, :organization @organization = Organization.init(organization_params, current_user) @@ -26,19 +40,12 @@ def create end end - def edit - authorize! :edit, @organization - - add_organization_breadcrumb - add_breadcrumb 'Edit details' - @cant_edit_slug = !current_user.administrator? - end - + sig { void } def update authorize! :edit, @organization authorize! :edit_slug, @organization unless organization_params[:slug].nil? - if @organization.update(organization_params) + if T.must(@organization).update(organization_params) redirect_to organization_path(@organization), notice: 'Organization was successfully updated.' else add_organization_breadcrumb @@ -49,10 +56,12 @@ def update end private + sig { void } def set_organization - @organization = Organization.find_by(slug: params[:id]) unless params[:id].nil? + @organization = Organization.find_by!(slug: params[:id]) unless params[:id].nil? end + sig { returns(ActionController::Parameters) } def organization_params params.require(:organization).permit(:name, :information, :website, :logo, :slug, :contact_information, :phone, :email, :disabled_reason) end diff --git a/app/controllers/setup/setup_controller.rb b/app/controllers/setup/setup_controller.rb index 5e5c78669..726bd11e8 100644 --- a/app/controllers/setup/setup_controller.rb +++ b/app/controllers/setup/setup_controller.rb @@ -1,9 +1,11 @@ +# typed: strict # frozen_string_literal: true class Setup::SetupController < ApplicationController + extend T::Sig before_action :set_organization, :add_setup_breadcrumb - STEPS = + STEPS = T.let( [ { # step_number: 1, @@ -31,8 +33,11 @@ class Setup::SetupController < ApplicationController title: 'Finish', path: :setup_organization_course_course_finisher_index_path } - ].freeze + ].freeze, + T::Array[{ title: String, path: Symbol }] + ) + sig { params(title: String).returns(T.nilable(Integer)) } def step_number(title) found = 0 STEPS.each do |st| @@ -42,15 +47,18 @@ def step_number(title) nil end + sig { params(step_number: Integer).returns(Symbol) } def link_to_next_step(step_number) - STEPS[step_number][:path] + STEPS.fetch(step_number)[:path] end + sig { void } def add_setup_breadcrumb add_breadcrumb 'Setup', setup_start_index_path add_breadcrumb 'Create new course' if controller_name.starts_with?('course_') && setup_in_progress? end + sig { params(phase: Integer).void } def print_setup_phases(phase = 0) update_setup_phase(phase) unless phase == 2 maxphase = setup_in_progress? ? session[:ongoing_course_setup][:phase] : phase @@ -66,20 +74,27 @@ def print_setup_phases(phase = 0) end options = {} options = { pass_parameters: true } if setup_in_progress? && course_choosed? - add_phase (i + 1).to_s + '. ' + STEPS[i][:title], type, path, options + add_phase (i + 1).to_s + '. ' + st[:title], type, path, options end end - def add_phase(name, type, url = '', options = {}) - @course_setup_phases ||= [] - if options[:pass_parameters] - url = url.to_s + "('#{@organization.slug}', #{@course.id})" - end - url = eval(url.to_s) if url =~ /_path|_url|@/ - @course_setup_phases << { name: name, url: url, type: type } + # route_helper: called with the current organization and course when options[:pass_parameters] is set. + sig { params(name: String, type: String, route_helper: T.nilable(Symbol), options: T::Hash[Symbol, T.untyped]).void } + def add_phase(name, type, route_helper = nil, options = {}) + phases = @course_setup_phases ||= T.let([], T.nilable(T::Array[T::Hash[Symbol, T.untyped]])) + url = + if route_helper.nil? + nil + elsif options[:pass_parameters] + send(route_helper, T.must(@organization).slug, T.must(@course).id) + else + send(route_helper) + end + phases << { name: name, url: url, type: type } end private + sig { params(phase: Integer).void } def save_wizard_to_session(phase = 1) return if setup_in_progress? session[:ongoing_course_setup] = { @@ -89,6 +104,7 @@ def save_wizard_to_session(phase = 1) } end + sig { returns(T::Boolean) } def setup_in_progress? return false if session[:ongoing_course_setup].nil? if !session[:ongoing_course_setup][:course_id].nil? && !@course.nil? @@ -98,34 +114,40 @@ def setup_in_progress? end end + sig { returns(T::Boolean) } def course_choosed? return false if session[:ongoing_course_setup].nil? !session[:ongoing_course_setup][:course_id].nil? end + sig { void } def reset_setup_session session[:ongoing_course_setup] = nil end + sig { params(phase: Integer).void } def update_setup_phase(phase) if setup_in_progress? session[:ongoing_course_setup][:phase] = phase if session[:ongoing_course_setup][:phase] < phase end end + sig { params(id: T.nilable(Integer)).void } def update_setup_course(id = nil) return unless setup_in_progress? session[:ongoing_course_setup][:course_id] = if id.nil? - @course.id + T.must(@course).id else id end end + sig { void } def set_organization - @organization = Organization.find_by(slug: params[:organization_id]) + @organization = Organization.find_by!(slug: params[:organization_id]) unless params[:organization_id].nil? end + sig { void } def set_course @course = Course.find(params[:course_id]) unless params[:course_id].nil? end diff --git a/app/controllers/setup/start_controller.rb b/app/controllers/setup/start_controller.rb index 5cff9e290..75e9c07c8 100644 --- a/app/controllers/setup/start_controller.rb +++ b/app/controllers/setup/start_controller.rb @@ -1,10 +1,14 @@ +# typed: strict # frozen_string_literal: true class Setup::StartController < Setup::SetupController + extend T::Sig skip_authorization_check only: [:index] + sig { void } def index - @my_organizations = Organization.taught_organizations(current_user) - @organization = @my_organizations.first if @my_organizations.count == 1 + my_organizations = Organization.taught_organizations(current_user) + @my_organizations = T.let(my_organizations, T.nilable(ActiveRecord::Relation)) + @organization = my_organizations.first if my_organizations.count == 1 end end diff --git a/app/controllers/solutions_controller.rb b/app/controllers/solutions_controller.rb index b3cf3770b..9d2474ea0 100644 --- a/app/controllers/solutions_controller.rb +++ b/app/controllers/solutions_controller.rb @@ -1,17 +1,19 @@ +# typed: strict # frozen_string_literal: true # Returns the suggestion solution as a ZIP. class SolutionsController < ApplicationController + sig { void } def show @exercise = Exercise.find(params[:exercise_id]) - @course = @exercise.course + @course = T.must(@exercise.course) @organization = @course.organization add_course_breadcrumb add_exercise_breadcrumb add_breadcrumb 'Suggested solution' - @solution = @exercise.solution + @solution = T.let(@exercise.solution, T.nilable(Solution)) begin authorize! :read, @solution rescue CanCan::AccessDenied diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index cf6c64ed9..43aff9f52 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -1,10 +1,13 @@ +# typed: strict # frozen_string_literal: true # Shows the various statistics under /stats. class StatsController < ApplicationController + extend T::Sig skip_authorization_check except: [:organization_stats_index] before_action :set_organization + sig { void } def index get_vars if @course @@ -21,6 +24,7 @@ def index end end + sig { void } def show get_vars page = params[:id] @@ -36,25 +40,29 @@ def show end private + sig { void } def get_vars @course = Course.find(params[:course_id]) if params[:course_id] end + sig { void } def course_stats_index respond_to do |format| format.html { render template: 'courses/stats/index' } end end + sig { void } def organization_stats_index authorize! :view_statistics, @organization - @stats = Stats.courses(@organization) + @stats = T.let(Stats.courses(@organization), T.nilable(T::Hash[Symbol, T.untyped])) respond_to do |format| format.html { render } format.json { render json: @stats, callback: params[:jsonp] } end end + sig { void } def general_stats_index @stats = Stats.courses respond_to do |format| @@ -63,6 +71,7 @@ def general_stats_index end end + sig { params(page: String).void } def course_stats_show(page) case page when 'submissions' @@ -74,46 +83,54 @@ def course_stats_show(page) end end + sig { void } def course_stats_show_submissions - return respond_not_found('No submissions yet') if @course.submissions.empty? + course = T.must(@course) + return respond_not_found('No submissions yet') if course.submissions.empty? - @start_time = + start_time = if params[:start_time] - then Time.zone.parse(params[:start_time]) - else @course.time_of_first_submission.to_date.in_time_zone + time_param(:start_time) + else + T.must(course.time_of_first_submission).to_date.in_time_zone end - @end_time = + return respond_with_error('Invalid start_time', 400) if start_time.nil? + end_time = if params[:end_time] - then Time.zone.parse(params[:end_time]) - else @course.time_of_last_submission.to_date.in_time_zone + time_param(:end_time) + else + T.must(course.time_of_last_submission).to_date.in_time_zone end - @time_unit = param_as_one_of(:time_unit, [nil, 'minute', 'hour', 'day']) - @time_unit = 'day' if @time_unit.nil? + return respond_with_error('Invalid end_time', 400) if end_time.nil? + time_unit = param_as_one_of(:time_unit, [nil, 'minute', 'hour', 'day']) || 'day' + @start_time = T.let(start_time, T.nilable(ActiveSupport::TimeWithZone)) + @end_time = T.let(end_time, T.nilable(ActiveSupport::TimeWithZone)) + @time_unit = T.let(time_unit, T.nilable(String)) respond_to do |format| format.html { render template: 'courses/stats/submissions', layout: 'bare' } format.json do - records = @course.submissions - .select(['COUNT(*) c', "date_trunc('#{@time_unit}', #{expr_for_time_in_time_zone('created_at')}) t"]) - .group('t') - .where('created_at >= ?', @start_time) - .where(user: User.legitimate_students) - .where('created_at < ?', @end_time) + records = course.submissions + .select(['COUNT(*) c', "date_trunc('#{time_unit}', #{expr_for_time_in_time_zone('created_at')}) t"]) + .group('t') + .where(created_at: start_time..) + .where(user: User.legitimate_students) + .where(created_at: ...end_time) date_format = '%Y-%m-%d %H:%M:%S' # query returns in this format, without timezone # date_format = '%FT%T.%LZ' # query returns in this format, without timezone lookup = {} for r in records - lookup[r.t.strftime(date_format)] = r.c.to_i + lookup[r['t'].strftime(date_format)] = r['c'].to_i end lookup.default = 0 result = [] - time = @start_time - while time < @end_time + time = start_time + while time < end_time result << lookup[time.strftime(date_format)] - time += 1.send(@time_unit) + time += 1.send(time_unit) end render json: result @@ -121,20 +138,22 @@ def course_stats_show_submissions end end + sig { void } def course_stats_show_submission_times - return respond_not_found('No submissions yet') if @course.submissions.empty? + course = T.must(@course) + return respond_not_found('No submissions yet') if course.submissions.empty? respond_to do |format| format.html { render template: 'courses/stats/submission_times', layout: 'bare' } format.json do - records = @course.submissions.where(user: User.legitimate_students).select([ + records = course.submissions.where(user: User.legitimate_students).select([ 'COUNT(*) c', "EXTRACT(HOUR FROM #{expr_for_time_in_time_zone('created_at')}) h" - ]).group('h').order('h ASC') + ]).group('h').order(:h) lookup = {} for r in records - lookup[r.h.to_i] = r.c.to_i + lookup[r['h'].to_i] = r['c'].to_i end lookup.default = 0 @@ -148,15 +167,25 @@ def course_stats_show_submission_times end end + sig { params(name: Symbol).returns(T.nilable(ActiveSupport::TimeWithZone)) } + def time_param(name) + Time.zone.parse(params[name].to_s) + rescue ArgumentError + nil + end + + sig { params(field: String).returns(String) } def expr_for_time_in_time_zone(field) connection = ActiveRecord::Base.connection "((#{field} AT TIME ZONE 'UTC') AT TIME ZONE #{connection.quote(Time.zone.name)})" end + sig { params(_page: String).void } def general_stats_show(_page) respond_not_found('No such stats page') end + sig { params(name: Symbol, valid_values: T::Array[T.nilable(String)]).returns(T.nilable(String)) } def param_as_one_of(name, valid_values) if valid_values.include?(params[name]) params[name] @@ -165,8 +194,8 @@ def param_as_one_of(name, valid_values) end end - private + sig { void } def set_organization - @organization = Organization.find_by(slug: params[:organization_id]) + @organization = Organization.find_by!(slug: params[:organization_id]) unless params[:organization_id].nil? end end diff --git a/app/controllers/status_controller.rb b/app/controllers/status_controller.rb index 983689fce..1a900a95b 100644 --- a/app/controllers/status_controller.rb +++ b/app/controllers/status_controller.rb @@ -1,12 +1,14 @@ +# typed: strict # frozen_string_literal: true # Shows the various statistics under /stats. class StatusController < ApplicationController + sig { void } def index authorize! :read_instance_state, nil - @stats = Rails.cache.fetch('submission-stats-cache') - @stats = JSON.parse(@stats) if @stats - @sandboxes = Rails.cache.fetch('sandbox-status-cache') - @sandboxes = JSON.parse(@sandboxes) if @sandboxes + stats_json = Rails.cache.fetch('submission-stats-cache') + @stats = T.let(stats_json && JSON.parse(stats_json), T.nilable(T::Hash[String, T.untyped])) + sandboxes_json = Rails.cache.fetch('sandbox-status-cache') + @sandboxes = T.let(sandboxes_json && JSON.parse(sandboxes_json), T.nilable(T::Array[T::Hash[String, T.untyped]])) end end diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index af8b7e550..4f1db0d8e 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'submission_processor' @@ -5,13 +6,16 @@ # Receives submissions and presents the full submission list and submission view. # Also handles rerun requests. class SubmissionsController < ApplicationController + extend T::Sig around_action :course_transaction before_action :get_course_and_exercise # Manually checked for #show and index skip_authorization_check only: %i[show index difference_with_solution] + sig { void } def index + course = T.must(@course) respond_to do |format| format.json do if params[:row_format] == 'datatables' @@ -21,20 +25,24 @@ def index end end format.html do # uses AJAX - respond_forbidden if !current_user.administrator? && @course.hide_submissions? - @organization = @course.organization + respond_forbidden if !current_user.administrator? && course.hide_submissions? + @organization = course.organization add_course_breadcrumb add_breadcrumb 'All submissions' end end end + sig { void } def show - @course ||= @submission.course - @exercise ||= @submission.exercise - @organization = @course.organization + submission = T.must(@submission) + @course ||= submission.course + @exercise ||= submission.exercise + course = T.must(@course) + exercise = @exercise + @organization = course.organization - @model_solution_token_used = ModelSolutionTokenUsed.where(course: @course, exercise_name: @exercise.name, user: @submission.user) + @model_solution_token_used = T.let(ModelSolutionTokenUsed.where(course: course, exercise_name: submission.exercise_name, user: submission.user), T.nilable(ActiveRecord::Relation)) add_course_breadcrumb add_exercise_breadcrumb @@ -42,48 +50,48 @@ def show respond_to do |format| format.html do - respond_forbidden if !current_user.administrator? && @course.hide_submissions? - @files = SourceFileList.for_submission(@submission) + respond_forbidden if !current_user.administrator? && course.hide_submissions? + @files = T.let(SourceFileList.for_submission(submission), T.nilable(T.any(SourceFileList, T::Array[T::Hash[Symbol, String]]))) end format.zip do - respond_forbidden if !current_user.administrator? && @course.hide_submissions? - send_data(@submission.return_file, filename: "#{@submission.user.login}-#{@exercise.name}-#{@submission.id}.zip") + respond_forbidden if !current_user.administrator? && course.hide_submissions? + send_data(submission.return_file, filename: "#{T.must(submission.user).login}-#{submission.exercise_name}-#{submission.id}.zip") end format.json do output = { api_version: ApiVersion::API_VERSION, - all_tests_passed: @submission.all_tests_passed?, - user_id: @submission.user_id, - login: @submission.user.login, - course: @course.name, - exercise_name: @submission.exercise.name, - status: @submission.status(current_user), - points: @submission.points_list, - validations: @submission.validations, - valgrind: @submission.valgrind, - solution_url: @exercise.solution.visible_to?(current_user) ? view_context.exercise_solution_url(@exercise) : nil, - submitted_at: @submission.created_at, - processing_time: @submission.processing_time, - reviewed: @submission.reviewed?, - requests_review: @submission.requests_review?, - paste_url: @submission.paste_available ? paste_url(@submission.paste_key) : nil, - message_for_paste: @submission.paste_available ? @submission.message_for_paste : nil, - missing_review_points: @exercise.missing_review_points_for(@submission.user) + all_tests_passed: submission.all_tests_passed?, + user_id: submission.user_id, + login: T.must(submission.user).login, + course: course.name, + exercise_name: submission.exercise_name, + status: submission.status(current_user), + points: submission.points_list, + validations: submission.validations, + valgrind: submission.valgrind, + solution_url: exercise && exercise.solution.visible_to?(current_user) ? view_context.exercise_solution_url(exercise) : nil, + submitted_at: submission.created_at, + processing_time: submission.processing_time, + reviewed: submission.reviewed?, + requests_review: submission.requests_review?, + paste_url: submission.paste_available ? paste_url(submission.paste_key) : nil, + message_for_paste: submission.paste_available ? submission.message_for_paste : nil, + missing_review_points: exercise ? exercise.missing_review_points_for(T.must(submission.user)) : [] } - output = output.merge( - case @submission.status(current_user) + status_fields = + case submission.status(current_user) when :processing then { - submissions_before_this: @submission.unprocessed_submissions_before_this, + submissions_before_this: submission.unprocessed_submissions_before_this, total_unprocessed: Submission.unprocessed_count } when :ok then { - test_cases: @submission.test_case_records, - feedback_questions: @course.feedback_questions.order(:position).map(&:record_for_api), - feedback_answer_url: submission_feedback_answers_url(@submission, format: :json) + test_cases: submission.test_case_records, + feedback_questions: course.feedback_questions.order(:position).map(&:record_for_api), + feedback_answer_url: submission_feedback_answers_url(submission, format: :json) } when :fail then { - test_cases: @submission.test_case_records + test_cases: submission.test_case_records } when :hidden then { all_tests_passed: nil, @@ -93,13 +101,13 @@ def show valgrind: nil } when :error then { - error: @submission.pretest_error + error: submission.pretest_error } end - ) + output = output.merge(T.must(status_fields)) output[:status] = :ok if output[:status] == :hidden if !!params[:include_files] - output[:files] = SourceFileList.for_submission(@submission).map { |f| { path: f.path, contents: f.contents } } + output[:files] = SourceFileList.for_submission(submission).map { |f| { path: f.path, contents: f.contents } } end render json: output @@ -107,12 +115,14 @@ def show end end + sig { void } def create if !params[:submission] || !params[:submission][:file] return respond_not_found('No ZIP file selected or failed to receive it') end - unless @exercise.submittable_by?(current_user) + exercise = T.must(@exercise) + unless exercise.submittable_by?(current_user) return respond_forbidden('Submissions for this exercise are no longer accepted.') end @@ -134,7 +144,7 @@ def create @submission = Submission.new( user: current_user, course: @course, - exercise: @exercise, + exercise: exercise, return_file: file_contents, params_json: submission_params.to_json, requests_review: !!params[:request_review], @@ -162,7 +172,7 @@ def create redirect_to(submission_path(@submission), notice: 'Submission received.') else - redirect_to(exercise_path(@exercise), + redirect_to(exercise_path(exercise), alert: errormsg) end end @@ -177,8 +187,9 @@ def create end end + sig { void } def update - submission = Submission.find(params[:id]) || respond_not_found + submission = Submission.find(params[:id]) authorize! :update, submission if params[:rerun] authorize! :rerun, submission @@ -193,32 +204,40 @@ def update end end + sig { void } def update_by_exercise - for submission in @exercise.submissions + exercise = T.must(@exercise) + for submission in exercise.submissions schedule_for_rerun(submission, -2) end - redirect_to exercise_path(@exercise), notice: 'Reruns scheduled' + redirect_to exercise_path(exercise), notice: 'Reruns scheduled' end + sig { void } def difference_with_solution - @course ||= @submission.course + submission = T.must(@submission) + @course ||= submission.course authorize! :teach, @course - @exercise ||= @submission.exercise - @organization = @course.organization + @exercise ||= submission.exercise + exercise = @exercise + return respond_not_found("This submission's exercise has been removed") if exercise.nil? + + @organization = T.must(@course).organization add_course_breadcrumb add_exercise_breadcrumb add_submission_breadcrumb add_breadcrumb 'Difference with model solution' - submission_files = SourceFileList.for_submission(@submission) - solution_files = SourceFileList.for_solution(@exercise.solution) + submission_files = SourceFileList.for_submission(submission) + solution_files = SourceFileList.for_solution(exercise.solution) files_in_list = Set.new - @files = [] + files = T.let([], T::Array[T::Hash[Symbol, String]]) + @files = files submission_files.each do |file| # TODO: In some exercises files may be named differently. Some kind of # similarity metric would be nice here model = solution_files.find { |solution_file| file.path == solution_file.path } - @files << { + files << { path: file.path, submission_contents: file.contents, model_contents: (model.nil? ? '' : model.contents) @@ -227,7 +246,7 @@ def difference_with_solution end solution_files.each do |file| next if files_in_list.include?(file.path) - @files << { + files << { path: file.path, submission_contents: '', model_contents: file.contents @@ -236,11 +255,13 @@ def difference_with_solution end private + sig { params(block: T.proc.void).void } def course_transaction(&block) Course.transaction(requires_new: true, &block) end # Ugly manual access control :/ + sig { void } def get_course_and_exercise submission_id = params[:id] || params[:submission_id] if submission_id @@ -250,14 +271,14 @@ def get_course_and_exercise @exercise = @submission.exercise elsif params[:exercise_id] @exercise = Exercise.find(params[:exercise_id]) - @course = Course.lock('FOR SHARE').find(@exercise.course_id) + @course = Course.lock('FOR SHARE').find(T.must(@exercise.course_id)) authorize! :read, @course authorize! :read, @exercise elsif params[:paste_key] @submission = Submission.find_by!(paste_key: params[:paste_key]) @exercise = @submission.exercise - @course = @exercise.course - @is_paste = true + @course = @submission.course + @is_paste = T.let(true, T.nilable(T::Boolean)) check_access! elsif params[:course_id] @course = Course.lock('FOR SHARE').find(params[:course_id]) @@ -268,14 +289,16 @@ def get_course_and_exercise end end + sig { params(submission: Submission, priority: Integer).void } def schedule_for_rerun(submission, priority) submission.set_to_be_reprocessed!(priority) end + sig { void } def index_json return respond_forbidden unless current_user.administrator? - submissions = @course.submissions + submissions = T.must(@course).submissions if params[:user_id] submissions = submissions.where(user_id: params[:user_id]) end @@ -288,17 +311,18 @@ def index_json } end + sig { void } def index_json_datatables - submissions = @course.submissions + submissions = T.must(@course).submissions unless current_user.administrator? || can?(:teach, @course) submissions = submissions.where(user_id: current_user.id) end if params[:max_id] - submissions = submissions.where('id <= ?', params[:max_id]) + submissions = submissions.where(id: ..params[:max_id]) end - submissions = submissions.includes(:user).order('id DESC') + submissions = submissions.includes(:user).order(id: :desc) remaining = submissions.count submissions_limited = submissions.limit(1000) Submission.eager_load_exercises(submissions_limited) @@ -306,48 +330,49 @@ def index_json_datatables render json: { remaining: remaining, max_id: params[:max_id].to_i, - last_id: submissions_limited.empty? ? nil : submissions_limited.last.id.to_i, + last_id: submissions_limited.empty? ? nil : T.must(submissions_limited.last).id.to_i, rows: view_context.submissions_for_datatables(submissions_limited) } end + sig { void } def check_access! if current_user.guest? raise CanCan::AccessDenied end - paste_visible = @submission.paste_visible_for?(current_user) + submission = T.must(@submission) + exercise = @exercise + course = T.must(@course) - paste_visibility = @exercise.paste_visibility - paste_visibility ||= @course.paste_visibility + paste_visible = submission.paste_visible_for?(current_user) + + paste_visibility = exercise&.paste_visibility + paste_visibility ||= course.paste_visibility paste_visibility ||= 'open' case paste_visibility when 'protected', 'secured' - respond_forbidden unless can?(:teach, @course) || @submission.user_id.to_s == current_user.id.to_s + respond_forbidden unless can?(:teach, course) || submission.user_id.to_s == current_user.id.to_s when 'no-tests-public' - respond_forbidden unless can?(:teach, @course) || @submission.created_at > 2.hours.ago || @submission.user_id.to_s == current_user.id.to_s + respond_forbidden unless can?(:teach, course) || T.must(submission.created_at) > 2.hours.ago || submission.user_id.to_s == current_user.id.to_s when 'completed-only' - respond_forbidden("You cannot see this paste because you haven't completed this exercise.") unless can?(:teach, @course) || @submission.user_id.to_s == current_user.id.to_s || @submission.exercise.completed_by?(current_user) || current_user.submissions.where(exercise_name: @exercise.name, pretest_error: nil, all_tests_passed: true).any? + respond_forbidden("You cannot see this paste because you haven't completed this exercise.") unless can?(:teach, course) || submission.user_id.to_s == current_user.id.to_s || exercise&.completed_by?(current_user) || current_user.submissions.where(exercise_name: submission.exercise_name, pretest_error: nil, all_tests_passed: true).any? when 'everyone' nil else - return if can?(:teach, @course) || @submission.user_id.to_s == current_user.id.to_s - if @submission.created_at > 2.hours.ago + return if can?(:teach, course) || submission.user_id.to_s == current_user.id.to_s + if T.must(submission.created_at) > 2.hours.ago respond_forbidden("You cannot see this paste because all tests passed and you haven't completed this exercise.") unless paste_visible - return else unless paste_visible - if @submission.exercise && !@submission.exercise.completed_by?(current_user) + submission_exercise = submission.exercise + if submission_exercise && !submission_exercise.completed_by?(current_user) respond_forbidden("You cannot see this paste because you haven't completed this exercise.") - return else respond_forbidden('You cannot see this paste because it was created over 2 hours ago.') end - return end end - - respond_forbidden('You cannot see this paste because all tests passed.') unless paste_visible end end end diff --git a/app/controllers/teachers_controller.rb b/app/controllers/teachers_controller.rb index 349fbb568..832445ed0 100644 --- a/app/controllers/teachers_controller.rb +++ b/app/controllers/teachers_controller.rb @@ -1,17 +1,21 @@ +# typed: strict # frozen_string_literal: true class TeachersController < ApplicationController + extend T::Sig before_action :set_organization + sig { void } def index authorize! :teach, @organization ordering = Arel.sql('LOWER(login)') - @teachers = @organization.teachers.order(ordering) - @teachership = Teachership.new + @teachers = T.let(T.must(@organization).teachers.order(ordering), T.nilable(ActiveRecord::Relation)) + @teachership = T.let(Teachership.new, T.nilable(Teachership)) add_organization_breadcrumb add_breadcrumb 'Manage teachers' end + sig { void } def create authorize! :teach, @organization @@ -19,26 +23,29 @@ def create @teachership = Teachership.new(user: user, organization: @organization) if @teachership.save - redirect_to organization_teachers_path, notice: "Teacher #{user.email} added to organization" + redirect_to organization_teachers_path, notice: "Teacher #{T.must(user).email} added to organization" else - @teachers = @organization.teachers + @teachers = T.must(@organization).teachers render :index end end + sig { void } def destroy authorize! :remove_teacher, @organization @teachership = Teachership.find(params[:id]) - destroyed_username = @teachership.user.login + destroyed_username = T.must(@teachership.user).login @teachership.destroy! redirect_to organization_teachers_path, notice: "Teacher #{destroyed_username} removed from organization" end private + sig { void } def set_organization - @organization = Organization.find_by(slug: params[:organization_id]) + @organization = Organization.find_by!(slug: params[:organization_id]) end + sig { returns(ActionController::Parameters) } def teacher_params params.permit(:email) end diff --git a/app/controllers/unlocks_controller.rb b/app/controllers/unlocks_controller.rb index 223a7bb82..e8450366d 100644 --- a/app/controllers/unlocks_controller.rb +++ b/app/controllers/unlocks_controller.rb @@ -1,12 +1,15 @@ +# typed: strict # frozen_string_literal: true # Receives explicit unlock requests and shows a web UI for making them. class UnlocksController < ApplicationController + extend T::Sig + sig { void } def show @course = Course.find(params[:course_id]) authorize! :read, @course - @organization = Organization.find_by(slug: params[:organization_id]) - @exercises = @course.unlockable_exercises_for(current_user) + @organization = Organization.find_by!(slug: params[:organization_id]) + @exercises = T.let(@course.unlockable_exercises_for(current_user), T.nilable(T::Array[Exercise])) respond_to do |format| format.html do @@ -16,10 +19,11 @@ def show end end + sig { void } def create @course = Course.find(params[:course_id]) authorize! :read, @course - @organization = Organization.find_by(slug: params[:organization_id]) + @organization = Organization.find_by!(slug: params[:organization_id]) @exercises = @course.unlockable_exercises_for(current_user) Unlock.unlock_exercises(@exercises, current_user) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 518a28c73..08717d482 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,17 +1,32 @@ +# typed: strict # frozen_string_literal: true # Presents the "register user" and "edit profile" views. class UsersController < ApplicationController + extend T::Sig skip_authorization_check after_action :remove_x_frame_options_header_when_bare_layout, only: %i[new create show] + sig { void } def index raise CanCan::AccessDenied if current_user.guest? respond_forbidden unless current_user.administrator? - @users = User.search(params[:search]) + @users = T.let(User.search(params[:search]), T.nilable(ActiveRecord::Relation)) end + sig { void } + def show + add_breadcrumb 'My account', user_path + + if current_user.guest? + raise CanCan::AccessDenied + else + @user = current_user + end + end + + sig { void } def new authorize! :create, User alternative_location = SiteSetting.all_settings['signup_location'] @@ -22,10 +37,11 @@ def new # Logged in from this page. No need to be here, so redirect away redirect_to root_path else - @user = User.new + @user = T.let(User.new, T.nilable(User)) end end + sig { void } def create authorize! :create, User @@ -62,20 +78,12 @@ def create end end - def show - add_breadcrumb 'My account', user_path - - if current_user.guest? - raise CanCan::AccessDenied - else - @user = current_user - end - end - + sig { void } def update User.transaction do @user = current_user - @email_before = @user.email + email_before = @user.email + @email_before = T.let(email_before, T.nilable(String)) set_email password_changed = maybe_update_password(@user, params[:user]) @@ -84,7 +92,7 @@ def update if @user.errors.empty? && @user.save # Password changed locally: migrate the user to courses.mooc.fi @user.post_new_user_to_courses_mooc_fi(params[:user][:password]) if password_changed && !@user.managed_externally? - RecentlyChangedUserDetail.email_changed.create!(old_value: @email_before, new_value: @user.email, username: @user.login, user_id: @user.id) unless @email_before.casecmp(@user.email).zero? + RecentlyChangedUserDetail.email_changed.create!(old_value: email_before, new_value: @user.email, username: @user.login, user_id: @user.id) unless T.must(email_before.casecmp(@user.email)).zero? flash[:notice] = if password_changed 'Changes saved and password changed' else @@ -98,6 +106,7 @@ def update end end + sig { void } def confirm_email language = params[:language] VerificationToken.unscoped.email.find_by!(user_id: params[:user_id], token: params[:id]) @@ -109,6 +118,7 @@ def confirm_email redirect_to redirect_path, notice: 'Your email address has been verified!', allow_other_host: true end + sig { void } def send_verification_email user = User.find(params[:user_id]) raise 'Access denied' if user != current_user && !current_user.administrator? @@ -117,11 +127,13 @@ def send_verification_email redirect_to root_path, notice: "Verification email sent to #{user.email}." end + sig { void } def verify_destroying_user @user = authenticate_current_user_destroy VerificationToken.delete_user.find_by!(user: @user, token: params[:id]) end + sig { void } def destroy_user im_sure = params[:im_sure] if im_sure != '1' @@ -146,6 +158,7 @@ def destroy_user redirect_to root_url, notice: 'Your account has been permanently destroyed.' end + sig { void } def send_destroy_email user = authenticate_current_user_destroy UserMailer.destroy_confirmation(user).deliver_now @@ -153,12 +166,14 @@ def send_destroy_email end private + sig { returns(User) } def authenticate_current_user_destroy user = User.find(params[:user_id]) authorize! :destroy, user user end + sig { params(status: T.anything).returns(String) } def failed_authentication_alert(status) case status when :unavailable @@ -170,33 +185,38 @@ def failed_authentication_alert(status) end end + sig { void } def set_email + user = T.must(@user) user_params = params[:user] - return if !@user.new_record? && user_params[:email_repeat].blank? + return if !user.new_record? && user_params[:email_repeat].blank? if user_params[:email].blank? - @user.errors.add(:email, 'needed') + user.errors.add(:email, 'needed') elsif user_params[:email] != user_params[:email_repeat] - @user.errors.add(:email_repeat, 'did not match') + user.errors.add(:email_repeat, 'did not match') else - @user.email = user_params[:email].strip + user.email = user_params[:email].strip end end + sig { void } def set_password + user = T.must(@user) user_params = params[:user] if user_params[:password].blank? - @user.errors.add(:password, 'needed') + user.errors.add(:password, 'needed') elsif user_params[:password].length > 1000 - @user.errors.add(:password, 'cannot be over 1000 characters') + user.errors.add(:password, 'cannot be over 1000 characters') elsif user_params[:password] != user_params[:password_repeat] - @user.errors.add(:password_repeat, 'did not match') + user.errors.add(:password_repeat, 'did not match') else - @user.password = user_params[:password] + user.password = user_params[:password] end end + sig { params(user: User, user_params: T.untyped).returns(T::Boolean) } def maybe_update_password(user, user_params) if user_params[:old_password].present? || user_params[:password].present? if user.managed_externally? @@ -226,11 +246,12 @@ def maybe_update_password(user, user_params) end end + sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) } def set_user_fields return if params[:user_field].nil? changes = {} UserField.all.select { |f| f.visible_to?(current_user) }.each do |field| - value_record = @user.field_value_record(field) + value_record = T.must(@user).field_value_record(field) old_value = value_record.ruby_value value_record.set_from_form(params[:user_field][field.name]) new_value = value_record.ruby_value diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index acdc9ccef..b991b6102 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,12 +1,16 @@ +# typed: strict # frozen_string_literal: true require 'tailoring' module ApplicationHelper + extend T::Sig + sig { returns(Tailoring) } def tailoring Tailoring.get end + sig { params(name: String, path: String, options: T::Hash[Symbol, T.untyped]).returns(ActiveSupport::SafeBuffer) } def navigation_link(name, path, options = {}) class_name = options[:class] || '' class_addition = request.path.start_with?(path) ? 'nav-link active' : 'nav-link' @@ -14,6 +18,7 @@ def navigation_link(name, path, options = {}) link_to name, path, options end + sig { params(name: T.nilable(String), path: String, options: T::Hash[Symbol, T.untyped]).returns(ActiveSupport::SafeBuffer) } def active_on_current_path_link_to(name, path, options = {}) if request.path == path classes = options[:class] || '' @@ -23,6 +28,15 @@ def active_on_current_path_link_to(name, path, options = {}) link_to(name, path, options) end + # `tags` may be omitted and the options hash passed in its place. + sig do + params( + label: String, + tags: T.nilable(T.any(String, T::Hash[Symbol, T.untyped])), + options: T::Hash[Symbol, T.untyped], + block: T.nilable(T.proc.returns(T.untyped)) + ).returns(ActiveSupport::SafeBuffer) + end def labeled(label, tags = nil, options = {}, &block) if tags.is_a?(Hash) && options.empty? options = tags @@ -38,7 +52,7 @@ def labeled(label, tags = nil, options = {}, &block) tags = tags.html_safe if tags =~ /id\s*=\s*"([^"]+)"/ - target = ' for="' + Regexp.last_match(1) + '"' + target = " for=\"#{Regexp.last_match(1)}\"" else raise 'Cannot label a tag without an id' end @@ -62,6 +76,14 @@ def labeled(label, tags = nil, options = {}, &block) end end + sig do + params( + label: String, + tags: T.nilable(T.any(String, T::Hash[Symbol, T.untyped])), + options: T::Hash[Symbol, T.untyped], + block: T.nilable(T.proc.returns(T.untyped)) + ).returns(ActiveSupport::SafeBuffer) + end def labeled_field(label, tags = nil, options = {}, &block) cls = ['field'] cls << options[:super_class].split(' ') if options[:super_class] @@ -69,6 +91,7 @@ def labeled_field(label, tags = nil, options = {}, &block) raw("
" + labeled(label, tags, options, &block) + '
') end + sig { params(label: String, field: String, options: T::Hash[Symbol, T.untyped]).returns(ActiveSupport::SafeBuffer) } def bs_labeled_field(label, field, options = {}) type = options[:type] || :text @@ -87,6 +110,7 @@ def bs_labeled_field(label, field, options = {}) raw(str) end + sig { params(table_selector: String, options: T::Hash[Symbol, T.untyped]).returns(ActiveSupport::SafeBuffer) } def use_datatables(table_selector, options = {}) options = { bJQueryUI: true, @@ -104,10 +128,12 @@ def use_datatables(table_selector, options = {}) raw(script) end + sig { returns(ActiveSupport::SafeBuffer) } def link_back raw('') end + sig { returns(T.nilable(String)) } def return_to_link return nil if request.path == '/' request.path diff --git a/app/helpers/authorize_collection_helper.rb b/app/helpers/authorize_collection_helper.rb index e70b6f09a..bc283a789 100644 --- a/app/helpers/authorize_collection_helper.rb +++ b/app/helpers/authorize_collection_helper.rb @@ -1,10 +1,14 @@ +# typed: strict # frozen_string_literal: true module AuthorizeCollectionHelper + extend T::Sig + # This method allows to authorize collections of items # TODO: Has to be tested with empty collections and other edge cases + sig { params(action: Symbol, collection: T::Enumerable[T.untyped]).void } def authorize_collection(action, collection) - @_authorized = true + @_authorized = T.let(true, T.nilable(T::Boolean)) collection.each { |col| authorize! action, col } end end diff --git a/app/helpers/bad_utf8_helper.rb b/app/helpers/bad_utf8_helper.rb index 823d87a10..d7601fb3c 100644 --- a/app/helpers/bad_utf8_helper.rb +++ b/app/helpers/bad_utf8_helper.rb @@ -1,18 +1,19 @@ +# typed: strict # frozen_string_literal: true module BadUtf8Helper + extend T::Sig + + # Returns `str` as valid UTF-8: as is if its bytes are UTF-8, otherwise decoded as Latin-1. + sig { params(str: String).returns(String) } def force_utf8_violently(str) - if str.encoding == Encoding.find('UTF-8') && str.valid_encoding? - str - else - str.dup.force_encoding('ISO-8859-1') - if str.valid_encoding? - str.dup.encode('UTF-8') - else - str.dup.force_encoding('UTF-8') - str.dup.encode('UTF-8', 'ASCII-8BIT', invalid: :replace, undef: :replace) - end - end + return str if str.encoding == Encoding::UTF_8 && str.valid_encoding? + + as_utf8 = str.dup.force_encoding(Encoding::UTF_8) + return as_utf8 if as_utf8.valid_encoding? + + # Latin-1 maps every byte to a character, so this cannot fail. + str.dup.force_encoding(Encoding::ISO_8859_1).encode(Encoding::UTF_8) end end diff --git a/app/helpers/bootstrap_flash_helper.rb b/app/helpers/bootstrap_flash_helper.rb index 97030de85..a732f5f0e 100644 --- a/app/helpers/bootstrap_flash_helper.rb +++ b/app/helpers/bootstrap_flash_helper.rb @@ -1,8 +1,11 @@ +# typed: strict # frozen_string_literal: true module BootstrapFlashHelper + extend T::Sig ALERT_TYPES = %i[error info success danger].freeze + sig { returns(ActiveSupport::SafeBuffer) } def bootstrap_flash flash_messages = [] flash.each do |type, message| diff --git a/app/helpers/course_timings_helper.rb b/app/helpers/course_timings_helper.rb index 24e28a08c..d623e1cce 100644 --- a/app/helpers/course_timings_helper.rb +++ b/app/helpers/course_timings_helper.rb @@ -1,6 +1,9 @@ +# typed: strict # frozen_string_literal: true module CourseTimingsHelper + extend T::Sig + sig { params(condition: String).returns(T.nilable(Integer)) } def parse_percentage_from_unlock_condition(condition) if condition =~ /^(\d+)[%]\s+(?:in|of|from)\s+(\S+)$/ percentage = Integer(Regexp.last_match(1)) @@ -8,15 +11,19 @@ def parse_percentage_from_unlock_condition(condition) percentage end + sig { params(condition: String).returns(T.nilable(String)) } def parse_group_from_unlock_condition(condition) - condition.split.last if condition =~ /^(\d+)[%]\s+(?:in|of|from)\s+(\S+)$/ + condition.split.last if /^(\d+)[%]\s+(?:in|of|from)\s+(\S+)$/.match?(condition) end + sig { params(group: ExerciseGroup).returns(T::Boolean) } def complex_unlock_conditions?(group) - return false if group.group_unlock_conditions.empty? - return true if group.group_unlock_conditions.length > 1 - return false if group.group_unlock_conditions.first.empty? - return true unless group.group_unlock_conditions.first =~ /^(\d+)[%]\s+(?:in|of|from)\s+(\S+)$/ + # Nil for a parent group without exercises of its own. + conditions = group.group_unlock_conditions + return false if conditions.blank? + return true if conditions.length > 1 + return false if conditions.first.empty? + return true unless /^(\d+)[%]\s+(?:in|of|from)\s+(\S+)$/.match?(conditions.first) false end end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index bc1291559..8b795f413 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true module CoursesHelper + extend T::Sig + sig { params(body: T.untyped).returns(String) } def response_body_for(body) - return "You wrote:\n\n#{body}\n\n---\n\n" - body.to_s + "You wrote:\n\n#{body}\n\n---\n\n" end end diff --git a/app/helpers/embeddable_helper.rb b/app/helpers/embeddable_helper.rb deleted file mode 100644 index b305f997b..000000000 --- a/app/helpers/embeddable_helper.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -module EmbeddableHelper - def remove_x_frame_options_header_when_bare_layout - response.headers.except! 'X-Frame-Options' if @bare_layout - end -end diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 8184000bf..5a1f7255b 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -1,18 +1,24 @@ +# typed: strict # frozen_string_literal: true module ExercisesHelper + extend T::Sig + sig { params(e: Exercise).returns(String) } def exercise_zip_url(e) exercise_url(e, format: 'zip').to_s end + sig { params(e: Exercise).returns(String) } def exercise_solution_zip_url(e) exercise_solution_url(e, format: 'zip').to_s end + sig { params(percentage: T.nilable(Integer)).returns(Integer) } def green(percentage) percentage || 0 end + sig { params(percentage_of_green: T.nilable(Integer)).returns(Integer) } def red(percentage_of_green) 100 - (percentage_of_green || 100) end diff --git a/app/helpers/extra_field_helper.rb b/app/helpers/extra_field_helper.rb index 3a1d6c401..4c9290388 100644 --- a/app/helpers/extra_field_helper.rb +++ b/app/helpers/extra_field_helper.rb @@ -1,8 +1,13 @@ +# typed: strict # frozen_string_literal: true module ExtraFieldHelper + extend T::Sig + + sig { params(field_value: UserFieldValue, method_options: T::Hash[Symbol, T.untyped]).returns(String) } def extra_field(field_value, method_options) - field = field_value.field + # The value record is looked up by a configured field, so its field exists. + field = T.must(field_value.field) return '' if field.options[:hidden] return raw(field.label) if field.field_type == :html @@ -14,7 +19,6 @@ def extra_field(field_value, method_options) common_attrs[:disabled] = 'disabled' if field.options[:disabled] existing_value = field_value.value - existing_value = field.default if existing_value.nil? field_tag = case field.field_type @@ -37,6 +41,8 @@ def extra_field(field_value, method_options) bs_labeled_field(raw(field.label), field_tag, order: label_order, type: field.field_type) end + # `value` is the raw filter param. + sig { params(prefix: String, field: UserField, value: T.untyped).returns(String) } def extra_field_filter(prefix, field, value) return '' if field.field_type == :html @@ -63,6 +69,7 @@ def extra_field_filter(prefix, field, value) bs_labeled_field(raw(field.name.humanize), field_tag, order: label_order) end + sig { params(prefix: String, field: UserField, value: T::Boolean).returns(String) } def extra_field_checkbox(prefix, field, value) return '' if field.field_type == :html field_name = prefix + field.name @@ -70,8 +77,9 @@ def extra_field_checkbox(prefix, field, value) labeled_field(raw(field.name.humanize), field_tag, order: :label_last, super_class: 'checkbox') end + sig { params(value_record: UserFieldValue).returns(String) } def extra_field_value(value_record) - field = value_record.field + field = T.must(value_record.field) case field.field_type when :boolean value_record.value.blank? ? 'No' : 'Yes' diff --git a/app/helpers/feedback_answers_helper.rb b/app/helpers/feedback_answers_helper.rb index 89bd91254..d81249586 100644 --- a/app/helpers/feedback_answers_helper.rb +++ b/app/helpers/feedback_answers_helper.rb @@ -1,24 +1,19 @@ +# typed: strict # frozen_string_literal: true module FeedbackAnswersHelper + extend T::Sig + sig { params(answer: FeedbackAnswer).returns(String) } def render_feedback_answer(answer) - if answer.feedback_question.intrange? - answer.answer + '/' + answer.feedback_question.intrange.max.to_s + question = T.must(answer.feedback_question) + if question.intrange? + answer.answer + '/' + question.intrange.max.to_s else simple_format(answer.answer) end end - def feedback_statistics_for_question(question) - stats = {} - stats[:count] = question.feedback_answers.count - - if question.intrange? - end - - # TODO - end - + sig { params(action: String, answer: FeedbackAnswer).returns(String) } def name_for(action, answer) "#{action} #{pluralize(answer.reply_to_feedback_answers.count, 'reply').sub(/\d+\s/, '')}" end diff --git a/app/helpers/flash_block_helper.rb b/app/helpers/flash_block_helper.rb index cc23aaed4..08f00170a 100644 --- a/app/helpers/flash_block_helper.rb +++ b/app/helpers/flash_block_helper.rb @@ -1,6 +1,10 @@ +# typed: strict # frozen_string_literal: true module FlashBlockHelper + extend T::Sig + + sig { returns(ActiveSupport::SafeBuffer) } def flash_block output = '' flash.each do |type, message| @@ -10,6 +14,8 @@ def flash_block raw(output) end + # Flash values come back from the session as whatever a controller stored. + sig { params(type: String, message: T.untyped).returns(ActiveSupport::SafeBuffer) } def flash_container(type, message) raw(content_tag(:div, class: "alert alert-#{type}") do content_tag(:a, raw('×'), class: 'close', data: { dismiss: 'alert' }) + diff --git a/app/helpers/paste_helper.rb b/app/helpers/paste_helper.rb index 7fb296fcb..523a514cd 100644 --- a/app/helpers/paste_helper.rb +++ b/app/helpers/paste_helper.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module PasteHelper diff --git a/app/helpers/points_helper.rb b/app/helpers/points_helper.rb index 91348bbee..880625b67 100644 --- a/app/helpers/points_helper.rb +++ b/app/helpers/points_helper.rb @@ -1,14 +1,18 @@ +# typed: strict # frozen_string_literal: true require 'natsort' module PointsHelper + extend T::Sig + sig { params(url: T.nilable(String)).returns(T.nilable(String)) } def github_repo_url_to_project_page_url(url) if url =~ /github.com[:\/]([^\/]*)\/([^\/]*)\.git/ "https://github.com/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}" end end + sig { params(points: T::Enumerable[String]).returns(ActiveSupport::SafeBuffer) } def points_list(points) points.to_a.natsort.map { |pt| h(pt) }.join('  ').html_safe end diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index 5fe3b2f08..5ee221505 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -1,15 +1,21 @@ +# typed: strict # frozen_string_literal: true module SessionsHelper + extend T::Sig + sig { params(user: User).returns(User) } def sign_in(user) session[:user_id] = user.id - @current_user = user + @current_user = T.let(user, T.nilable(User)) + user end + sig { returns(User) } def current_user - @current_user ||= user_from_basic_auth || user_from_session || Guest.new + @current_user ||= T.let(user_from_basic_auth || user_from_session || Guest.new, T.nilable(User)) end + sig { params(user: User).void } def current_user=(user) if user.guest? sign_out @@ -18,10 +24,12 @@ def current_user=(user) end end + sig { returns(T::Boolean) } def signed_in? !current_user.guest? end + sig { void } def sign_out session[:user_id] = nil @current_user = Guest.new @@ -29,10 +37,12 @@ def sign_out end private + sig { returns(T.nilable(User)) } def user_from_session User.find_by(id: session[:user_id]) end + sig { returns(T.nilable(User)) } def user_from_basic_auth if request&.authorization username, password = ActionController::HttpAuthentication::Basic.user_name_and_password(request) diff --git a/app/helpers/submissions_helper.rb b/app/helpers/submissions_helper.rb index d1c90de64..73ebbee6b 100644 --- a/app/helpers/submissions_helper.rb +++ b/app/helpers/submissions_helper.rb @@ -1,6 +1,9 @@ +# typed: strict # frozen_string_literal: true module SubmissionsHelper + extend T::Sig + sig { params(submissions: T::Enumerable[Submission], options: T::Hash[Symbol, T.untyped]).returns(ActiveSupport::SafeBuffer) } def show_submission_list(submissions, options = {}) locals = { submissions: submissions, @@ -17,11 +20,13 @@ def show_submission_list(submissions, options = {}) render partial: 'submissions/list', locals: locals end + sig { params(submission: Submission).returns(ActiveSupport::SafeBuffer) } def submission_status(submission) status = submission.status(current_user) raw("#{status.to_s.capitalize}") end + sig { params(submission: Submission).returns(T.nilable(String)) } def submission_review_column(submission) if submission.reviewed? if can? :create_review, submission.course @@ -58,37 +63,42 @@ def submission_review_column(submission) end end + # `exception` is the decoded exception JSON of a test case run. + sig { params(exception: T.untyped).returns(String) } def format_exception_chain(exception) return '' if exception.nil? return handle_langs_chain(exception) if exception.is_a?(Array) result = ActiveSupport::SafeBuffer.new('') - result << exception['className'] << ': ' << exception['message'] << tag(:br) + result << exception['className'] << ': ' << exception['message'] << tag.br exception['stackTrace'].each do |line| result << "#{line['fileName']}:#{line['lineNumber']}: #{line['declaringClass']}.#{line['methodName']}" - result << tag(:br) + result << tag.br end result << 'Caused by: ' << format_exception_chain(exception['cause']) if exception['cause'] result end + sig { params(exception: T::Array[T.untyped]).returns(ActiveSupport::SafeBuffer) } def handle_langs_chain(exception) result = ActiveSupport::SafeBuffer.new('') exception.each do |line| result << line - result << tag(:br) + result << tag.br end result end + sig { params(submissions: T::Enumerable[Submission]).returns(T::Array[T::Array[T.untyped]]) } def submissions_for_datatables(submissions) submissions.map do |sub| - user_col = if can? :read, sub.user - link_to sub.user.email, participant_path(sub.user) + user = T.must(sub.user) + user_col = if can? :read, user + link_to user.email, participant_path(user) else 'user' end [ - sub.created_at.strftime('%Y-%m-%d %H:%M'), + T.must(sub.created_at).strftime('%Y-%m-%d %H:%M'), user_col, link_to_submission_exericse(sub), submission_status(sub), @@ -99,10 +109,12 @@ def submissions_for_datatables(submissions) end end + sig { params(submission: Submission, text: T.nilable(String), missing_text: String).returns(String) } def link_to_submission_exericse(submission, text = nil, missing_text = '') - if submission.exercise - text = submission.exercise.name if text.nil? - link_to text, exercise_path(submission.exercise) + exercise = submission.exercise + if exercise + text = exercise.name if text.nil? + link_to text, exercise_path(exercise) else missing_text end diff --git a/app/helpers/twitter_breadcrumbs_helper.rb b/app/helpers/twitter_breadcrumbs_helper.rb index b212f6309..b254a3a1b 100644 --- a/app/helpers/twitter_breadcrumbs_helper.rb +++ b/app/helpers/twitter_breadcrumbs_helper.rb @@ -1,6 +1,10 @@ +# typed: strict # frozen_string_literal: true module TwitterBreadcrumbsHelper + extend T::Sig + + sig { params(divider: String).returns(ActiveSupport::SafeBuffer) } def render_breadcrumbs(divider = '/') render partial: 'twitter-bootstrap/breadcrumbs', locals: { divider: divider } end diff --git a/app/mailers/course_notification_mailer.rb b/app/mailers/course_notification_mailer.rb index 643dbd4be..e724bc55b 100644 --- a/app/mailers/course_notification_mailer.rb +++ b/app/mailers/course_notification_mailer.rb @@ -1,14 +1,20 @@ +# typed: strict # frozen_string_literal: true class CourseNotificationMailer < ActionMailer::Base + extend T::Sig include ActionView::Helpers::SanitizeHelper + + # `params` keys: :reply_to, :to, :topic, :message. + sig { params(params: T::Hash[Symbol, T.nilable(String)]).void } def notification_email(params = {}) from = SiteSetting.value('emails')['from'] reply_to = params[:reply_to] subject = params[:topic] - @html_mailbody = params[:message].gsub("\n", '
') - @text_mailbody = strip_tags(params[:message]) + message = T.must(params[:message]) + @html_mailbody = T.let(message.gsub("\n", '
'), T.nilable(String)) + @text_mailbody = T.let(strip_tags(message), T.nilable(String)) to = params[:to] mail(from: from, reply_to: reply_to, to: to, subject: subject) diff --git a/app/mailers/feedback_reply_mailer.rb b/app/mailers/feedback_reply_mailer.rb index 2743a2212..a635edd58 100644 --- a/app/mailers/feedback_reply_mailer.rb +++ b/app/mailers/feedback_reply_mailer.rb @@ -1,10 +1,13 @@ +# typed: strict # frozen_string_literal: true class FeedbackReplyMailer < ActionMailer::Base + extend T::Sig + sig { params(reply_to: String, to: T.nilable(String), body: T.nilable(String), exercise_name: String).void } def feedback_email(reply_to, to, body, exercise_name) from = SiteSetting.value('emails')['from'] subject = "[TMC] Reply to your feedback for exercise #{exercise_name}" - @mailbody = body + @mailbody = T.let(body, T.nilable(String)) mail(from: from, reply_to: reply_to, to: to, subject: subject) end end diff --git a/app/mailers/new_organization_request_mailer.rb b/app/mailers/new_organization_request_mailer.rb index 3356765a6..f8f14fd0b 100644 --- a/app/mailers/new_organization_request_mailer.rb +++ b/app/mailers/new_organization_request_mailer.rb @@ -1,13 +1,16 @@ +# typed: strict # frozen_string_literal: true class NewOrganizationRequestMailer < ActionMailer::Base + extend T::Sig + sig { params(organization: Organization).void } def request_email(organization) email = SiteSetting.value('administrative_email') if email.empty? Rails.logger.warn 'Not sending a notification on a new organization because administrative_email is not defined. ' end - @organization = organization - @creator = organization.creator + @organization = T.let(organization, T.nilable(Organization)) + @creator = T.let(organization.creator, T.nilable(User)) mail(from: SiteSetting.value('emails')['from'], to: email, subject: "New TestMyCode Organization Request: #{organization.name}") end end diff --git a/app/mailers/password_reset_key_mailer.rb b/app/mailers/password_reset_key_mailer.rb index 06dde6819..17f780116 100644 --- a/app/mailers/password_reset_key_mailer.rb +++ b/app/mailers/password_reset_key_mailer.rb @@ -1,13 +1,16 @@ +# typed: strict # frozen_string_literal: true class PasswordResetKeyMailer < ActionMailer::Base + extend T::Sig + sig { params(user: User, key: ActionToken, origin: T.nilable(String)).void } def reset_link_email(user, key, origin = nil) - @user = user - @origin = origin + @user = T.let(user, T.nilable(User)) + @origin = T.let(origin, T.nilable(String)) settings = SiteSetting.value('emails') subject = 'Reset your mooc.fi account password' - @url = settings['baseurl'].sub(/\/+$/, '') + '/reset_password/' + key.token + @url = T.let(settings['baseurl'].sub(/\/+$/, '') + '/reset_password/' + key.token, T.nilable(String)) mail(from: settings['from'], to: user.email, subject: subject) end end diff --git a/app/mailers/review_mailer.rb b/app/mailers/review_mailer.rb index 1357a7b7c..cf42e855b 100644 --- a/app/mailers/review_mailer.rb +++ b/app/mailers/review_mailer.rb @@ -1,14 +1,19 @@ +# typed: strict # frozen_string_literal: true class ReviewMailer < ActionMailer::Base + extend T::Sig + sig { params(review: Review).void } def review_email(review) settings = SiteSetting.value('emails') + # belongs_to associations are required, so a saved review has both. + submission = T.must(review.submission) subject = '[TMC] Code Review' - @review = review - @url = settings['baseurl'].sub(/\/+$/, '') + "/submissions/#{review.submission.id}/reviews" + @review = T.let(review, T.nilable(Review)) + @url = T.let(settings['baseurl'].sub(/\/+$/, '') + "/submissions/#{submission.id}/reviews", T.nilable(String)) from = settings['from'] - reply_to = review.reviewer.email - mail(from: from, reply_to: reply_to, to: review.submission.user.email, subject: subject) + reply_to = review.reviewer&.email + mail(from: from, reply_to: reply_to, to: T.must(submission.user).email, subject: subject) end end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index f75cccd13..9e282b9ff 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,17 +1,20 @@ +# typed: strict # frozen_string_literal: true require 'cgi' class UserMailer < ActionMailer::Base + extend T::Sig + sig { params(user: User, origin: T.nilable(String), language: T.nilable(String)).void } def email_confirmation(user, origin = nil, language = nil) # For the Elements course, emails often bounce because the course does not mention mooc.fi handles the technical implementation of the course. # To protect our delivery rates we temporaily disable sending this email. return if origin && origin.downcase.include?('elements') - @origin = origin - @user = user + @origin = T.let(origin, T.nilable(String)) + @user = T.let(user, T.nilable(User)) token = user.verification_tokens.email.create! - @url = confirm_email_url(@user.id, token.token, language: language) + @url = T.let(confirm_email_url(user.id, token.token, language: language), T.nilable(String)) subject = 'Confirm your mooc.fi account email address' if language == 'en' || language == 'en-lu' || language == 'en-ie' subject = 'Vahvista mooc.fi-tilisi sähköpostiosoite' if language == 'fi' subject = 'Bekräfta e-postadressen för ditt mooc.fi-konto' if language == 'se' @@ -40,8 +43,8 @@ def email_confirmation(user, origin = nil, language = nil) if origin origin_name = origin.downcase.tr(' ', '_').gsub(/[.\/]/, '') origin_name += "_#{language}" if language - @url = confirm_email_url(@user.id, token.token, language: language, origin: CGI.escape(origin_name)) - template_path = Rails.root.join('config', 'email_templates', 'user_mailer', 'email_confirmation') + @url = confirm_email_url(user.id, token.token, language: language, origin: CGI.escape(origin_name)) + template_path = Rails.root.join('config/email_templates/user_mailer/email_confirmation') html_template_path = template_path.join("#{origin_name}.html.erb") text_template_path = template_path.join("#{origin_name}.text.erb") @@ -57,18 +60,20 @@ def email_confirmation(user, origin = nil, language = nil) mail(from: SiteSetting.value('emails')['from'], to: user.email, subject: subject) end + sig { params(user: User).void } def destroy_confirmation(user) - @user = user + @user = T.let(user, T.nilable(User)) token = user.verification_tokens.delete_user.create! - @url = verify_destroying_user_url(@user.id, token.token) + @url = T.let(verify_destroying_user_url(user.id, token.token), T.nilable(String)) mail(from: SiteSetting.value('emails')['from'], to: user.email, subject: 'Confirm deleting your mooc.fi account') end private + sig { returns(String) } def base_url - @base_url ||= begin + @base_url ||= T.let(begin settings = SiteSetting.value('emails') settings['baseurl'].sub(/\/+$/, '') - end + end, T.nilable(String)) end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 812fc015b..5eaa208c9 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -1,13 +1,16 @@ +# typed: strict # frozen_string_literal: true # CanCan ability definitions. # # See: https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities class Ability + extend T::Sig include CanCan::Ability # +auth_source+ is :courses_mooc_fi_token when the user authenticated with a courses.mooc.fi # access token; account changes are then denied to everyone, administrators included. + sig { params(user: User, auth_source: T.nilable(Symbol)).void } def initialize(user, auth_source: nil) if user.administrator? can :manage, :all @@ -55,12 +58,12 @@ def initialize(user, auth_source: nil) user.assistant?(c) || ( c.initial_refresh_ready? && - (!c.disabled? && !c.hidden? && + ((!c.disabled? && !c.hidden? && ( c.hidden_if_registered_after.nil? || c.hidden_if_registered_after > Time.now || (!user.guest? && c.hidden_if_registered_after > user.created_at) - ) || user.student_in_course?(c)) + )) || user.student_in_course?(c)) ) end @@ -111,11 +114,11 @@ def initialize(user, auth_source: nil) end can :download, Submission do |sub| - !sub.course.hide_submission_results? && !sub.exercise.hide_submission_results? && (can?(:read, sub) || sub.paste_visible_for?(user)) + !sub.course.hide_submission_results? && !sub.exercise&.hide_submission_results? && (can?(:read, sub) || sub.paste_visible_for?(user)) end can :read_results, Submission do |sub| - (!sub.course.hide_submission_results? && !sub.exercise.hide_submission_results?) || (can? :teach, sub.course) + (!sub.course.hide_submission_results? && !sub.exercise&.hide_submission_results?) || (can? :teach, sub.course) end cannot :manage_feedback_questions, Course diff --git a/app/models/action_token.rb b/app/models/action_token.rb index f75db4e9e..99814e760 100644 --- a/app/models/action_token.rb +++ b/app/models/action_token.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'securerandom' @@ -8,14 +9,16 @@ # may be used once to set a new password. # A password reset key is valid for a limited time and may safely be left unused. class ActionToken < ApplicationRecord + extend T::Sig belongs_to :user validates :user_id, presence: true, uniqueness: true validates :token, uniqueness: true # this going wrong should be extremely unlikely before_create :randomize_token - enum action: %i[confirm_email reset_password enroll_course] + enum :action, { confirm_email: 0, reset_password: 1, enroll_course: 2 } + sig { params(user: User).returns(ActionToken) } def self.generate_password_reset_key_for(user) old_key = user.password_reset_key old_key&.destroy @@ -25,11 +28,14 @@ def self.generate_password_reset_key_for(user) key end + sig { returns(T::Boolean) } def expired? - expires_at < Time.now + expires_at = self.expires_at + !expires_at.nil? && expires_at < Time.now end private + sig { void } def randomize_token self.token = SecureRandom.urlsafe_base64 end diff --git a/app/models/api_version.rb b/app/models/api_version.rb index 80a8ae34a..f0d5dbf84 100644 --- a/app/models/api_version.rb +++ b/app/models/api_version.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true module ApiVersion diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 71fbba5b3..f758b63e7 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base diff --git a/app/models/assistantship.rb b/app/models/assistantship.rb index 109a56acc..5f49e2e45 100644 --- a/app/models/assistantship.rb +++ b/app/models/assistantship.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class Assistantship < ApplicationRecord diff --git a/app/models/available_point.rb b/app/models/available_point.rb index 9a17b6636..5fcbc5e6d 100644 --- a/app/models/available_point.rb +++ b/app/models/available_point.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'point_comparison' @@ -7,6 +8,7 @@ # these are recreated every time a course is refreshed. # Instead they are always searched for (course_id, name). class AvailablePoint < ApplicationRecord + extend T::Sig include PointComparison include Swagger::Blocks @@ -26,6 +28,7 @@ class AvailablePoint < ApplicationRecord validates :name, presence: true validate :name_must_not_contain_whitespace + sig { params(course: Course, included_exercises: T::Enumerable[Exercise], hidden: T::Boolean).returns(Integer) } def self.course_points_of_exercises(course, included_exercises, hidden = false) available_points = AvailablePoint.arel_table exercises = Exercise.arel_table @@ -46,22 +49,26 @@ def self.course_points_of_exercises(course, included_exercises, hidden = false) end end + sig { params(course: Course, exercises: T::Enumerable[Exercise]).returns(ActiveRecord::Relation) } def self.course_points_of_exercises_list(course, exercises) course_points(course).where(exercise_id: exercises.map(&:id)) end + sig { params(course: Course).returns(ActiveRecord::Relation) } def self.course_points(course) joins(:exercise) .where(exercises: { course_id: course.id, hidden: false, hide_submission_results: false, disabled_status: 0 }) end # Selects all points for list of courses (with course_id for convenience) + sig { params(courses: T::Enumerable[Course]).returns(ActiveRecord::Relation) } def self.courses_points(courses) select('available_points.*, exercises.course_id') .joins(:exercise) .where(exercises: { course_id: courses.map(&:id), hide_submission_results: false }) end + sig { params(course: Course, sheetnames: T.any(String, T::Array[String])).returns(T::Hash[String, Integer]) } def self.course_sheet_points(course, sheetnames) available_points = AvailablePoint.arel_table exercises = Exercise.arel_table @@ -72,32 +79,36 @@ def self.course_sheet_points(course, sheetnames) .where(exercises[:hide_submission_results].eq(false)) .group(exercises[:gdocs_sheet]) - res = {} + res = T.let({}, T::Hash[String, Integer]) ActiveRecord::Base.connection.execute(query.to_sql).each do |record| res[record['gdocs_sheet']] = record['count'].to_i end res end + sig { params(course: Course, sheet: T.nilable(String)).returns(ActiveRecord::Relation) } def self.course_sheet_points_list(course, sheet) joins(:exercise) .where(exercises: { course_id: course.id, gdocs_sheet: sheet }) end + sig { params(user: User, submission: T.nilable(Submission)).returns(T.nilable(AwardedPoint)) } def award_to(user, submission = nil) point_awarded_at = submission ? submission.created_at : Time.zone.now AwardedPoint.create!( - course_id: exercise.course_id, + course_id: T.must(exercise).course_id, name: name, user_id: user.id, submission: submission, created_at: point_awarded_at ) rescue ActiveRecord::RecordNotUnique + # Already awarded. end private + sig { void } def name_must_not_contain_whitespace - errors.add(:name, "can't contain whitespace") if /\s+/ =~ name + errors.add(:name, "can't contain whitespace") if /\s+/.match?(name) end end diff --git a/app/models/awarded_point.rb b/app/models/awarded_point.rb index c4873d112..d7299a803 100644 --- a/app/models/awarded_point.rb +++ b/app/models/awarded_point.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'point_comparison' @@ -8,6 +9,7 @@ # reference can be nil if the submission has been deleted. class AwardedPoint < ApplicationRecord + extend T::Sig include PointComparison include Swagger::Blocks @@ -22,6 +24,7 @@ class AwardedPoint < ApplicationRecord property :created_at, type: :string, example: '2016-10-17T11:10:17.295+03:00' end + sig { returns(T::Hash[String, T.untyped]) } def point_as_json as_json only: %i[ id @@ -42,10 +45,13 @@ def point_as_json property :exercise_id, type: :integer, example: 1 end - def self.as_json_with_exercise_ids(related_exercises) - related_exercises = related_exercises.map { |e| ["#{e.course_id}-#{e.name}", e.id] }.to_h - all.map do |p| - { awarded_point: p.point_as_json, exercise_id: related_exercises["#{p.course_id}-#{p.submission.exercise_name}"] } + sig { params(points: T::Enumerable[AwardedPoint], related_exercises: T::Enumerable[Exercise]).returns(T::Array[T::Hash[Symbol, T.untyped]]) } + def self.as_json_with_exercise_ids(points, related_exercises) + exercise_ids = related_exercises.to_h { |e| ["#{e.course_id}-#{e.name}", e.id] } + points.map do |p| + submission = p.submission + exercise_id = submission ? exercise_ids["#{p.course_id}-#{submission.exercise_name}"] : nil + { awarded_point: p.point_as_json, exercise_id: exercise_id } end end @@ -53,10 +59,11 @@ def self.as_json_with_exercise_ids(related_exercises) belongs_to :user belongs_to :submission, optional: true + after_destroy :kafka_update_points after_save :create_organization_membership after_save :kafka_update_points - after_destroy :kafka_update_points + sig { params(exercise: Exercise, user: User).returns(ActiveRecord::Relation) } def self.exercise_user_points(exercise, user) return none if exercise.hide_submission_results where(course_id: exercise.course_id, user_id: user.id) @@ -65,10 +72,12 @@ def self.exercise_user_points(exercise, user) exercise.course_id, exercise.name) end + sig { params(course: Course, user: User).returns(ActiveRecord::Relation) } def self.course_user_points(course, user) where(course_id: course.id, user_id: user.id) end + sig { params(course: Course, include_admins: T::Boolean, hidden: T::Boolean, only_for_user: T.nilable(User)).returns(Integer) } def self.course_points(course, include_admins = false, hidden = false, only_for_user = nil) awarded_points = AwardedPoint.arel_table users = User.arel_table @@ -104,6 +113,7 @@ def self.course_points(course, include_admins = false, hidden = false, only_for_ end end + sig { params(course: Course, user: User, sheetname: String).returns(ActiveRecord::Relation) } def self.course_user_sheet_points(course, user, sheetname) course_user_points(course, user) .joins('INNER JOIN available_points ON available_points.name = awarded_points.name') @@ -112,6 +122,7 @@ def self.course_user_sheet_points(course, user, sheetname) .group('awarded_points.id') end + sig { params(course: Course, sheetnames: T.any(String, T::Array[String]), include_admins: T::Boolean, only_for_user: T.nilable(User)).returns(T::Hash[String, Integer]) } def self.course_sheet_points(course, sheetnames, include_admins = false, only_for_user = nil) awarded_points = AwardedPoint.arel_table available_points = AvailablePoint.arel_table @@ -134,7 +145,7 @@ def self.course_sheet_points(course, sheetnames, include_admins = false, only_fo query.join(users).on(users[:id].eq(awarded_points[:user_id])).where(users[:id].eq(only_for_user.id)) end - res = {} + res = T.let({}, T::Hash[String, Integer]) ActiveRecord::Base.connection.execute(query.to_sql).map do |record| res[record['gdocs_sheet']] = record['count'].to_i end @@ -142,18 +153,20 @@ def self.course_sheet_points(course, sheetnames, include_admins = false, only_fo end # Loads users that have any points for the course/sheet + sig { params(course: Course, sheetname: String).returns(ActiveRecord::Relation) } def self.users_in_course_with_sheet(course, sheetname) users = User.arel_table - sql = per_user_in_course_with_sheet_query(course, sheetname, hidden: false) + sql = per_user_in_course_with_sheet_query(course, sheetname, false) .project(users[:id].as('uid')) .to_sql - uids = ActiveRecord::Base.connection.execute(sql).map { |record| record['uid'] } + uids = ActiveRecord::Base.connection.execute(sql).pluck('uid') User.where(id: uids) end # Gets a hash of user to array of point names awarded for exercises of the given sheet + sig { params(course: Course, sheetname: String, opts: T::Hash[Symbol, T::Boolean]).returns(T::Hash[String, T::Array[String]]) } def self.per_user_in_course_with_sheet(course, sheetname, opts = {}) users = User.arel_table awarded_points = AwardedPoint.arel_table @@ -162,10 +175,9 @@ def self.per_user_in_course_with_sheet(course, sheetname, opts = {}) .project([users[:login].as('username'), awarded_points[:name].as('name')]) .to_sql - result = {} + result = T.let({}, T::Hash[String, T::Array[String]]) ActiveRecord::Base.connection.execute(sql).each do |record| - result[record['username']] ||= [] - result[record['username']] << record['name'] + (result[record['username']] ||= []) << record['name'] end result.default = [] result @@ -173,6 +185,7 @@ def self.per_user_in_course_with_sheet(course, sheetname, opts = {}) # Gets a hash of user to count of points awarded for exercises of the given sheet # TODO find users, shttename -> sheetnames + sig { params(course: Course, sheetnames: T.any(String, T::Array[String]), only_for_user: T.nilable(User), hidden: T::Boolean).returns(T::Hash[String, T::Hash[String, Integer]]) } def self.count_per_user_in_course_with_sheet(course, sheetnames, only_for_user = nil, hidden = false) users = User.arel_table exercises = Exercise.arel_table @@ -183,15 +196,14 @@ def self.count_per_user_in_course_with_sheet(course, sheetnames, only_for_user = query.where(users[:id].eq(only_for_user.id)) if only_for_user - result = {} + result = T.let({}, T::Hash[String, T::Hash[String, Integer]]) ActiveRecord::Base.connection.execute(query.to_sql).each do |record| - result[record['username']] ||= {} - result[record['username']][record['gdocs_sheet']] ||= 0 - result[record['username']][record['gdocs_sheet']] = record['count'].to_i + (result[record['username']] ||= {})[record['gdocs_sheet']] = record['count'].to_i end result end + sig { params(user: User).returns(T::Array[Integer]) } def self.all_awarded(user) awarded_points = AwardedPoint.arel_table exercises = Exercise.arel_table @@ -208,13 +220,15 @@ def self.all_awarded(user) courses[:id].eq(exercises[:course_id]) .and(submissions[:exercise_name].eq(exercises[:name])) ) - ActiveRecord::Base.connection.execute(awarded_query.to_sql).to_a.map { |h| h['id'] } + ActiveRecord::Base.connection.execute(awarded_query.to_sql).to_a.pluck('id') end + sig { params(query: ActiveRecord::Relation).returns(ActiveRecord::Relation) } private_class_method def self.without_admins(query) query.joins('INNER JOIN users ON users.id = awarded_points.user_id').where(users: { administrator: false }) end + sig { params(course: Course, sheetnames: T.any(String, T::Array[String]), hidden: T.nilable(T::Boolean)).returns(Arel::SelectManager) } private_class_method def self.per_user_in_course_with_sheet_query(course, sheetnames, hidden = false) users = User.arel_table awarded_points = AwardedPoint.arel_table @@ -237,15 +251,18 @@ def self.all_awarded(user) end private + sig { void } def kafka_update_points - return if !self.course.moocfi_id || self.course.moocfi_id.blank? - exercise = self.submission.exercise + return if !T.must(self.course).moocfi_id || T.must(self.course).moocfi_id.blank? + exercise = self.submission&.exercise + return unless exercise KafkaBatchUpdatePoints.create!(course_id: self.course_id, user_id: self.user_id, exercise_id: exercise.id, task_type: 'user_progress') KafkaBatchUpdatePoints.create!(course_id: self.course_id, user_id: self.user_id, exercise_id: exercise.id, task_type: 'user_points') end + sig { void } def create_organization_membership - organization = self.course.organization + organization = T.must(T.must(self.course).organization) user = self.user OrganizationMembership.create!(user: user, organization: organization) unless organization.member?(user) end diff --git a/app/models/banned_email.rb b/app/models/banned_email.rb index 27a7f5335..c2bcfa4db 100644 --- a/app/models/banned_email.rb +++ b/app/models/banned_email.rb @@ -1,9 +1,12 @@ +# typed: strict # frozen_string_literal: true class BannedEmail < ApplicationRecord + extend T::Sig validates :email, presence: true, uniqueness: { case_sensitive: false } # Returns true if the given email is banned. Handles emails with +prefiexes by removing the prefix and checking if that address is banned. + sig { params(email: String).returns(T::Boolean) } def self.banned?(email) email = email.strip email = email.gsub(/\+.*@/, '@').downcase diff --git a/app/models/certificate.rb b/app/models/certificate.rb index 875854195..824be3b6f 100644 --- a/app/models/certificate.rb +++ b/app/models/certificate.rb @@ -1,27 +1,30 @@ +# typed: strict # frozen_string_literal: true require 'pdfkit' class Certificate < ApplicationRecord + extend T::Sig belongs_to :user belongs_to :course validates :name, :course, :user, presence: true before_save :generate + sig { void } def generate visible_exercises, available_points = visible_exercises_and_points_for data = File.read(File.join(path, 'certificate.html')) - awarded_points = AwardedPoint.course_user_points(course, user).reject do |p| + awarded_points = AwardedPoint.course_user_points(T.must(course), T.must(user)).reject do |p| exercise = p.submission.exercise exercise.nil? ? false : p.submission.exercise.hide_submission_results? end data %= { time: Time.zone.now.to_f * 1000, name: name, - course: course.formal_name || course.title, - weeks: course.exercise_groups.count, + course: T.must(course).formal_name || T.must(course).title, + weeks: T.must(course).exercise_groups.count, exercises: visible_exercises.count, points: awarded_points.count, point_names: awarded_points.map(&:name).join(','), @@ -44,14 +47,16 @@ def generate image_dpi: 300).to_pdf end + sig { returns(String) } def path - File.join(course.clone_path, 'certificate') + File.join(T.must(course).clone_path, 'certificate') end private + sig { returns([T::Array[Exercise], Integer]) } def visible_exercises_and_points_for - visible_exercises = course.exercises.select { |e| e.points_visible_to?(user) } - total_available = AvailablePoint.course_points_of_exercises(course, visible_exercises, hidden: true) + visible_exercises = T.must(course).exercises.select { |e| e.points_visible_to?(T.must(user)) } + total_available = AvailablePoint.course_points_of_exercises(T.must(course), visible_exercises, true) [visible_exercises, total_available] end end diff --git a/app/models/course.rb b/app/models/course.rb index d3f1cba54..4dee5213d 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -1,9 +1,11 @@ +# typed: strict # frozen_string_literal: true require 'system_commands' require 'date_and_time_utils' class Course < ApplicationRecord + extend T::Sig include SystemCommands include Swagger::Blocks @@ -66,6 +68,7 @@ class Course < ApplicationRecord end end + sig { returns(T::Hash[Symbol, T.untyped]) } def course_as_json { name: name, @@ -120,6 +123,7 @@ def course_as_json property :title, type: :string, example: 'testcourse' end + sig { params(view_context: ActionView::Base).returns(T::Hash[String, T.untyped]) } def links_as_json(view_context) { id: id, @@ -149,9 +153,9 @@ def links_as_json(view_context) validates :description, length: { maximum: 512 } validate :check_name_length + before_validation :save_template # If made from template, make sure cached_version is not out of sync. before_save :set_cached_version - before_validation :save_template validates :source_url, presence: true # validates :custom_points_url, # format: { @@ -187,9 +191,10 @@ def links_as_json(view_context) scope :with_certificates_for, ->(user) { select { |c| c.visible_to?(user) && c.certificate_downloadable_for?(user) } } - enum disabled_status: %i[enabled disabled] - enum paste_visibility: %i[open secured no-tests-public everyone completed-only] + enum :disabled_status, { enabled: 0, disabled: 1 } + enum :paste_visibility, { open: 0, secured: 1, 'no-tests-public': 2, everyone: 3, 'completed-only': 4 } + sig { void } def destroy # Optimization: delete dependent objects quickly. # Rails' :dependent => :delete_all is very slow. @@ -216,6 +221,7 @@ def destroy .group('courses.id') end + sig { params(course_template: CourseTemplate).returns(Course) } def self.new_from_template(course_template) Course.new(name: course_template.name, title: course_template.title, @@ -239,31 +245,38 @@ def self.new_from_template(course_template) delegate :source_backend=, to: :course_template_obj + sig { params(user: User).returns(T::Boolean) } def visible_to?(user) + hide_after = self.hide_after + hidden_if_registered_after = self.hidden_if_registered_after user.administrator? || user.teacher?(organization) || user.assistant?(self) || ( - initial_refresh_ready? && - !disabled? && - !hidden && - (hide_after.nil? || hide_after > Time.now) && - ( - hidden_if_registered_after.nil? || - hidden_if_registered_after > Time.now || - (!user.guest? && hidden_if_registered_after > user.created_at) + initial_refresh_ready? && + !disabled? && + !hidden && + (hide_after.nil? || hide_after > Time.now) && + ( + hidden_if_registered_after.nil? || + hidden_if_registered_after > Time.now || + (!user.guest? && hidden_if_registered_after > user.created_at) + ) ) - ) end + sig { params(x: T.untyped).void } def hide_after=(x) - super(DateAndTimeUtils.to_time(x, prefer_end_of_day: true)) + # Active Record casts any Time to TimeWithZone; Tapioca types the writer as TimeWithZone only. + super(T.unsafe(DateAndTimeUtils.to_time(x, prefer_end_of_day: true))) end + sig { params(x: T.untyped).void } def hidden_if_registered_after=(x) - super(DateAndTimeUtils.to_time(x, prefer_end_of_day: false)) + super(T.unsafe(DateAndTimeUtils.to_time(x, prefer_end_of_day: false))) end # This could eventually be made a hstore + sig { params(new_options: T::Hash[String, T.untyped]).void } def options=(new_options) self.hide_after = new_options['hide_after'].presence @@ -286,11 +299,13 @@ def options=(new_options) self.certificate_unlock_spec = new_options['certificate_unlock_spec'].presence end + sig { params(exercises: T.nilable(T::Enumerable[Exercise])).returns(T::Array[String]) } def gdocs_sheets(exercises = nil) exercises ||= self.exercises.select { |ex| !ex.hidden? && ex.published? } - exercises.map(&:gdocs_sheet).reject(&:nil?).uniq + exercises.filter_map(&:gdocs_sheet).uniq end + sig { returns(String) } def self.cache_root "#{FileStore.root}/course" end @@ -300,10 +315,12 @@ def self.cache_root delegate :cache_path, to: :course_template_obj # Holds a clone of the course repository + sig { returns(String) } def clone_path "#{cache_path}/clone" end + sig { returns(T.nilable(String)) } def git_revision Dir.chdir clone_path do output = `git rev-parse --verify HEAD` @@ -313,44 +330,51 @@ def git_revision nil end + sig { returns(String) } def solution_path "#{cache_path}/solution" end + sig { returns(String) } def stub_path "#{cache_path}/stub" end + sig { returns(String) } def stub_zip_path "#{cache_path}/stub_zip" end + sig { returns(String) } def solution_zip_path "#{cache_path}/solution_zip" end + sig { params(force_reload: T::Boolean).returns(T::Array[ExerciseGroup]) } def exercise_groups(force_reload = false) - @groups = nil if force_reload - @groups ||= begin + @groups = T.let(nil, T.nilable(T::Array[ExerciseGroup])) if force_reload + @groups ||= T.let(begin result = exercises.all.map(&:exercise_group_name).uniq .map { |gname| ExerciseGroup.new(self, gname) } - new_parents = [] - begin - all_parents = result.map(&:parent_name).reject(&:nil?) + loop do + all_parents = result.filter_map(&:parent_name) new_parents = all_parents.reject { |pn| result.any? { |eg| eg.name == pn } }.uniq + break if new_parents.empty? result += new_parents.map { |pn| ExerciseGroup.new(self, pn) } - end until new_parents.empty? + end result.sort - end + end, T.nilable(T::Array[ExerciseGroup])) end + sig { params(name: String, force_reload: T::Boolean).returns(T.nilable(ExerciseGroup)) } def exercise_group_by_name(name, force_reload = false) exercise_groups(force_reload).find { |eg| eg.name == name } end # Returns exercises in group `name`, or whose full name is `name`. + sig { params(name: String, force_reload: T::Boolean).returns(T::Array[Exercise]) } def exercises_by_name_or_group(name, force_reload = false) group = exercise_group_by_name(name, force_reload) exercises.to_a.select { |ex| ex.name == name || (group && ex.belongs_to_exercise_group?(group)) } @@ -358,6 +382,7 @@ def exercises_by_name_or_group(name, force_reload = false) # Set of names of the exercises in `exercises_to_check` the user may open, including those that need no unlock. # Batched form of Exercise#unlocked_for? without resolving pending unlocks. + sig { params(user: User, exercises_to_check: T::Enumerable[Exercise]).returns(T::Set[T.nilable(String)]) } def unlocked_exercise_names_for(user, exercises_to_check) from_rows = unlocks.where(user_id: user.id).where('valid_after IS NULL OR valid_after < ?', Time.now).pluck(:exercise_name).to_set exercises_to_check.select do |ex| @@ -371,43 +396,53 @@ def unlocked_exercise_names_for(user, exercises_to_check) end.to_set(&:name) end + sig { params(user: User).returns(T::Array[Exercise]) } def unlockable_exercises_for(user) UncomputedUnlock.resolve(self, user) unlocked = unlocks.where(user_id: user.id).pluck(:exercise_name) - exercises.to_a.select { |ex| !unlocked.include?(ex.name) && ex.unlockable_for?(user) } + exercises.to_a.select { |ex| unlocked.exclude?(ex.name) && ex.unlockable_for?(user) } end - def reload + sig { params(options: T.nilable(T::Hash[Symbol, T.untyped])).returns(T.self_type) } + def reload(options = nil) super @groups = nil + self end + sig { params(current_user_id: Integer).returns(CourseTemplateRefresh) } def refresh(current_user_id) CourseTemplateRefresh.create!(user_id: current_user_id, course_template_id: self.course_template_id) end + sig { void } def delete_cache FileUtils.rm_rf cache_path if custom? end + sig { returns(T::Array[String]) } def self.valid_source_backends ['git'] end + sig { returns(String) } def self.default_source_backend 'git' end + sig { returns(T.nilable(ActiveSupport::TimeWithZone)) } def time_of_first_submission - sub = submissions.order('created_at ASC').limit(1).first + sub = submissions.order(:created_at).limit(1).first sub&.created_at end + sig { returns(T.nilable(ActiveSupport::TimeWithZone)) } def time_of_last_submission - sub = submissions.order('created_at DESC').limit(1).first + sub = submissions.order(created_at: :desc).limit(1).first sub&.created_at end + sig { returns(ActiveRecord::Relation) } def reviews_required submissions.where( requires_review: true, @@ -417,6 +452,7 @@ def reviews_required ) end + sig { returns(ActiveRecord::Relation) } def reviews_requested submissions.where( requests_review: true, @@ -426,10 +462,12 @@ def reviews_requested ) end + sig { returns(ActiveRecord::Relation) } def submissions_to_review submissions.where('(requests_review OR requires_review) AND NOT reviewed AND NOT newer_submission_reviewed AND NOT review_dismissed') end + sig { params(user: User).returns(T::Boolean) } def certificate_downloadable_for?(user) user.administrator? || user.teacher?(organization) || ( @@ -439,6 +477,7 @@ def certificate_downloadable_for?(user) UnlockSpec.new(self, ActiveSupport::JSON.decode(certificate_unlock_spec)).permits_unlock_for?(user))) end + sig { void } def toggle_submission_result_visiblity self.hide_submission_results = !hide_submission_results save! @@ -448,17 +487,17 @@ def toggle_submission_result_visiblity # :available_points => number of available points, # :points_by_user => {user_id => number_of_points} # } + sig { returns(T::Hash[String, T::Hash[Symbol, T.untyped]]) } def exercise_group_completion_by_user # TODO: clean up exercise group discovery groups = exercises .where(disabled_status: 0) - .select(&:_fast_visible?) - .map(&:name) - .map { |name| name =~ /^(.+)-[^-]+$/ ? Regexp.last_match(1) : '' } + .filter_map { |e| e.name if e._fast_visible? } + .map { |name| name =~ /^(.+)-[^-]+$/ ? T.must(Regexp.last_match(1)) : '' } .uniq - result = {} + result = T.let({}, T::Hash[String, T::Hash[Symbol, T.untyped]]) for group in groups conn = ActiveRecord::Base.connection @@ -485,13 +524,14 @@ def exercise_group_completion_by_user # Returns a hash of exercise group => { # { awarded: double, late: double } # } + sig { params(user: User).returns(T::Hash[String, T::Hash[Symbol, Numeric]]) } def exercise_group_completion_counts_for_user(user) # TODO: clean up exercise group discovery - groups = exercises.enabled.map(&:name).map { |name| name =~ /^(.+)-[^-]+$/ ? Regexp.last_match(1) : '' }.uniq.sort + groups = exercises.enabled.map(&:name).map { |name| name =~ /^(.+)-[^-]+$/ ? T.must(Regexp.last_match(1)) : '' }.uniq.sort conn = ActiveRecord::Base.connection - groups.each_with_object({}) do |group, result| + groups.each_with_object(T.let({}, T::Hash[String, T::Hash[Symbol, Numeric]])) do |group, result| available_points = ExerciseGroup.new(self, group).available_point_names next if available_points.empty? @@ -507,7 +547,7 @@ def exercise_group_completion_counts_for_user(user) res = conn.execute(sql).values.to_h awarded = res[false].nil? ? 0 : res[false].to_i late = res[true].nil? ? 0 : res[true].to_i - calculated_ratio = (awarded + late * self.soft_deadline_point_multiplier).to_f / available_points.length + calculated_ratio = (awarded + (late * self.soft_deadline_point_multiplier)).to_f / available_points.length result[group] = { awarded: awarded, late: late, @@ -517,50 +557,68 @@ def exercise_group_completion_counts_for_user(user) end end + sig { returns(T::Boolean) } def refreshed? !refreshed_at.nil? end + sig { params(user: User).returns(T::Boolean) } def taught_by?(user) user.teacher?(organization) end + sig { params(user: User).returns(T::Boolean) } def assistant?(user) assistants.exists?(user.id) end + sig { returns(T::Boolean) } def contains_unlock_deadlines? exercise_groups.any?(&:contains_unlock_deadlines?) end + sig { params(material: T.nilable(String)).void } def material_url=(material) - return super('') if material.blank? - return super("http://#{material}") unless /^https?:\/\//.match?(material) - super(material) + if material.blank? + super('') + elsif !/^https?:\/\//.match?(material) + super("http://#{material}") + else + super(material) + end end + sig { returns(T::Boolean) } def custom? course_template_obj.dummy? end + sig { params(url: T.nilable(String)).void } def external_scoreboard_url=(url) - return super("http://#{url}") unless url =~ /^(https?:\/\/|$)/ - super(url) + if /^(https?:\/\/|$)/.match?(url) + super(url) + else + super("http://#{url}") + end end + sig { returns(T::Boolean) } def has_external_scoreboard_url? external_scoreboard_url.present? end + sig { params(organization: Organization, course: Course, user: User).returns(String) } def parsed_external_scoreboard_url(organization, course, user) - format(external_scoreboard_url, user: user.username, course: course.id.to_s, org: organization.slug) + format(T.must(external_scoreboard_url), user: user.username, course: course.id.to_s, org: organization.slug) end private + sig { void } def set_cached_version self.cached_version = course_template_obj.cached_version end + sig { void } def save_template course_template_obj.save! rescue StandardError => e @@ -569,35 +627,42 @@ def save_template end end + sig { returns(CourseTemplate) } def course_template_obj self.course_template ||= CourseTemplate.new_dummy(self) end + sig { void } def check_name_length + name = self.name + slug = organization&.slug # If name starts with organization slug (org-course1), then check that # the actual name (course1) is within range (for backward compatibility). - test_range = if !name.nil? && name.start_with?("#{organization.slug}-") - name_range_with_slug + test_range = if name && slug && name.start_with?("#{slug}-") + name_range_with_slug(slug) else name_range end - unless !name.nil? && test_range.include?(name.length) + unless name && test_range.include?(name.length) errors.add(:name, "must be between #{name_range} characters") end end + sig { returns(T::Range[Integer]) } def name_range 1..40 end - def name_range_with_slug - add_length = organization.slug.length + 1 + sig { params(slug: String).returns(T::Range[Integer]) } + def name_range_with_slug(slug) + add_length = slug.length + 1 (name_range.first + add_length)..(name_range.last + add_length) end + sig { void } def check_external_scoreboard_url - format(external_scoreboard_url, user: '', course: '', org: '') if external_scoreboard_url.present? + format(T.must(external_scoreboard_url), user: '', course: '', org: '') if external_scoreboard_url.present? rescue StandardError errors.add(:external_scoreboard_url, 'contains invalid keys') end diff --git a/app/models/course_notification.rb b/app/models/course_notification.rb index 88b43915a..626fec635 100644 --- a/app/models/course_notification.rb +++ b/app/models/course_notification.rb @@ -1,7 +1,7 @@ +# typed: strict # frozen_string_literal: true class CourseNotification < ApplicationRecord - attr_accessor :topic, :message, :user, :course belongs_to :course - belongs_to :user + belongs_to :sender, class_name: 'User', inverse_of: :course_notifications end diff --git a/app/models/course_template.rb b/app/models/course_template.rb index 9cae1c46c..2ec8c8aa8 100644 --- a/app/models/course_template.rb +++ b/app/models/course_template.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true # Course stub to be copied by teachers for their own organisations @@ -6,6 +7,7 @@ require 'system_commands' class CourseTemplate < ApplicationRecord + extend T::Sig include SystemCommands validates :name, @@ -38,6 +40,7 @@ class CourseTemplate < ApplicationRecord after_save :update_courses_sourcedata + sig { params(course: Course, options: T::Hash[Symbol, T.nilable(String)]).returns(CourseTemplate) } def self.new_dummy(course, options = {}) CourseTemplate.new(dummy: true, name: course.name, @@ -49,33 +52,41 @@ def self.new_dummy(course, options = {}) source_backend: options[:source_backend] || 'git') end + sig { void } def valid_git_repo? - result = sh!('git', 'ls-remote', '--exit-code', source_url, git_branch, timeout: 10) + result = sh!('git', 'ls-remote', '--exit-code', '--', source_url, git_branch, timeout: 10) result[:status].success? rescue StandardError => e errors.add(:base, 'Cannot clone repository. Error: ' + e.to_s) end + sig { void } def valid_source_backend? errors.add(:source_backend, '"not git') unless source_backend == 'git' end + sig { void } def set_default_source_backend - self.source_backend ||= CourseTemplate.default_source_backend + self.source_backend = CourseTemplate.default_source_backend if T.let(source_backend, T.nilable(String)).nil? end + sig { returns(String) } def self.default_source_backend 'git' end + sig { returns(T::Boolean) } def clonable? + expires_at = self.expires_at !hidden? && (expires_at.nil? || expires_at > Time.now) && !dummy? end + sig { returns(String) } def cache_path File.join(Course.cache_root, "#{name}-#{cached_version}") end + sig { void } def increment_cached_version self.cached_version += 1 courses.each do |course| @@ -83,15 +94,18 @@ def increment_cached_version end end + sig { params(current_user_id: Integer).returns(CourseTemplateRefresh) } def refresh(current_user_id) CourseTemplateRefresh.create!(user_id: current_user_id, course_template_id: self.id) end + sig { returns(T::Boolean) } def cache_exists? File.exist?(cache_path) end private + sig { void } def update_courses_sourcedata courses.each do |c| c.cached_version = cached_version diff --git a/app/models/course_template_refresh.rb b/app/models/course_template_refresh.rb index beb0e7fd1..b25f46f0f 100644 --- a/app/models/course_template_refresh.rb +++ b/app/models/course_template_refresh.rb @@ -1,19 +1,23 @@ +# typed: strict # frozen_string_literal: true class CourseTemplateRefresh < ApplicationRecord + extend T::Sig belongs_to :user, optional: true belongs_to :course_template has_many :course_template_refresh_phases, dependent: :delete_all has_one :course_template_refresh_report, dependent: :destroy after_create :create_first_course_template_refresh_phase - enum status: %i[not_started in_progress complete crashed] + enum :status, { not_started: 0, in_progress: 1, complete: 2, crashed: 3 } + sig { params(phase_name: T.untyped, time_ms: T.untyped).returns(CourseTemplateRefreshPhase) } def create_phase(phase_name, time_ms) CourseTemplateRefreshPhase.create(course_template_refresh: self, phase_name: phase_name, time_ms: time_ms) end private + sig { void } def create_first_course_template_refresh_phase CourseTemplateRefreshPhase.create(course_template_refresh: self, phase_name: 'Refresh initialized', time_ms: 0) end diff --git a/app/models/course_template_refresh_phase.rb b/app/models/course_template_refresh_phase.rb index 1692e606f..5741df1b7 100644 --- a/app/models/course_template_refresh_phase.rb +++ b/app/models/course_template_refresh_phase.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class CourseTemplateRefreshPhase < ApplicationRecord diff --git a/app/models/course_template_refresh_report.rb b/app/models/course_template_refresh_report.rb index 70a7f816e..d42f9f65e 100644 --- a/app/models/course_template_refresh_report.rb +++ b/app/models/course_template_refresh_report.rb @@ -1,18 +1,16 @@ +# typed: strict # frozen_string_literal: true class CourseTemplateRefreshReport < ApplicationRecord + extend T::Sig belongs_to :course_template_refresh serialize :refresh_errors, class: Array, coder: JSON serialize :refresh_warnings, class: Array, coder: JSON serialize :refresh_notices, class: Array, coder: JSON serialize :refresh_timings, class: Hash, coder: JSON - attr_reader :refresh_errors - attr_reader :refresh_warnings - attr_reader :refresh_notices - attr_reader :refresh_timings - + sig { returns(T::Boolean) } def successful? - :refresh_errors.empty? + refresh_errors.blank? end end diff --git a/app/models/deadline_spec.rb b/app/models/deadline_spec.rb index fe9eabd39..9b07b111c 100644 --- a/app/models/deadline_spec.rb +++ b/app/models/deadline_spec.rb @@ -1,14 +1,19 @@ +# typed: strict # frozen_string_literal: true require 'date_and_time_utils' # Parses and abstracts specification in the "deadline" field of a `metadata.yml` file. class DeadlineSpec # (the name of this class is unfortunate as it confuses IDEs when jumping to tests) + extend T::Sig class InvalidSyntaxError < StandardError; end + # specs is a decoded JSON array. + sig { params(exercise: Exercise, specs: T::Array[T.untyped]).void } def initialize(exercise, specs) @exercise = exercise - @specs = [] + @specs = T.let([], T::Array[SingleSpec]) + @depends_on_unlock_time = T.let(false, T::Boolean) for i in 0...specs.size begin spec = specs[i].to_s.strip @@ -21,51 +26,79 @@ def initialize(exercise, specs) end end + sig { returns(T.nilable(String)) } def universal_description if @specs.empty? nil elsif @specs.size == 1 - @specs.first.universal_description + T.must(@specs.first).universal_description else @specs.map(&:universal_description).join(' or ') + ', whichever comes first' end end + sig { params(user: User).returns(String) } def description_for(user) min_spec(user)&.personal_describer&.call(user) || 'none' end + sig { params(user: User).returns(T.nilable(T.any(Time, ActiveSupport::TimeWithZone, DateTime))) } def deadline_for(user) @specs.map { |s| s.timefun.call(user) }.reject(&:nil?).min end + sig { returns(T::Boolean) } def depends_on_unlock_time? !!@depends_on_unlock_time end + sig { returns(T.nilable(String)) } def static_deadline_spec - @specs.select { |n| !n.nil? && DateAndTimeUtils.looks_like_date_or_time(n.raw_spec) }.map(&:raw_spec).first + @specs.find { |n| !n.nil? && DateAndTimeUtils.looks_like_date_or_time(n.raw_spec) }&.raw_spec end + sig { returns(T.nilable(String)) } def unlock_deadline_spec - @specs.select { |n| !n.nil? && !DateAndTimeUtils.looks_like_date_or_time(n.raw_spec) }.map(&:raw_spec).first + @specs.find { |n| !n.nil? && !DateAndTimeUtils.looks_like_date_or_time(n.raw_spec) }&.raw_spec end private + sig { params(user: User).returns(T.nilable(SingleSpec)) } def min_spec(user) - @specs.map { |s| [s.timefun.call(user), s] }.reject { |p| p.first.nil? }.min_by(&:first)&.map(&:second) + timed_specs = @specs.filter_map do |s| + time = s.timefun.call(user) + [time, s] if time + end + timed_specs.min_by(&:first)&.last end class SingleSpec + extend T::Sig + + sig do + params( + spec: String, + timefun: T.proc.params(user: User).returns(T.nilable(T.any(Time, ActiveSupport::TimeWithZone, DateTime))), + universal_description: String, + personal_describer: T.proc.params(user: User).returns(String) + ).void + end def initialize(spec, timefun, universal_description, personal_describer) @raw_spec = spec @timefun = timefun @universal_description = universal_description @personal_describer = personal_describer end - attr_accessor :raw_spec, :timefun, :universal_description, :personal_describer + + sig { returns(String) } + attr_accessor :raw_spec, :universal_description + sig { returns(T.proc.params(user: User).returns(T.nilable(T.any(Time, ActiveSupport::TimeWithZone, DateTime)))) } + attr_accessor :timefun + sig { returns(T.proc.params(user: User).returns(String)) } + attr_accessor :personal_describer end + sig { params(spec: String).void } def parse_spec(spec) # A spec is a proc that takes a user and returns a Time object or nil if DateAndTimeUtils.looks_like_date_or_time(spec) @@ -77,7 +110,7 @@ def parse_spec(spec) elsif spec =~ /^unlock\s*[+]\s*(\d+)\s+(minutes?|hours?|days?|weeks?|months?|years?)$/ time_scalar = Regexp.last_match(1) time_unit = Regexp.last_match(2) - time_delta = time_scalar.to_i.send(time_unit) + time_delta = time_scalar.to_i.send(T.must(time_unit)) @depends_on_unlock_time = true timefun = lambda do |user| unlock_time = @exercise.time_unlocked_for(user) diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 8cb93fbf5..7229cd2a7 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'shellwords' @@ -5,6 +6,7 @@ require 'date_and_time_utils' class Exercise < ApplicationRecord + extend T::Sig self.include_root_in_json = false include Swagger::Blocks @@ -121,273 +123,321 @@ class Exercise < ApplicationRecord res } - enum disabled_status: %i[enabled disabled] - enum paste_visibility: %i[open secured no-tests-public everyone completed-only] + enum :disabled_status, { enabled: 0, disabled: 1 } + enum :paste_visibility, { open: 0, secured: 1, 'no-tests-public': 2, everyone: 3, 'completed-only': 4 } + sig { returns(String) } def relative_path - name.tr('-', '/') + T.must(name).tr('-', '/') end + sig { returns(T.nilable(ExerciseGroup)) } def exercise_group - course.exercise_group_by_name(exercise_group_name) + T.must(course).exercise_group_by_name(exercise_group_name) end + sig { returns(String) } def exercise_group_name - parts = name.split('-') + parts = T.must(name).split('-') parts.pop parts.join('-') end - def part - exercise.group_name.tr('^0-9', '').to_i - rescue - 0 - end - + sig { params(group: ExerciseGroup).returns(T::Boolean) } def belongs_to_exercise_group?(group) group.course.id == course_id && (exercise_group_name + '-').start_with?(group.name + '-') end + sig { returns(String) } def clone_path - "#{course.clone_path}/#{relative_path}" + "#{T.must(course).clone_path}/#{relative_path}" end + sig { returns(String) } def solution_path - "#{course.solution_path}/#{relative_path}" + "#{T.must(course).solution_path}/#{relative_path}" end + sig { returns(String) } def stub_path - "#{course.stub_path}/#{relative_path}" + "#{T.must(course).stub_path}/#{relative_path}" end + sig { returns(String) } def stub_zip_file_path - "#{course.stub_zip_path}/#{name}.zip" + "#{T.must(course).stub_zip_path}/#{name}.zip" end + sig { returns(String) } def solution_zip_file_path - "#{course.solution_zip_path}/#{name}.zip" + "#{T.must(course).solution_zip_path}/#{name}.zip" end + sig { returns(Solution) } def solution Solution.new(self) end + sig { params(user: User, value: T::Array[Submission]).void } def set_submissions_by!(user, value) - @submissions_by ||= {} - @submissions_by[user.id] = value + submissions_by_user_id[user.id] = value end + sig { params(user: User).returns(T::Array[Submission]) } def submissions_by(user) - @submissions_by ||= {} - @submissions_by[user.id] ||= submissions.where(user_id: user.id).to_a + submissions_by_user_id[user.id] ||= submissions.where(user_id: user.id).to_a end - def reload + sig { params(options: T.nilable(T::Hash[Symbol, T.untyped])).returns(T.self_type) } + def reload(options = nil) super @submissions_by = {} + self end # Whether a user may make submissions + sig { params(user: User).returns(T::Boolean) } def submittable_by?(user) returnable? && - (user.administrator? || user.teacher?(course.organization) || user.assistant?(course) || + (user.administrator? || user.teacher?(T.must(course).organization) || user.assistant?(T.must(course)) || (!expired_for?(user) && !hidden? && published? && !disabled? && !user.guest? && unlocked_for?(user))) end # Whether a user may see all metadata about the exercise + sig { params(user: User).returns(T::Boolean) } def visible_to?(user) - user.administrator? || user.teacher?(course.organization) || user.assistant?(course) || - _fast_visible? && (unlocked_for?(user) || unlock_spec_obj.permits_unlock_for?(user)) + user.administrator? || user.teacher?(T.must(course).organization) || user.assistant?(T.must(course)) || + (_fast_visible? && (unlocked_for?(user) || unlock_spec_obj.permits_unlock_for?(user))) end + sig { returns(T::Boolean) } def _fast_visible? !hidden? && !disabled? && published? end # Whether the user may see the scoreboard for the exercise + sig { params(user: User).returns(T::Boolean) } def points_visible_to?(user) user.administrator? || - user.teacher?(course.organization) || + user.teacher?(T.must(course).organization) || ( !hidden? && published? && !disabled? && - (course.locked_exercise_points_visible? || unlock_spec_obj.permits_unlock_for?(user)) && + (T.must(course).locked_exercise_points_visible? || unlock_spec_obj.permits_unlock_for?(user)) && !hide_submission_results && - !course.hide_submission_results + !T.must(course).hide_submission_results ) end # Whether the user may download the exercise ZIP file + sig { params(user: User).returns(T::Boolean) } def downloadable_by?(user) - user.administrator? || user.teacher?(course.organization) || user.assistant?(course) || - visible_to?(user) && unlocked_for?(user) + user.administrator? || user.teacher?(T.must(course).organization) || user.assistant?(T.must(course)) || + (visible_to?(user) && unlocked_for?(user)) end # Whether the exercise has been published (it may still be hidden) + sig { returns(T::Boolean) } def published? + publish_time = self.publish_time !publish_time || publish_time <= Time.now end delegate :deadline_for, to: :deadline_spec_obj + sig { params(user: User).returns(T.nilable(T.any(Time, ActiveSupport::TimeWithZone, DateTime))) } def soft_deadline_for(user) soft_deadline_spec_obj.deadline_for(user) end # Whether the deadline has passed + sig { params(user: User).returns(T::Boolean) } def expired_for?(user) Exercise.deadline_expired?(deadline_for(user)) end + sig { params(user: User).returns(T::Boolean) } def soft_deadline_expired_for?(user) Exercise.deadline_expired?(soft_deadline_for(user)) end # Whether a user has made a submission for this exercise + sig { params(user: User).returns(T::Boolean) } def attempted_by?(user) submissions_by(user).any?(&:processed) end # Whether a user has made a submission with all test cases passing + sig { params(user: User).returns(T::Boolean) } def completed_by?(user) submissions_by(user).any? do |s| s.pretest_error.nil? && s.all_tests_passed? end end + sig { returns(T::Boolean) } def requires_review? !available_review_points.empty? end # Whether a code review for this exercise exists for a submission made by 'user'. + sig { params(user: User).returns(T::Boolean) } def reviewed_for?(user) submissions_by(user).any?(&:reviewed) end # Returns all reviewed submissions for this exercise for 'user' + sig { params(user: User).returns(T::Array[Submission]) } def reviewed_submissions_for(user) submissions_by(user).select(&:reviewed) end # Whether all of the required code review points have been given. # Returns true if the exercise doesn't require code review. + sig { params(user: User).returns(T::Boolean) } def all_review_points_given_for?(user) arp = available_review_points return true if arp.empty? # optimization - user.has_points?(course, arp) + user.has_points?(T.must(course), arp) end + sig { returns(T::Array[String]) } def available_review_points # use 'select' instead of 'where' to use cached value of available_points - available_points.to_a.select(&:requires_review).map(&:name) + available_points.to_a.filter_map { |point| point.name if point.requires_review } end + sig { params(user: User).returns(T::Array[String]) } def points_for(user) AwardedPoint.exercise_user_points(self, user).map(&:name) end + sig { params(user: User).returns(T::Array[String]) } def missing_review_points_for(user) available_review_points - points_for(user) end + sig { params(spec: T.nilable(String)).void } def unlock_spec=(spec) check_is_json_array_of_strings(spec) - @unlock_spec_obj = UnlockSpec.from_str(course, spec) - super(@unlock_spec_obj.empty? ? nil : spec) + unlock_spec_obj = UnlockSpec.from_str(course, spec) + @unlock_spec_obj = T.let(unlock_spec_obj, T.nilable(UnlockSpec)) + super(unlock_spec_obj.empty? ? nil : spec) end + sig { returns(UnlockSpec) } def unlock_spec_obj - @unlock_spec_obj ||= UnlockSpec.from_str(course, unlock_spec) + @unlock_spec_obj ||= T.let(UnlockSpec.from_str(course, unlock_spec), T.nilable(UnlockSpec)) end + sig { returns(T::Array[T.untyped]) } def unlock_conditions unlock_spec_obj.raw_spec end + sig { params(spec: T.nilable(String)).void } def deadline_spec=(spec) check_is_json_array_of_strings(spec) super(spec) - @deadline_spec_obj = DeadlineSpec.new(self, ActiveSupport::JSON.decode(spec)) + @deadline_spec_obj = T.let(DeadlineSpec.new(self, ActiveSupport::JSON.decode(spec)), T.nilable(DeadlineSpec)) end + sig { params(spec: T.nilable(String)).void } def soft_deadline_spec=(spec) check_is_json_array_of_strings(spec) super(spec) - @soft_deadline_spec_obj = DeadlineSpec.new(self, ActiveSupport::JSON.decode(spec)) + @soft_deadline_spec_obj = T.let(DeadlineSpec.new(self, ActiveSupport::JSON.decode(spec)), T.nilable(DeadlineSpec)) end + sig { returns(DeadlineSpec) } def deadline_spec_obj - @deadline_spec_obj ||= new_deadline_spec_obj(deadline_spec) + @deadline_spec_obj ||= T.let(new_deadline_spec_obj(deadline_spec), T.nilable(DeadlineSpec)) end + sig { returns(DeadlineSpec) } def soft_deadline_spec_obj - @soft_deadline_spec_obj ||= new_deadline_spec_obj(soft_deadline_spec) + @soft_deadline_spec_obj ||= T.let(new_deadline_spec_obj(soft_deadline_spec), T.nilable(DeadlineSpec)) end + sig { returns(T.nilable(String)) } def static_deadline deadline_spec_obj.static_deadline_spec end + sig { returns(T.nilable(String)) } def unlock_deadline deadline_spec_obj.unlock_deadline_spec end + sig { returns(T.nilable(String)) } def soft_static_deadline soft_deadline_spec_obj.static_deadline_spec end + sig { returns(T.nilable(String)) } def soft_unlock_deadline soft_deadline_spec_obj.unlock_deadline_spec end + sig { returns(T::Boolean) } def has_unlock_deadline? unlock_deadline.present? || soft_unlock_deadline.present? end + sig { returns(T::Boolean) } def requires_unlock? !unlock_spec.nil? end + sig { returns(T::Boolean) } def requires_explicit_unlock? deadline_spec_obj.depends_on_unlock_time? end # Date-only unlocks are decided by the clock, not by unlock rows: a user without rows must not stay locked. # Explicit-unlock exercises are excluded because their unlock row starts the deadline timer. + sig { returns(T::Boolean) } def unlocked_by_date? UnlockSpec.date_only?(unlock_spec) && !requires_explicit_unlock? end # Returns when the exercise unlocked for the user, or nil if it is locked or needs no unlock. + sig { params(user: User, resolve_unlocks: T::Boolean).returns(T.nilable(T.any(Time, ActiveSupport::TimeWithZone, DateTime))) } def time_unlocked_for(user, resolve_unlocks = true) return unlock_time_by_date if unlocked_by_date? - UncomputedUnlock.resolve(course, user) if resolve_unlocks + UncomputedUnlock.resolve(T.must(course), user) if resolve_unlocks unlocks.where(user_id: user).find_by('valid_after IS NULL OR valid_after < ?', Time.now)&.created_at end # The unlock date of a date-only exercise once it has passed; nil before it. + sig { returns(T.nilable(T.any(Time, ActiveSupport::TimeWithZone, DateTime))) } def unlock_time_by_date - unlock_date = unlock_spec_obj.valid_after + unlock_date = T.must(unlock_spec_obj.valid_after) unlock_date <= Time.now ? unlock_date : nil end + sig { params(user: User, resolve_unlocks: T::Boolean).returns(T::Boolean) } def unlocked_for?(user, resolve_unlocks = true) res = !requires_unlock? || time_unlocked_for(user, resolve_unlocks) !!res end + sig { params(user: User).returns(T::Boolean) } def unlockable_for?(user) requires_explicit_unlock? && !unlocked_for?(user) && unlock_spec_obj.permits_unlock_for?(user) end + sig { params(new_value: T.untyped).void } def solution_visible_after=(new_value) - super(DateAndTimeUtils.to_time(new_value, prefer_end_of_day: true)) + # Active Record casts any Time to TimeWithZone; Tapioca types the writer as TimeWithZone only. + super(T.unsafe(DateAndTimeUtils.to_time(new_value, prefer_end_of_day: true))) end # Ignore some options if already set; to keep changes done in UI. # metadata.yml support removed, should these be removed from database + sig { params(new_options: T::Hash[String, T.untyped]).void } def options=(new_options) new_options = self.class.default_options.merge(new_options) @@ -407,30 +457,36 @@ def options=(new_options) # Whether this exercise accepts submissions at all. # TMC may be used to distribute exercise templates without tests. + sig { returns(T::Boolean) } def returnable? - if !returnable_forced.nil? - returnable_forced # may be true or false + forced = returnable_forced + if !forced.nil? + forced else - has_tests? && course.initial_refresh_ready? + has_tests? && T.must(course).initial_refresh_ready? end end # The memory limit in megabytes or nil if not set. # Limited by the global limit in site.yml (if any). # Not configurable per-exercise yet but possibly in the future. + sig { returns(T.nilable(Integer)) } def memory_limit global_limit = SiteSetting.value('memory_limit') global_limit&.to_i end + sig { returns(T::Array[String]) } def runtime_params_array ActiveSupport::JSON.decode(runtime_params) end + sig { returns(T::Boolean) } def code_review_requests_enabled? - course.code_review_requests_enabled? && self[:code_review_requests_enabled] + T.must(course).code_review_requests_enabled? && self[:code_review_requests_enabled] end + sig { returns(T::Hash[String, T.untyped]) } def self.default_options { 'deadline' => nil, @@ -448,10 +504,12 @@ def self.default_options } end + sig { returns(ActiveRecord::Relation) } def submissions_having_feedback submissions.where('EXISTS (SELECT 1 FROM feedback_answers WHERE feedback_answers.submission_id = submissions.id)') end + sig { params(users: T.any(ActiveRecord::Relation, T::Array[User]), exercises: T.any(ActiveRecord::Relation, T::Array[Exercise])).returns(Integer) } def self.count_completed(users, exercises) return 0 if exercises.empty? @@ -474,16 +532,27 @@ def self.count_completed(users, exercises) end end + sig { void } def toggle_submission_result_visiblity self.hide_submission_results = !hide_submission_results save! end + sig { params(deadline: T.nilable(T.any(Time, ActiveSupport::TimeWithZone, DateTime)), time: T.any(Time, ActiveSupport::TimeWithZone)).returns(T::Boolean) } def self.deadline_expired?(deadline, time = Time.now) - !deadline.nil? && deadline < time + !deadline.nil? && deadline.to_time < time.to_time end private + SubmissionsByUserId = T.type_alias { T::Hash[T.nilable(Integer), T::Array[Submission]] } + private_constant :SubmissionsByUserId + + sig { returns(SubmissionsByUserId) } + def submissions_by_user_id + @submissions_by ||= T.let({}, T.nilable(SubmissionsByUserId)) + end + + sig { params(spec: T.nilable(String)).returns(DeadlineSpec) } def new_deadline_spec_obj(spec) if spec DeadlineSpec.new(self, ActiveSupport::JSON.decode(spec)) @@ -492,17 +561,20 @@ def new_deadline_spec_obj(spec) end end + sig { params(enabled: T.untyped, sheetname: T.untyped).returns(T.nilable(String)) } def new_gdocs_sheet(enabled, sheetname) return nil unless enabled return sheetname.to_s if sheetname.present? name_to_gdocs_sheet end + sig { returns(String) } def name_to_gdocs_sheet - sheetname = name.split('-')[0..-2].join('-') + sheetname = T.must(T.must(name).split('-')[0..-2]).join('-') sheetname.empty? ? 'root' : sheetname end + sig { params(value: T.untyped).returns(String) } def to_json_array(value) if !value.nil? value = [value] unless value.is_a?(Array) @@ -512,6 +584,7 @@ def to_json_array(value) end end + sig { params(str: T.nilable(String)).void } def check_is_json_array_of_strings(str) return if str.nil? array = ActiveSupport::JSON.decode(str) @@ -519,6 +592,7 @@ def check_is_json_array_of_strings(str) raise 'JSON array of strings expected' if array.any? { |a| !a.is_a?(String) } end + sig { params(raw_params: T.untyped).returns(String) } def parse_runtime_params(raw_params) if raw_params.nil? '[]' diff --git a/app/models/exercise_group.rb b/app/models/exercise_group.rb index 57422c55b..100d18db6 100644 --- a/app/models/exercise_group.rb +++ b/app/models/exercise_group.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'natcmp' @@ -6,30 +7,39 @@ # # Obtainable from Course.exercise_groups and other methods there. class ExerciseGroup + extend T::Sig include Comparable + sig { params(course: Course, name: String).void } def initialize(course, name) @course = course @name = name + @parent_name = T.let(nil, T.nilable(String)) end + sig { returns(Course) } attr_reader :course + sig { returns(String) } attr_reader :name + sig { returns(T.nilable(ExerciseGroup)) } def parent - course.exercise_group_by_name(parent_name) if parent_name + group_name = parent_name + course.exercise_group_by_name(group_name) if group_name end + sig { returns(T.nilable(String)) } def parent_name - @parent_name ||= begin + @parent_name ||= T.let(begin parts = name.split('-') if parts.size > 1 parts.pop parts.join('-') end - end + end, T.nilable(String)) end + sig { params(recursively: T::Boolean).returns(T::Array[Exercise]) } def exercises(recursively) if recursively course.exercises.to_a.select { |e| e.exercise_group_name.start_with?(name) } @@ -38,70 +48,84 @@ def exercises(recursively) end end + sig { returns(T::Array[ExerciseGroup]) } def children course.exercise_groups.select { |eg| eg.name.start_with?(name) && eg != self } end + sig { params(other: ExerciseGroup).returns(Integer) } def <=>(other) Natcmp.natcmp(name, other.name) end + sig { returns(String) } def inspect "" end + sig { returns(T.nilable(DeadlineSpec)) } def hard_group_deadline group_deadline(:deadline_spec_obj) end + sig { returns(T.nilable(DeadlineSpec)) } def soft_group_deadline group_deadline(:soft_deadline_spec_obj) end # Returns true if all exercises in this group have the same deadline + sig { returns(T::Boolean) } def uniform_group_deadlines? exercises(false).map do |e| [e.static_deadline, e.unlock_deadline, e.soft_static_deadline, e.soft_unlock_deadline] end.uniq.length == 1 end + sig { returns(T::Boolean) } def contains_unlock_deadlines? exercises(false).any?(&:has_unlock_deadline?) end + sig { params(deadline: T.nilable(String)).void } def hard_group_deadline=(deadline) set_group_deadline(:deadline_spec=, deadline) end + sig { params(deadline: T.nilable(String)).void } def soft_group_deadline=(deadline) set_group_deadline(:soft_deadline_spec=, deadline) end + sig { returns(T.nilable(T::Array[T.untyped])) } def group_unlock_conditions exercises(false).map(&:unlock_conditions).first end # The group's exercises keyed by raw unlock spec (nil for none); more than one key means # `group_unlock_conditions` shows only the first exercise's conditions. + sig { returns(T::Hash[T.nilable(String), T::Array[Exercise]]) } def exercises_by_unlock_spec exercises(false).group_by(&:unlock_spec) end + sig { params(unlock_conditions: T.nilable(String)).void } def group_unlock_conditions=(unlock_conditions) group_exercises = exercises(false) # Rows granted under other conditions keep their date: fast refresh never revokes them, so moving it would open them early. # Explicit unlocks keep theirs too: the row already started the deadline timer, so a later date would lock it while the timer runs. conditions = UnlockSpec.non_date_conditions(unlock_conditions).sort - rows_to_move = group_exercises.select do |e| - !e.requires_explicit_unlock? && UnlockSpec.non_date_conditions(e.unlock_spec).sort == conditions - end.map(&:name) + rows_to_move = group_exercises.filter_map do |e| + e.name if !e.requires_explicit_unlock? && UnlockSpec.non_date_conditions(e.unlock_spec).sort == conditions + end group_exercises.each do |e| e.unlock_spec = unlock_conditions e.save! end - update_unlock_dates(group_exercises.first, rows_to_move) unless group_exercises.empty? + first_exercise = group_exercises.first + update_unlock_dates(first_exercise, rows_to_move) if first_exercise end + sig { returns(T::Array[String]) } def available_point_names conn = ActiveRecord::Base.connection @@ -122,16 +146,19 @@ def available_point_names private # Unlock rows copy the date at creation; keep existing rows in step when the date is edited. + sig { params(exercise: Exercise, exercise_names: T::Array[T.nilable(String)]).void } def update_unlock_dates(exercise, exercise_names) spec = exercise.unlock_spec_obj return if spec.empty? Unlock.where(course_id: course.id, exercise_name: exercise_names).update_all(valid_after: spec.valid_after) end + sig { params(method: Symbol).returns(T.nilable(DeadlineSpec)) } def group_deadline(method) exercises(false).map { |n| n.send(method) }.first end + sig { params(method: Symbol, deadline: T.nilable(String)).void } def set_group_deadline(method, deadline) exercises(false).each do |e| e.send(method, deadline) diff --git a/app/models/extra_field.rb b/app/models/extra_field.rb index c3e166922..3f1b72376 100644 --- a/app/models/extra_field.rb +++ b/app/models/extra_field.rb @@ -1,68 +1,94 @@ +# typed: strict # frozen_string_literal: true # An abstract base for classes representing extra fields on a record. # # See UserField for an example. module ExtraField + extend T::Sig extend ActiveSupport::Concern - included do - def self.extra_field_kind - name.underscore.gsub(/_field$/, '').to_sym + extend T::Helpers + requires_ancestor { UserField } + + module ClassMethods + extend T::Sig + extend T::Helpers + requires_ancestor { T.class_of(UserField) } + + sig { returns(Symbol) } + def extra_field_kind + T.must(name).underscore.gsub(/_field$/, '').to_sym end - def self.all - @all ||= ExtraField.by_kind(extra_field_kind) + sig { returns(T::Array[UserField]) } + def all + @all ||= T.let(ExtraField.by_kind(extra_field_kind), T.nilable(T::Array[UserField])) end - def self.groups + sig { returns(T::Array[T.nilable(String)]) } + def groups all.map(&:group).uniq end - def self.by_group(group) + sig { params(group: T.nilable(String)).returns(T::Array[UserField]) } + def by_group(group) all.select { |field| field.group == group } end end + mixes_in_class_methods(ClassMethods) + # Option values come from the Ruby DSL in config/extra_fields. + sig { params(options: T::Hash[Symbol, T.untyped]).void } def initialize(options = {}) - @options = default_options.merge(options) + @options = T.let(default_options.merge(options), T::Hash[Symbol, T.untyped]) raise 'Name missing' unless @options[:name] - @value_class = Object.const_get(self.class.name + 'Value') + @value_class = T.let(UserFieldValue, T.class_of(UserFieldValue)) end + sig { returns(T::Hash[Symbol, T.untyped]) } def options @options.clone end + sig { returns(String) } def name @options[:name] end + sig { returns(T.nilable(String)) } def group @options[:group] end + sig { returns(Symbol) } def field_type @options[:field_type].to_sym end + sig { returns(String) } def label @options[:label] || @options[:name] end + sig { returns(T::Boolean) } def should_save? !@options[:hidden] && !@options[:disabled] && @options[:field_type] != :html end + sig { returns(T.class_of(UserFieldValue)) } attr_reader :value_class + sig { returns(ActiveRecord::Relation) } def values value_class.where(kind: kind) end + sig { returns(Symbol) } def kind - self.class.extra_field_kind + T.cast(self.class, T.class_of(UserField)).extra_field_kind end + sig { returns(T::Hash[Symbol, T.untyped]) } def default_options { hidden: false, @@ -71,61 +97,76 @@ def default_options } end + @fields = T.let(nil, T.nilable(T::Hash[Symbol, T::Array[UserField]])) + + sig { params(kind: T.any(String, Symbol)).returns(T::Array[UserField]) } def self.by_kind(kind) - unless @fields - kinds = config_files.map { |file| File.basename(file, '_fields.rb') } - @fields = Hash[kinds.zip(config_files).map { |k, f| [k.to_sym, load_fields(k, f)] }] + fields = @fields ||= config_files.to_h do |file| + file_kind = File.basename(file, '_fields.rb') + [file_kind.to_sym, load_fields(file_kind, file)] end - @fields[kind.to_sym] || [] + fields[kind.to_sym] || [] end - private - def self.config_files - Dir.glob("#{::Rails.root}/config/extra_fields/*_fields.rb") + class ConfigDsl + extend T::Sig + sig { returns(T::Array[UserField]) } + attr_reader :fields + + sig { params(field_class: T.class_of(UserField)).void } + def initialize(field_class) + @field_class = field_class + @fields = T.let([], T::Array[UserField]) + @html_count = T.let(0, Integer) + @group = T.let(nil, T.nilable(String)) end - def self.load_fields(kind, config_file_path) - return [] unless File.exist?(config_file_path) - - kind = kind.to_s - - cls_name = "#{kind.camelize}Field" - - cls = Object.const_get(cls_name) - raise "Field class not found: #{cls}" if cls.nil? - - dsl = Object.new - dsl.instance_variable_set('@cls', cls) - dsl.instance_variable_set('@fields', []) - dsl.instance_variable_set('@html_count', 0) - - class << dsl - def group(group_name) - raise "Don't nest groups" if @group - @group = group_name - begin - yield - ensure - @group = nil - end - end - - def field(options) - @fields << @cls.new({ group: @group }.merge(options)) - end - - def html(text, options = {}) - @html_count += 1 - @fields << @cls.new({ - name: "html#{@html_count}", - group: @group, - field_type: :html, - label: text - }.merge(options)) - end + sig { params(group_name: String, block: T.proc.void).void } + def group(group_name, &block) + raise "Don't nest groups" if @group + @group = group_name + begin + yield + ensure + @group = nil end + end - dsl.instance_eval(File.read(config_file_path)) - dsl.instance_variable_get('@fields') + sig { params(options: T::Hash[Symbol, T.untyped]).void } + def field(options) + @fields << @field_class.new({ group: @group }.merge(options)) end + + sig { params(text: String, options: T::Hash[Symbol, T.untyped]).void } + def html(text, options = {}) + @html_count += 1 + @fields << @field_class.new({ + name: "html#{@html_count}", + group: @group, + field_type: :html, + label: text + }.merge(options)) + end + end + private_constant :ConfigDsl + + sig { returns(T::Array[String]) } + private_class_method def self.config_files + Dir.glob(Rails.root.join('config/extra_fields/*_fields.rb').to_s) + end + + sig { params(kind: T.any(String, Symbol), config_file_path: String).returns(T::Array[UserField]) } + private_class_method def self.load_fields(kind, config_file_path) + return [] unless File.exist?(config_file_path) + + cls = + case kind.to_s + when 'user' then UserField + else raise "Field class not found for kind #{kind}" + end + + dsl = ConfigDsl.new(cls) + dsl.instance_eval(File.read(config_file_path)) + dsl.fields + end end diff --git a/app/models/extra_field_value.rb b/app/models/extra_field_value.rb index 419d2e8bc..65545d1be 100644 --- a/app/models/extra_field_value.rb +++ b/app/models/extra_field_value.rb @@ -1,27 +1,34 @@ +# typed: strict # frozen_string_literal: true # An abstract base for active record classes representing values for 'ExtraField's. # # See UserFieldValue for an example. module ExtraFieldValue + extend T::Sig extend ActiveSupport::Concern + extend T::Helpers + requires_ancestor { UserFieldValue } included do validates :field_name, uniqueness: { scope: :user_id } end + sig { returns(T.nilable(UserField)) } def field - @field ||= ExtraField.by_kind(field_kind).find { |f| f.name == field_name } + @field ||= T.let(ExtraField.by_kind(field_kind).find { |f| f.name == field_name }, T.nilable(UserField)) end + sig { returns(Symbol) } def field_kind - @field_kind ||= self.class.name.underscore.gsub(/_field_value$/, '').to_sym + @field_kind ||= T.let(T.must(self.class.name).underscore.gsub(/_field_value$/, '').to_sym, T.nilable(Symbol)) end # Unfortunately, value is actually a string that can be put directly in a form. # May want to refactor some day. + sig { returns(T.any(String, T::Boolean)) } def ruby_value - case field.field_type + case field&.field_type when :boolean value.blank? || value == '0' ? false : true else @@ -29,15 +36,16 @@ def ruby_value end end + sig { params(new_value: T.untyped).void } def set_from_form(new_value) - if field.should_save? - self.value = - case field_kind - when :boolean - new_value.to_bool - else - new_value.to_s - end - end + field = self.field + return unless field&.should_save? + self.value = + case field.field_type + when :boolean + ActiveModel::Type::Boolean.new.cast(new_value) ? '1' : '' + else + new_value.to_s + end end end diff --git a/app/models/feedback_answer.rb b/app/models/feedback_answer.rb index 1f870a5bf..4623b0a49 100644 --- a/app/models/feedback_answer.rb +++ b/app/models/feedback_answer.rb @@ -1,7 +1,9 @@ +# typed: strict # frozen_string_literal: true # Stores what the student has answered to a single feedback question (for an exercise in a course). class FeedbackAnswer < ApplicationRecord + extend T::Sig belongs_to :feedback_question belongs_to :course belongs_to :exercise, ->(exercise) { where(course: exercise.course) }, foreign_key: :exercise_name, primary_key: :name @@ -10,63 +12,67 @@ class FeedbackAnswer < ApplicationRecord validates_with Validators::FeedbackAnswerFormatValidator + sig { returns(T::Boolean) } def replied? reply_to_feedback_answers.count > 0 end + sig { params(exercise: Exercise).returns(T::Hash[Integer, Float]) } def self.numeric_answer_averages(exercise) - result = {} + result = T.let({}, T::Hash[Integer, Float]) connection.execute(numeric_answer_averages_query(exercise).to_sql).each do |record| result[record['qid'].to_i] = record['avg'].to_f end result end + sig { params(exercise: Exercise).returns(T::Array[T::Hash[Integer, Integer]]) } def self.anonymous_numeric_answers(exercise) - by_submission = {} + by_submission = T.let({}, T::Hash[Integer, T::Hash[Integer, Integer]]) connection.execute(numeric_answers_query(exercise).to_sql).each do |record| sid = record['sid'].to_i qid = record['qid'].to_i answer = record['answer'].to_i - by_submission[sid] ||= {} - by_submission[sid][qid] = answer + (by_submission[sid] ||= {})[qid] = answer end by_submission.values.shuffle! # shuffled to minimize user identifiability end - private - def self.numeric_answers_query(exercise) - questions = FeedbackQuestion.arel_table - answers = FeedbackAnswer.arel_table + sig { params(exercise: Exercise).returns(Arel::SelectManager) } + private_class_method def self.numeric_answers_query(exercise) + questions = FeedbackQuestion.arel_table + answers = FeedbackAnswer.arel_table - numeric_answers_base_query(exercise) - .project( - questions[:id].as('qid'), - answers[:submission_id].as('sid'), - Arel.sql('CAST(answer AS int)').as('answer') - ) - end + numeric_answers_base_query(exercise) + .project( + questions[:id].as('qid'), + answers[:submission_id].as('sid'), + Arel.sql('CAST(answer AS int)').as('answer') + ) + end - def self.numeric_answer_averages_query(exercise) - questions = FeedbackQuestion.arel_table + sig { params(exercise: Exercise).returns(Arel::SelectManager) } + private_class_method def self.numeric_answer_averages_query(exercise) + questions = FeedbackQuestion.arel_table - numeric_answers_base_query(exercise) - .group(questions[:id]) - .project( - questions[:id].as('qid'), - Arel.sql('AVG(CAST(answer AS int))').as('avg') - ) - end + numeric_answers_base_query(exercise) + .group(questions[:id]) + .project( + questions[:id].as('qid'), + Arel.sql('AVG(CAST(answer AS int))').as('avg') + ) + end - def self.numeric_answers_base_query(exercise) - answers = FeedbackAnswer.arel_table - questions = FeedbackQuestion.arel_table + sig { params(exercise: Exercise).returns(Arel::SelectManager) } + private_class_method def self.numeric_answers_base_query(exercise) + answers = FeedbackAnswer.arel_table + questions = FeedbackQuestion.arel_table - answers.join(questions).on(answers[:feedback_question_id].eq(questions[:id])) - .where(questions[:kind].matches('intrange%')) - .where(answers[:course_id].eq(exercise.course_id)) - .where(answers[:exercise_name].eq(exercise.name)) - end + answers.join(questions).on(answers[:feedback_question_id].eq(questions[:id])) + .where(questions[:kind].matches('intrange%')) + .where(answers[:course_id].eq(exercise.course_id)) + .where(answers[:exercise_name].eq(exercise.name)) + end end diff --git a/app/models/feedback_question.rb b/app/models/feedback_question.rb index 556172d6a..d2047e709 100644 --- a/app/models/feedback_question.rb +++ b/app/models/feedback_question.rb @@ -1,23 +1,29 @@ +# typed: strict # frozen_string_literal: true class FeedbackQuestion < ApplicationRecord + extend T::Sig include Orderable belongs_to :course has_many :feedback_answers, dependent: :delete_all validates :course, presence: true - validates :kind, presence: true do validate_kind end + validates :kind, presence: true validates :question, presence: true + validate :validate_kind + sig { returns(String) } def title_or_question title || question end + sig { returns(T.nilable(Integer)) } def intrange? kind =~ intrange_regex end + sig { returns(T::Range[Integer]) } def intrange if kind =~ intrange_regex (Regexp.last_match(1).to_i)..(Regexp.last_match(2).to_i) @@ -26,6 +32,7 @@ def intrange end end + sig { returns(T::Hash[Symbol, T.untyped]) } def record_for_api { id: id, @@ -34,16 +41,19 @@ def record_for_api } end + sig { returns(Regexp) } + def self.intrange_regex + /^intrange\[(-?\d+)\.\.(-?\d+)\]$/ + end + private + sig { returns(Regexp) } def intrange_regex self.class.intrange_regex end - def self.intrange_regex - /^intrange\[(-?\d+)\.\.(-?\d+)\]$/ - end - + sig { void } def validate_kind - errors[:kind] << 'invalid' unless kind == 'text' || kind =~ intrange_regex + errors.add(:kind, 'invalid') unless kind == 'text' || kind =~ intrange_regex end end diff --git a/app/models/file_store.rb b/app/models/file_store.rb index e476e510f..a8e40a3b1 100644 --- a/app/models/file_store.rb +++ b/app/models/file_store.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'fileutils' @@ -9,20 +10,25 @@ # # Note: currently this class provides no concurrency control whatsoever! module FileStore + extend T::Sig + sig { returns(String) } def self.root - "#{::Rails.root}/db/files" + Rails.root.join('db/files').to_s end + sig { params(relpath: T.any(String, Pathname)).returns(String) } def self.get(relpath) File.read(abspath(relpath)) end + sig { params(relpath: T.any(String, Pathname)).returns(T.nilable(String)) } def self.try_get(relpath) get(relpath) rescue StandardError nil end + sig { params(relpath: T.any(String, Pathname), contents: String).void } def self.put(relpath, contents) path = abspath(relpath) FileUtils.mkdir_p(File.dirname(path)) @@ -33,22 +39,24 @@ def self.put(relpath, contents) tmpfile.close # Note: rename is an all-or-nothing opeartion IF the source and dest are on the same filesystem # (which we try to ensure here). Even so, a concurrent operation may breifly see a missing file. - File.rename(tmpfile.path, path) + File.rename(T.must(tmpfile.path), path) rescue StandardError tmpfile.delete end end + sig { params(relpath: T.any(String, Pathname)).returns(Time) } def self.mtime(relpath) File.mtime(abspath(relpath)) end + sig { params(relpath: T.any(String, Pathname)).returns(String) } def self.abspath(relpath) "#{root}/#{relpath}" end - private - def self.tmpdir - "#{root}/tmp" - end + sig { returns(String) } + private_class_method def self.tmpdir + "#{root}/tmp" + end end diff --git a/app/models/guest.rb b/app/models/guest.rb index 5468fe50f..d92d1c378 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,21 +1,26 @@ +# typed: strict # frozen_string_literal: true # A transient object representing a non-logged-in user (null object pattern). # # The guest is never explicitly saved in the database. class Guest < User + extend T::Sig before_save :reject_save + sig { params(args: T.untyped).void } def initialize(*args) - super(*args) + super self.login = 'guest' end + sig { returns(T::Boolean) } def guest? true end private + sig { returns(T.noreturn) } def reject_save raise 'The guest user cannot be saved!' end diff --git a/app/models/kafka_batch_update_points.rb b/app/models/kafka_batch_update_points.rb index 09178b3d0..5298ed700 100644 --- a/app/models/kafka_batch_update_points.rb +++ b/app/models/kafka_batch_update_points.rb @@ -1,6 +1,8 @@ +# typed: strict # frozen_string_literal: true class KafkaBatchUpdatePoints < ApplicationRecord + extend T::Sig belongs_to :course # Re-enqueue user progress and points updates for a given (course, user) pair. @@ -11,6 +13,8 @@ class KafkaBatchUpdatePoints < ApplicationRecord # Returns: # { status: :ok, course_id:, user_id:, progress_enqueued:, user_points_enqueued: } # or { status: :skip_, course_id:, user_id: } + # interval is checked in the body so console callers get a readable error. + sig { params(course_id: Integer, user_id: Integer, interval: T.untyped).returns(T::Hash[Symbol, T.untyped]) } def self.send_points_again_for_user_and_course(course_id, user_id, interval: nil) if interval && !interval.is_a?(ActiveSupport::Duration) raise ArgumentError, 'Invalid interval: expected an ActiveSupport::Duration (e.g. 1.week, 3.days)' @@ -43,6 +47,7 @@ def self.send_points_again_for_user_and_course(course_id, user_id, interval: nil # # Accepts optional `interval` (ActiveSupport::Duration) to restrict submissions. # Returns aggregate counts by status and total enqueued items. + sig { params(user_id: Integer, interval: T.untyped).returns(T::Hash[Symbol, Integer]) } def self.send_points_again_for_user_and_all_courses(user_id, interval: nil) if interval && !interval.is_a?(ActiveSupport::Duration) raise ArgumentError, 'Invalid interval: expected an ActiveSupport::Duration (e.g. 1.week, 3.days)' @@ -75,6 +80,7 @@ def self.send_points_again_for_user_and_all_courses(user_id, interval: nil) # then prints overall totals at the end. # Wraps the whole operation in one transaction; if it aborts, prints a clear message. # Returns overall totals hash. + sig { params(duration: T.untyped, batch_size: Integer).returns(T::Hash[Symbol, Integer]) } def self.resend_points_for_recent_submissions(duration, batch_size: 1000) unless duration.is_a?(ActiveSupport::Duration) raise ArgumentError, 'Invalid argument: expected an ActiveSupport::Duration (e.g. 1.week, 3.days)' diff --git a/app/models/migrated_submissions.rb b/app/models/migrated_submissions.rb index a0f1afbc0..167118e85 100644 --- a/app/models/migrated_submissions.rb +++ b/app/models/migrated_submissions.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class MigratedSubmissions < ApplicationRecord diff --git a/app/models/model_solution_access_log.rb b/app/models/model_solution_access_log.rb index f06a018e1..6426b0925 100644 --- a/app/models/model_solution_access_log.rb +++ b/app/models/model_solution_access_log.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class ModelSolutionAccessLog < ApplicationRecord diff --git a/app/models/model_solution_token_used.rb b/app/models/model_solution_token_used.rb index 7a4d64f83..003e762ae 100644 --- a/app/models/model_solution_token_used.rb +++ b/app/models/model_solution_token_used.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class ModelSolutionTokenUsed < ApplicationRecord diff --git a/app/models/orderable.rb b/app/models/orderable.rb index 77d1ccdcc..5ee625797 100644 --- a/app/models/orderable.rb +++ b/app/models/orderable.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true # Provides operations for active records with a position field. @@ -5,7 +6,11 @@ # Currently this is only used by FeedbackQuestion, and should probably # go away if FeedbackQuestion is ever changed to use a config file. module Orderable + extend T::Sig extend ActiveSupport::Concern + extend T::Helpers + requires_ancestor { FeedbackQuestion } + included do validates :position, uniqueness: true before_create :set_default_position @@ -13,6 +18,7 @@ module Orderable include Comparable + sig { params(other: T.untyped).returns(T.nilable(Integer)) } def <=>(other) position <=> other.position end @@ -21,27 +27,32 @@ def <=>(other) # - they operate on the database immediately # - any records that are not self and other may have a stale position afterwards + sig { void } def move_forward! - other = self.class.where("position > #{quote(position)}").order('position ASC').first + other = record_class.where("position > #{quote(position)}").order(:position).first move_after!(other) if other end + sig { void } def move_backward! - other = self.class.where("position < #{quote(position)}").order('position DESC').first + other = record_class.where("position < #{quote(position)}").order(position: :desc).first move_before!(other) if other end + sig { params(other: FeedbackQuestion).void } def move_before!(other) move!(other, '<=', -1) end + sig { params(other: FeedbackQuestion).void } def move_after!(other) move!(other, '>=', 1) end private + sig { params(other: FeedbackQuestion, op: String, delta: Integer).void } def move!(other, op, delta) - tbl = self.class.quoted_table_name + tbl = record_class.quoted_table_name conn = ActiveRecord::Base.connection conn.transaction(requires_new: true) do conn.execute("LOCK #{tbl} IN ACCESS EXCLUSIVE MODE") @@ -59,9 +70,10 @@ def move!(other, op, delta) end end + sig { void } def set_default_position if position.nil? - tbl = self.class.quoted_table_name + tbl = record_class.quoted_table_name conn = ActiveRecord::Base.connection conn.execute("LOCK #{tbl} IN ACCESS EXCLUSIVE MODE") # applies to the rest of this transaction max = conn.select_value("SELECT MAX(position) FROM #{tbl}").to_i @@ -69,7 +81,13 @@ def set_default_position end end + sig { params(value: T.untyped).returns(String) } def quote(value) - self.class.connection.quote(value) + record_class.connection.quote(value) + end + + sig { returns(T.class_of(FeedbackQuestion)) } + def record_class + T.cast(self.class, T.class_of(FeedbackQuestion)) end end diff --git a/app/models/organization.rb b/app/models/organization.rb index d37419a1d..1ca6d6c2d 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true # Organisations (schools etc.) have teachers and their own customized courses. class Organization < ApplicationRecord + extend T::Sig include Swagger::Blocks swagger_schema :Organization do @@ -52,6 +54,7 @@ class Organization < ApplicationRecord scope :participated_organizations, ->(user) { joins(:courses, courses: :awarded_points).where(awarded_points: { user_id: user.id }) } scope :visible_organizations, -> { accepted_organizations.where(hidden: false) } + sig { params(params: T.any(ActionController::Parameters, T::Hash[Symbol, T.untyped]), initial_user: User).returns(Organization) } def self.init(params, initial_user) organization = Organization.new(params.merge(verified: false, creator: initial_user)) teachership = Teachership.new(user: initial_user, organization: organization) @@ -62,39 +65,48 @@ def self.init(params, initial_user) organization end + sig { returns(T::Hash[Symbol, T.untyped]) } def org_as_json { name: name, information: information, slug: slug, logo_path: logo_path, pinned: pinned } end + sig { params(user: T.nilable(User)).returns(T::Boolean) } def teacher?(user) teachers.include? user end + sig { params(user: T.nilable(User)).returns(T::Boolean) } def member?(user) members.include?(user) end + sig { returns(T.nilable(String)) } def to_param slug end + sig { params(slug: String).returns(ActiveRecord::Relation) } def find_by_slug(slug) Organization.where(slug: slug) end + sig { params(request: ActionDispatch::Request, user: User).returns(T::Boolean) } def visibility_allowed?(request, user) return true if user.administrator? + whitelisted_ips = self.whitelisted_ips return true unless whitelisted_ips whitelisted_ips.include?(request.remote_ip) end + sig { void } def valid_slug? # slug must not be an existing route (/org/new etc) errors.add(:slug, 'is a system reserved word') if %w[new list_requests].include? slug end + sig { returns(String) } def logo_path if self.logo.attached? - Rails.application.routes.url_helpers.rails_representation_url(self.logo.variant(resize_to_fill: [100, nil]).processed, only_path: true) + Rails.application.routes.url_helpers.rails_representation_url(T.unsafe(self.logo).variant(resize_to_limit: [100, nil]).processed, only_path: true) else 'missing.png' end @@ -103,9 +115,10 @@ def logo_path 'missing.png' end + sig { returns(T.any(ActiveStorage::VariantWithRecord, ActiveStorage::Variant, String)) } def org_logo if self.logo.attached? - self.logo.variant(resize_to_fill: [100, nil]) + T.unsafe(self.logo).variant(resize_to_limit: [100, nil]) else 'missing.png' end diff --git a/app/models/organization_membership.rb b/app/models/organization_membership.rb index 8d6ca9741..e125380c1 100644 --- a/app/models/organization_membership.rb +++ b/app/models/organization_membership.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class OrganizationMembership < ApplicationRecord diff --git a/app/models/recently_changed_user_detail.rb b/app/models/recently_changed_user_detail.rb index 64af6c4bc..beeb17007 100644 --- a/app/models/recently_changed_user_detail.rb +++ b/app/models/recently_changed_user_detail.rb @@ -1,5 +1,6 @@ +# typed: strict # frozen_string_literal: true class RecentlyChangedUserDetail < ApplicationRecord - enum change_type: %i[email_changed deleted] + enum :change_type, { email_changed: 0, deleted: 1 } end diff --git a/app/models/remote_sandbox.rb b/app/models/remote_sandbox.rb index e19bd2cc3..e9bbb64c2 100644 --- a/app/models/remote_sandbox.rb +++ b/app/models/remote_sandbox.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'rest-client' @@ -5,30 +6,39 @@ require 'timeout' require 'rust_langs_cli_executor' -SUBMISSION_PACKAGING_TIMEOUT_SECONDS = 10 - # Represents a connection to a remote machine running the tmc-sandbox web service. # # These are transient objects read from the configuration file. class RemoteSandbox + extend T::Sig + sig { returns(String) } attr_reader :baseurl + # object is the sandbox's JSON error payload. class InternalSandboxError < StandardError + extend T::Sig + sig { returns(T.untyped) } attr_reader :object + sig { params(object: T.untyped).void } def initialize(object) + super() @object = object end end class SandboxUnavailableError < StandardError; end + sig { params(baseurl: String, experimental: T::Boolean).void } def initialize(baseurl, experimental = true) @baseurl = baseurl @baseurl = @baseurl.gsub(/\/+$/, '') @experimental = experimental + @capacity = T.let(nil, T.nilable(Integer)) + @parsed = T.let(nil, T.untyped) end + sig { params(submission: Submission, notify_url: String).returns(T::Boolean) } def self.try_to_send_submission_to_free_server(submission, notify_url) # dir = ExerciseDir.get(submission.exercise.clone_path) # servers = if submission.exercise && dir.safe_for_experimental_sandbox @@ -49,7 +59,7 @@ def self.try_to_send_submission_to_free_server(submission, notify_url) # ignore else Rails.logger.info "Submission #{submission.id} sent to remote sandbox at #{server.baseurl}" - Rails.logger.debug "Notify url: #{notify_url}" + Rails.logger.debug { "Notify url: #{notify_url}" } return true end end @@ -57,6 +67,7 @@ def self.try_to_send_submission_to_free_server(submission, notify_url) false end + sig { params(submission: Submission, notify_url: String).void } def send_submission(submission, notify_url) exercise = submission.exercise @@ -70,14 +81,14 @@ def send_submission(submission, notify_url) begin Timeout.timeout(SUBMISSION_PACKAGING_TIMEOUT_SECONDS) do - RustLangsCliExecutor.prepare_submission(submission.exercise.clone_path, tar_path, zip_path, {}, no_archive_prefix: true) + RustLangsCliExecutor.prepare_submission(exercise.clone_path, tar_path, zip_path, {}, no_archive_prefix: true) end rescue Timeout::Error Rails.logger.error("RustLangsCliExecutor.prepare_submission timed out after #{SUBMISSION_PACKAGING_TIMEOUT_SECONDS} seconds for submission #{submission.id}") submission.pretest_error = 'Packaging submission took too long. Please make sure your submission is not too large or has too large files, or too many files.' submission.processed = true submission.save! - return + next end File.open(tar_path, 'r') do |tar_file| @@ -85,9 +96,9 @@ def send_submission(submission, notify_url) # While Timeout::timeout is considered dangerous, this is still necessary because if this happens to block it will bring the whole server down. Timeout.timeout(10) do # The timeout is only for open_timeout and read_timeout - payload = { + payload = T.let({ file: tar_file, notify: notify_url, token: submission.secret_token, submission_id: submission.id - } + }, T::Hash[Symbol, T.untyped]) payload[:docker_image] = exercise.docker_image if exercise.docker_image payload[:memory_limit_gb] = exercise.memory_limit_gb if exercise.memory_limit_gb payload[:cpu_limit] = exercise.cpu_limit if exercise.cpu_limit @@ -97,9 +108,10 @@ def send_submission(submission, notify_url) submission.sandbox = post_url submission.save! rescue StandardError => e - puts e + Rails.logger.error(e) begin # Try to parse the response to see if the error originated from within the sandbox. + raise SandboxUnavailableError unless e.is_a?(RestClient::Exception) @parsed = JSON.parse e.response rescue StandardError raise SandboxUnavailableError @@ -126,42 +138,58 @@ def send_submission(submission, notify_url) end end + sig { returns(T::Array[RemoteSandbox]) } def self.all - @all ||= SiteSetting.value('remote_sandboxes').map { |url| RemoteSandbox.new(url) } + @all ||= T.let(SiteSetting.value('remote_sandboxes').map { |url| RemoteSandbox.new(url) }, T.nilable(T::Array[RemoteSandbox])) end + sig { returns(T::Array[RemoteSandbox]) } def self.all_experimental - @all_experimental ||= SiteSetting.value('experimental_sandboxes').map { |url| RemoteSandbox.new(url, true) } + @all_experimental ||= T.let(SiteSetting.value('experimental_sandboxes').map { |url| RemoteSandbox.new(url, true) }, T.nilable(T::Array[RemoteSandbox])) end + sig { returns(Integer) } def self.total_capacity - all.map(&:capacity).reduce(0, &:+) + all.sum(&:capacity) end + sig { returns(Integer) } def capacity @capacity ||= begin - get_status['total_instances'] + status_count('total_instances') rescue StandardError nil end @capacity || 0 end + # nil when the status lacks an integer count; 0 when the sandbox is unreachable. + sig { returns(T.nilable(Integer)) } def busy_instances - get_status['busy_instances'] + status_count('busy_instances') rescue StandardError 0 end private + # Polled every second, so a malformed status yields nil instead of a logged type error. + sig { params(key: String).returns(T.nilable(Integer)) } + def status_count(key) + count = get_status[key] + count if count.is_a?(Integer) + end + + sig { returns(T.untyped) } def get_status ActiveSupport::JSON.decode(RestClient.get(status_url)) end + sig { returns(String) } def post_url "#{@baseurl}/tasks.json" end + sig { returns(String) } def status_url "#{@baseurl}/status.json" end diff --git a/app/models/reply_to_feedback_answer.rb b/app/models/reply_to_feedback_answer.rb index c01ae7deb..39c5a19e7 100644 --- a/app/models/reply_to_feedback_answer.rb +++ b/app/models/reply_to_feedback_answer.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class ReplyToFeedbackAnswer < ApplicationRecord diff --git a/app/models/review.rb b/app/models/review.rb index 47eb31dda..59b887811 100644 --- a/app/models/review.rb +++ b/app/models/review.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true require 'natsort' class Review < ApplicationRecord + extend T::Sig include Swagger::Blocks swagger_schema :Review do @@ -31,12 +33,14 @@ class Review < ApplicationRecord property :updated_at, type: :string, example: '2016-10-10T13:22:19.554+03:00' end + sig { params(course: Course, reviewed_submissions: ActiveRecord::Relation, view_context: ActionView::Base).returns(T::Array[T::Hash[Symbol, T.untyped]]) } def self.course_reviews_json(course, reviewed_submissions, view_context) reviewed_submissions = reviewed_submissions.includes(reviews: %i[reviewer submission]) exercises = course.exercises.index_by { |e| e.name } reviewed_submissions.map do |s| s.reviews.map do |r| - available_points = exercises[r.submission.exercise_name].available_points.where(requires_review: true).map(&:name) + exercise = exercises[r.submission.exercise_name] + available_points = exercise ? exercise.available_points.where(requires_review: true).map(&:name) : [] points_not_awarded = available_points - r.points_list { submission_id: s.id, @@ -44,7 +48,7 @@ def self.course_reviews_json(course, reviewed_submissions, view_context) id: r.id, marked_as_read: r.marked_as_read, - reviewer_name: r.reviewer.display_name, + reviewer_name: r.reviewer&.display_name || '(deleted)', review_body: r.review_body, points: r.points_list.natsort, points_not_awarded: points_not_awarded.natsort, @@ -60,18 +64,21 @@ def self.course_reviews_json(course, reviewed_submissions, view_context) belongs_to :submission belongs_to :reviewer, class_name: 'User', inverse_of: :reviews + sig { returns(T::Array[String]) } def points_list points.to_s.split end + sig { params(user: User).returns(T::Boolean) } def readable_by?(user) user.administrator? || - user.id == submission.user.id || - user.teacher?(submission.course.organization) + user.id == T.must(T.must(submission).user).id || + user.teacher?(T.must(T.must(submission).course).organization) end + sig { params(user: User).returns(T::Boolean) } def manageable_by?(user) user.administrator? || - user.teacher?(submission.course.organization) + user.teacher?(T.must(T.must(submission).course).organization) end end diff --git a/app/models/session.rb b/app/models/session.rb index 43bfa05b2..f7f359385 100644 --- a/app/models/session.rb +++ b/app/models/session.rb @@ -1,11 +1,15 @@ +# typed: strict # frozen_string_literal: true class Session < ActiveRecord::SessionStore::Session + extend T::Sig + sig { returns(Integer) } def self.delete_expired - delete_all(['updated_at < ?', 1.month.ago]) + where(updated_at: ...1.month.ago).delete_all end + sig { params(user: User).returns(T::Boolean) } def belongs_to?(user) - data['user_id'] == user.id + T.unsafe(data)['user_id'] == user.id end end diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb index ad9d4f868..46ddc5fa0 100644 --- a/app/models/site_setting.rb +++ b/app/models/site_setting.rb @@ -1,36 +1,45 @@ +# typed: strict # frozen_string_literal: true # Represents the contents of `config/site.yml`. class SiteSetting + extend T::Sig + @settings = T.let(nil, T.nilable(T::Hash[String, T.untyped])) + + # Values come from YAML. + sig { params(key: T.any(String, Symbol)).returns(T.untyped) } def self.value(key) key = key.to_s raise "No such setting: #{key}" unless all_settings.key?(key) all_settings[key] end + sig { returns(T::Hash[String, T.untyped]) } def self.all_settings @settings ||= settings_from_files(settings_files) end + sig { void } def self.use_distribution_defaults! # for tests @settings = settings_from_files(settings_files.select { |f| f.end_with?('site.defaults.yml') }) end - private - def self.settings_from_files(files) - result = {} - files.each do |path| - next unless File.exist?(path) - template = ERB.new File.new(path).read - data = YAML.safe_load template.result(binding) - raise "Invalid configuration file #{path}" unless data.is_a? Hash - result = result.deep_merge(data) - end - result + sig { params(files: T::Array[String]).returns(T::Hash[String, T.untyped]) } + private_class_method def self.settings_from_files(files) + result = T.let({}, T::Hash[String, T.untyped]) + files.each do |path| + next unless File.exist?(path) + template = ERB.new File.new(path).read + data = YAML.safe_load template.result(binding) + raise "Invalid configuration file #{path}" unless data.is_a? Hash + result = result.deep_merge(data) end + result + end - def self.settings_files - config_dir = "#{Rails.root}/config" - ["#{config_dir}/site.defaults.yml", "#{config_dir}/site.yml"] - end + sig { returns(T::Array[String]) } + private_class_method def self.settings_files + config_dir = Rails.root.join('config').to_s + ["#{config_dir}/site.defaults.yml", "#{config_dir}/site.yml"] + end end diff --git a/app/models/solution.rb b/app/models/solution.rb index 002dbef3d..974371562 100644 --- a/app/models/solution.rb +++ b/app/models/solution.rb @@ -1,50 +1,65 @@ +# typed: strict # frozen_string_literal: true require 'find' # Represents a solution (files prepared by CourseRefresher). class Solution + extend T::Sig + + sig { params(exercise: Exercise).void } def initialize(exercise) @exercise = exercise end + sig { returns(Exercise) } attr_reader :exercise + sig { returns(String) } def path @exercise.solution_path end + sig { params(user: User, ignore_email_verification: T::Boolean).returns(T.nilable(T::Boolean)) } def visible_to?(user, ignore_email_verification = false) if user.administrator? true elsif !ignore_email_verification && !user.email_verified? false - elsif !@exercise.course.organization.verified + elsif !course.organization&.verified false - elsif user.teacher?(@exercise.course.organization) || user.assistant?(@exercise.course) + elsif user.teacher?(course.organization) || user.assistant?(course) true elsif user.guest? false - elsif @exercise.course.hide_submission_results? || @exercise.hide_submission_results? + elsif course.hide_submission_results? || @exercise.hide_submission_results? false - elsif @exercise.course.model_solution_visible_before_completion? && @exercise.course.enabled? + elsif course.model_solution_visible_before_completion? && course.enabled? true elsif @exercise.completed_by?(user) true - elsif !@exercise.course.visible_to?(user) + elsif !course.visible_to?(user) false elsif !@exercise.visible_to?(user) false else show_when_completed = SiteSetting.value('show_model_solutions_when_exercise_completed') show_when_expired = SiteSetting.value('show_model_solutions_when_exercise_expired') - (!@exercise.solution_visible_after.nil? && @exercise.solution_visible_after < Time.now) || + visible_after = @exercise.solution_visible_after + (!visible_after.nil? && visible_after < Time.now) || (show_when_completed && @exercise.completed_by?(user)) || (show_when_expired && @exercise.expired_for?(user)) end end + sig { returns(SourceFileList) } def files - @files ||= SourceFileList.for_solution(self) + @files ||= T.let(SourceFileList.for_solution(self), T.nilable(SourceFileList)) end + + private + sig { returns(Course) } + def course + T.must(@exercise.course) + end end diff --git a/app/models/source_file_list.rb b/app/models/source_file_list.rb index 0d5900bef..bb7cd3089 100644 --- a/app/models/source_file_list.rb +++ b/app/models/source_file_list.rb @@ -1,7 +1,7 @@ +# typed: strict # frozen_string_literal: true require 'find' -require 'pathname' require 'safe_unzipper' require 'system_commands' require 'tmc_dir_utils' @@ -9,29 +9,42 @@ # Represents a list of source code files for the web UI to display. class SourceFileList + extend T::Sig + extend T::Generic include Enumerable - MAX_SIZE = 3.megabytes - MAX_INDIVIDUAL_FILE_SIZE = 300.kilobytes + MAX_SIZE = T.let(3.megabytes, Integer) + MAX_INDIVIDUAL_FILE_SIZE = T.let(300.kilobytes, Integer) class FileRecord + extend T::Sig + sig { params(path: String, contents: String).void } def initialize(path, contents) @path = path @contents = contents - @html_prelude = nil + @html_prelude = T.let(nil, T.nilable(String)) end - attr_accessor :path, :contents, :html_prelude + sig { returns(String) } + attr_accessor :path, :contents + sig { returns(T.nilable(String)) } + attr_accessor :html_prelude end + sig { params(files: T::Array[FileRecord]).void } def initialize(files) @files = files end + Elem = type_member { { fixed: FileRecord } } + + sig { override.params(block: T.nilable(T.proc.params(file: FileRecord).void)).returns(T.any(T::Array[FileRecord], T::Enumerator[FileRecord])) } def each(&block) + return @files.each unless block @files.each(&block) end + sig { params(submission: Submission).returns(T.attached_class) } def self.for_submission(submission) Dir.mktmpdir do |tmpdir| zip_path = "#{tmpdir}/submission.zip" @@ -41,17 +54,14 @@ def self.for_submission(submission) project_dir = TmcDirUtils.find_dir_containing(tmpdir, 'src') return new([]) if project_dir.nil? - files = if project_dir == tmpdir - find_all_files_under(project_dir) - else - find_source_files_under(project_dir) - end + files = find_source_files_under(project_dir) - return new([]) unless submission.exercise + exercise = submission.exercise + return new([]) unless exercise - project_file = TmcProjectFile.for_project(submission.exercise.clone_path) + project_file = TmcProjectFile.for_project(exercise.clone_path) - project_file&.extra_student_files&.each do |f| + project_file.extra_student_files.each do |f| file = Pathname.new(File.join(project_dir, f)) if source_file?(file) && file.size <= MAX_INDIVIDUAL_FILE_SIZE files << FileRecord.new(file.to_s, file.read) @@ -64,9 +74,10 @@ def self.for_submission(submission) end end + sig { params(solution: Solution).returns(T.attached_class) } def self.for_solution(solution) project_file = TmcProjectFile.for_project(solution.exercise.clone_path) - files = if project_file&.show_all_files_in_solution + files = if project_file.show_all_files_in_solution find_all_files_under(solution.path) else find_source_files_under(solution.path) @@ -83,84 +94,90 @@ def self.for_solution(solution) new(files) end - private - def self.find_source_files_under(root_dir) - files = [] - total_size = 0 - Pathname(root_dir).realpath.find do |file| - Find.prune if file.directory? && should_skip_dir?(file) + sig { params(root_dir: T.any(String, Pathname)).returns(T::Array[FileRecord]) } + private_class_method def self.find_source_files_under(root_dir) + files = T.let([], T::Array[FileRecord]) + total_size = 0 + Pathname(root_dir).realpath.find do |file| + Find.prune if file.directory? && should_skip_dir?(file) - next unless source_file?(file) && file.size <= MAX_INDIVIDUAL_FILE_SIZE - total_size += file.size - raise 'Files are too large' if total_size > MAX_SIZE - - files << FileRecord.new(file.to_s, file.read) - end + next unless source_file?(file) && file.size <= MAX_INDIVIDUAL_FILE_SIZE + total_size += file.size + raise 'Files are too large' if total_size > MAX_SIZE - files.sort_by(&:path) + files << FileRecord.new(file.to_s, file.read) end - def self.find_all_files_under(root_dir) - files = [] - total_size = 0 - Pathname(root_dir).realpath.find do |file| - next unless file.size <= MAX_INDIVIDUAL_FILE_SIZE - total_size += file.size - raise 'Files are too large' if total_size > MAX_SIZE - name = file.to_s - next if file.directory? || name.end_with?('.zip') || name.end_with?('.tar') || name.include?('nbproject') - files << FileRecord.new(file.to_s, file.read) - end + files.sort_by(&:path) + end - files.sort_by(&:path) + sig { params(root_dir: T.any(String, Pathname)).returns(T::Array[FileRecord]) } + private_class_method def self.find_all_files_under(root_dir) + files = T.let([], T::Array[FileRecord]) + total_size = 0 + Pathname(root_dir).realpath.find do |file| + next unless file.size <= MAX_INDIVIDUAL_FILE_SIZE + total_size += file.size + raise 'Files are too large' if total_size > MAX_SIZE + name = file.to_s + next if file.directory? || name.end_with?('.zip') || name.end_with?('.tar') || name.include?('nbproject') + files << FileRecord.new(file.to_s, file.read) end - def self.source_file?(file) - return false unless file.file? - dir = file.parent.to_s - name = file.basename.to_s.downcase - name.end_with?('.java', '.jsp') || - (name.end_with?('.xml') && name != 'build.xml' && name != 'pom.xml' && name != 'nbactions.xml' && !name.end_with?('checkstyle.xml')) || - name.end_with?('.properties') || - name.end_with?('.txt') || - name.end_with?('.html') || - name.end_with?('.css') || - name.end_with?('.less') || - name.end_with?('.sass') || - name.end_with?('.js') || - name.end_with?('.c') || - name.end_with?('.cpp') || - name.end_with?('.qml') || - name.end_with?('.hpp') || - name.end_with?('.h') || - name.end_with?('.rb') || - (dir.include?('/R') && name.end_with?('.r')) || - (dir.include?('/src') && name.end_with?('.py')) || - dir.include?('/WEB-INF') || - name.end_with?('.cs') - end + files.sort_by(&:path) + end - def self.should_skip_dir?(file) - name = file.basename.to_s - name.start_with?('.') || name == 'test' || name == 'lib' || name == 'nbproject' || name == 'bower_components' || name == 'test_runner' - end + sig { params(file: Pathname).returns(T::Boolean) } + private_class_method def self.source_file?(file) + return false unless file.file? + dir = file.parent.to_s + name = file.basename.to_s.downcase + name.end_with?('.java', '.jsp') || + (name.end_with?('.xml') && name != 'build.xml' && name != 'pom.xml' && name != 'nbactions.xml' && !name.end_with?('checkstyle.xml')) || + name.end_with?('.properties') || + name.end_with?('.txt') || + name.end_with?('.html') || + name.end_with?('.css') || + name.end_with?('.less') || + name.end_with?('.sass') || + name.end_with?('.js') || + name.end_with?('.c') || + name.end_with?('.cpp') || + name.end_with?('.qml') || + name.end_with?('.hpp') || + name.end_with?('.h') || + name.end_with?('.rb') || + (dir.include?('/R') && name.end_with?('.r')) || + (dir.include?('/src') && name.end_with?('.py')) || + dir.include?('/WEB-INF') || + name.end_with?('.cs') + end - def self.make_path_names_relative(root_dir, files) - root_dir = root_dir.to_s - for file in files - file.path = file.path[(root_dir.size + 1)...file.path.length] if file.path.start_with?(root_dir) - end - end + sig { params(file: Pathname).returns(T::Boolean) } + private_class_method def self.should_skip_dir?(file) + name = file.basename.to_s + name.start_with?('.') || name == 'test' || name == 'lib' || name == 'nbproject' || name == 'bower_components' || name == 'test_runner' + end - def self.sort_source_files(files) - files.sort_by do |f| - priority = if f.path.include?('WEB-INF/') then 1 - elsif f.path.start_with?('src/main/resources') then 2 - elsif f.path == 'pom.xml' then 3 - else 0 - end + sig { params(root_dir: T.any(String, Pathname), files: T::Array[FileRecord]).void } + private_class_method def self.make_path_names_relative(root_dir, files) + root_dir = root_dir.to_s + for file in files + file.path = T.must(file.path[(root_dir.size + 1)...file.path.length]) if file.path.start_with?(root_dir) + end + end - [priority, f.path] + sig { params(files: T::Array[FileRecord]).returns(T::Array[FileRecord]) } + private_class_method def self.sort_source_files(files) + files.sort_by do |f| + priority = if f.path.include?('WEB-INF/') then 1 + elsif f.path.start_with?('src/main/resources') then 2 + elsif f.path == 'pom.xml' then 3 + else + 0 end + + [priority, f.path] end + end end diff --git a/app/models/stats.rb b/app/models/stats.rb index 0aa37bdff..383e65428 100644 --- a/app/models/stats.rb +++ b/app/models/stats.rb @@ -1,7 +1,10 @@ +# typed: strict # frozen_string_literal: true # Helpers for serving /stats. module Stats + extend T::Sig + sig { params(organization: T.nilable(Organization)).returns(T::Hash[Symbol, T.untyped]) } def self.courses(organization = nil) courses = Course.all courses = courses.where(organization: organization) unless organization.nil? @@ -11,6 +14,7 @@ def self.courses(organization = nil) } end + sig { params(course: Course).returns(T::Hash[Symbol, T.untyped]) } def self.for_course(course) keys = %i[ participants_with_submissions_count @@ -21,8 +25,9 @@ def self.for_course(course) keys.reduce({}) { |h, k| h.merge(k => send(k, course)) } end + sig { params(course: Course).returns(T::Hash[String, T::Hash[Symbol, Integer]]) } def self.exercise_group_stats(course) - result = {} + result = T.let({}, T::Hash[String, T::Hash[Symbol, Integer]]) for group_name, exercises in exercise_groups(course) result[group_name] = { participants_with_submissions_count: participants_with_submissions_count(exercises), @@ -33,15 +38,16 @@ def self.exercise_group_stats(course) result end + sig { params(course: Course).returns(T::Hash[String, T::Array[Exercise]]) } def self.exercise_groups(course) - groups = {} + groups = T.let({}, T::Hash[String, T::Array[Exercise]]) for exercise in course.exercises.where(hidden: false) - groups[exercise.exercise_group_name] ||= [] - groups[exercise.exercise_group_name] << exercise + (groups[exercise.exercise_group_name] ||= []) << exercise end groups end + sig { params(exercise_or_course: T.nilable(T.any(Course, T.any(ActiveRecord::Relation, T::Array[Exercise])))).returns(Integer) } def self.participants_with_submissions_count(exercise_or_course = nil) exercises = get_exercises(exercise_or_course) if exercises.present? @@ -53,32 +59,36 @@ def self.participants_with_submissions_count(exercise_or_course = nil) end end + sig { params(exercise_or_course: T.nilable(T.any(Course, T.any(ActiveRecord::Relation, T::Array[Exercise])))).returns(Integer) } def self.completed_exercise_count(exercise_or_course = nil) exercises = get_exercises(exercise_or_course) Exercise.count_completed(all_regular_users, exercises) end + sig { params(exercise_or_course: T.nilable(T.any(Course, T.any(ActiveRecord::Relation, T::Array[Exercise])))).returns(Integer) } def self.possible_completed_exercise_count(exercise_or_course = nil) exercises = get_exercises(exercise_or_course) participants_with_submissions_count(exercises) * exercises.size end - private - def self.all_regular_users - User.where(administrator: false) - end + sig { returns(ActiveRecord::Relation) } + private_class_method def self.all_regular_users + User.where(administrator: false) + end - def self.all_nonhidden_exercises - Exercise.where(hidden: false) - end + sig { returns(ActiveRecord::Relation) } + private_class_method def self.all_nonhidden_exercises + Exercise.where(hidden: false) + end - def self.get_exercises(exercise_or_course = nil) - if exercise_or_course.nil? - all_nonhidden_exercises - elsif exercise_or_course.is_a?(Course) - exercise_or_course.exercises.where(hidden: false) - else - exercise_or_course - end + sig { params(exercise_or_course: T.nilable(T.any(Course, T.any(ActiveRecord::Relation, T::Array[Exercise])))).returns(T.any(ActiveRecord::Relation, T::Array[Exercise])) } + private_class_method def self.get_exercises(exercise_or_course = nil) + if exercise_or_course.nil? + all_nonhidden_exercises + elsif exercise_or_course.is_a?(Course) + exercise_or_course.exercises.where(hidden: false) + else + exercise_or_course end + end end diff --git a/app/models/submission.rb b/app/models/submission.rb index 734aa7c89..78c9f813b 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'zlib' @@ -5,6 +6,7 @@ require 'submission_packager' class Submission < ApplicationRecord + extend T::Sig include Swagger::Blocks swagger_schema :Submission do @@ -77,8 +79,11 @@ class Submission < ApplicationRecord has_many :test_case_runs, -> { order(:id) }, dependent: :delete_all has_many :reviews, -> { order(:created_at) }, dependent: :delete_all do + extend T::Sig + + sig { returns(T.nilable(Review)) } def latest - order('created_at DESC').limit(1).first + T.unsafe(self).order(created_at: :desc).limit(1).first end end has_many :awarded_points, dependent: :nullify @@ -90,33 +95,41 @@ def latest before_create :set_processing_attempts_started_at before_create :set_paste_key_if_paste_available - after_save :kafka_update_progress + before_create :randomize_secret_token after_destroy :kafka_update_progress + after_save :kafka_update_progress + sig { returns(T.nilable(Integer)) } def processing_time - if processing_completed_at.nil? || processing_completed_at.nil? + completed_at = processing_completed_at + started_at = processing_attempts_started_at + if completed_at.nil? || started_at.nil? nil else - (processing_completed_at - processing_attempts_started_at).round + (completed_at - started_at).round end end + sig { returns(ActiveRecord::Relation) } def self.to_be_reprocessed unprocessed .where('processing_tried_at IS NULL OR processing_tried_at < ?', Time.now - processing_retry_interval) .where('processing_began_at IS NULL OR processing_began_at < ?', Time.now - processing_resend_interval) end + sig { returns(ActiveRecord::Relation) } def self.unprocessed where(processed: false) - .order('processing_priority DESC, processing_tried_at ASC, id ASC') + .order(processing_priority: :desc, processing_tried_at: :asc, id: :asc) end + sig { returns(Integer) } def self.unprocessed_count unprocessed.count end # Count how many submissions a user has processing for a specific exercise + sig { params(user_id: T.nilable(Integer), exercise_name: String, course_id: Integer).returns(Integer) } def self.processing_count_for_user_and_exercise(user_id, exercise_name, course_id) where( user_id: user_id, @@ -127,24 +140,27 @@ def self.processing_count_for_user_and_exercise(user_id, exercise_name, course_i end # How many times at most should a submission be (successfully) sent to a sandbox + sig { returns(Integer) } def self.max_attempts_at_processing 3 end - before_create :randomize_secret_token - + sig { returns(T::Boolean) } def tests_ran? processed? && pretest_error.nil? end + sig { returns(String) } def result_url "#{SiteSetting.value(:baseurl_for_remote_sandboxes).sub(/\/+$/, '')}/submissions/#{id}/result" end + sig { returns(T.nilable(T::Hash[String, T.untyped])) } def params ActiveSupport::JSON.decode(params_json) if params_json end + sig { params(value: T.untyped).void } def params=(value) if value.is_a?(Hash) value.each { |k, v| raise "Invalid submission param: #{k} = #{v}" unless valid_param?(k, v) } @@ -156,6 +172,7 @@ def params=(value) end end + sig { params(k: T.untyped, v: T.untyped).returns(T.nilable(Integer)) } def valid_param?(k, v) # See also: SubmissionPackager.write_extra_params k = k.to_s @@ -163,6 +180,7 @@ def valid_param?(k, v) k =~ /^[a-zA-Z\-_]+$/ && v =~ /^[a-zA-Z\-_]+$/ end + sig { params(user: User).returns(Symbol) } def status(user) if !processed? :processing @@ -177,20 +195,23 @@ def status(user) end end + sig { params(user: User).returns(T::Boolean) } def can_see_results?(user) - results_hidden = ((!exercise.nil? && exercise.hide_submission_results?) || course.hide_submission_results?) + results_hidden = ((!exercise.nil? && T.must(exercise).hide_submission_results?) || T.must(course).hide_submission_results?) !results_hidden || - course.organization.teacher?(user) || - course.assistant?(user) || + T.must(T.must(course).organization).teacher?(user) || + T.must(course).assistant?(user) || user.administrator? end + sig { returns(T::Array[String]) } def points_list points.to_s.split(' ') end # Returns a query for all submissions (including this one) by the same user # for the same course and exercise + sig { returns(ActiveRecord::Relation) } def of_same_kind Submission.where( course_id: course_id, @@ -201,16 +222,19 @@ def of_same_kind # Returns the newest submission by the same user for the same exercise, # as long as it's newer than this submission + sig { returns(T.nilable(Submission)) } def newest_of_same_kind - of_same_kind.where(['created_at > ?', created_at]).order('created_at DESC').first + of_same_kind.where(['created_at > ?', created_at]).order(created_at: :desc).first end + sig { returns(T::Boolean) } def review_dismissable? (requires_review? || requests_review?) && !review_dismissed? && !newer_submission_reviewed? end + sig { returns(Integer) } def unprocessed_submissions_before_this if !processed? i = 0 @@ -224,10 +248,12 @@ def unprocessed_submissions_before_this end end + sig { returns(String) } def downloadable_file_name "#{exercise_name}-#{id}.zip" end + sig { returns(T::Array[T::Hash[Symbol, T.untyped]]) } def test_case_records test_case_runs.map do |tcr| { @@ -242,61 +268,75 @@ def test_case_records delegate :return_file, to: :submission_data + sig { params(value: T.nilable(String)).void } def return_file=(value) build_submission_data unless submission_data - submission_data.return_file = value + T.must(submission_data).return_file = value end + sig { returns(T.nilable(String)) } def stdout build_submission_data unless submission_data - submission_data.stdout + T.must(submission_data).stdout end + sig { params(value: T.nilable(String)).void } def stdout=(value) build_submission_data unless submission_data - submission_data.stdout = value + T.must(submission_data).stdout = value end + sig { returns(T.nilable(String)) } def stderr build_submission_data unless submission_data - submission_data.stderr + T.must(submission_data).stderr end + sig { params(value: T.nilable(String)).void } def stderr=(value) build_submission_data unless submission_data - submission_data.stderr = value + T.must(submission_data).stderr = value end + sig { returns(T.nilable(String)) } def vm_log build_submission_data unless submission_data - submission_data.vm_log + T.must(submission_data).vm_log end + sig { params(value: T.nilable(String)).void } def vm_log=(value) build_submission_data unless submission_data - submission_data.vm_log = value + T.must(submission_data).vm_log = value end + sig { returns(T.nilable(String)) } def valgrind build_submission_data unless submission_data - submission_data.valgrind + T.must(submission_data).valgrind end + sig { params(value: T.nilable(String)).void } def valgrind=(value) build_submission_data unless submission_data - submission_data.valgrind = value + T.must(submission_data).valgrind = value end + # Parsed from the sandbox's JSON. + sig { returns(T.untyped) } def validations build_submission_data unless submission_data - JSON.parse submission_data.validations if submission_data.validations.present? + data = T.must(submission_data).validations + JSON.parse data if data.present? end + sig { params(value: T.nilable(String)).void } def validations=(value) build_submission_data unless submission_data - submission_data.validations = value + T.must(submission_data).validations = value end + sig { void } def raise_pretest_error_if_any unless pretest_error.nil? error = "Submission failed: #{pretest_error}." @@ -314,11 +354,12 @@ def raise_pretest_error_if_any end end + sig { params(priority: Integer).returns(T::Boolean) } def set_to_be_reprocessed!(priority = -200) self.processed = false self.times_sent_to_sandbox = 0 self.processing_priority = priority - self.processing_attempts_started_at = Time.now + self.processing_attempts_started_at = Time.zone.now self.processing_tried_at = nil self.processing_began_at = nil self.processing_completed_at = nil @@ -330,21 +371,25 @@ def set_to_be_reprocessed!(priority = -200) # When a remote sandbox returns a result to the webapp, # it authenticates the result by passing back the secret token. # Changing it in the meantime will obsolete any runs currently being processed. + sig { void } def randomize_secret_token self.secret_token = rand(10**100).to_s end # How often we try to resend if no sandbox has received it yet + sig { returns(ActiveSupport::Duration) } def self.processing_retry_interval 7.seconds end # How often we try to resend after a sandbox has received but not responded with a result + sig { returns(ActiveSupport::Duration) } def self.processing_resend_interval 5.minutes end # A dirty workaround. See http://stackoverflow.com/questions/10666808/rails-eager-loading-a-belongs-to-with-conditions-refering-to-self + sig { params(submissions: T::Enumerable[Submission]).void } def self.eager_load_exercises(submissions) keys = submissions.map { |s| "(#{connection.quote(s.course_id)}, #{connection.quote(s.exercise_name)})" } keys.uniq! @@ -358,21 +403,25 @@ def self.eager_load_exercises(submissions) end end + sig { params(user: User).returns(T::Boolean) } def paste_visible_for?(user) return false unless paste_available - return true if exercise && exercise.completed_by?(user) - return true if user.submissions.where(exercise_name: exercise.name, pretest_error: nil, all_tests_passed: true).any? + return true if exercise&.completed_by?(user) + return true if user.submissions.where(exercise_name: exercise_name, pretest_error: nil, all_tests_passed: true).any? !all_tests_passed end + sig { params(user: User).returns(T::Boolean) } def readable_by?(user) - user.administrator? || user.teacher?(course.organization) || user.assistant?(course) || user_id == user.id + user.administrator? || user.teacher?(T.must(course).organization) || user.assistant?(T.must(course)) || user_id == user.id end + sig { void } def set_paste_key_if_paste_available self.paste_key = SecureRandom.urlsafe_base64 if paste_available? end + sig { params(submissions: T::Array[T.untyped]).returns(T::Array[T::Hash[Symbol, T.untyped]]) } def self.filter_fields!(submissions) submissions.map! do |sub| { @@ -405,16 +454,20 @@ def self.filter_fields!(submissions) end private + sig { void } def set_processing_attempts_started_at - self.processing_attempts_started_at = Time.now + self.processing_attempts_started_at = Time.zone.now end + sig { void } def kafka_update_progress - return if (!self.course.moocfi_id || self.course.moocfi_id.blank?) || !self.processed - realtime = self.created_at > 1.hour.ago - first_submission = self.exercise.submissions_by(user).length == 1 - KafkaBatchUpdatePoints.create!(course_id: self.course_id, user_id: self.user_id, exercise_id: self.exercise.id, task_type: 'user_progress', realtime: realtime) - KafkaBatchUpdatePoints.create!(course_id: self.course_id, user_id: self.user_id, exercise_id: self.exercise.id, task_type: 'user_points', realtime: realtime) unless first_submission + return if (!T.must(self.course).moocfi_id || T.must(self.course).moocfi_id.blank?) || !self.processed + exercise = self.exercise + return unless exercise + realtime = T.must(self.created_at) > 1.hour.ago + first_submission = exercise.submissions_by(T.must(user)).length == 1 + KafkaBatchUpdatePoints.create!(course_id: self.course_id, user_id: self.user_id, exercise_id: exercise.id, task_type: 'user_progress', realtime: realtime) + KafkaBatchUpdatePoints.create!(course_id: self.course_id, user_id: self.user_id, exercise_id: exercise.id, task_type: 'user_points', realtime: realtime) unless first_submission KafkaBatchUpdatePoints.create!(course_id: self.course_id, user_id: self.user_id, task_type: 'user_course_points', realtime: realtime) if first_submission end end diff --git a/app/models/submission_data.rb b/app/models/submission_data.rb index 5377e85da..6e10d9b99 100644 --- a/app/models/submission_data.rb +++ b/app/models/submission_data.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true # Stores large data such as the returned ZIP and compressed I/O logs for a submission. @@ -6,75 +7,88 @@ # loaded explicitly. If these fields were directly in Submission, a result set # (with default configuration) of Submission objects would easily consume quite a bit of memory. class SubmissionData < ApplicationRecord + extend T::Sig self.primary_key = 'submission_id' belongs_to :submission + sig { returns(T.nilable(String)) } def stdout - unless stdout_compressed.nil? - @stdout ||= - uncompress(stdout_compressed) + compressed = stdout_compressed + unless compressed.nil? + @stdout ||= T.let(uncompress(compressed), T.nilable(String)) end end + sig { params(value: T.nilable(String)).void } def stdout=(value) self.stdout_compressed = (compress(value) unless value.nil?) - @stdout = value + @stdout = T.let(value, T.nilable(String)) end + sig { returns(T.nilable(String)) } def stderr - unless stderr_compressed.nil? - @stderr ||= - uncompress(stderr_compressed) + compressed = stderr_compressed + unless compressed.nil? + @stderr ||= T.let(uncompress(compressed), T.nilable(String)) end end + sig { params(value: T.nilable(String)).void } def stderr=(value) self.stderr_compressed = (compress(value) unless value.nil?) - @stderr = value + @stderr = T.let(value, T.nilable(String)) end + sig { returns(T.nilable(String)) } def vm_log - unless vm_log_compressed.nil? - @vm_log ||= - uncompress(vm_log_compressed) + compressed = vm_log_compressed + unless compressed.nil? + @vm_log ||= T.let(uncompress(compressed), T.nilable(String)) end end + sig { params(value: T.nilable(String)).void } def vm_log=(value) self.vm_log_compressed = (compress(value) unless value.nil?) - @vm_log = value + @vm_log = T.let(value, T.nilable(String)) end + sig { returns(T.nilable(String)) } def valgrind - unless valgrind_compressed.nil? - @valgrind ||= - uncompress(valgrind_compressed) + compressed = valgrind_compressed + unless compressed.nil? + @valgrind ||= T.let(uncompress(compressed), T.nilable(String)) end end + sig { params(value: T.nilable(String)).void } def valgrind=(value) self.valgrind_compressed = (compress(value) unless value.nil?) - @valgrind = value + @valgrind = T.let(value, T.nilable(String)) end + sig { returns(T.nilable(String)) } def validations - unless validations_compressed.nil? - @validations ||= - uncompress(validations_compressed) + compressed = validations_compressed + unless compressed.nil? + @validations ||= T.let(uncompress(compressed), T.nilable(String)) end end + sig { params(value: T.nilable(String)).void } def validations=(value) self.validations_compressed = (compress(value) unless value.nil?) - @validations = value + @validations = T.let(value, T.nilable(String)) end private + sig { params(text: String).returns(String) } def compress(text) Zlib::Deflate.deflate(text) end + sig { params(compressed_text: String).returns(String) } def uncompress(compressed_text) Zlib::Inflate.inflate(compressed_text).force_encoding('UTF-8') end diff --git a/app/models/teachership.rb b/app/models/teachership.rb index de3bfd431..ce17b67c9 100644 --- a/app/models/teachership.rb +++ b/app/models/teachership.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class Teachership < ApplicationRecord diff --git a/app/models/test_case_run.rb b/app/models/test_case_run.rb index 417511b42..22851e4b0 100644 --- a/app/models/test_case_run.rb +++ b/app/models/test_case_run.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class TestCaseRun < ApplicationRecord diff --git a/app/models/tmc_project_file.rb b/app/models/tmc_project_file.rb index e12928568..79355c788 100644 --- a/app/models/tmc_project_file.rb +++ b/app/models/tmc_project_file.rb @@ -1,11 +1,15 @@ +# typed: strict # frozen_string_literal: true -require 'pathname' - # Represents a `.tmcproject.yml` file. class TmcProjectFile + extend T::Sig + # data is the parsed YAML, so it may be anything. + sig { params(data: T.untyped).void } def initialize(data) - @extra_student_files = [] + @extra_student_files = T.let([], T::Array[String]) + @show_all_files_in_solution = T.let(nil, T.untyped) + @data = T.let(nil, T.untyped) return unless data.is_a?(Hash) @extra_student_files = data['extra_student_files'] if data['extra_student_files'].is_a?(Array) @@ -14,9 +18,12 @@ def initialize(data) @data = data end + sig { returns(T::Array[String]) } attr_reader :extra_student_files + sig { returns(T.untyped) } attr_reader :show_all_files_in_solution + sig { params(project_dir: T.any(String, Pathname)).returns(TmcProjectFile) } def self.for_project(project_dir) file = Pathname(project_dir) + '.tmcproject.yml' TmcProjectFile.new(YAML.load_file(file)) @@ -25,10 +32,12 @@ def self.for_project(project_dir) end private - def self.empty + sig { returns(TmcProjectFile) } + private_class_method def self.empty TmcProjectFile.new({}) end + sig { void } def filter_extra_student_files! @extra_student_files.reject! { |path| path.include?('..') } end diff --git a/app/models/uncomputed_unlock.rb b/app/models/uncomputed_unlock.rb index 80fbc2fd6..991dd6f92 100644 --- a/app/models/uncomputed_unlock.rb +++ b/app/models/uncomputed_unlock.rb @@ -1,15 +1,16 @@ +# typed: strict # frozen_string_literal: true -require 'set' - # Keeps track of whether a (course, user)'s unlocks have yet to be computed, enabling lazy computation. # A course refresh populates this table and the UnlockComputerTask background task # consumes it by calling Unlock.refresh_unlocks on the entries. Code that needs # up-to-date unlocks should call UncomputedUnlock.resolve for the (course, user) first. class UncomputedUnlock < ApplicationRecord + extend T::Sig belongs_to :course belongs_to :user + sig { params(course: Course).void } def self.create_all_for_course(course) transaction do course_users = User.course_students(course).pluck(:id) @@ -26,13 +27,15 @@ def self.create_all_for_course(course) # Primarily used for demoing unlock date change through gui, this version of the method creates uncomputed unlocks # for every user, not requiring the user to have awarded points from the course. This method will most likely be # left unused in production build. + sig { params(course: Course).void } def self.create_all_for_course_eager(course) transaction do - rows_to_insert = User.all.pluck(:id).map { |uid| { course_id: course.id, user_id: uid } } + rows_to_insert = User.pluck(:id).map { |uid| { course_id: course.id, user_id: uid } } UncomputedUnlock.create!(rows_to_insert) end end + sig { params(course: Course, user: User).void } def self.resolve(course, user) if find_by(course_id: course, user_id: user) Unlock.refresh_unlocks(course, user) diff --git a/app/models/unlock.rb b/app/models/unlock.rb index 68f5d5c78..db26a5db4 100644 --- a/app/models/unlock.rb +++ b/app/models/unlock.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true @@ -16,21 +17,24 @@ # starting the timer prematurely. # class Unlock < ApplicationRecord + extend T::Sig belongs_to :user belongs_to :course belongs_to :exercise, ->(unlock) { where(course: unlock.course) }, foreign_key: :exercise_name, primary_key: :name # the DB validates uniqueness for (user_id, course_id, :exercise_name) + sig { params(course: Course, user: User).void } def self.refresh_unlocks(course, user) time = Time.zone.now Unlock.transaction do unlocks = course.unlocks.where(user_id: user.id) by_exercise_name = unlocks.index_by { |u| u.exercise_name } fast_refresh_unlocks_impl(course, user, by_exercise_name) - UncomputedUnlock.where(course_id: course.id, user_id: user.id).where('created_at < ?', time).delete_all + UncomputedUnlock.where(course_id: course.id, user_id: user.id).where(created_at: ...time).delete_all end end + sig { params(exercises: T::Enumerable[Exercise], user: User).void } def self.unlock_exercises(exercises, user) Unlock.transaction do for ex in exercises @@ -45,47 +49,49 @@ def self.unlock_exercises(exercises, user) end end - private - def self.refresh_unlocks_impl(course, user, user_unlocks_by_exercise_name) - course.exercises.enabled.each do |exercise| - existing = user_unlocks_by_exercise_name[exercise.name] - exists = !!existing - may_exist = exercise.requires_unlock? && exercise.unlock_spec_obj.permits_unlock_for?(user) - if !exists && may_exist && !exercise.requires_explicit_unlock? - Unlock.create!( - user: user, - course: course, - exercise: exercise, - valid_after: exercise.unlock_spec_obj.valid_after - ) - elsif exists && !may_exist - user_unlocks_by_exercise_name[exercise.name].destroy - elsif exists && may_exist && exercise.unlock_spec_obj.valid_after != existing.valid_after - existing.valid_after = exercise.unlock_spec_obj.valid_after - existing.save! - end + sig { params(course: Course, user: User, user_unlocks_by_exercise_name: T::Hash[T.nilable(String), Unlock]).void } + private_class_method def self.refresh_unlocks_impl(course, user, user_unlocks_by_exercise_name) + course.exercises.enabled.each do |exercise| + existing = user_unlocks_by_exercise_name[exercise.name] + exists = !!existing + may_exist = exercise.requires_unlock? && exercise.unlock_spec_obj.permits_unlock_for?(user) + if !exists && may_exist && !exercise.requires_explicit_unlock? + Unlock.create!( + user: user, + course: course, + exercise: exercise, + valid_after: exercise.unlock_spec_obj.valid_after + ) + elsif exists && !may_exist + existing.destroy + elsif exists && may_exist && exercise.unlock_spec_obj.valid_after != existing.valid_after + # Active Record casts any Time to TimeWithZone; Tapioca types the writer as TimeWithZone only. + existing.valid_after = T.unsafe(exercise.unlock_spec_obj.valid_after) + existing.save! end end + end - def self.fast_refresh_unlocks_impl(course, user, user_unlocks_by_exercise_name) - # We can share the calculation between the exercises that have the same condition - new_unlocks = [] - course.exercises.enabled.group_by { |o| o.unlock_spec }.each do |_spec, exercises| - exercise = exercises.first - existing = exercises.all? { |ex| user_unlocks_by_exercise_name[ex.name] } - exists = !!existing - may_exist = exercise.requires_unlock? && exercise.unlock_spec_obj.permits_unlock_for?(user) - next unless !exists && may_exist && !exercise.requires_explicit_unlock? + sig { params(course: Course, user: User, user_unlocks_by_exercise_name: T::Hash[T.nilable(String), Unlock]).void } + private_class_method def self.fast_refresh_unlocks_impl(course, user, user_unlocks_by_exercise_name) + # We can share the calculation between the exercises that have the same condition + new_unlocks = T.let([], T::Array[Unlock]) + course.exercises.enabled.group_by { |o| o.unlock_spec }.each do |_spec, exercises| + exercise = T.must(exercises.first) + existing = exercises.all? { |ex| user_unlocks_by_exercise_name[ex.name] } + exists = !!existing + may_exist = exercise.requires_unlock? && exercise.unlock_spec_obj.permits_unlock_for?(user) + next unless !exists && may_exist && !exercise.requires_explicit_unlock? - exercises.select { |e| !user_unlocks_by_exercise_name[e.name] }.each do |ex| - new_unlocks << Unlock.new( - user: user, - course: course, - exercise: ex, - valid_after: ex.unlock_spec_obj.valid_after - ) - end + exercises.select { |e| !user_unlocks_by_exercise_name[e.name] }.each do |ex| + new_unlocks << Unlock.new( + user: user, + course: course, + exercise: ex, + valid_after: ex.unlock_spec_obj.valid_after + ) end - Unlock.import new_unlocks, on_duplicate_key_ignore: true end + Unlock.import new_unlocks, on_duplicate_key_ignore: true + end end diff --git a/app/models/unlock_spec.rb b/app/models/unlock_spec.rb index 7fbb694c3..d5b9ba96c 100644 --- a/app/models/unlock_spec.rb +++ b/app/models/unlock_spec.rb @@ -1,18 +1,31 @@ +# typed: strict # frozen_string_literal: true require 'date_and_time_utils' # Parses and abstracts specification in the "unlocked_after" field of a `metadata.yml` file. class UnlockSpec # (the name of this class is unfortunate as it confuses IDEs when jumping to tests) + extend T::Sig class InvalidSyntaxError < StandardError; end + # Aliases so the per-instance T.lets below don't rebuild these types on every UnlockSpec.new. + Conditions = T.type_alias { T::Array[T.proc.params(user: User).returns(T::Boolean)] } + Describers = T.type_alias { T::Array[T.proc.params(user: User).returns(T.nilable(String))] } + OptionalTime = T.type_alias { T.nilable(T.any(Time, ActiveSupport::TimeWithZone, DateTime)) } + private_constant :Conditions, :Describers, :OptionalTime + + # course may be nil while an exercise is being built; only progress conditions need it. + # conditions is a decoded JSON array. + sig { params(course: T.nilable(Course), conditions: T::Array[T.untyped]).void } def initialize(course, conditions) @course = course @raw_spec = conditions - @conditions = [] - @universal_descriptions = [] - @describers = [] - @datetime_count = 0 + @conditions = T.let([], Conditions) + @universal_descriptions = T.let([], T::Array[String]) + @describers = T.let([], Describers) + @datetime_count = T.let(0, Integer) + @valid_after = T.let(nil, OptionalTime) + @depends_on_other_exercises = T.let(false, T::Boolean) conditions.each_with_index do |condition, i| parse_condition(condition.to_s.strip) if condition.to_s.present? rescue InvalidSyntaxError @@ -22,41 +35,50 @@ def initialize(course, conditions) end end + sig { params(course: T.nilable(Course), string: T.nilable(String)).returns(T.attached_class) } def self.from_str(course, string) return new(course, []) if string.nil? new(course, ActiveSupport::JSON.decode(string)) end + sig { returns(T::Boolean) } def empty? # No unlock conditions - no Unlock object required to be unlocked @conditions.empty? && @valid_after.nil? end # Whether the raw spec is only a date, so the clock alone decides the unlock. # Reads the JSON without parsing the spec, since parsing a progress condition queries the course's exercises. + sig { params(string: T.nilable(String)).returns(T::Boolean) } def self.date_only?(string) conditions = raw_conditions(string) conditions.any? && conditions.all? { |c| DateAndTimeUtils.looks_like_date_or_time(c) } end # The raw spec's conditions other than dates. Works on specs that no longer parse. + sig { params(string: T.nilable(String)).returns(T::Array[String]) } def self.non_date_conditions(string) raw_conditions(string).reject { |c| DateAndTimeUtils.looks_like_date_or_time(c) } end + sig { params(string: T.nilable(String)).returns(T::Array[String]) } def self.raw_conditions(string) return [] if string.nil? ActiveSupport::JSON.decode(string).map { |c| c.to_s.strip }.reject(&:empty?) end private_class_method :raw_conditions + sig { returns(T::Array[T.untyped]) } attr_reader :raw_spec + sig { returns(T.nilable(T.any(Time, ActiveSupport::TimeWithZone, DateTime))) } attr_reader :valid_after + sig { returns(T::Array[String]) } attr_reader :universal_descriptions + sig { params(user: User).returns(T.nilable(String)) } def description_for(user) - descrs = @describers.map { |d| d.call(user) }.reject(&:nil?) + descrs = @describers.filter_map { |d| d.call(user) } unless descrs.empty? - last = descrs.pop + last = T.must(descrs.pop) 'To unlock this exercise, you must ' + if descrs.empty? last else @@ -65,18 +87,31 @@ def description_for(user) end end + sig { params(user: User).returns(T::Boolean) } def permits_unlock_for?(user) @conditions.all? { |c| c.call(user) } end + sig { returns(T::Boolean) } def depends_on_other_exercises? !!@depends_on_other_exercises end + sig { params(spec: String, exercise: Exercise).returns(T::Boolean) } + def self.parsable?(spec, exercise) + UnlockSpec.new(exercise.course, ActiveSupport::JSON.decode(spec)) # Parses spec and fails if invalid + true + rescue InvalidSyntaxError + raise + rescue StandardError + raise InvalidSyntaxError, $! + end + private + sig { params(str: String).void } def parse_condition(str) if DateAndTimeUtils.looks_like_date_or_time(str) - time = DateAndTimeUtils.to_time(str) + time = T.must(DateAndTimeUtils.to_time(str)) raise 'Date out of range' if time.year > 10_000 || time.year < 1 # Prevent database datetime overflow raise "You can't have multiple unlock dates for the same exercise" if @datetime_count > 0 # Multiple unlock dates don't work correctly @datetime_count += 1 @@ -87,31 +122,32 @@ def parse_condition(str) # TODO: This does not work well with soft deadlines elsif str =~ /^points?\s+(\S+.*)$/ - points = Regexp.last_match(1).split(' ').map(&:strip).reject(&:empty?) + points = T.must(Regexp.last_match(1)).split(' ').map(&:strip).reject(&:empty?) @depends_on_other_exercises = true @conditions << lambda do |u| - AwardedPoint.where(user_id: u.id, course_id: @course.id, name: points).count == points.count + AwardedPoint.where(user_id: u.id, course_id: T.must(@course).id, name: points).count == points.count end @universal_descriptions << "the following points: #{points.join(' ')}" @describers << lambda do |u| - awarded = AwardedPoint.where(user_id: u.id, course_id: @course.id, name: points).map(&:name) + awarded = AwardedPoint.where(user_id: u.id, course_id: T.must(@course).id, name: points).map(&:name) "get the following points: #{(points - awarded).join(' ')}" end elsif str =~ /^(\d+)[%]\s+(?:in|of|from)\s+(\S+)$/ percentage_str = Regexp.last_match(1) percentage = percentage_str.to_f / 100.0 - group = Regexp.last_match(2) - check_group_or_exercise_exists(@course, group) + group = T.must(Regexp.last_match(2)) + course = T.must(@course) + check_group_or_exercise_exists(course, group) @depends_on_other_exercises = true @conditions << lambda do |u| - available, awarded, late = available_and_awarded_and_awarded_late(@course, group, u) - (awarded.count.to_f + late.count.to_f * @course.soft_deadline_point_multiplier) / available.count.to_f >= percentage - 0.0001 + available, awarded, late = available_and_awarded_and_awarded_late(course, group, u) + (awarded.count.to_f + (late.count.to_f * course.soft_deadline_point_multiplier)) / available.count.to_f >= percentage - 0.0001 end @universal_descriptions << "#{percentage_str}% from #{group}" @describers << lambda do |u| - available, awarded, late = available_and_awarded_and_awarded_late(@course, group, u) - remaining = ((percentage - 0.0001) * available.count.to_f).ceil - (awarded.count.to_f + late.count.to_f * @course.soft_deadline_point_multiplier).round(2) + available, awarded, late = available_and_awarded_and_awarded_late(course, group, u) + remaining = ((percentage - 0.0001) * available.count.to_f).ceil - (awarded.count.to_f + (late.count.to_f * course.soft_deadline_point_multiplier)).round(2) if remaining > 0 "get #{remaining} more #{plural(remaining, 'point')} from #{group}" end @@ -119,16 +155,17 @@ def parse_condition(str) elsif str =~ /^(\d+)\s+exercises?\s+(?:in|of|from)\s+(\S+)$/ num_exercises = Regexp.last_match(1).to_i - group = Regexp.last_match(2) - check_group_or_exercise_exists(@course, group) + group = T.must(Regexp.last_match(2)) + course = T.must(@course) + check_group_or_exercise_exists(course, group) @depends_on_other_exercises = true @conditions << lambda do |u| - required_exercises = @course.exercises_by_name_or_group(group) + required_exercises = course.exercises_by_name_or_group(group) required_exercises.count { |ex| ex.completed_by?(u) } >= num_exercises end @universal_descriptions << "#{num_exercises} #{plural(num_exercises, 'exercise')} from #{group}" @describers << lambda do |u| - required_exercises = @course.exercises_by_name_or_group(group) + required_exercises = course.exercises_by_name_or_group(group) remaining = num_exercises - required_exercises.count { |ex| ex.completed_by?(u) } if remaining > 0 "complete #{remaining} more #{plural(remaining, 'exercise')} from #{group}" @@ -137,16 +174,17 @@ def parse_condition(str) elsif str =~ /^(\d+)\s+points?\s+(?:in|of|from)\s+(\S+)$/ num_points = Regexp.last_match(1).to_i - group = Regexp.last_match(2) - check_group_or_exercise_exists(@course, group) + group = T.must(Regexp.last_match(2)) + course = T.must(@course) + check_group_or_exercise_exists(course, group) @depends_on_other_exercises = true @conditions << lambda do |u| - awarded = available_and_awarded_and_awarded_late(@course, group, u)[1] + awarded = available_and_awarded_and_awarded_late(course, group, u)[1] awarded.count >= num_points end @universal_descriptions << "#{num_points} #{plural(num_points, 'point')} from #{group}" @describers << lambda do |u| - awarded = available_and_awarded_and_awarded_late(@course, group, u)[1] + awarded = available_and_awarded_and_awarded_late(course, group, u)[1] remaining = num_points - awarded.count if remaining > 0 "get #{remaining} more #{plural(remaining, 'point')} from #{group}" @@ -157,12 +195,14 @@ def parse_condition(str) end end + sig { params(course: Course, group_or_exercise_name: String).void } def check_group_or_exercise_exists(course, group_or_exercise_name) if course.exercises_by_name_or_group(group_or_exercise_name, true).empty? raise "No such exercise or exercise group: #{group_or_exercise_name}. Remember that exercises need to be specified with their full name including their group." end end + sig { params(course: Course, group_or_exercise_name: String, user: User).returns([T::Array[String], T::Array[AwardedPoint], T::Array[AwardedPoint]]) } def available_and_awarded_and_awarded_late(course, group_or_exercise_name, user) required_exercises = course.exercises_by_name_or_group(group_or_exercise_name) .select { |e| e.hide_submission_results == false && e.enabled? } @@ -175,6 +215,7 @@ def available_and_awarded_and_awarded_late(course, group_or_exercise_name, user) [available, awarded, late] end + sig { params(n: Numeric, word: String).returns(String) } def plural(n, word) if n == 1 word @@ -182,13 +223,4 @@ def plural(n, word) word.pluralize end end - - def self.parsable?(spec, exercise) - UnlockSpec.new(exercise.course, ActiveSupport::JSON.decode(spec)) # Parses spec and fails if invalid - true - rescue InvalidSyntaxError - raise - rescue StandardError - raise InvalidSyntaxError, $! - end end diff --git a/app/models/user.rb b/app/models/user.rb index 781abaa59..e72c5da07 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,8 +1,10 @@ +# typed: strict # frozen_string_literal: true require 'app_secrets' class User < ApplicationRecord + extend T::Sig include Comparable include Gravtastic include Swagger::Blocks @@ -26,7 +28,7 @@ class User < ApplicationRecord has_many :uncomputed_unlocks, dependent: :delete_all has_many :reviews, foreign_key: :reviewer_id, inverse_of: :reviewer, dependent: :nullify has_many :course_template_refreshes, dependent: :nullify - has_many :course_notifications + has_many :course_notifications, foreign_key: :sender_id, inverse_of: :sender has_many :comments has_many :certificates has_many :teacherships, dependent: :destroy @@ -69,9 +71,11 @@ class User < ApplicationRecord scope :legitimate_students, -> { where(legitimate_student: true) } scope :non_legitimate_students, -> { where(legitimate_student: false) } + sig { returns(T.nilable(String)) } attr_accessor :password before_save :encrypt_password + sig { params(course: Course).returns(ActiveRecord::Relation) } def self.course_students(course) joins(:awarded_points) .where(awarded_points: { course_id: course.id }) @@ -79,46 +83,60 @@ def self.course_students(course) end # TODO: Later after enrollment has implemented, this should use it instead + sig { params(organization: Organization).returns(ActiveRecord::Relation) } def self.organization_students(organization) joins(awarded_points: :course) .where(courses: { organization_id: organization.id }) .group('users.id') end + sig { params(course: Course, sheetname: String).returns(ActiveRecord::Relation) } def self.course_sheet_students(course, sheetname) AwardedPoint.users_in_course_with_sheet(course, sheetname) end + sig { returns(String) } def username login # 'login' is a legacy name that ought to be refactored out some day end + sig { params(name: String).void } def username=(name) self.login = name end # May eventually be separate from username + sig { returns(String) } def display_name username end - def field_value(field) - field_value_record(field).value + sig { params(field_name: String).returns(String) } + def field_value_by_name(field_name) + field_value_record_by_name(field_name).value end + sig { params(field: UserField).returns(T.any(String, T::Boolean)) } def field_ruby_value(field) field_value_record(field).ruby_value end + sig { params(field: UserField).returns(UserFieldValue) } def field_value_record(field) - value = user_field_values.to_a.select { |v| v.field_name == field.name }.first + field_value_record_by_name(field.name) + end + + sig { params(field_name: String).returns(UserFieldValue) } + def field_value_record_by_name(field_name) + value = user_field_values.to_a.find { |v| v.field_name == field_name } unless value - value = UserFieldValue.new(field_name: field.name, user_id: id, value: '') + value = UserFieldValue.new(field_name: field_name, user_id: id, value: '') user_field_values << value end value end + sig { params(filter_params: T.any(ActionController::Parameters, T::Hash[String, T.untyped])).returns(ActiveRecord::Relation) } def self.filter_by(filter_params) users = includes(:user_field_values) @@ -142,10 +160,12 @@ def self.filter_by(filter_params) users end + sig { returns(T::Boolean) } def guest? false end + sig { params(submitted_password: T.nilable(String)).returns(T::Boolean) } def has_password?(submitted_password) if !salt normalized = normalize_password(submitted_password) @@ -169,6 +189,7 @@ def has_password?(submitted_password) # The user when the password is accepted, nil otherwise. Use .authenticate_with_status when the # outcome is shown to the user, so that a delegation failure is not reported as a wrong password. + sig { params(login: T.nilable(String), submitted_password: T.nilable(String)).returns(T.nilable(User)) } def self.authenticate(login, submitted_password) user, status = authenticate_with_status(login, submitted_password) status == :accepted ? user : nil @@ -178,6 +199,7 @@ def self.authenticate(login, submitted_password) # :unavailable when courses.mooc.fi could not be reached, or :misconfigured when the account # cannot be delegated at all and only an admin can repair it. A found user is returned whatever # the status, so sign in only on :accepted. + sig { params(login: T.nilable(String), submitted_password: T.nilable(String)).returns([T.nilable(User), Symbol]) } def self.authenticate_with_status(login, submitted_password) return [nil, :rejected] unless login login = login.strip @@ -201,12 +223,14 @@ def self.authenticate_with_status(login, submitted_password) end # The password is stored in courses.mooc.fi and we have the id needed to delegate auth/changes. + sig { returns(T::Boolean) } def managed_externally? password_managed_by_courses_mooc_fi && courses_mooc_fi_user_id.present? end # Flagged as managed by courses.mooc.fi but missing the delegation id: a misconfigured state in # which local credentials must never be used as a fallback. + sig { returns(T::Boolean) } def externally_managed_without_target? password_managed_by_courses_mooc_fi && courses_mooc_fi_user_id.blank? end @@ -214,6 +238,7 @@ def externally_managed_without_target? # :accepted, :rejected when courses.mooc.fi judged the password wrong, or :unavailable when it # could not be consulted. Raises nothing, so that an outage is never mistaken for a rejection. + sig { params(submitted_password: T.nilable(String)).returns(Symbol) } def courses_mooc_fi_authentication_status(submitted_password) auth_url = courses_mooc_fi_url('/api/v0/tmc-server/users/authenticate') @@ -267,6 +292,7 @@ def courses_mooc_fi_authentication_status(submitted_password) + sig { params(old_password: T.nilable(String), new_password: T.nilable(String)).returns(T::Boolean) } def update_password_via_courses_mooc_fi(old_password, new_password) update_url = courses_mooc_fi_url('/api/v0/tmc-server/users/change-password') @@ -319,6 +345,7 @@ def update_password_via_courses_mooc_fi(old_password, new_password) end end + sig { params(password: T.nilable(String)).returns(T::Boolean) } def post_new_user_to_courses_mooc_fi(password) Rails.logger.info("Posting new user #{self.email} to courses.mooc.fi") create_url = courses_mooc_fi_url('/api/v0/tmc-server/users/create') @@ -385,6 +412,7 @@ def post_new_user_to_courses_mooc_fi(password) # so the user is passwordless until generate_password_reset_link runs. Local state is only # updated after a confirmed remote success, so a failure (e.g. re-creating a soft-deleted linked # id collides on the primary key) never leaves the account half-migrated. + sig { returns(T::Hash[Symbol, T.untyped]) } def force_migrate_to_courses_mooc_fi conn = courses_mooc_fi_connection @@ -422,6 +450,7 @@ def force_migrate_to_courses_mooc_fi # Live, display-only read of courses.mooc.fi's view of this user -- never gates any action. # nil means genuinely unknown (unconfigured, network error, unexpected response), not "not migrated". + sig { returns(T.nilable(T::Hash[Symbol, T.untyped])) } def courses_mooc_fi_migration_status return nil if SiteSetting.value('courses_mooc_fi_base_url').blank? @@ -456,6 +485,7 @@ def courses_mooc_fi_migration_status nil end + sig { returns(T.nilable(String)) } def courses_mooc_fi_profile_url return nil if courses_mooc_fi_user_id.blank? return nil if SiteSetting.value('courses_mooc_fi_base_url').blank? @@ -463,40 +493,49 @@ def courses_mooc_fi_profile_url courses_mooc_fi_url("/manage/users/#{courses_mooc_fi_user_id}") end + sig { returns(T.nilable(ActionToken)) } def password_reset_key action_tokens.find { |t| t.action == 'reset_password' } end + sig { params(course: Course, point_name: String).returns(T::Boolean) } def has_point?(course, point_name) awarded_points.where(course_id: course.id, name: point_name).any? end + sig { params(course: Course, point_names: T::Array[String]).returns(T::Boolean) } def has_points?(course, point_names) existing = awarded_points.where(course_id: course.id, name: point_names).map(&:name) point_names.all? { |pt| existing.include?(pt) } end + sig { params(other: T.untyped).returns(T.nilable(Integer)) } def <=>(other) login.downcase <=> other.login.downcase end + sig { params(organization: T.nilable(Organization)).returns(T::Boolean) } def teacher?(organization) organizations.include? organization end + sig { params(organization: Organization).returns(T.nilable(Teachership)) } def teachership(organization) Teachership.find_by(user_id: self, organization_id: organization) end + sig { params(course: Course).returns(T::Boolean) } def assistant?(course) assisted_courses.exists?(course.id) end + sig { params(organization: T.nilable(Organization)).returns(T::Boolean) } def member?(organization) memberships.include?(organization) end # TODO: this might need optimizing for minimizing sql queries made + sig { params(user: User).returns(T::Boolean) } def readable_by?(user) user.administrator? || id == user.id || @@ -504,6 +543,7 @@ def readable_by?(user) visible_to_assistant?(user) end + sig { params(teacher: User).returns(T::Boolean) } def visible_to_teacher?(teacher) courses = Course.joins(organization: :teacherships).where(teacherships: { user_id: teacher.id }) courses.each do |c| @@ -512,6 +552,7 @@ def visible_to_teacher?(teacher) false end + sig { params(assistant: User).returns(T::Boolean) } def visible_to_assistant?(assistant) assistant.assisted_courses.each do |c| return true if student_in_course?(c) @@ -519,10 +560,12 @@ def visible_to_assistant?(assistant) false end + sig { params(c: Course).returns(T::Boolean) } def student_in_course?(c) in?(User.course_students(c)) end + sig { params(organization: Organization).returns(T::Boolean) } def student_in_organization?(organization) organization.courses.each do |c| return true if student_in_course?(c) @@ -530,6 +573,7 @@ def student_in_organization?(organization) false end + sig { returns(T.nilable(T::Array[Integer])) } def teaching_in_courses if !assistantships.empty? Course.where(id: assistantships.pluck(:course_id)).ids @@ -538,14 +582,17 @@ def teaching_in_courses end end + sig { returns(T::Array[Integer]) } def teaching_in_organizations Teachership.where(user: self).pluck(:organization_id) end + sig { params(course: Course).returns(T.nilable(Assistantship)) } def assistantship(course) Assistantship.find_by(user_id: self, course_id: course) end + sig { returns(T::Hash[Integer, T::Array[T::Hash[Symbol, T.untyped]]]) } def courses_with_submissions exercises = Exercise.arel_table submissions = Submission.arel_table @@ -555,17 +602,15 @@ def courses_with_submissions .project(exercises[:course_id], exercises[:name], exercises[:id], submissions[:id].count, Arel::Nodes::SqlLiteral.new('bool_or(submissions.all_tests_passed)').as('all_tests_passed'), Arel::Nodes::SqlLiteral.new('ARRAY_AGG(DISTINCT available_points.name order by available_points.name) = ARRAY_AGG(DISTINCT awarded_points.name order by awarded_points.name)').as('got_all_points'), Arel::Nodes::SqlLiteral.new("STRING_AGG(DISTINCT available_points.name, ' ' order by available_points.name)").as('available_points'), Arel::Nodes::SqlLiteral.new("STRING_AGG(DISTINCT awarded_points.name, ' ' order by awarded_points.name)").as('awarded_points')) sql = query.to_sql - result = {} + result = T.let({}, T::Hash[Integer, T::Array[T::Hash[Symbol, T.untyped]]]) ActiveRecord::Base.connection.execute(sql).each do |record| - # {"course_id"=>"8", "name"=>"viikkob-B.1.Opiskelijanumero", "count"=>"1", "all_tests_passed"=>"t", "got_all_points"=>"t", "available_points"=>"{B.1}", "awarded_points"=>"{B.1}"} course_id = record['course_id'].to_i - result[course_id] ||= [] - result[course_id] << { + (result[course_id] ||= []) << { exercise_name: record['name'], exercise_id: record['id'].to_i, submissions_count: record['count'].to_i, - all_tests_passed: record['all_tests_passed'] == 't', - got_all_points: record['got_all_points'] == 't', + all_tests_passed: record['all_tests_passed'] == true, + got_all_points: record['got_all_points'] == true, available_points: record['available_points'].nil? ? nil : record['available_points'].split(' '), awarded_points: record['awarded_points'].nil? ? nil : record['awarded_points'].split(' ') } @@ -574,14 +619,16 @@ def courses_with_submissions result end + sig { returns(T::Array[Integer]) } def course_ids - results = [] + results = T.let([], T::Array[Integer]) ActiveRecord::Base.connection.execute(course_ids_arel.to_sql).each do |record| results << record['course_id'] end results end + sig { returns(String) } def generate_password_reset_link key = ActionToken.generate_password_reset_key_for(self) settings = SiteSetting.value('emails') @@ -589,17 +636,21 @@ def generate_password_reset_link url end + sig { params(query: T.nilable(String)).returns(ActiveRecord::Relation) } def self.search(query) return User.none unless query User.where('lower(email) LIKE ?', "%#{query.strip.downcase}%") end # Count how many submissions this user has processing for a specific exercise + sig { params(exercise_name: String, course_id: Integer).returns(Integer) } def processing_submissions_count_for_exercise(exercise_name, course_id) Submission.processing_count_for_user_and_exercise(id, exercise_name, course_id) end private + # Unchecked because specs stub Faraday.new with plain doubles. + sig { returns(Faraday::Connection).checked(:never) } def courses_mooc_fi_connection Faraday.new(headers: CoursesMoocFiRateLimitBypass.headers, request: { open_timeout: 2, timeout: 10 }) do |f| f.request :json @@ -607,10 +658,12 @@ def courses_mooc_fi_connection end end + sig { params(path: String).returns(String) } def courses_mooc_fi_url(path) "#{SiteSetting.value('courses_mooc_fi_base_url')}#{path}" end + sig { returns(Arel::SelectManager) } def course_ids_arel courses = Course.arel_table submissions = Submission.arel_table @@ -621,17 +674,20 @@ def course_ids_arel .order(submissions[:course_id]) end + sig { params(query: Arel::SelectManager).returns(Arel::SelectManager) } def without_disabled(query) exercises = Exercise.arel_table query.where(exercises[:disabled_status].eq(0)) query.where(exercises[:hidden].eq(false)) end + sig { params(query: Arel::SelectManager).returns(Arel::SelectManager) } def without_hidden_points(query) exercises = Exercise.arel_table query.where(exercises[:hide_submission_results].eq(false)) end + sig { returns(Arel::SelectManager) } def submissions_exercises_and_points_for_user users = User.arel_table awarded_points = AwardedPoint.arel_table @@ -649,6 +705,7 @@ def submissions_exercises_and_points_for_user .order(exercises[:name], exercises[:course_id]) end + sig { void } def encrypt_password if password.present? self.argon_hash = generate_argon(password) @@ -656,14 +713,17 @@ def encrypt_password end end + sig { params(string: T.nilable(String)).returns(String) } def old_encrypt(string) secure_hash("#{salt}--#{string}") end + sig { params(string: String).returns(String) } def secure_hash(string) Digest::SHA2.hexdigest(string) end + sig { void } def reject_common_login_mistakes return if login.blank? errors.add(:login, 'may not be your email address. Keep in mind that your username is public to everyone.') if login.include?('@') @@ -672,6 +732,7 @@ def reject_common_login_mistakes errors.add(:email, 'is incorrect. You probably meant firstname.lastname@helsinki.fi. Keep in mind that your email address does not contain your University of Helsinki username.') if email.end_with?('@helsinki.fi') && !/.*\..*@helsinki.fi/.match?(email) end + sig { params(input: T.nilable(String)).returns(String) } def generate_argon(input) Argon2::Password.new(t_cost: 4, m_cost: 15).create(normalize_password(input)) end @@ -680,6 +741,7 @@ def generate_argon(input) # entered on different platforms/forms hashes to identical bytes. Argon2 hashes raw bytes, so # a composed "ä" (U+00E4) and a decomposed "ä" (U+0061 U+0308) would otherwise produce # different hashes. nil is passed through unchanged (e.g. a missing old_password on reset). + sig { params(password: T.nilable(String)).returns(T.nilable(String)) } def normalize_password(password) return password unless password.is_a?(String) # HTTP Basic Auth credentials arrive Base64-decoded as ASCII-8BIT (binary), and @@ -695,6 +757,7 @@ def normalize_password(password) # be used as a fallback. Drop it if present. This self-heals users whose managed flag was set # by a direct SQL backfill that left the old hash behind (see also the one-time cleanup task). # update_columns writes directly, skipping validations and callbacks. + sig { void } def clear_stale_local_password return unless argon_hash.present? || salt.present? || password_hash.present? update_columns(argon_hash: nil, salt: nil, password_hash: nil, updated_at: Time.now) diff --git a/app/models/user_app_datum.rb b/app/models/user_app_datum.rb index 41cc7993b..ca01c6896 100644 --- a/app/models/user_app_datum.rb +++ b/app/models/user_app_datum.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class UserAppDatum < ApplicationRecord diff --git a/app/models/user_field.rb b/app/models/user_field.rb index 078fca3ff..fce33403e 100644 --- a/app/models/user_field.rb +++ b/app/models/user_field.rb @@ -1,16 +1,21 @@ +# typed: strict # frozen_string_literal: true class UserField + extend T::Sig include ExtraField + sig { returns(T::Boolean) } def show_in_participant_list? @options[:show_in_participant_list] end + sig { params(user: User).returns(T::Boolean) } def visible_to?(user) @options[:visible_to_if].call(user) end + sig { returns(T::Hash[Symbol, T.untyped]) } def default_options super.merge(show_in_participant_list: false, visible_to_if: ->(_user) { true }) diff --git a/app/models/user_field_value.rb b/app/models/user_field_value.rb index 35ba46c89..02ca0392f 100644 --- a/app/models/user_field_value.rb +++ b/app/models/user_field_value.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class UserFieldValue < ApplicationRecord diff --git a/app/models/validators/feedback_answer_format_validator.rb b/app/models/validators/feedback_answer_format_validator.rb index 8bc88c8bb..21efd8c87 100644 --- a/app/models/validators/feedback_answer_format_validator.rb +++ b/app/models/validators/feedback_answer_format_validator.rb @@ -1,15 +1,19 @@ +# typed: strict # frozen_string_literal: true class Validators::FeedbackAnswerFormatValidator < ActiveModel::Validator + extend T::Sig + + sig { params(record: FeedbackAnswer).void } def validate(record) - kind = record.feedback_question.kind + kind = T.must(record.feedback_question).kind ans = record.answer.strip - if kind =~ FeedbackQuestion.send(:intrange_regex) + if kind =~ FeedbackQuestion.intrange_regex range = (Regexp.last_match(1).to_i)..(Regexp.last_match(2).to_i) if !/^(-?\d+)$/.match?(ans) record.errors.add(:answer, 'is not an integer') - elsif !range.include?(ans.to_i) + elsif range.exclude?(ans.to_i) record.errors.add(:answer, "is not between #{range.first}..#{range.last}") end elsif kind == 'text' diff --git a/app/models/verification_token.rb b/app/models/verification_token.rb index ef0c2deee..137a5f8bf 100644 --- a/app/models/verification_token.rb +++ b/app/models/verification_token.rb @@ -1,21 +1,24 @@ +# typed: strict # frozen_string_literal: true class VerificationToken < ApplicationRecord + extend T::Sig # This class does not use single table inheritance self.inheritance_column = :_type_disabled belongs_to :user - enum type: %i[email delete_user] + enum :type, { email: 0, delete_user: 1 } validates :type, presence: true validates :user, presence: true - default_scope { where(created_at: ((Time.current - 1.week)..Time.current)) } + default_scope { where(created_at: (1.week.ago..Time.current)) } before_create :generate_token private + sig { returns(String) } def generate_token self.token = SecureRandom.urlsafe_base64.to_s end diff --git a/app/services/courses_mooc_fi_authentication.rb b/app/services/courses_mooc_fi_authentication.rb index 4062ae791..c8b86292a 100644 --- a/app/services/courses_mooc_fi_authentication.rb +++ b/app/services/courses_mooc_fi_authentication.rb @@ -1,10 +1,13 @@ +# typed: strict # frozen_string_literal: true # Resolves the local user behind a courses.mooc.fi access token sent to API v8. module CoursesMoocFiAuthentication + extend T::Sig # Returns the user the request's bearer token belongs to, or nil when there is no bearer token, # courses.mooc.fi rejects it, or it belongs to no local user. Raises # CoursesMoocFiTokenIntrospector::Unavailable when the token cannot be checked right now. + sig { params(request: ActionDispatch::Request).returns(T.nilable(User)) } def self.user_for(request) token = Doorkeeper::OAuth::Token.from_bearer_authorization(request) return nil if token.blank? @@ -17,6 +20,7 @@ def self.user_for(request) # Binds the user with the TMC id courses.mooc.fi reports to the token's subject, unless that user # is already bound to another subject. + sig { params(result: CoursesMoocFiTokenIntrospector::Result).returns(T.nilable(User)) } def self.link_by_upstream_id(result) return nil if result.upstream_id.blank? diff --git a/app/services/courses_mooc_fi_rate_limit_bypass.rb b/app/services/courses_mooc_fi_rate_limit_bypass.rb index 7f96bcd51..0a5613713 100644 --- a/app/services/courses_mooc_fi_rate_limit_bypass.rb +++ b/app/services/courses_mooc_fi_rate_limit_bypass.rb @@ -1,10 +1,13 @@ +# typed: strict # frozen_string_literal: true # Headers for tmc-server's requests to courses.mooc.fi: sp331 skips its per-IP rate limits when this # header matches its RATELIMIT_PROTECTION_SAFE_API_KEY, the same shared value as RACK_ATTACK_SAFE_API_KEY. module CoursesMoocFiRateLimitBypass + extend T::Sig HEADER = 'RATELIMIT-PROTECTION-SAFE-API-KEY' + sig { returns(T::Hash[String, String]) } def self.headers key = ENV['RACK_ATTACK_SAFE_API_KEY'] key.present? ? { HEADER => key } : {} diff --git a/app/services/courses_mooc_fi_token_introspector.rb b/app/services/courses_mooc_fi_token_introspector.rb index 5b168c565..6aef62418 100644 --- a/app/services/courses_mooc_fi_token_introspector.rb +++ b/app/services/courses_mooc_fi_token_introspector.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true require 'app_secrets' @@ -5,6 +6,7 @@ # Checks an opaque courses.mooc.fi (secret-project-331) access token via RFC 7662 introspection. class CoursesMoocFiTokenIntrospector + extend T::Sig # courses.mooc.fi could not answer: transport failure, non-200 (including 401 for our own client # credentials), unreadable body or missing configuration. Says nothing about the token. class Unavailable < StandardError; end @@ -21,10 +23,12 @@ class Unavailable < StandardError; end # Returns the Result for a token courses.mooc.fi vouches for, or nil when it rejects the token. # Raises Unavailable when it cannot answer; that is never cached. + sig { params(token: String).returns(T.nilable(Result)) } def self.introspect(token) new.introspect(token) end + sig { params(token: String).returns(T.nilable(Result)) } def introspect(token) return nil if token.blank? @@ -53,10 +57,13 @@ def introspect(token) private # sp331 serves introspection at "/introspect" and stamps every active response with # this issuer. + sig { returns(String) } def issuer - @issuer ||= "#{SiteSetting.value('courses_mooc_fi_base_url').to_s.chomp('/')}/api/v0/main-frontend/oauth" + @issuer ||= T.let("#{SiteSetting.value('courses_mooc_fi_base_url').to_s.chomp('/')}/api/v0/main-frontend/oauth", T.nilable(String)) end + # Returns the parsed JSON object of a 200 answer. + sig { params(token: String).returns(T::Hash[String, T.untyped]) } def request_introspection(token) client_id = AppSecrets.courses_mooc_fi_introspection_client_id client_secret = AppSecrets.courses_mooc_fi_introspection_secret @@ -88,6 +95,7 @@ def request_introspection(token) end # `aud` is not checked: sp331 mints every access token without an audience. + sig { params(body: T::Hash[String, T.untyped]).returns(T.nilable(String)) } def reject_reason(body) return 'inactive' unless body['active'] == true return "iss #{body['iss'].inspect} is not #{issuer.inspect}" unless body['iss'] == issuer @@ -100,6 +108,8 @@ def reject_reason(body) nil end + # In seconds; nil when the token has already expired. + sig { params(expires_at: T.nilable(Time)).returns(T.nilable(Integer)) } def cache_ttl(expires_at) return MAX_CACHE_TTL if expires_at.nil? remaining = (expires_at - Time.now).floor diff --git a/app/views/courses/_deadline_fields.html.erb b/app/views/courses/_deadline_fields.html.erb index 5db1873b1..e8e83e3bc 100644 --- a/app/views/courses/_deadline_fields.html.erb +++ b/app/views/courses/_deadline_fields.html.erb @@ -1,6 +1,6 @@ <% - static_autofill = uniform ? deadline.static_deadline_spec : 'various' - unlock_autofill = uniform ? deadline.unlock_deadline_spec : 'various' + static_autofill = uniform ? deadline&.static_deadline_spec : 'various' + unlock_autofill = uniform ? deadline&.unlock_deadline_spec : 'various' field_class = uniform ? nil : 'various' %> <%= label_tag "#{param_name}[#{deadline_type}][static]", 'Deadline' %> diff --git a/app/views/courses/manage_unlocks.html.erb b/app/views/courses/manage_unlocks.html.erb index 0a5533a2d..f925217d5 100644 --- a/app/views/courses/manage_unlocks.html.erb +++ b/app/views/courses/manage_unlocks.html.erb @@ -62,8 +62,7 @@ param_array = "group[#{group.name}]" end - group_unlock_conditions = group.group_unlock_conditions - group_unlock_conditions = [''] if group_unlock_conditions.empty? # Always have at least one input field + group_unlock_conditions = group.group_unlock_conditions.presence || [''] # Always have at least one input field %> +# +# The first two characters (`">`) are required in case the exception happens +# while rendering attributes for a given tag. You can check the real cause for +# the exception in your logger. +# +# ## Web server support +# +# Rack 3+ compatible servers all support streaming. +# +# pkg:gem/actionpack#lib/action_controller/metal/streaming.rb:169 +module ActionController::Streaming + private + + # Call render_body if we are streaming instead of usual `render`. + # + # pkg:gem/actionpack#lib/action_controller/metal/streaming.rb:172 + def _render_template(options); end +end + +# # Strong Parameters +# +# It provides an interface for protecting attributes from end-user assignment. +# This makes Action Controller parameters forbidden to be used in Active Model +# mass assignment until they have been explicitly enumerated. +# +# In addition, parameters can be marked as required and flow through a +# predefined raise/rescue flow to end up as a `400 Bad Request` with no effort. +# +# class PeopleController < ActionController::Base +# # Using "Person.create(params[:person])" would raise an +# # ActiveModel::ForbiddenAttributesError exception because it'd +# # be using mass assignment without an explicit permit step. +# # This is the recommended form: +# def create +# Person.create(person_params) +# end +# +# # This will pass with flying colors as long as there's a person key in the +# # parameters, otherwise it'll raise an ActionController::ParameterMissing +# # exception, which will get caught by ActionController::Base and turned +# # into a 400 Bad Request reply. +# def update +# redirect_to current_account.people.find(params[:id]).tap { |person| +# person.update!(person_params) +# } +# end +# +# private +# # Using a private method to encapsulate the permissible parameters is +# # a good pattern since you'll be able to reuse the same permit +# # list between create and update. Also, you can specialize this method +# # with per-user checking of permissible attributes. +# def person_params +# params.expect(person: [:name, :age]) +# end +# end +# +# In order to use `accepts_nested_attributes_for` with Strong Parameters, you +# will need to specify which nested attributes should be permitted. You might +# want to allow `:id` and `:_destroy`, see ActiveRecord::NestedAttributes for +# more information. +# +# class Person +# has_many :pets +# accepts_nested_attributes_for :pets +# end +# +# class PeopleController < ActionController::Base +# def create +# Person.create(person_params) +# end +# +# ... +# +# private +# +# def person_params +# # It's mandatory to specify the nested attributes that should be permitted. +# # If you use `permit` with just the key that points to the nested attributes hash, +# # it will return an empty hash. +# params.expect(person: [ :name, :age, pets_attributes: [ :id, :name, :category ] ]) +# end +# end +# +# See ActionController::Parameters.expect, +# See ActionController::Parameters.require, and +# ActionController::Parameters.permit for more information. +# +# pkg:gem/actionpack#lib/action_controller/metal/strong_parameters.rb:1516 +module ActionController::StrongParameters + # Returns a new ActionController::Parameters object that has been instantiated + # with the `request.parameters`. + # + # pkg:gem/actionpack#lib/action_controller/metal/strong_parameters.rb:1519 + def params; end + + # Assigns the given `value` to the `params` hash. If `value` is a Hash, this + # will create an ActionController::Parameters object that has been instantiated + # with the given `value` hash. + # + # pkg:gem/actionpack#lib/action_controller/metal/strong_parameters.rb:1534 + def params=(value); end +end + +# pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:4 +class ActionController::StructuredEventSubscriber < ::ActiveSupport::StructuredEventSubscriber + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:91 + def exist_fragment?(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:95 + def expire_fragment(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:43 + def halted_callback(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:25 + def process_action(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:87 + def read_fragment(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:64 + def redirect_to(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:47 + def rescue_from_callback(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:68 + def send_data(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:60 + def send_file(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:7 + def start_processing(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:72 + def unpermitted_parameters(event); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:83 + def write_fragment(event); end + + private + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:110 + def additions_for(payload); end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:100 + def fragment_cache(method_name, event); end + + class << self + private + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:81 + def __class_attr_debug_methods; end + + # pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:81 + def __class_attr_debug_methods=(new_value); end + end +end + +# pkg:gem/actionpack#lib/action_controller/structured_event_subscriber.rb:5 +ActionController::StructuredEventSubscriber::INTERNAL_PARAMS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_controller/template_assertions.rb:6 +module ActionController::TemplateAssertions + # pkg:gem/actionpack#lib/action_controller/template_assertions.rb:7 + def assert_template(options = T.unsafe(nil), message = T.unsafe(nil)); end +end + +# # Action Controller Test Case +# +# Superclass for ActionController functional tests. Functional tests allow you +# to test a single controller action per test method. +# +# ## Use integration style controller tests over functional style controller tests. +# +# Rails discourages the use of functional tests in favor of integration tests +# (use ActionDispatch::IntegrationTest). +# +# New Rails applications no longer generate functional style controller tests +# and they should only be used for backward compatibility. Integration style +# controller tests perform actual requests, whereas functional style controller +# tests merely simulate a request. Besides, integration tests are as fast as +# functional tests and provide lot of helpers such as `as`, `parsed_body` for +# effective testing of controller actions including even API endpoints. +# +# ## Basic example +# +# Functional tests are written as follows: +# 1. First, one uses the `get`, `post`, `patch`, `put`, `delete`, or `head` +# method to simulate an HTTP request. +# 2. Then, one asserts whether the current state is as expected. "State" can be +# anything: the controller's HTTP response, the database contents, etc. +# +# +# For example: +# +# class BooksControllerTest < ActionController::TestCase +# def test_create +# # Simulate a POST response with the given HTTP parameters. +# post(:create, params: { book: { title: "Love Hina" }}) +# +# # Asserts that the controller tried to redirect us to +# # the created book's URI. +# assert_response :found +# +# # Asserts that the controller really put the book in the database. +# assert_not_nil Book.find_by(title: "Love Hina") +# end +# end +# +# You can also send a real document in the simulated HTTP request. +# +# def test_create +# json = {book: { title: "Love Hina" }}.to_json +# post :create, body: json +# end +# +# ## Special instance variables +# +# ActionController::TestCase will also automatically provide the following +# instance variables for use in the tests: +# +# @controller +# +# @request +# You can modify this object before sending the HTTP request. For example, +# you might want to set some session properties before sending a GET +# request. +# +# @response +# last HTTP response. In the above example, `@response` becomes valid after +# calling `post`. If the various assert methods are not sufficient, then you +# may use this object to inspect the HTTP response in detail. +# +# +# ## Controller is automatically inferred +# +# ActionController::TestCase will automatically infer the controller under test +# from the test class name. If the controller cannot be inferred from the test +# class name, you can explicitly set it with `tests`. +# +# class SpecialEdgeCaseWidgetsControllerTest < ActionController::TestCase +# tests WidgetController +# end +# +# ## Testing controller internals +# +# In addition to these specific assertions, you also have easy access to various +# collections that the regular test/unit assertions can be used against. These +# collections are: +# +# * session: Objects being saved in the session. +# * flash: The flash objects currently in the session. +# * cookies: Cookies being sent to the user on this request. +# +# +# These collections can be used just like any other hash: +# +# assert_equal "Dave", cookies[:name] # makes sure that a cookie called :name was set as "Dave" +# assert flash.empty? # makes sure that there's nothing in the flash +# +# On top of the collections, you have the complete URL that a given action +# redirected to available in `redirect_to_url`. +# +# For redirects within the same controller, you can even call follow_redirect +# and the redirect will be followed, triggering another action call which can +# then be asserted against. +# +# ## Manipulating session and cookie variables +# +# Sometimes you need to set up the session and cookie variables for a test. To +# do this just assign a value to the session or cookie collection: +# +# session[:key] = "value" +# cookies[:key] = "value" +# +# To clear the cookies for a test just clear the cookie collection: +# +# cookies.clear +# +# ## Testing named routes +# +# If you're using named routes, they can be easily tested using the original +# named routes' methods straight in the test case. +# +# assert_redirected_to page_url(title: 'foo') +# +# pkg:gem/actionpack#lib/action_controller/test_case.rb:368 +class ActionController::TestCase < ::ActiveSupport::TestCase + include ::ActiveSupport::Testing::ConstantLookup + include ::ActionDispatch::TestProcess::FixtureFile + include ::ActionDispatch::TestProcess + include ::ActionDispatch::Assertions::ResponseAssertions + include ::Rails::Dom::Testing::Assertions::DomAssertions + include ::Rails::Dom::Testing::Assertions::SelectorAssertions + include ::Rails::Dom::Testing::Assertions + include ::ActionController::TestCase::Behavior + include ::ActionController::TemplateAssertions + include ::ActionDispatch::Assertions::RoutingAssertions + include ::ActionDispatch::Assertions + extend ::ActiveSupport::Testing::ConstantLookup::ClassMethods + extend ::ActionController::TestCase::Behavior::ClassMethods + extend ::ActionDispatch::Assertions::RoutingAssertions::ClassMethods + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:599 + def _controller_class; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:599 + def _controller_class=(_arg0); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:599 + def _controller_class?; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:600 + def _run_setup_callbacks(&block); end + + class << self + # pkg:gem/actionpack#lib/action_controller/test_case.rb:599 + def _controller_class; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:599 + def _controller_class=(value); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:599 + def _controller_class?; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:369 + def executor_around_each_request; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:369 + def executor_around_each_request=(_arg0); end + + private + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:600 + def __class_attr___callbacks; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:600 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:599 + def __class_attr__controller_class; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:599 + def __class_attr__controller_class=(new_value); end + end +end + +# pkg:gem/actionpack#lib/action_controller/test_case.rb:371 +module ActionController::TestCase::Behavior + include ::ActionDispatch::TestProcess::FixtureFile + include ::ActionDispatch::TestProcess + include ::Rails::Dom::Testing::Assertions::DomAssertions + include ::Rails::Dom::Testing::Assertions::SelectorAssertions + include ::Rails::Dom::Testing::Assertions + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveSupport::Testing::ConstantLookup + include ::ActionController::TemplateAssertions + include ::ActionDispatch::Assertions::RoutingAssertions + include ::ActionDispatch::Assertions + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveSupport::Testing::ConstantLookup::ClassMethods + mixes_in_class_methods ::ActionController::TestCase::Behavior::ClassMethods + mixes_in_class_methods ::ActionDispatch::Assertions::RoutingAssertions::ClassMethods + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:592 + def build_response(klass); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:552 + def controller_class_name; end + + # Simulate a DELETE request with the given parameters and set/volley the + # response. See `get` for more details. + # + # pkg:gem/actionpack#lib/action_controller/test_case.rb:463 + def delete(action, **args); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:556 + def generated_path(generated_extras); end + + # Simulate a GET request with the given parameters. + # + # * `action`: The controller action to call. + # * `params`: The hash with HTTP parameters that you want to pass. This may be + # `nil`. + # * `body`: The request body with a string that is appropriately encoded + # (`application/x-www-form-urlencoded` or `multipart/form-data`). + # * `session`: A hash of parameters to store in the session. This may be + # `nil`. + # * `flash`: A hash of parameters to store in the flash. This may be `nil`. + # + # + # You can also simulate POST, PATCH, PUT, DELETE, and HEAD requests with `post`, + # `patch`, `put`, `delete`, and `head`. Example sending parameters, session, and + # setting a flash message: + # + # get :show, + # params: { id: 7 }, + # session: { user_id: 1 }, + # flash: { notice: 'This is flash message' } + # + # Note that the request method is not verified. The different methods are + # available to make the tests more expressive. + # + # pkg:gem/actionpack#lib/action_controller/test_case.rb:439 + def get(action, **args); end + + # Simulate a HEAD request with the given parameters and set/volley the response. + # See `get` for more details. + # + # pkg:gem/actionpack#lib/action_controller/test_case.rb:469 + def head(action, **args); end + + # Simulate a PATCH request with the given parameters and set/volley the + # response. See `get` for more details. + # + # pkg:gem/actionpack#lib/action_controller/test_case.rb:451 + def patch(action, **args); end + + # Simulate a POST request with the given parameters and set/volley the response. + # See `get` for more details. + # + # pkg:gem/actionpack#lib/action_controller/test_case.rb:445 + def post(action, **args); end + + # Simulate an HTTP request to `action` by specifying request method, parameters + # and set/volley the response. + # + # * `action`: The controller action to call. + # * `method`: Request method used to send the HTTP request. Possible values + # are `GET`, `POST`, `PATCH`, `PUT`, `DELETE`, `HEAD`. Defaults to `GET`. + # Can be a symbol. + # * `params`: The hash with HTTP parameters that you want to pass. This may be + # `nil`. + # * `body`: The request body with a string that is appropriately encoded + # (`application/x-www-form-urlencoded` or `multipart/form-data`). + # * `session`: A hash of parameters to store in the session. This may be + # `nil`. + # * `flash`: A hash of parameters to store in the flash. This may be `nil`. + # * `format`: Request format. Defaults to `nil`. Can be string or symbol. + # * `as`: Content type. Defaults to `nil`. Must be a symbol that corresponds + # to a mime type. + # + # + # Example calling `create` action and sending two params: + # + # process :create, + # method: 'POST', + # params: { + # user: { name: 'Gaurish Sharma', email: 'user@example.com' } + # }, + # session: { user_id: 1 }, + # flash: { notice: 'This is flash message' } + # + # To simulate `GET`, `POST`, `PATCH`, `PUT`, `DELETE`, and `HEAD` requests + # prefer using #get, #post, #patch, #put, #delete and #head methods respectively + # which will make tests more expressive. + # + # It's not recommended to make more than one request in the same test. Instance + # variables that are set in one request will not persist to the next request, + # but it's not guaranteed that all Rails internal state will be reset. Prefer + # ActionDispatch::IntegrationTest for making multiple requests in the same test. + # + # Note that the request method is not verified. + # + # pkg:gem/actionpack#lib/action_controller/test_case.rb:512 + def process(action, method: T.unsafe(nil), params: T.unsafe(nil), session: T.unsafe(nil), body: T.unsafe(nil), flash: T.unsafe(nil), format: T.unsafe(nil), xhr: T.unsafe(nil), as: T.unsafe(nil)); end + + # Simulate a PUT request with the given parameters and set/volley the response. + # See `get` for more details. + # + # pkg:gem/actionpack#lib/action_controller/test_case.rb:457 + def put(action, **args); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:560 + def query_parameter_names(generated_extras); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:377 + def request; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:377 + def response; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:564 + def setup_controller_request_and_response; end + + private + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:685 + def check_required_ivars; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:681 + def document_root_element; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:635 + def process_controller_response(action, cookies, xhr); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:671 + def scrub_env!(env); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:605 + def setup_request(controller_class_name, action, parameters, session, flash, xhr); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:627 + def wrap_execution(&block); end + + module GeneratedClassMethods + def _controller_class; end + def _controller_class=(value); end + def _controller_class?; end + end + + module GeneratedInstanceMethods + def _controller_class; end + def _controller_class=(value); end + def _controller_class?; end + end +end + +# pkg:gem/actionpack#lib/action_controller/test_case.rb:379 +module ActionController::TestCase::Behavior::ClassMethods + # pkg:gem/actionpack#lib/action_controller/test_case.rb:401 + def controller_class; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:397 + def controller_class=(new_class); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:409 + def determine_default_controller_class(name); end + + # Sets the controller class name. Useful if the name can't be inferred from test + # class. Normalizes `controller_class` before using. + # + # tests WidgetController + # tests :widget + # tests 'widget' + # + # pkg:gem/actionpack#lib/action_controller/test_case.rb:386 + def tests(controller_class); end +end + +# ActionController::TestCase will be deprecated and moved to a gem in the +# future. Please use ActionDispatch::IntegrationTest going forward. +# +# pkg:gem/actionpack#lib/action_controller/test_case.rb:46 +class ActionController::TestRequest < ::ActionDispatch::TestRequest + # pkg:gem/actionpack#lib/action_controller/test_case.rb:69 + def initialize(env, session, controller_class); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:88 + def assign_parameters(routes, controller_path, action, parameters, generated_path, query_string_keys); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:84 + def content_type=(type); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:54 + def controller_class; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:80 + def query_string=(string); end + + private + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:179 + def params_parsers; end + + class << self + # Create a new test request with default `env` values. + # + # pkg:gem/actionpack#lib/action_controller/test_case.rb:57 + def create(controller_class); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:50 + def new_session; end + + private + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:64 + def default_env; end + end +end + +# pkg:gem/actionpack#lib/action_controller/test_case.rb:47 +ActionController::TestRequest::DEFAULT_ENV = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_controller/test_case.rb:151 +ActionController::TestRequest::ENCODER = T.let(T.unsafe(nil), T.untyped) + +# Methods #destroy and #load! are overridden to avoid calling methods on the +# @store object, which does not exist for the TestSession class. +# +# pkg:gem/actionpack#lib/action_controller/test_case.rb:197 +class ActionController::TestSession < ::Rack::Session::Abstract::PersistedSecure::SecureSessionHash + # pkg:gem/actionpack#lib/action_controller/test_case.rb:200 + def initialize(session = T.unsafe(nil), id = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:220 + def destroy; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:224 + def dig(*keys); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:233 + def enabled?; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:208 + def exists?; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:229 + def fetch(key, *args, &block); end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:237 + def id_was; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:212 + def keys; end + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:216 + def values; end + + private + + # pkg:gem/actionpack#lib/action_controller/test_case.rb:242 + def load!; end +end + +# pkg:gem/actionpack#lib/action_controller/test_case.rb:198 +ActionController::TestSession::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_controller/metal/testing.rb:6 +module ActionController::Testing; end + +# Behavior specific to functional tests +# +# pkg:gem/actionpack#lib/action_controller/metal/testing.rb:8 +module ActionController::Testing::Functional + # pkg:gem/actionpack#lib/action_controller/metal/testing.rb:9 + def clear_instance_variables_between_requests; end + + # pkg:gem/actionpack#lib/action_controller/metal/testing.rb:18 + def recycle!; end +end + +# Raised when a Rate Limit is exceeded by too many requests within a period of +# time. +# +# pkg:gem/actionpack#lib/action_controller/metal/exceptions.rb:109 +class ActionController::TooManyRequests < ::ActionController::ActionControllerError; end + +# Raised when a Parameters instance is not marked as permitted and an operation +# to transform it to hash is called. +# +# params = ActionController::Parameters.new(a: "123", b: "456") +# params.to_h +# # => ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash +# +# pkg:gem/actionpack#lib/action_controller/metal/strong_parameters.rb:74 +class ActionController::UnfilteredParameters < ::ArgumentError + # pkg:gem/actionpack#lib/action_controller/metal/strong_parameters.rb:75 + def initialize; end +end + +# pkg:gem/actionpack#lib/action_controller/metal/exceptions.rb:75 +class ActionController::UnknownFormat < ::ActionController::ActionControllerError; end + +# pkg:gem/actionpack#lib/action_controller/metal/exceptions.rb:72 +class ActionController::UnknownHttpMethod < ::ActionController::ActionControllerError; end + +# Raised when a supplied parameter is not expected and +# ActionController::Parameters.action_on_unpermitted_parameters is set to +# `:raise`. +# +# params = ActionController::Parameters.new(a: "123", b: "456") +# params.permit(:c) +# # => ActionController::UnpermittedParameters: found unpermitted parameters: :a, :b +# +# pkg:gem/actionpack#lib/action_controller/metal/strong_parameters.rb:59 +class ActionController::UnpermittedParameters < ::IndexError + # pkg:gem/actionpack#lib/action_controller/metal/strong_parameters.rb:62 + def initialize(params); end + + # pkg:gem/actionpack#lib/action_controller/metal/strong_parameters.rb:60 + def params; end +end + +# # Action Controller UrlFor +# +# Includes `url_for` into the host class. The class has to provide a `RouteSet` +# by implementing the `_routes` method. Otherwise, an exception will be raised. +# +# In addition to AbstractController::UrlFor, this module accesses the HTTP layer +# to define URL options like the `host`. In order to do so, this module requires +# the host class to implement `env` which needs to be Rack-compatible, and +# `request` which returns an ActionDispatch::Request instance. +# +# class RootUrl +# include ActionController::UrlFor +# include Rails.application.routes.url_helpers +# +# delegate :env, :request, to: :controller +# +# def initialize(controller) +# @controller = controller +# @url = root_path # named route from the application. +# end +# end +# +# pkg:gem/actionpack#lib/action_controller/metal/url_for.rb:27 +module ActionController::UrlFor + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActionDispatch::Routing::UrlFor + include ::AbstractController::UrlFor + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::AbstractController::UrlFor::ClassMethods + + # pkg:gem/actionpack#lib/action_controller/metal/url_for.rb:32 + def initialize(*, **, &); end + + # pkg:gem/actionpack#lib/action_controller/metal/url_for.rb:37 + def url_options; end + + module GeneratedClassMethods + def default_url_options; end + def default_url_options=(value); end + def default_url_options?; end + end + + module GeneratedInstanceMethods + def default_url_options; end + def default_url_options=(value); end + def default_url_options?; end + end +end + +# pkg:gem/actionpack#lib/action_controller/metal/exceptions.rb:27 +class ActionController::UrlGenerationError < ::ActionController::ActionControllerError + include ::DidYouMean::Correctable + + # pkg:gem/actionpack#lib/action_controller/metal/exceptions.rb:30 + def initialize(message, routes = T.unsafe(nil), route_name = T.unsafe(nil), method_name = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_controller/metal/exceptions.rb:41 + def corrections; end + + # pkg:gem/actionpack#lib/action_controller/metal/exceptions.rb:28 + def method_name; end + + # pkg:gem/actionpack#lib/action_controller/metal/exceptions.rb:28 + def route_name; end + + # pkg:gem/actionpack#lib/action_controller/metal/exceptions.rb:28 + def routes; end +end + +# # Action Dispatch +# +# Action Dispatch is a module of Action Pack. +# +# Action Dispatch parses information about the web request, handles routing as +# defined by the user, and does advanced processing related to HTTP such as +# MIME-type negotiation, decoding parameters in POST, PATCH, or PUT bodies, +# handling HTTP caching logic, cookies and sessions. +# :markup: markdown +# +# pkg:gem/actionpack#lib/action_dispatch/deprecator.rb:5 +module ActionDispatch + extend ::ActiveSupport::Autoload + + # pkg:gem/actionpack#lib/action_dispatch.rb:149 + def eager_load!; end + + # pkg:gem/actionpack#lib/action_dispatch.rb:127 + def test_app; end + + # pkg:gem/actionpack#lib/action_dispatch.rb:127 + def test_app=(val); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/deprecator.rb:6 + def deprecator; end + + # pkg:gem/actionpack#lib/action_dispatch.rb:127 + def test_app; end + + # pkg:gem/actionpack#lib/action_dispatch.rb:127 + def test_app=(val); end + + # pkg:gem/actionpack#lib/action_dispatch.rb:146 + def verbose_redirect_logs; end + + # pkg:gem/actionpack#lib/action_dispatch.rb:146 + def verbose_redirect_logs=(_arg0); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/actionable_exceptions.rb:9 +class ActionDispatch::ActionableExceptions + # pkg:gem/actionpack#lib/action_dispatch/middleware/actionable_exceptions.rb:12 + def initialize(app); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/actionable_exceptions.rb:16 + def call(env); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/actionable_exceptions.rb:10 + def endpoint; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/actionable_exceptions.rb:10 + def endpoint=(val); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/actionable_exceptions.rb:26 + def actionable_request?(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/actionable_exceptions.rb:30 + def redirect_to(location); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/middleware/actionable_exceptions.rb:10 + def endpoint; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/actionable_exceptions.rb:10 + def endpoint=(val); end + end +end + +# This is a class that abstracts away an asserted response. It purposely does +# not inherit from Response because it doesn't need it. That means it does not +# have headers or a body. +# +# pkg:gem/actionpack#lib/action_dispatch/testing/assertion_response.rb:9 +class ActionDispatch::AssertionResponse + # Accepts a specific response status code as an Integer (404) or String ('404') + # or a response status range as a Symbol pseudo-code (:success, indicating any + # 200-299 status code). + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertion_response.rb:22 + def initialize(code_or_name); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertion_response.rb:10 + def code; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertion_response.rb:35 + def code_and_name; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertion_response.rb:10 + def name; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertion_response.rb:40 + def code_from_name(name); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertion_response.rb:44 + def name_from_code(code); end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/assertion_response.rb:12 +ActionDispatch::AssertionResponse::GENERIC_RESPONSE_CODES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:6 +module ActionDispatch::Assertions + include ::ActionDispatch::Assertions::ResponseAssertions + include ::Rails::Dom::Testing::Assertions::DomAssertions + include ::Rails::Dom::Testing::Assertions::SelectorAssertions + include ::Rails::Dom::Testing::Assertions + extend ::ActiveSupport::Concern + include ::ActionDispatch::Assertions::RoutingAssertions + + mixes_in_class_methods ::ActionDispatch::Assertions::RoutingAssertions::ClassMethods + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions.rb:17 + def html_document; end +end + +# A small suite of assertions that test responses from Rails applications. +# +# pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:8 +module ActionDispatch::Assertions::ResponseAssertions + # Asserts that the given +text+ is present somewhere in the response body. + # + # assert_in_body fixture(:name).description + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:77 + def assert_in_body(text); end + + # Asserts that the given +text+ is not present anywhere in the response body. + # + # assert_not_in_body fixture(:name).description + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:84 + def assert_not_in_body(text); end + + # Asserts that the response is a redirect to a URL matching the given options. + # + # # Asserts that the redirection was to the "index" action on the WeblogController + # assert_redirected_to controller: "weblog", action: "index" + # + # # Asserts that the redirection was to the named route login_url + # assert_redirected_to login_url + # + # # Asserts that the redirection was to the URL for @customer + # assert_redirected_to @customer + # + # # Asserts that the redirection matches the regular expression + # assert_redirected_to %r(\Ahttp://example.org) + # + # # Asserts that the redirection has the HTTP status code 301 (Moved + # # Permanently). + # assert_redirected_to "/some/path", status: :moved_permanently + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:60 + def assert_redirected_to(url_options = T.unsafe(nil), options = T.unsafe(nil), message = T.unsafe(nil)); end + + # Asserts that the response is one of the following types: + # + # * `:success` - Status code was in the 200-299 range + # * `:redirect` - Status code was in the 300-399 range + # * `:missing` - Status code was 404 + # * `:error` - Status code was in the 500-599 range + # + # + # You can also pass an explicit status number like `assert_response(501)` or its + # symbolic equivalent `assert_response(:not_implemented)`. See + # `Rack::Utils::SYMBOL_TO_STATUS_CODE` for a full list. + # + # # Asserts that the response was a redirection + # assert_response :redirect + # + # # Asserts that the response code was status code 401 (unauthorized) + # assert_response 401 + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:33 + def assert_response(type, message = T.unsafe(nil)); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:129 + def code_with_name(code_or_name); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:118 + def exception_if_present; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:103 + def generate_response_message(expected, actual = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:123 + def location_if_redirected; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:94 + def normalize_argument_to_redirection(fragment); end + + # Proxy to to_param if the object will respond to it. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:90 + def parameterize(value); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:113 + def response_body_if_short; end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/assertions/response.rb:9 +ActionDispatch::Assertions::ResponseAssertions::RESPONSE_PREDICATES = T.let(T.unsafe(nil), Hash) + +# Suite of assertions to test routes generated by Rails and the handling of +# requests made to them. +# +# pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:15 +module ActionDispatch::Assertions::RoutingAssertions + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionDispatch::Assertions::RoutingAssertions::ClassMethods + + # Asserts that the provided options can be used to generate the provided path. + # This is the inverse of `assert_recognizes`. The `extras` parameter is used to + # tell the request the names and values of additional request parameters that + # would be in a query string. The `message` parameter allows you to specify a + # custom error message for assertion failures. + # + # The `defaults` parameter is unused. + # + # # Asserts that the default action is generated for a route with no action + # assert_generates "/items", controller: "items", action: "index" + # + # # Tests that the list action is properly routed + # assert_generates "/items/list", controller: "items", action: "list" + # + # # Tests the generation of a route with a parameter + # assert_generates "/items/list/1", { controller: "items", action: "list", id: "1" } + # + # # Asserts that the generated route gives us our custom route + # assert_generates "changesets/12", { controller: 'scm', action: 'show_diff', revision: "12" } + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:216 + def assert_generates(expected_path, options, defaults = T.unsafe(nil), extras = T.unsafe(nil), message = T.unsafe(nil)); end + + # Asserts that the routing of the given `path` was handled correctly and that + # the parsed options (given in the `expected_options` hash) match `path`. + # Basically, it asserts that Rails recognizes the route given by + # `expected_options`. + # + # Pass a hash in the second argument (`path`) to specify the request method. + # This is useful for routes requiring a specific HTTP method. The hash should + # contain a `:path` with the incoming request path and a `:method` containing + # the required HTTP verb. + # + # # Asserts that POSTing to /items will call the create action on ItemsController + # assert_recognizes({controller: 'items', action: 'create'}, {path: 'items', method: :post}) + # + # You can also pass in `extras` with a hash containing URL parameters that would + # normally be in the query string. This can be used to assert that values in the + # query string will end up in the params hash correctly. To test query strings + # you must use the extras argument because appending the query string on the + # path directly will not work. For example: + # + # # Asserts that a path of '/items/list/1?view=print' returns the correct options + # assert_recognizes({controller: 'items', action: 'list', id: '1', view: 'print'}, 'items/list/1', { view: "print" }) + # + # The `message` parameter allows you to pass in an error message that is + # displayed upon failure. + # + # # Check the default route (i.e., the index action) + # assert_recognizes({controller: 'items', action: 'index'}, 'items') + # + # # Test a specific action + # assert_recognizes({controller: 'items', action: 'list'}, 'items/list') + # + # # Test an action with a parameter + # assert_recognizes({controller: 'items', action: 'destroy', id: '1'}, 'items/destroy/1') + # + # # Test a custom route + # assert_recognizes({controller: 'items', action: 'show', id: '1'}, 'view/item1') + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:176 + def assert_recognizes(expected_options, path, extras = T.unsafe(nil), msg = T.unsafe(nil)); end + + # Asserts that path and options match both ways; in other words, it verifies + # that `path` generates `options` and then that `options` generates `path`. This + # essentially combines `assert_recognizes` and `assert_generates` into one step. + # + # The `extras` hash allows you to specify options that would normally be + # provided as a query string to the action. The `message` parameter allows you + # to specify a custom error message to display upon failure. + # + # # Asserts a basic route: a controller with the default action (index) + # assert_routing '/home', controller: 'home', action: 'index' + # + # # Test a route generated with a specific controller, action, and parameter (id) + # assert_routing '/entries/show/23', controller: 'entries', action: 'show', id: 23 + # + # # Asserts a basic route (controller + default action), with an error message if it fails + # assert_routing '/store', { controller: 'store', action: 'index' }, {}, {}, 'Route for store index not generated properly' + # + # # Tests a route, providing a defaults hash + # assert_routing 'controller/action/9', {id: "9", item: "square"}, {controller: "controller", action: "action"}, {}, {item: "square"} + # + # # Tests a route with an HTTP method + # assert_routing({ method: 'put', path: '/product/321' }, { controller: "product", action: "update", id: "321" }) + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:260 + def assert_routing(path, options, defaults = T.unsafe(nil), extras = T.unsafe(nil), message = T.unsafe(nil)); end + + # ROUTES TODO: These assertions should really work in an integration context + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:273 + def method_missing(selector, *, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:115 + def setup; end + + # A helper to make it easier to test different route configurations. This method + # temporarily replaces @routes with a new RouteSet instance. + # + # The new instance is yielded to the passed block. Typically the block will + # create some routes using `set.draw { match ... }`: + # + # with_routing do |set| + # set.draw do + # resources :users + # end + # assert_equal "/users", users_path + # end + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:133 + def with_routing(config = T.unsafe(nil), &block); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:282 + def create_routes(config = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:348 + def fail_on(exception_class, message); end + + # Recognizes the route for a given path. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:314 + def recognized_request_for(path, extras = T.unsafe(nil), msg); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:306 + def reset_routes(old_routes, old_controller); end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:88 +module ActionDispatch::Assertions::RoutingAssertions::ClassMethods + # A helper to make it easier to test different route configurations. This method + # temporarily replaces @routes with a new RouteSet instance before each test. + # + # The new instance is yielded to the passed block. Typically the block will + # create some routes using `set.draw { match ... }`: + # + # with_routing do |set| + # set.draw do + # resources :users + # end + # end + # + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:101 + def with_routing(&block); end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:18 +module ActionDispatch::Assertions::RoutingAssertions::WithIntegrationRouting + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionDispatch::Assertions::RoutingAssertions::WithIntegrationRouting::ClassMethods + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:40 + def with_routing(&block); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:58 + def create_routes; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:50 + def initialize_lazy_routes(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:80 + def reset_routes(old_routes, old_routes_call_method, old_integration_session); end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:21 +module ActionDispatch::Assertions::RoutingAssertions::WithIntegrationRouting::ClassMethods + # pkg:gem/actionpack#lib/action_dispatch/testing/assertions/routing.rb:22 + def with_routing(&block); end +end + +# # Action Dispatch AssumeSSL +# +# When proxying through a load balancer that terminates SSL, the forwarded +# request will appear as though it's HTTP instead of HTTPS to the application. +# This makes redirects and cookie security target HTTP instead of HTTPS. This +# middleware makes the server assume that the proxy already terminated SSL, and +# that the request really is HTTPS. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/assume_ssl.rb:13 +class ActionDispatch::AssumeSSL + # pkg:gem/actionpack#lib/action_dispatch/middleware/assume_ssl.rb:14 + def initialize(app); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/assume_ssl.rb:18 + def call(env); end +end + +# # Action Dispatch Callbacks +# +# Provides callbacks to be executed before and after dispatching the request. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:9 +class ActionDispatch::Callbacks + include ::ActiveSupport::Callbacks + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:24 + def initialize(app); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:10 + def __callbacks; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:12 + def _call_callbacks; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:12 + def _run_call_callbacks; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:12 + def _run_call_callbacks!(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:28 + def call(env); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:10 + def __callbacks; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:10 + def __callbacks=(value); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:12 + def _call_callbacks; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:12 + def _call_callbacks=(value); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:19 + def after(*args, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:15 + def before(*args, &block); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:10 + def __class_attr___callbacks; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/callbacks.rb:10 + def __class_attr___callbacks=(new_value); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:8 +module ActionDispatch::Constants; end + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:23 +ActionDispatch::Constants::CONTENT_ENCODING = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:24 +ActionDispatch::Constants::CONTENT_SECURITY_POLICY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:25 +ActionDispatch::Constants::CONTENT_SECURITY_POLICY_REPORT_ONLY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:27 +ActionDispatch::Constants::FEATURE_POLICY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:26 +ActionDispatch::Constants::LOCATION = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:30 +ActionDispatch::Constants::SERVER_TIMING = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:31 +ActionDispatch::Constants::STRICT_TRANSPORT_SECURITY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:37 +ActionDispatch::Constants::UNPROCESSABLE_CONTENT = T.let(T.unsafe(nil), Symbol) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:22 +ActionDispatch::Constants::VARY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:29 +ActionDispatch::Constants::X_CASCADE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/constants.rb:28 +ActionDispatch::Constants::X_REQUEST_ID = T.let(T.unsafe(nil), String) + +# # Action Dispatch Content Security Policy +# +# Configures the HTTP [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) +# response header to help protect against XSS and +# injection attacks. +# +# Example global policy: +# +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# +# # Specify URI for violation reports +# policy.report_uri "/csp-violation-report-endpoint" +# end +# +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:28 +class ActionDispatch::ContentSecurityPolicy + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:182 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def base_uri(*sources); end + + # Specify whether to prevent the user agent from loading any assets over HTTP + # when the page uses HTTPS: + # + # policy.block_all_mixed_content + # + # Pass `false` to allow it again: + # + # policy.block_all_mixed_content false + # + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:210 + def block_all_mixed_content(enabled = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:299 + def build(context = T.unsafe(nil), nonce = T.unsafe(nil), nonce_directives = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def child_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def connect_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def default_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:180 + def directives; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def font_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def form_action(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def frame_ancestors(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def frame_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def img_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def manifest_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def media_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def object_src(*sources); end + + # Restricts the set of plugins that can be embedded: + # + # policy.plugin_types "application/x-shockwave-flash" + # + # Leave empty to allow all plugins: + # + # policy.plugin_types + # + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:226 + def plugin_types(*types); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def prefetch_src(*sources); end + + # Enable the [report-uri](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-uri) + # directive. Violation reports will be sent to the + # specified URI: + # + # policy.report_uri "/csp-violation-report-endpoint" + # + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:240 + def report_uri(uri); end + + # Specify asset types for which [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) is required: + # + # policy.require_sri_for :script, :style + # + # Leave empty to not require Subresource Integrity: + # + # policy.require_sri_for + # + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:252 + def require_sri_for(*types); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def require_trusted_types_for(*sources); end + + # Specify whether a [sandbox](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox) + # should be enabled for the requested resource: + # + # policy.sandbox + # + # Values can be passed as arguments: + # + # policy.sandbox "allow-scripts", "allow-modals" + # + # Pass `false` to disable the sandbox: + # + # policy.sandbox false + # + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:273 + def sandbox(*values); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def script_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def script_src_attr(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def script_src_elem(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def style_src(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def style_src_attr(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def style_src_elem(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def trusted_types(*sources); end + + # Specify whether user agents should treat any assets over HTTP as HTTPS: + # + # policy.upgrade_insecure_requests + # + # Pass `false` to disable it: + # + # policy.upgrade_insecure_requests false + # + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:291 + def upgrade_insecure_requests(enabled = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:192 + def worker_src(*sources); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:324 + def apply_mapping(source); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:305 + def apply_mappings(sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:358 + def build_directive(directive, sources, context); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:330 + def build_directives(context, nonce, nonce_directives); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:386 + def hash_source?(source); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:187 + def initialize_copy(other); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:382 + def nonce_directive?(directive, nonce_directives); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:364 + def resolve_source(source, context); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:346 + def validate(directive, sources); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:176 +ActionDispatch::ContentSecurityPolicy::DEFAULT_NONCE_DIRECTIVES = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:149 +ActionDispatch::ContentSecurityPolicy::DIRECTIVES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:174 +ActionDispatch::ContentSecurityPolicy::HASH_SOURCE_ALGORITHM_PREFIXES = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:29 +class ActionDispatch::ContentSecurityPolicy::InvalidDirectiveError < ::StandardError; end + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:128 +ActionDispatch::ContentSecurityPolicy::MAPPINGS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:32 +class ActionDispatch::ContentSecurityPolicy::Middleware + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:33 + def initialize(app); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:37 + def call(env); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:59 + def header_name(request); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:67 + def policy_present?(headers); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:73 +module ActionDispatch::ContentSecurityPolicy::Request + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:80 + def content_security_policy; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:84 + def content_security_policy=(policy); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:112 + def content_security_policy_nonce; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:104 + def content_security_policy_nonce_directives; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:108 + def content_security_policy_nonce_directives=(generator); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:96 + def content_security_policy_nonce_generator; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:100 + def content_security_policy_nonce_generator=(generator); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:88 + def content_security_policy_report_only; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:92 + def content_security_policy_report_only=(value); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:123 + def generate_content_security_policy_nonce; end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:77 +ActionDispatch::ContentSecurityPolicy::Request::NONCE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:78 +ActionDispatch::ContentSecurityPolicy::Request::NONCE_DIRECTIVES = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:76 +ActionDispatch::ContentSecurityPolicy::Request::NONCE_GENERATOR = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:74 +ActionDispatch::ContentSecurityPolicy::Request::POLICY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_security_policy.rb:75 +ActionDispatch::ContentSecurityPolicy::Request::POLICY_REPORT_ONLY = T.let(T.unsafe(nil), String) + +# Read and write data to cookies through ActionController::Cookies#cookies. +# +# When reading cookie data, the data is read from the HTTP request header, +# Cookie. When writing cookie data, the data is sent out in the HTTP response +# header, `Set-Cookie`. +# +# Examples of writing: +# +# # Sets a simple session cookie. +# # This cookie will be deleted when the user's browser is closed. +# cookies[:user_name] = "david" +# +# # Cookie values are String-based. Other data types need to be serialized. +# cookies[:lat_lon] = JSON.generate([47.68, -122.37]) +# +# # Sets a cookie that expires in 1 hour. +# cookies[:login] = { value: "XJ-122", expires: 1.hour } +# +# # Sets a cookie that expires at a specific time. +# cookies[:login] = { value: "XJ-122", expires: Time.utc(2020, 10, 15, 5) } +# +# # Sets a signed cookie, which prevents users from tampering with its value. +# cookies.signed[:user_id] = current_user.id +# # It can be read using the signed method. +# cookies.signed[:user_id] # => 123 +# +# # Sets an encrypted cookie value before sending it to the client which +# # prevent users from reading and tampering with its value. +# cookies.encrypted[:discount] = 45 +# # It can be read using the encrypted method. +# cookies.encrypted[:discount] # => 45 +# +# # Sets a "permanent" cookie (which expires in 20 years from now). +# cookies.permanent[:login] = "XJ-122" +# +# # You can also chain these methods: +# cookies.signed.permanent[:login] = "XJ-122" +# +# Examples of reading: +# +# cookies[:user_name] # => "david" +# cookies.size # => 2 +# JSON.parse(cookies[:lat_lon]) # => [47.68, -122.37] +# cookies.signed[:login] # => "XJ-122" +# cookies.encrypted[:discount] # => 45 +# +# Example for deleting: +# +# cookies.delete :user_name +# +# Please note that if you specify a `:domain` when setting a cookie, you must +# also specify the domain when deleting the cookie: +# +# cookies[:name] = { +# value: 'a yummy cookie', +# expires: 1.year, +# domain: 'domain.com' +# } +# +# cookies.delete(:name, domain: 'domain.com') +# +# The option symbols for setting cookies are: +# +# * `:value` - The cookie's value. +# * `:path` - The path for which this cookie applies. Defaults to the root of +# the application. +# * `:domain` - The domain for which this cookie applies so you can restrict +# to the domain level. If you use a schema like www.example.com and want to +# share session with user.example.com set `:domain` to `:all`. To support +# multiple domains, provide an array, and the first domain matching +# `request.host` will be used. Make sure to specify the `:domain` option +# with `:all` or `Array` again when deleting cookies. For more flexibility +# you can set the domain on a per-request basis by specifying `:domain` with +# a proc. +# +# domain: nil # Does not set cookie domain. (default) +# domain: :all # Allow the cookie for the top most level +# # domain and subdomains. +# domain: %w(.example.com .example.org) # Allow the cookie +# # for concrete domain names. +# domain: proc { Tenant.current.cookie_domain } # Set cookie domain dynamically +# domain: proc { |req| ".sub.#{req.host}" } # Set cookie domain dynamically based on request +# +# * `:tld_length` - When using `:domain => :all`, this option can be used to +# explicitly set the TLD length when using a short (<= 3 character) domain +# that is being interpreted as part of a TLD. For example, to share cookies +# between user1.lvh.me and user2.lvh.me, set `:tld_length` to 2. +# * `:expires` - The time at which this cookie expires, as a Time or +# ActiveSupport::Duration object. +# * `:secure` - Whether this cookie is only transmitted to HTTPS servers. +# Default is `false`. +# * `:httponly` - Whether this cookie is accessible via scripting or only +# HTTP. Defaults to `false`. +# * `:same_site` - The value of the `SameSite` cookie attribute, which +# determines how this cookie should be restricted in cross-site contexts. +# Possible values are `nil`, `:none`, `:lax`, and `:strict`. Defaults to +# `:lax`. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:195 +class ActionDispatch::Cookies + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:717 + def initialize(app); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:721 + def call(env); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:201 +ActionDispatch::Cookies::AUTHENTICATED_ENCRYPTED_COOKIE_SALT = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:514 +class ActionDispatch::Cookies::AbstractCookieJar + include ::ActionDispatch::Cookies::ChainedCookieJars + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:517 + def initialize(parent_jar); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:521 + def [](name); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:533 + def []=(name, options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:544 + def upgraded(name); end + + protected + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:549 + def request; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:567 + def commit(name, options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:560 + def cookie_metadata(name, options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:552 + def expiry_options(options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:566 + def parse(name, data, purpose: T.unsafe(nil)); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:207 +ActionDispatch::Cookies::COOKIES_DIGEST = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:208 +ActionDispatch::Cookies::COOKIES_ROTATIONS = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:209 +ActionDispatch::Cookies::COOKIES_SAME_SITE_PROTECTION = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:206 +ActionDispatch::Cookies::COOKIES_SERIALIZER = T.let(T.unsafe(nil), String) + +# Include in a cookie jar to allow chaining, e.g. `cookies.permanent.signed`. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:219 +module ActionDispatch::Cookies::ChainedCookieJars + # Returns a jar that'll automatically encrypt cookie values before sending them + # to the client and will decrypt them for read. If the cookie was tampered with + # by the user (or a 3rd party), `nil` will be returned. + # + # If `config.action_dispatch.encrypted_cookie_salt` and + # `config.action_dispatch.encrypted_signed_cookie_salt` are both set, legacy + # cookies encrypted with HMAC AES-256-CBC will be transparently upgraded. + # + # This jar requires that you set a suitable secret for the verification on your + # app's `secret_key_base`. + # + # Example: + # + # cookies.encrypted[:discount] = 45 + # # => Set-Cookie: discount=DIQ7fw==--K3n//8vvnSbGq9dA--7Xh91HfLpwzbj1czhBiwOg==; path=/ + # + # cookies.encrypted[:discount] # => 45 + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:274 + def encrypted; end + + # Returns a jar that'll automatically set the assigned cookies to have an + # expiration date 20 years from now. Example: + # + # cookies.permanent[:prefers_open_id] = true + # # => Set-Cookie: prefers_open_id=true; path=/; expires=Sun, 16-Dec-2029 03:24:16 GMT + # + # This jar is only meant for writing. You'll read permanent cookies through the + # regular accessor. + # + # This jar allows chaining with the signed jar as well, so you can set + # permanent, signed cookies. Examples: + # + # cookies.permanent.signed[:remember_me] = current_user.id + # # => Set-Cookie: remember_me=BAhU--848956038e692d7046deab32b7131856ab20e14e; path=/; expires=Sun, 16-Dec-2029 03:24:16 GMT + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:234 + def permanent; end + + # Returns a jar that'll automatically generate a signed representation of cookie + # value and verify it when reading from the cookie again. This is useful for + # creating cookies with values that the user is not supposed to change. If a + # signed cookie was tampered with by the user (or a 3rd party), `nil` will be + # returned. + # + # This jar requires that you set a suitable secret for the verification on your + # app's `secret_key_base`. + # + # Example: + # + # cookies.signed[:discount] = 45 + # # => Set-Cookie: discount=BAhpMg==--2c1c6906c90a3bc4fd54a51ffb41dffa4bf6b5f7; path=/ + # + # cookies.signed[:discount] # => 45 + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:253 + def signed; end + + # Returns the `signed` or `encrypted` jar, preferring `encrypted` if + # `secret_key_base` is set. Used by ActionDispatch::Session::CookieStore to + # avoid the need to introduce new cookie stores. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:281 + def signed_or_encrypted; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:304 + def encrypted_cookie_cipher; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:298 + def prepare_upgrade_legacy_hmac_aes_cbc_cookies?; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:308 + def signed_cookie_digest; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:291 + def upgrade_legacy_hmac_aes_cbc_cookies?; end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:313 +class ActionDispatch::Cookies::CookieJar + include ::ActionDispatch::Cookies::ChainedCookieJars + include ::Enumerable + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:324 + def initialize(request); end + + # Returns the value of the cookie by `name`, or `nil` if no such cookie exists. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:346 + def [](name); end + + # Sets the cookie named `name`. The second argument may be the cookie's value or + # a hash of options as documented above. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:380 + def []=(name, options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:449 + def always_write_cookie; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:449 + def always_write_cookie=(val); end + + # Removes all cookies on the client machine by calling `delete` for each cookie. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:427 + def clear(options = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:335 + def commit!; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:333 + def committed?; end + + # Removes the cookie on the client machine by setting the value to an empty + # string and the expiration date in the past. Like `[]=`, you can pass in an + # options hash to delete cookies with extra data such as a `:path`. + # + # Returns the value of the cookie, or `nil` if the cookie does not exist. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:406 + def delete(name, options = T.unsafe(nil)); end + + # Whether the given cookie is to be deleted by this CookieJar. Like `[]=`, you + # can pass in an options hash to test if a deletion applies to a specific + # `:path`, `:domain` etc. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:420 + def deleted?(name, options = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:341 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:350 + def fetch(name, *args, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:357 + def has_key?(name); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:354 + def key?(name); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:322 + def request; end + + # Returns the cookies as Hash. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:360 + def to_hash(*_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:374 + def to_header; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:362 + def update(other_hash); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:367 + def update_cookies_from_jar; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:431 + def upgraded(name); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:435 + def write(response); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:452 + def escape(string); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:460 + def handle_options(options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:456 + def write_cookie?(cookie); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:449 + def always_write_cookie; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:449 + def always_write_cookie=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:316 + def build(req, cookies); end + end +end + +# Raised when storing more than 4K of session data. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:216 +class ActionDispatch::Cookies::CookieOverflow < ::StandardError; end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:203 +ActionDispatch::Cookies::ENCRYPTED_COOKIE_CIPHER = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:199 +ActionDispatch::Cookies::ENCRYPTED_COOKIE_SALT = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:200 +ActionDispatch::Cookies::ENCRYPTED_SIGNED_COOKIE_SALT = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:665 +class ActionDispatch::Cookies::EncryptedKeyRotatingCookieJar < ::ActionDispatch::Cookies::AbstractCookieJar + include ::ActionDispatch::Cookies::SerializedCookieJars + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:668 + def initialize(parent_jar); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:710 + def commit(name, options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:702 + def parse(name, encrypted_message, purpose: T.unsafe(nil)); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:197 +ActionDispatch::Cookies::GENERATOR_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:196 +ActionDispatch::Cookies::HTTP_HEADER = T.let(T.unsafe(nil), String) + +# Cookies can typically store 4096 bytes. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:213 +ActionDispatch::Cookies::MAX_COOKIE_SIZE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:570 +class ActionDispatch::Cookies::PermanentCookieJar < ::ActionDispatch::Cookies::AbstractCookieJar + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:572 + def commit(name, options); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:205 +ActionDispatch::Cookies::SECRET_KEY_BASE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:204 +ActionDispatch::Cookies::SIGNED_COOKIE_DIGEST = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:198 +ActionDispatch::Cookies::SIGNED_COOKIE_SALT = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:577 +module ActionDispatch::Cookies::SerializedCookieJars + protected + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:581 + def digest; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:627 + def check_for_overflow!(name, options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:623 + def commit(name, options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:606 + def parse(name, dumped, force_reserialize: T.unsafe(nil), **); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:600 + def reserialize?(dumped); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:586 + def serializer; end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:578 +ActionDispatch::Cookies::SerializedCookieJars::SERIALIZER = ActiveSupport::MessageEncryptor::NullSerializer + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:636 +class ActionDispatch::Cookies::SignedKeyRotatingCookieJar < ::ActionDispatch::Cookies::AbstractCookieJar + include ::ActionDispatch::Cookies::SerializedCookieJars + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:639 + def initialize(parent_jar); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:658 + def commit(name, options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:652 + def parse(name, signed_message, purpose: T.unsafe(nil)); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:202 +ActionDispatch::Cookies::USE_AUTHENTICATED_COOKIE_ENCRYPTION = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:210 +ActionDispatch::Cookies::USE_COOKIES_WITH_METADATA = T.let(T.unsafe(nil), String) + +# # Action Dispatch DebugExceptions +# +# This middleware is responsible for logging exceptions and showing a debugging +# page in case the request is local. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:15 +class ActionDispatch::DebugExceptions + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:23 + def initialize(app, routes_app = T.unsafe(nil), response_format = T.unsafe(nil), interceptors = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:30 + def call(env); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:206 + def api_request?(content_type); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:148 + def compose_exception_message(wrapper); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:118 + def create_template(request, wrapper); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:50 + def invoke_interceptors(request, exception, wrapper); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:180 + def log_array(logger, lines, request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:138 + def log_error(request, wrapper); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:210 + def log_rescued_responses?(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:192 + def logger(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:134 + def render(status, body, format); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:58 + def render_exception(request, exception, wrapper); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:94 + def render_for_api_request(content_type, wrapper); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:80 + def render_for_browser_request(request, wrapper); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:200 + def routes_inspector(exception); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:196 + def stderr_logger; end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:16 + def interceptors; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_exceptions.rb:18 + def register_interceptor(object = T.unsafe(nil), &block); end + end +end + +# # Action Dispatch DebugLocks +# +# This middleware can be used to diagnose deadlocks in the autoload interlock. +# +# To use it, insert it near the top of the middleware stack, using +# `config/application.rb`: +# +# config.middleware.insert_before Rack::Sendfile, ActionDispatch::DebugLocks +# +# After restarting the application and re-triggering the deadlock condition, the +# route `/rails/locks` will show a summary of all threads currently known to the +# interlock, which lock level they are holding or awaiting, and their current +# backtrace. +# +# Generally a deadlock will be caused by the interlock conflicting with some +# other external lock or blocking I/O call. These cannot be automatically +# identified, but should be visible in the displayed backtraces. +# +# NOTE: The formatting and content of this middleware's output is intended for +# human consumption, and should be expected to change between releases. +# +# This middleware exposes operational details of the server, with no access +# control. It should only be enabled when in use, and removed thereafter. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/debug_locks.rb:29 +class ActionDispatch::DebugLocks + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_locks.rb:30 + def initialize(app, path = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_locks.rb:35 + def call(env); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_locks.rb:108 + def blocked_by?(victim, blocker, all_threads); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_locks.rb:49 + def render_details(req); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:11 +class ActionDispatch::DebugView < ::ActionView::Base + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:14 + def initialize(assigns); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:20 + def compiled_method_container; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:44 + def debug_hash(object); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:36 + def debug_headers(headers); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:24 + def debug_params(params); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:58 + def editor_url(location, line: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:73 + def params_valid?; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:69 + def protect_against_forgery?; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:48 + def render(*); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/debug_view.rb:12 +ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:11 +class ActionDispatch::ExceptionWrapper + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:51 + def initialize(backtrace_cleaner, exception); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:102 + def actions; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:114 + def annotated_source_code; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:136 + def application_trace; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:49 + def backtrace_cleaner; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:90 + def corrections; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:49 + def exception; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:49 + def exception_class_name; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:234 + def exception_id; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:230 + def exception_inspect; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:222 + def exception_name; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:130 + def exception_trace; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:78 + def failures; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:94 + def file_name; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:140 + def framework_trace; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:144 + def full_trace; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:74 + def has_cause?; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:82 + def has_corrections?; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:98 + def line_number; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:226 + def message; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:86 + def original_message; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:200 + def rescue_response?; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:12 + def rescue_responses; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:12 + def rescue_responses=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:122 + def rescue_template; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:31 + def rescue_templates; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:31 + def rescue_templates=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:62 + def routing_error?; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:185 + def show?(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:44 + def silent_exceptions; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:44 + def silent_exceptions=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:204 + def source_extracts; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:218 + def source_to_show_id; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:126 + def status_code; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:70 + def sub_template_message; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:66 + def template_error?; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:210 + def trace_to_show; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:148 + def traces; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:106 + def unwrapped_exception; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:49 + def wrapped_causes; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:40 + def wrapper_exceptions; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:40 + def wrapper_exceptions=(val); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:258 + def backtrace; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:260 + def build_backtrace; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:283 + def causes_for(exception); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:293 + def clean_backtrace(*args); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:346 + def extract_file_and_line_number(trace); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:301 + def extract_source(trace); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:330 + def extract_source_fragment_lines(source_lines, line); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:336 + def source_fragment(path, line); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:289 + def wrapped_causes_for(exception, backtrace_cleaner); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:12 + def rescue_responses; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:12 + def rescue_responses=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:31 + def rescue_templates; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:31 + def rescue_templates=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:44 + def silent_exceptions; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:44 + def silent_exceptions=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:181 + def status_code_for_exception(class_name); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:40 + def wrapper_exceptions; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:40 + def wrapper_exceptions=(val); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:239 +class ActionDispatch::ExceptionWrapper::SourceMapLocation + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:240 + def initialize(location, template); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/exception_wrapper.rb:245 + def spot(exc); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/executor.rb:8 +class ActionDispatch::Executor + # pkg:gem/actionpack#lib/action_dispatch/middleware/executor.rb:9 + def initialize(app, executor); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/executor.rb:13 + def call(env); end +end + +# # Action Dispatch FileHandler +# +# This endpoint serves static files from disk using `Rack::Files`. +# +# URL paths are matched with static files according to expected conventions: +# `path`, `path`.html, `path`/index.html. +# +# Precompressed versions of these files are checked first. Brotli (.br) and gzip +# (.gz) files are supported. If `path`.br exists, this endpoint returns that +# +# If no matching file is found, this endpoint responds `404 Not Found`. +# +# Pass the `root` directory to search for matching files, an optional `index: +# "index"` to change the default `path`/index.html, and optional additional +# response headers. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:47 +class ActionDispatch::FileHandler + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:55 + def initialize(root, index: T.unsafe(nil), headers: T.unsafe(nil), precompressed: T.unsafe(nil), compressible_content_types: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:69 + def attempt(env); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:65 + def call(env); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:185 + def clean_path(path_info); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:149 + def compressible?(content_type); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:162 + def each_candidate_filepath(path_info); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:153 + def each_precompressed_filepath(filepath); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:144 + def file_readable?(path); end + + # Match a URI path to a static file to be served. + # + # Used by the `Static` class to negotiate a servable file in the `public/` + # directory (see Static#call). + # + # Checks for `path`, `path`.html, and `path`/index.html files, in that order, + # including .br and .gzip compressed extensions. + # + # If a matching file is found, the path and necessary response headers + # (Content-Type, Content-Encoding) are returned. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:104 + def find_file(path_info, accept_encoding:); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:80 + def serve(request, filepath, content_headers); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:112 + def try_files(filepath, content_type, accept_encoding:); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:122 + def try_precompressed_files(filepath, headers, accept_encoding:); end +end + +# `Accept-Encoding` value -> file extension +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:49 +ActionDispatch::FileHandler::PRECOMPRESSED = T.let(T.unsafe(nil), Hash) + +# # Action Dispatch Flash +# +# The flash provides a way to pass temporary primitive-types (String, Array, +# Hash) between actions. Anything you place in the flash will be exposed to the +# very next action and then cleared out. This is a great way of doing notices +# and alerts, such as a create action that sets `flash[:notice] = "Post +# successfully created"` before redirecting to a display action that can then +# expose the flash to its template. Actually, that exposure is automatically +# done. +# +# class PostsController < ActionController::Base +# def create +# # save post +# flash[:notice] = "Post successfully created" +# redirect_to @post +# end +# +# def show +# # doesn't need to assign the flash notice to the template, that's done automatically +# end +# end +# +# Then in `show.html.erb`: +# +# <% if flash[:notice] %> +#
<%= flash[:notice] %>
+# <% end %> +# +# Since the `notice` and `alert` keys are a common idiom, convenience accessors +# are available: +# +# flash.alert = "You must be logged in" +# flash.notice = "Post successfully created" +# +# This example places a string in the flash. And of course, you can put as many +# as you like at a time too. If you want to pass non-primitive types, you will +# have to handle that in your application. Example: To show messages with links, +# you will have to use sanitize helper. +# +# Just remember: They'll be gone by the time the next action has been performed. +# +# See docs on the FlashHash class for more details about the flash. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:50 +class ActionDispatch::Flash + class << self + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:312 + def new(app); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:119 +class ActionDispatch::Flash::FlashHash + include ::Enumerable + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:149 + def initialize(flashes = T.unsafe(nil), discard = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:169 + def [](k); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:163 + def []=(k, v); end + + # Convenience accessor for `flash[:alert]`. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:280 + def alert; end + + # Convenience accessor for `flash[:alert]=`. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:285 + def alert=(message); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:204 + def clear; end + + # Immediately deletes the single flash entry. Use this method when you want + # remove the message within the current action. See also #discard. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:189 + def delete(key); end + + # Marks the entire flash or a single flash entry to be discarded by the end of + # the current action: + # + # flash.discard # discard the entire flash at the end of the current action + # flash.discard(:warning) # discard only the "warning" entry at the end of the current action + # + # Use this method when you want to display the message in the current action but + # not in the next one. See also #delete. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:264 + def discard(k = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:209 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:200 + def empty?; end + + # Keeps either the entire current flash or a specific flash entry available for + # the next action: + # + # flash.keep # keeps the entire flash + # flash.keep(:notice) # keeps only the "notice" entry, the rest of the flash is discarded + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:250 + def keep(k = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:183 + def key?(name); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:179 + def keys; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:213 + def merge!(h); end + + # Convenience accessor for `flash[:notice]`. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:290 + def notice; end + + # Convenience accessor for `flash[:notice]=`. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:295 + def notice=(message); end + + # Sets a flash that will not be available to the next action, only to the + # current. + # + # flash.now[:message] = "Hello current action" + # + # This method enables you to use the flash as a central messaging system in your + # app. When you need to pass an object to the next action, you use the standard + # flash assign (`[]=`). When you need to pass an object to the current action, + # you use `now`, and your object will vanish when the current action is done. + # + # Entries set via `now` are accessed the same way as standard entries: + # `flash['my-key']`. + # + # Also, brings two convenience accessors: + # + # flash.now.alert = "Beware now!" + # # Equivalent to flash.now[:alert] = "Beware now!" + # + # flash.now.notice = "Good luck now!" + # # Equivalent to flash.now[:notice] = "Good luck now!" + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:241 + def now; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:215 + def replace(h); end + + # Mark for removal entries that were kept, and delete unkept ones. + # + # This method is called automatically by filters, so you generally don't need to + # care about it. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:274 + def sweep; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:196 + def to_hash; end + + # Builds a hash containing the flashes to keep for the next request. If there + # are none to keep, returns `nil`. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:143 + def to_session_value; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:173 + def update(h); end + + protected + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:300 + def now_is_loaded?; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:155 + def initialize_copy(other); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:305 + def stringify_array(array); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:122 + def from_session_value(value); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:90 +class ActionDispatch::Flash::FlashNow + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:93 + def initialize(flash); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:104 + def [](k); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:97 + def []=(k, v); end + + # Convenience accessor for `flash.now[:alert]=`. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:109 + def alert=(message); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:91 + def flash; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:91 + def flash=(_arg0); end + + # Convenience accessor for `flash.now[:notice]=`. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:114 + def notice=(message); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:51 +ActionDispatch::Flash::KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:53 +module ActionDispatch::Flash::RequestMethods + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:71 + def commit_flash; end + + # Access the contents of the flash. Returns a ActionDispatch::Flash::FlashHash. + # + # See ActionDispatch::Flash for example usage. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:57 + def flash; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:63 + def flash=(flash); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:67 + def flash_hash; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/flash.rb:84 + def reset_session; end +end + +# # Action Dispatch HostAuthorization +# +# This middleware guards from DNS rebinding attacks by explicitly permitting the +# hosts a request can be sent to, and is passed the options set in +# `config.host_authorization`. +# +# Requests can opt-out of Host Authorization with `exclude`: +# +# config.host_authorization = { exclude: ->(request) { request.path =~ /healthcheck/ } } +# +# When a request comes to an unauthorized host, the `response_app` application +# will be executed and rendered. If no `response_app` is given, a default one +# will run. The default response app logs blocked host info with level 'error' +# and responds with `403 Forbidden`. The body of the response contains debug +# info if `config.consider_all_requests_local` is set to true, otherwise the +# body is empty. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:22 +class ActionDispatch::HostAuthorization + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:128 + def initialize(app, hosts, exclude: T.unsafe(nil), response_app: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:136 + def call(env); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:152 + def blocked_hosts(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:164 + def excluded?(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:168 + def mark_as_authorized(request); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:23 +ActionDispatch::HostAuthorization::ALLOWED_HOSTS_IN_DEVELOPMENT = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:89 +class ActionDispatch::HostAuthorization::DefaultResponseApp + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:92 + def call(env); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:123 + def available_logger(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:115 + def log_error(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:108 + def response(format, body); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:101 + def response_body(request); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:90 +ActionDispatch::HostAuthorization::DefaultResponseApp::RESPONSE_STATUS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:26 +ActionDispatch::HostAuthorization::IPV4_HOSTNAME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:27 +ActionDispatch::HostAuthorization::IPV6_HOSTNAME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:28 +ActionDispatch::HostAuthorization::IPV6_HOSTNAME_WITH_PORT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:24 +ActionDispatch::HostAuthorization::PORT_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:35 +class ActionDispatch::HostAuthorization::Permissions + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:36 + def initialize(hosts); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:44 + def allows?(host); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:40 + def empty?; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:84 + def extract_hostname(host); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:61 + def sanitize_hosts(hosts); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:71 + def sanitize_regexp(host); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:75 + def sanitize_string(host); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:25 +ActionDispatch::HostAuthorization::SUBDOMAIN_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/host_authorization.rb:29 +ActionDispatch::HostAuthorization::VALID_IP_HOSTNAME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch.rb:95 +module ActionDispatch::Http + extend ::ActiveSupport::Autoload +end + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:7 +module ActionDispatch::Http::Cache; end + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:8 +module ActionDispatch::Http::Cache::Request + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:71 + def cache_control_directives; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:36 + def etag_matches?(etag); end + + # Check response freshness (`Last-Modified` and `ETag`) against request + # `If-Modified-Since` and `If-None-Match` conditions. + # If both headers are supplied, based on configuration, either `ETag` is preferred over `Last-Modified` + # or both are considered equally. You can adjust the preference with + # `config.action_dispatch.strict_freshness`. + # Reference: http://tools.ietf.org/html/rfc7232#section-6 + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:49 + def fresh?(response); end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:14 + def if_modified_since; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:24 + def if_none_match; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:28 + def if_none_match_etags; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:32 + def not_modified?(modified_at); end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:12 + def strict_freshness; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:12 + def strict_freshness=(val); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:12 + def strict_freshness; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:12 + def strict_freshness=(val); end + end +end + +# Represents the HTTP Cache-Control header for requests, +# providing methods to access various cache control directives +# Reference: https://www.rfc-editor.org/rfc/rfc9111.html#name-request-directives +# +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:78 +class ActionDispatch::Http::Cache::Request::CacheControlDirectives + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:79 + def initialize(cache_control_header); end + + # Returns the value of the max-age directive. + # This directive indicates that the client is willing to accept a response + # whose age is no greater than the specified number of seconds. + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:122 + def max_age; end + + # Returns the value of the max-stale directive. + # When max-stale is present with a value, returns that integer value. + # When max-stale is present without a value, returns true (unlimited staleness). + # When max-stale is not present, returns nil. + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:128 + def max_stale; end + + # Returns true if max-stale directive is present (with or without a value) + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:131 + def max_stale?; end + + # Returns true if max-stale directive is present without a value (unlimited staleness) + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:136 + def max_stale_unlimited?; end + + # Returns the value of the min-fresh directive. + # This directive indicates that the client is willing to accept a response + # whose freshness lifetime is no less than its current age plus the specified time in seconds. + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:143 + def min_fresh; end + + # Returns true if the no-cache directive is present. + # This directive indicates that a cache must not use the response + # to satisfy subsequent requests without successful validation on the origin server. + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:102 + def no_cache?; end + + # Returns true if the no-store directive is present. + # This directive indicates that a cache must not store any part of the + # request or response. + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:109 + def no_store?; end + + # Returns true if the no-transform directive is present. + # This directive indicates that a cache or proxy must not transform the payload. + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:115 + def no_transform?; end + + # Returns true if the only-if-cached directive is present. + # This directive indicates that the client only wishes to obtain a + # stored response. If a valid stored response is not available, + # the server should respond with a 504 (Gateway Timeout) status. + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:95 + def only_if_cached?; end + + # Returns the value of the stale-if-error directive. + # This directive indicates that the client is willing to accept a stale response + # if the check for a fresh one fails with an error for the specified number of seconds. + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:148 + def stale_if_error; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:151 + def parse_directives(header_value); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:9 +ActionDispatch::Http::Cache::Request::HTTP_IF_MODIFIED_SINCE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:10 +ActionDispatch::Http::Cache::Request::HTTP_IF_NONE_MATCH = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:180 +module ActionDispatch::Http::Cache::Response + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:181 + def cache_control; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:197 + def date; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:207 + def date=(utc_time); end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:203 + def date?; end + + # This method sets a weak ETag validator on the response so browsers and proxies + # may cache the response, keyed on the ETag. On subsequent requests, the + # `If-None-Match` header is set to the cached ETag. If it matches the current + # ETag, we can return a `304 Not Modified` response with no body, letting the + # browser or proxy know that their cache is current. Big savings in request time + # and network bandwidth. + # + # Weak ETags are considered to be semantically equivalent but not byte-for-byte + # identical. This is perfect for browser caching of HTML pages where we don't + # care about exact equality, just what the user is viewing. + # + # Strong ETags are considered byte-for-byte identical. They allow a browser or + # proxy cache to support `Range` requests, useful for paging through a PDF file + # or scrubbing through a video. Some CDNs only support strong ETags and will + # ignore weak ETags entirely. + # + # Weak ETags are what we almost always need, so they're the default. Check out + # #strong_etag= to provide a strong ETag validator. + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:229 + def etag=(weak_validators); end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:241 + def etag?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:183 + def last_modified; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:193 + def last_modified=(utc_time); end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:189 + def last_modified?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:237 + def strong_etag=(strong_validators); end + + # True if an ETag is set, and it isn't a weak validator (not preceded with + # `W/`). + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:250 + def strong_etag?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:233 + def weak_etag=(weak_validators); end + + # True if an ETag is set, and it's a weak validator (preceded with `W/`). + # + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:244 + def weak_etag?; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:273 + def cache_control_headers; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:267 + def cache_control_segments; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:263 + def generate_strong_etag(validators); end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:259 + def generate_weak_etag(validators); end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:304 + def handle_conditional_get!; end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:313 + def merge_and_normalize_cache_control!(cache_control); end + + # pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:291 + def prepare_cache_control!; end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:255 +ActionDispatch::Http::Cache::Response::DATE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:295 +ActionDispatch::Http::Cache::Response::DEFAULT_CACHE_CONTROL = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:301 +ActionDispatch::Http::Cache::Response::IMMUTABLE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:256 +ActionDispatch::Http::Cache::Response::LAST_MODIFIED = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:300 +ActionDispatch::Http::Cache::Response::MUST_REVALIDATE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:302 +ActionDispatch::Http::Cache::Response::MUST_UNDERSTAND = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:297 +ActionDispatch::Http::Cache::Response::NO_CACHE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:296 +ActionDispatch::Http::Cache::Response::NO_STORE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:299 +ActionDispatch::Http::Cache::Response::PRIVATE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:298 +ActionDispatch::Http::Cache::Response::PUBLIC = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/cache.rb:257 +ActionDispatch::Http::Cache::Response::SPECIAL_KEYS = T.let(T.unsafe(nil), Set) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:7 +class ActionDispatch::Http::ContentDisposition + # pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:14 + def initialize(disposition:, filename:); end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:21 + def ascii_filename; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:12 + def disposition; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:12 + def filename; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:31 + def to_s; end + + # pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:27 + def utf8_filename; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:40 + def percent_escape(string, pattern); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:8 + def format(disposition:, filename:); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:25 +ActionDispatch::Http::ContentDisposition::RFC_5987_ESCAPED_CHAR = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/http/content_disposition.rb:19 +ActionDispatch::Http::ContentDisposition::TRADITIONAL_ESCAPED_CHAR = T.let(T.unsafe(nil), Regexp) + +# # Action Dispatch HTTP Filter Parameters +# +# Allows you to specify sensitive query string and POST parameters to filter +# from the request log. +# +# # Replaces values with "[FILTERED]" for keys that match /foo|bar/i. +# env["action_dispatch.parameter_filter"] = [:foo, "bar"] +# +# For more information about filter behavior, see +# ActiveSupport::ParameterFilter. +# +# pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:19 +module ActionDispatch::Http::FilterParameters + # :startdoc: + # + # pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:26 + def initialize; end + + # Returns a hash of request.env with all sensitive data replaced. + # + # pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:42 + def filtered_env; end + + # Returns a hash of parameters with all sensitive data replaced. + # + # pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:35 + def filtered_parameters; end + + # Reconstructs a path with all sensitive GET parameters replaced. + # + # pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:47 + def filtered_path; end + + # Returns the `ActiveSupport::ParameterFilter` object used to filter in this + # request. + # + # pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:53 + def parameter_filter; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:62 + def env_filter; end + + # pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:73 + def filtered_query_string; end + + # pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:69 + def parameter_filter_for(filters); end +end + +# :stopdoc: +# +# pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:21 +ActionDispatch::Http::FilterParameters::ENV_MATCH = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:23 +ActionDispatch::Http::FilterParameters::NULL_ENV_FILTER = T.let(T.unsafe(nil), ActiveSupport::ParameterFilter) + +# pkg:gem/actionpack#lib/action_dispatch/http/filter_parameters.rb:22 +ActionDispatch::Http::FilterParameters::NULL_PARAM_FILTER = T.let(T.unsafe(nil), ActiveSupport::ParameterFilter) + +# pkg:gem/actionpack#lib/action_dispatch/http/filter_redirect.rb:7 +module ActionDispatch::Http::FilterRedirect + # pkg:gem/actionpack#lib/action_dispatch/http/filter_redirect.rb:10 + def filtered_location; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/filter_redirect.rb:27 + def location_filter_match?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/filter_redirect.rb:19 + def location_filters; end + + # pkg:gem/actionpack#lib/action_dispatch/http/filter_redirect.rb:37 + def parameter_filtered_location; end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/filter_redirect.rb:8 +ActionDispatch::Http::FilterRedirect::FILTERED = T.let(T.unsafe(nil), String) + +# # Action Dispatch HTTP Headers +# +# Provides access to the request's HTTP headers from the environment. +# +# env = { "CONTENT_TYPE" => "text/plain", "HTTP_USER_AGENT" => "curl/7.43.0" } +# headers = ActionDispatch::Http::Headers.from_hash(env) +# headers["Content-Type"] # => "text/plain" +# headers["User-Agent"] # => "curl/7.43.0" +# +# Also note that when headers are mapped to CGI-like variables by the Rack +# server, both dashes and underscores are converted to underscores. This +# ambiguity cannot be resolved at this stage anymore. Both underscores and +# dashes have to be interpreted as if they were originally sent as dashes. +# +# # GET / HTTP/1.1 +# # ... +# # User-Agent: curl/7.43.0 +# # X_Custom_Header: token +# +# headers["X_Custom_Header"] # => nil +# headers["X-Custom-Header"] # => "token" +# +# pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:28 +class ActionDispatch::Http::Headers + include ::Enumerable + + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:58 + def initialize(request); end + + # Returns the value for the given key mapped to @env. + # + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:63 + def [](key); end + + # Sets the given value for the key mapped to @env. + # + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:68 + def []=(key, value); end + + # Add a value to a multivalued header like `Vary` or `Accept-Encoding`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:73 + def add(key, value); end + + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:98 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:118 + def env; end + + # Returns the value for the given key mapped to @env. + # + # If the key is not found and an optional code block is not provided, raises a + # `KeyError` exception. + # + # If the code block is provided, then it will be run and its result returned. + # + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:90 + def fetch(key, default = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:80 + def include?(key); end + + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:77 + def key?(key); end + + # Returns a new Http::Headers instance containing the contents of + # `headers_or_env` and the original instance. + # + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:104 + def merge(headers_or_env); end + + # Adds the contents of `headers_or_env` to original instance entries; duplicate + # keys are overwritten with the values from `headers_or_env`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:112 + def merge!(headers_or_env); end + + private + + # Converts an HTTP header name to an environment variable name if it is not + # contained within the headers hash. + # + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:123 + def env_name(key); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:54 + def from_hash(hash); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:29 +ActionDispatch::Http::Headers::CGI_VARIABLES = T.let(T.unsafe(nil), Set) + +# pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:82 +ActionDispatch::Http::Headers::DEFAULT = T.let(T.unsafe(nil), Object) + +# pkg:gem/actionpack#lib/action_dispatch/http/headers.rb:50 +ActionDispatch::Http::Headers::HTTP_HEADER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:9 +module ActionDispatch::Http::MimeNegotiation + extend ::ActiveSupport::Concern + + # Returns the accepted MIME type for the request. + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:42 + def accepts; end + + # The MIME type of the HTTP request, such as [Mime](:xml). + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:24 + def content_mime_type; end + + # Returns the MIME type for the format used in the request. + # + # # GET /posts/5.xml + # request.format # => Mime[:xml] + # + # # GET /posts/5.xhtml + # request.format # => Mime[:html] + # + # # GET /posts/5 + # request.format # => Mime[:html] or Mime[:js], or request.accepts.first + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:68 + def format(_view_path = T.unsafe(nil)); end + + # Sets the format by string extension, which can be used to force custom formats + # that are not controlled by the extension. + # + # class ApplicationController < ActionController::Base + # before_action :adjust_format_for_iphone + # + # private + # def adjust_format_for_iphone + # request.format = :iphone if request.env["HTTP_USER_AGENT"][/iPhone/] + # end + # end + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:174 + def format=(extension); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:72 + def formats; end + + # Sets the formats by string extensions. This differs from #format= by allowing + # you to set multiple, ordered formats, which is useful when you want to have a + # fallback. + # + # In this example, the `:iphone` format will be used if it's available, + # otherwise it'll fall back to the `:html` format. + # + # class ApplicationController < ActionController::Base + # before_action :adjust_format_for_iphone_with_html_fallback + # + # private + # def adjust_format_for_iphone_with_html_fallback + # request.formats = [ :iphone, :html ] if request.env["HTTP_USER_AGENT"][/iPhone/] + # end + # end + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:194 + def formats=(extensions); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:37 + def has_content_type?; end + + # Returns the first MIME type that matches the provided array of MIME types. + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:202 + def negotiate_mime(order); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:214 + def should_apply_vary_header?; end + + # Returns the \variant for the response template as an instance of + # ActiveSupport::ArrayInquirer. + # + # request.variant = :phone + # request.variant.phone? # => true + # request.variant.tablet? # => false + # + # request.variant = [:phone, :tablet] + # request.variant.phone? # => true + # request.variant.desktop? # => false + # request.variant.any?(:phone, :desktop) # => true + # request.variant.any?(:desktop, :watch) # => false + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:159 + def variant; end + + # Sets the \variant for the response template. + # + # When determining which template to render, Action View will incorporate + # all variants from the request. For example, if an + # `ArticlesController#index` action needs to respond to + # `request.variant = [:ios, :turbo_native]`, it will render the + # first template file it can find in the following list: + # + # - `app/views/articles/index.html+ios.erb` + # - `app/views/articles/index.html+turbo_native.erb` + # - `app/views/articles/index.html.erb` + # + # Variants add context to the requests that views render appropriately. + # Variant names are arbitrary, and can communicate anything from the + # request's platform (`:android`, `:ios`, `:linux`, `:macos`, `:windows`) + # to its browser (`:chrome`, `:edge`, `:firefox`, `:safari`), to the type + # of user (`:admin`, `:guest`, `:user`). + # + # Note: Adding many new variant templates with similarities to existing + # template files can make maintaining your view code more difficult. + # + # #### Parameters + # + # * `variant` - a symbol name or an array of symbol names for variants + # used to render the response template + # + # #### Examples + # + # class ApplicationController < ActionController::Base + # before_action :determine_variants + # + # private + # def determine_variants + # variants = [] + # + # # some code to determine the variant(s) to use + # + # variants << :ios if request.user_agent.include?("iOS") + # variants << :turbo_native if request.user_agent.include?("Turbo Native") + # + # request.variant = variants + # end + # end + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:137 + def variant=(variant); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:218 + def vary_headers; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:248 + def format_from_path_extension; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:233 + def params_readable?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:244 + def use_accept_header; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:239 + def valid_accept_header; end +end + +# We use normal content negotiation unless you include **/** in your list, in +# which case we assume you're a browser and send HTML. +# +# pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:231 +ActionDispatch::Http::MimeNegotiation::BROWSER_LIKE_ACCEPTS = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:12 +class ActionDispatch::Http::MimeNegotiation::InvalidType < ::Mime::Type::InvalidMimeType; end + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_negotiation.rb:14 +ActionDispatch::Http::MimeNegotiation::RESCUABLE_MIME_FORMAT_ERRORS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:7 +module ActionDispatch::Http::Parameters + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionDispatch::Http::Parameters::ClassMethods + + # Returns both GET and POST parameters in a single hash. + # + # pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:52 + def parameters; end + + # pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:65 + def params; end + + # Returns a hash with the parameters used to form the path of the request. + # Returned hash keys are symbols: + # + # { action: "my_action", controller: "my_controller" } + # + # pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:84 + def path_parameters; end + + # pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:67 + def path_parameters=(parameters); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:102 + def log_parse_error_once; end + + # pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:114 + def params_parsers; end + + # pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:89 + def parse_formatted_parameters(parsers); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:36 +module ActionDispatch::Http::Parameters::ClassMethods + # Configure the parameter parser for a given MIME type. + # + # It accepts a hash where the key is the symbol of the MIME type and the value + # is a proc. + # + # original_parsers = ActionDispatch::Request.parameter_parsers + # xml_parser = -> (raw_post) { Hash.from_xml(raw_post) || {} } + # new_parsers = original_parsers.merge(xml: xml_parser) + # ActionDispatch::Request.parameter_parsers = new_parsers + # + # pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:46 + def parameter_parsers=(parsers); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:12 +ActionDispatch::Http::Parameters::DEFAULT_PARSERS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:10 +ActionDispatch::Http::Parameters::PARAMETERS_KEY = T.let(T.unsafe(nil), String) + +# Raised when raw data from the request cannot be parsed by the parser defined +# for request's content MIME type. +# +# pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:21 +class ActionDispatch::Http::Parameters::ParseError < ::StandardError + # pkg:gem/actionpack#lib/action_dispatch/http/parameters.rb:22 + def initialize(message = T.unsafe(nil)); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/url.rb:9 +module ActionDispatch::Http::URL + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:277 + def initialize; end + + # Returns the domain part of a host, such as "rubyonrails.org" in + # "www.rubyonrails.org". You can specify a different `tld_length`, such as 2 to + # catch rubyonrails.co.uk in "www.rubyonrails.co.uk". + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:420 + def domain(tld_length = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:112 + def domain_extractor; end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:112 + def domain_extractor=(val); end + + # Returns the host for this request, such as "example.com". + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080' + # req.host # => "example.com" + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:324 + def host; end + + # Returns a host:port string for this request, such as "example.com" or + # "example.com:8080". Port is only included if it is not a default port (80 or + # 443) + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com' + # req.host_with_port # => "example.com" + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:80' + # req.host_with_port # => "example.com" + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080' + # req.host_with_port # => "example.com:8080" + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:340 + def host_with_port; end + + # Returns a number port suffix like 8080 if the port number of this request is + # not the default HTTP port 80 or HTTPS port 443. + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:80' + # req.optional_port # => nil + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080' + # req.optional_port # => 8080 + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:390 + def optional_port; end + + # Returns the port number of this request as an integer. + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com' + # req.port # => 80 + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080' + # req.port # => 8080 + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:351 + def port; end + + # Returns a string port suffix, including colon, like ":8080" if the port number + # of this request is not the default HTTP port 80 or HTTPS port 443. + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:80' + # req.port_string # => "" + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080' + # req.port_string # => ":8080" + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:402 + def port_string; end + + # Returns 'https://' if this is an SSL request and 'http://' otherwise. + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com' + # req.protocol # => "http://" + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com', 'HTTPS' => 'on' + # req.protocol # => "https://" + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:298 + def protocol; end + + # Returns the host and port for this request, such as "example.com:8080". + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com' + # req.raw_host_with_port # => "example.com" + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:80' + # req.raw_host_with_port # => "example.com:80" + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080' + # req.raw_host_with_port # => "example.com:8080" + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:312 + def raw_host_with_port; end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:110 + def secure_protocol; end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:110 + def secure_protocol=(val); end + + # Returns the requested port, such as 8080, based on SERVER_PORT. + # + # req = ActionDispatch::Request.new 'SERVER_PORT' => '80' + # req.server_port # => 80 + # + # req = ActionDispatch::Request.new 'SERVER_PORT' => '8080' + # req.server_port # => 8080 + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:413 + def server_port; end + + # Returns the standard port number for this request's protocol. + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080' + # req.standard_port # => 80 + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:363 + def standard_port; end + + # Returns whether this request is using the standard port. + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:80' + # req.standard_port? # => true + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080' + # req.standard_port? # => false + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:378 + def standard_port?; end + + # Returns all the subdomains as a string, so `"dev.www"` would be returned for + # "dev.www.rubyonrails.org". You can specify a different `tld_length`, such as 2 + # to catch `"www"` instead of `"www.rubyonrails"` in "www.rubyonrails.co.uk". + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:435 + def subdomain(tld_length = T.unsafe(nil)); end + + # Returns all the subdomains as an array, so `["dev", "www"]` would be returned + # for "dev.www.rubyonrails.org". You can specify a different `tld_length`, such + # as 2 to catch `["www"]` instead of `["www", "rubyonrails"]` in + # "www.rubyonrails.co.uk". + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:428 + def subdomains(tld_length = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:111 + def tld_length; end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:111 + def tld_length=(val); end + + # Returns the complete URL used for this request. + # + # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com' + # req.url # => "http://example.com" + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:287 + def url; end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:112 + def domain_extractor; end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:112 + def domain_extractor=(val); end + + # Returns the domain part of a host given the domain level. + # + # # Top-level domain example + # extract_domain('www.example.com', 1) # => "example.com" + # # Second-level domain example + # extract_domain('dev.www.example.co.uk', 2) # => "example.co.uk" + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:121 + def extract_domain(host, tld_length); end + + # Returns the subdomains of a host as a String given the domain level. + # + # # Top-level domain example + # extract_subdomain('www.example.com', 1) # => "www" + # # Second-level domain example + # extract_subdomain('dev.www.example.co.uk', 2) # => "dev.www" + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:145 + def extract_subdomain(host, tld_length); end + + # Returns the subdomains of a host as an Array given the domain level. + # + # # Top-level domain example + # extract_subdomains('www.example.com', 1) # => ["www"] + # # Second-level domain example + # extract_subdomains('dev.www.example.co.uk', 2) # => ["dev", "www"] + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:131 + def extract_subdomains(host, tld_length); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:157 + def full_url_for(options); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:169 + def path_for(options); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:110 + def secure_protocol; end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:110 + def secure_protocol=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:111 + def tld_length; end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:111 + def tld_length=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:149 + def url_for(options); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:189 + def add_anchor(path, anchor); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:182 + def add_params(path, params); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:203 + def build_host_url(host, port, protocol, options, path); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:195 + def extract_domain_from(host, tld_length); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:199 + def extract_subdomains_from(host, tld_length); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:227 + def named_host?(host); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:244 + def normalize_host(_host, options); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:264 + def normalize_port(port, protocol); end + + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:231 + def normalize_protocol(protocol); end + end +end + +# DomainExtractor provides utility methods for extracting domain and subdomain +# information from host strings. This module is used internally by Action Dispatch +# to parse host names and separate the domain from subdomains based on the +# top-level domain (TLD) length. +# +# The module assumes a standard domain structure where domains consist of: +# - Subdomains (optional, can be multiple levels) +# - Domain name +# - Top-level domain (TLD, can be multiple levels like .co.uk) +# +# For example, in "api.staging.example.co.uk": +# - Subdomains: ["api", "staging"] +# - Domain: "example.co.uk" (with tld_length=2) +# - TLD: "co.uk" +# +# pkg:gem/actionpack#lib/action_dispatch/http/url.rb:28 +module ActionDispatch::Http::URL::DomainExtractor + extend ::ActionDispatch::Http::URL::DomainExtractor + + # Extracts the domain part from a host string, including the specified + # number of top-level domain components. + # + # The domain includes the main domain name plus the TLD components. + # The +tld_length+ parameter specifies how many components from the right + # should be considered part of the TLD. + # + # ==== Parameters + # + # [+host+] + # The host string to extract the domain from. + # + # [+tld_length+] + # The number of domain components that make up the TLD. For example, + # use 1 for ".com" or 2 for ".co.uk". + # + # ==== Examples + # + # # Standard TLD (tld_length = 1) + # DomainExtractor.domain_from("www.example.com", 1) + # # => "example.com" + # + # # Country-code TLD (tld_length = 2) + # DomainExtractor.domain_from("www.example.co.uk", 2) + # # => "example.co.uk" + # + # # Multiple subdomains + # DomainExtractor.domain_from("api.staging.myapp.herokuapp.com", 1) + # # => "herokuapp.com" + # + # # Single component (returns the host itself) + # DomainExtractor.domain_from("localhost", 1) + # # => "localhost" + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:64 + def domain_from(host, tld_length); end + + # Extracts the subdomain components from a host string as an Array. + # + # Returns all the components that come before the domain and TLD parts. + # The +tld_length+ parameter is used to determine where the domain begins + # so that everything before it is considered a subdomain. + # + # ==== Parameters + # + # [+host+] + # The host string to extract subdomains from. + # + # [+tld_length+] + # The number of domain components that make up the TLD. This affects + # where the domain boundary is calculated. + # + # ==== Examples + # + # # Standard TLD (tld_length = 1) + # DomainExtractor.subdomains_from("www.example.com", 1) + # # => ["www"] + # + # # Country-code TLD (tld_length = 2) + # DomainExtractor.subdomains_from("api.staging.example.co.uk", 2) + # # => ["api", "staging"] + # + # # No subdomains + # DomainExtractor.subdomains_from("example.com", 1) + # # => [] + # + # # Single subdomain with complex TLD + # DomainExtractor.subdomains_from("www.mysite.co.uk", 2) + # # => ["www"] + # + # # Multiple levels of subdomains + # DomainExtractor.subdomains_from("dev.api.staging.example.com", 1) + # # => ["dev", "api", "staging"] + # + # pkg:gem/actionpack#lib/action_dispatch/http/url.rb:104 + def subdomains_from(host, tld_length); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/url.rb:11 +ActionDispatch::Http::URL::HOST_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/http/url.rb:10 +ActionDispatch::Http::URL::IP_HOST_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/http/url.rb:12 +ActionDispatch::Http::URL::PROTOCOL_REGEXP = T.let(T.unsafe(nil), Regexp) + +# # Action Dispatch HTTP UploadedFile +# +# Models uploaded files. +# +# The actual file is accessible via the `tempfile` accessor, though some of its +# interface is available directly for convenience. +# +# Uploaded files are temporary files whose lifespan is one request. When the +# object is finalized Ruby unlinks the file, so there is no need to clean them +# with a separate maintenance task. +# +# pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:17 +class ActionDispatch::Http::UploadedFile + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:31 + def initialize(hash); end + + # Shortcut for `tempfile.close`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:73 + def close(unlink_now = T.unsafe(nil)); end + + # A string with the MIME type of the file. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:22 + def content_type; end + + # A string with the MIME type of the file. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:22 + def content_type=(_arg0); end + + # Shortcut for `tempfile.eof?`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:98 + def eof?; end + + # A string with the headers of the multipart request. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:29 + def headers; end + + # A string with the headers of the multipart request. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:29 + def headers=(_arg0); end + + # Shortcut for `tempfile.open`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:68 + def open; end + + # The basename of the file in the client. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:19 + def original_filename; end + + # The basename of the file in the client. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:19 + def original_filename=(_arg0); end + + # Shortcut for `tempfile.path`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:78 + def path; end + + # Shortcut for `tempfile.read`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:63 + def read(length = T.unsafe(nil), buffer = T.unsafe(nil)); end + + # Shortcut for `tempfile.rewind`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:88 + def rewind; end + + # Shortcut for `tempfile.size`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:93 + def size; end + + # A `Tempfile` object with the actual uploaded file. Note that some of its + # interface is available directly. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:26 + def tempfile; end + + # A `Tempfile` object with the actual uploaded file. Note that some of its + # interface is available directly. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:26 + def tempfile=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:102 + def to_io; end + + # Shortcut for `tempfile.to_path`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/upload.rb:83 + def to_path; end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:14 +module ActionDispatch::Integration; end + +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:15 +module ActionDispatch::Integration::RequestHelpers + # Performs a DELETE request with the given parameters. See + # ActionDispatch::Integration::Session#process for more details. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:42 + def delete(path, **args); end + + # Follow a single redirect response. If the last response was not a redirect, an + # exception will be raised. Otherwise, the redirect is performed on the location + # header. If the redirection is a 307 or 308 redirect, the same HTTP verb will + # be used when redirecting, otherwise a GET request will be performed. Any + # arguments are passed to the underlying request. + # + # The HTTP_REFERER header will be set to the previous url. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:65 + def follow_redirect!(headers: T.unsafe(nil), **args); end + + # Performs a GET request with the given parameters. See + # ActionDispatch::Integration::Session#process for more details. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:18 + def get(path, **args); end + + # Performs a HEAD request with the given parameters. See + # ActionDispatch::Integration::Session#process for more details. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:48 + def head(path, **args); end + + # Performs an OPTIONS request with the given parameters. See + # ActionDispatch::Integration::Session#process for more details. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:54 + def options(path, **args); end + + # Performs a PATCH request with the given parameters. See + # ActionDispatch::Integration::Session#process for more details. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:30 + def patch(path, **args); end + + # Performs a POST request with the given parameters. See + # ActionDispatch::Integration::Session#process for more details. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:24 + def post(path, **args); end + + # Performs a PUT request with the given parameters. See + # ActionDispatch::Integration::Session#process for more details. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:36 + def put(path, **args); end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:335 +module ActionDispatch::Integration::Runner + include ::ActionDispatch::Assertions::RoutingAssertions + include ::ActionDispatch::Assertions::ResponseAssertions + include ::Rails::Dom::Testing::Assertions::DomAssertions + include ::Rails::Dom::Testing::Assertions::SelectorAssertions + include ::Rails::Dom::Testing::Assertions + include ::ActionDispatch::Assertions + extend ::ActionDispatch::Assertions::RoutingAssertions::ClassMethods + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:343 + def initialize(*args, &blk); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:340 + def app; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:413 + def assertions; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:417 + def assertions=(assertions); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:385 + def assigns(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:348 + def before_setup; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:385 + def cookies(*, **, &); end + + # Copy the instance variables from the current session instance into the test + # instance. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:423 + def copy_session_variables!; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:363 + def create_session(app); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:429 + def default_url_options; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:433 + def default_url_options=(options); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:385 + def delete(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:385 + def follow_redirect!(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:385 + def get(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:385 + def head(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:353 + def integration_session; end + + # Open a new session instance. If a block is given, the new session is yielded + # to the block before being returned. + # + # session = open_session do |sess| + # sess.extend(CustomAssertions) + # end + # + # By default, a single session is automatically created for you, but you can use + # this method to open multiple sessions that ought to be tested simultaneously. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:405 + def open_session; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:385 + def patch(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:385 + def post(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:385 + def put(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:375 + def remove!; end + + # Reset the current session. This is useful for testing multiple sessions in a + # single test case. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:359 + def reset!; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:341 + def root_session; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:341 + def root_session=(_arg0); end + + private + + # Delegate unhandled messages to the current session instance. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:443 + def method_missing(method, *, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:438 + def respond_to_missing?(method, _); end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:338 +ActionDispatch::Integration::Runner::APP_SESSIONS = T.let(T.unsafe(nil), Hash) + +# An instance of this class represents a set of requests and responses performed +# sequentially by a test process. Because you can instantiate multiple sessions +# and run them side-by-side, you can also mimic (to some limited extent) +# multiple simultaneous users interacting with your system. +# +# Typically, you will instantiate a new session using Runner#open_session, +# rather than instantiating a Session directly. +# +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:91 +class ActionDispatch::Integration::Session + include ::Minitest::Assertions + include ::ActionDispatch::Assertions::RoutingAssertions + include ::ActionDispatch::Assertions::ResponseAssertions + include ::Rails::Dom::Testing::Assertions::DomAssertions + include ::Rails::Dom::Testing::Assertions::SelectorAssertions + include ::Rails::Dom::Testing::Assertions + include ::ActionDispatch::Assertions + include ::ActionDispatch::Integration::RequestHelpers + include ::ActionDispatch::TestProcess::FixtureFile + include ::ActionDispatch::TestProcess + include ::ActionDispatch::Routing::PolymorphicRoutes + include ::ActionDispatch::Routing::UrlFor + extend ::ActionDispatch::Assertions::RoutingAssertions::ClassMethods + + # Create and initialize a new Session instance. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:133 + def initialize(app); end + + # The Accept header to send. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:110 + def accept; end + + # The Accept header to send. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:110 + def accept=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:97 + def body(*, **, &); end + + # A reference to the controller instance used by the last request. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:119 + def controller; end + + # A map of the cookies returned by the last response, and which will be sent + # with the next request. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:114 + def cookies; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:130 + def default_url_options; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:130 + def default_url_options=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:130 + def default_url_options?; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:97 + def headers(*, **, &); end + + # The hostname used in the last request. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:101 + def host; end + + # Set the host name to use in the next request. + # + # session.host! "www.example.com" + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:316 + def host!(_arg0); end + + # The hostname used in the last request. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:104 + def host=(_arg0); end + + # Specify whether or not the session should mimic a secure HTTPS request. + # + # session.https! + # session.https!(false) + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:180 + def https!(flag = T.unsafe(nil)); end + + # Returns `true` if the session is mimicking a secure HTTPS request. + # + # if session.https? + # # ... + # end + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:189 + def https?; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:98 + def path(*, **, &); end + + # Performs the actual request. + # + # * `method`: The HTTP method (GET, POST, PATCH, PUT, DELETE, HEAD, OPTIONS) + # as a symbol. + # * `path`: The URI (as a String) on which you want to perform the request. + # * `params`: The HTTP parameters that you want to pass. This may be `nil`, a + # Hash, or a String that is appropriately encoded + # (`application/x-www-form-urlencoded` or `multipart/form-data`). + # * `headers`: Additional headers to pass, as a Hash. The headers will be + # merged into the Rack env hash. + # * `env`: Additional env to pass, as a Hash. The headers will be merged into + # the Rack env hash. + # * `xhr`: Set to `true` if you want to make an Ajax request. Adds request + # headers characteristic of `XMLHttpRequest`, e.g. `HTTP_X_REQUESTED_WITH`. The + # headers will be merged into the Rack env hash. + # * `as`: Used for encoding the request with different content type. Supports + # `:json` by default and will set the appropriate request headers. The + # headers will be merged into the Rack env hash. + # + # + # This method is rarely used directly. Use RequestHelpers#get, + # RequestHelpers#post, or other standard HTTP methods in integration tests. + # `#process` is only required when using a request method that doesn't have a + # method defined in the integration tests. + # + # This method returns the response status, after performing the request. + # Furthermore, if this method was called from an ActionDispatch::IntegrationTest + # object, then that object's `@response` instance variable will point to a + # ActionDispatch::TestResponse object which one can use to inspect the details of the response. + # + # Example: + # + # process :get, '/author', params: { since: 201501011400 } + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:226 + def process(method, path, params: T.unsafe(nil), headers: T.unsafe(nil), env: T.unsafe(nil), xhr: T.unsafe(nil), as: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:97 + def redirect?(*, **, &); end + + # The remote_addr used in the last request. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:107 + def remote_addr; end + + # The remote_addr used in the last request. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:107 + def remote_addr=(_arg0); end + + # A reference to the request instance used by the last request. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:122 + def request; end + + # A running counter of the number of requests processed. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:128 + def request_count; end + + # A running counter of the number of requests processed. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:128 + def request_count=(_arg0); end + + # Resets the instance. This can be used to reset the state information in an + # existing session instance, so it can be used from a clean-slate condition. + # + # session.reset! + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:156 + def reset!; end + + # A reference to the response instance used by the last request. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:125 + def response; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:97 + def status(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:97 + def status_message(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:140 + def url_options; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:319 + def _mock_session; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:327 + def build_expanded_path(path); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:323 + def build_full_uri(path, env); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:130 + def default_url_options; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:130 + def default_url_options=(value); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:130 + def default_url_options?; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:130 + def __class_attr_default_url_options; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:130 + def __class_attr_default_url_options=(new_value); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:92 +ActionDispatch::Integration::Session::DEFAULT_HOST = T.let(T.unsafe(nil), String) + +# An integration test spans multiple controllers and actions, tying them all +# together to ensure they work together as expected. It tests more completely +# than either unit or functional tests do, exercising the entire stack, from the +# dispatcher to the database. +# +# At its simplest, you simply extend `IntegrationTest` and write your tests +# using the Integration::RequestHelpers#get and/or +# Integration::RequestHelpers#post methods: +# +# require "test_helper" +# +# class ExampleTest < ActionDispatch::IntegrationTest +# fixtures :people +# +# def test_login +# # get the login page +# get "/login" +# assert_equal 200, status +# +# # post the login and follow through to the home page +# post "/login", params: { username: people(:jamis).username, +# password: people(:jamis).password } +# follow_redirect! +# assert_equal 200, status +# assert_equal "/home", path +# end +# end +# +# However, you can also have multiple session instances open per test, and even +# extend those instances with assertions and methods to create a very powerful +# testing DSL that is specific for your application. You can even reference any +# named routes you happen to have defined. +# +# require "test_helper" +# +# class AdvancedTest < ActionDispatch::IntegrationTest +# fixtures :people, :rooms +# +# def test_login_and_speak +# jamis, david = login(:jamis), login(:david) +# room = rooms(:office) +# +# jamis.enter(room) +# jamis.speak(room, "anybody home?") +# +# david.enter(room) +# david.speak(room, "hello!") +# end +# +# private +# +# module CustomAssertions +# def enter(room) +# # reference a named route, for maximum internal consistency! +# get(room_url(id: room.id)) +# assert(...) +# ... +# end +# +# def speak(room, message) +# post "/say/#{room.id}", xhr: true, params: { message: message } +# assert(...) +# ... +# end +# end +# +# def login(who) +# open_session do |sess| +# sess.extend(CustomAssertions) +# who = people(who) +# sess.post "/login", params: { username: who.username, +# password: who.password } +# assert(...) +# end +# end +# end +# +# Another longer example would be: +# +# A simple integration test that exercises multiple controllers: +# +# require "test_helper" +# +# class UserFlowsTest < ActionDispatch::IntegrationTest +# test "login and browse site" do +# # login via https +# https! +# get "/login" +# assert_response :success +# +# post "/login", params: { username: users(:david).username, password: users(:david).password } +# follow_redirect! +# assert_equal '/welcome', path +# assert_equal 'Welcome david!', flash[:notice] +# +# https!(false) +# get "/articles/all" +# assert_response :success +# assert_dom 'h1', 'Articles' +# end +# end +# +# As you can see the integration test involves multiple controllers and +# exercises the entire stack from database to dispatcher. In addition you can +# have multiple session instances open simultaneously in a test and extend those +# instances with assertion methods to create a very powerful testing DSL +# (domain-specific language) just for your application. +# +# Here's an example of multiple sessions and custom DSL in an integration test +# +# require "test_helper" +# +# class UserFlowsTest < ActionDispatch::IntegrationTest +# test "login and browse site" do +# # User david logs in +# david = login(:david) +# # User guest logs in +# guest = login(:guest) +# +# # Both are now available in different sessions +# assert_equal 'Welcome david!', david.flash[:notice] +# assert_equal 'Welcome guest!', guest.flash[:notice] +# +# # User david can browse site +# david.browses_site +# # User guest can browse site as well +# guest.browses_site +# +# # Continue with other assertions +# end +# +# private +# +# module CustomDsl +# def browses_site +# get "/products/all" +# assert_response :success +# assert_dom 'h1', 'Products' +# end +# end +# +# def login(user) +# open_session do |sess| +# sess.extend(CustomDsl) +# u = users(user) +# sess.https! +# sess.post "/login", params: { username: u.username, password: u.password } +# assert_equal '/welcome', sess.path +# sess.https!(false) +# end +# end +# end +# +# See the [request helpers documentation](rdoc-ref:ActionDispatch::Integration::RequestHelpers) +# for help on how to use `get`, etc. +# +# ### Changing the request encoding +# +# You can also test your JSON API easily by setting what the request should be +# encoded as: +# +# require "test_helper" +# +# class ApiTest < ActionDispatch::IntegrationTest +# test "creates articles" do +# assert_difference -> { Article.count } do +# post articles_path, params: { article: { title: "Ahoy!" } }, as: :json +# end +# +# assert_response :success +# assert_equal({ "id" => Article.last.id, "title" => "Ahoy!" }, response.parsed_body) +# end +# end +# +# The `as` option passes an "application/json" Accept header (thereby setting +# the request format to JSON unless overridden), sets the content type to +# "application/json" and encodes the parameters as JSON. +# +# Calling TestResponse#parsed_body on the response parses the response body +# based on the last response MIME type. +# +# Out of the box, only `:json` is supported. But for any custom MIME types +# you've registered, you can add your own encoders with: +# +# ActionDispatch::IntegrationTest.register_encoder :wibble, +# param_encoder: -> params { params.to_wibble }, +# response_parser: -> body { body } +# +# Where `param_encoder` defines how the params should be encoded and +# `response_parser` defines how the response body should be parsed through +# TestResponse#parsed_body. +# +# Consult the [Rails Testing Guide](https://guides.rubyonrails.org/testing.html) +# for more. +# +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:650 +class ActionDispatch::IntegrationTest < ::ActiveSupport::TestCase + include ::ActionDispatch::TestProcess::FixtureFile + include ::ActionDispatch::Assertions::RoutingAssertions + include ::ActionDispatch::Assertions::ResponseAssertions + include ::Rails::Dom::Testing::Assertions::DomAssertions + include ::Rails::Dom::Testing::Assertions::SelectorAssertions + include ::Rails::Dom::Testing::Assertions + include ::ActionDispatch::Assertions + include ::ActionDispatch::Integration::Runner + include ::ActionController::TemplateAssertions + include ::ActionDispatch::TestHelpers::PageDumpHelper + include ::ActionDispatch::IntegrationTest::Behavior + include ::ActionDispatch::Routing::PolymorphicRoutes + include ::ActionDispatch::Routing::UrlFor + include ::ActionDispatch::IntegrationTest::UrlOptions + include ::ActionDispatch::Assertions::RoutingAssertions::WithIntegrationRouting + extend ::ActionDispatch::IntegrationTest::Behavior::ClassMethods + extend ::ActionDispatch::Assertions::RoutingAssertions::WithIntegrationRouting::ClassMethods +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:660 +module ActionDispatch::IntegrationTest::Behavior + include ::ActionDispatch::Assertions::RoutingAssertions + include ::ActionDispatch::Assertions::ResponseAssertions + include ::Rails::Dom::Testing::Assertions::DomAssertions + include ::Rails::Dom::Testing::Assertions::SelectorAssertions + include ::Rails::Dom::Testing::Assertions + include ::ActionDispatch::Assertions + include ::ActionDispatch::Integration::Runner + include ::ActionController::TemplateAssertions + include ::ActionDispatch::TestHelpers::PageDumpHelper + extend ::ActiveSupport::Concern + include ::ActionDispatch::Routing::UrlFor + include ::ActionDispatch::IntegrationTest::UrlOptions + include ::ActionDispatch::Assertions::RoutingAssertions::WithIntegrationRouting + + mixes_in_class_methods ::ActionDispatch::IntegrationTest::Behavior::ClassMethods + mixes_in_class_methods ::ActionDispatch::Assertions::RoutingAssertions::WithIntegrationRouting::ClassMethods + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:693 + def app; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:697 + def document_root_element; end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:675 +module ActionDispatch::IntegrationTest::Behavior::ClassMethods + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:676 + def app; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:684 + def app=(app); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:688 + def register_encoder(*args, **options); end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:653 +module ActionDispatch::IntegrationTest::UrlOptions + extend ::ActiveSupport::Concern + + # pkg:gem/actionpack#lib/action_dispatch/testing/integration.rb:655 + def url_options; end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/param_error.rb:21 +class ActionDispatch::InvalidParameterError < ::ActionDispatch::ParamError; end + +# :stopdoc: +# +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:6 +module ActionDispatch::Journey; end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:9 +class ActionDispatch::Journey::Ast + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:13 + def initialize(tree, formatted); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:38 + def glob?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:10 + def names; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:10 + def path_params; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:25 + def requirements=(requirements); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:11 + def root; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:34 + def route=(route); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:10 + def terminals; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:10 + def tree; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:10 + def wildcard_options; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:43 + def stars; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:43 + def symbols; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:45 + def visit_tree(formatted); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:8 +class ActionDispatch::Journey::Format + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:24 + def initialize(parts); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:39 + def evaluate(hash); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:16 + def required_path(symbol); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:20 + def required_segment(symbol); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:9 +ActionDispatch::Journey::Format::ESCAPE_PATH = T.let(T.unsafe(nil), Proc) + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:10 +ActionDispatch::Journey::Format::ESCAPE_SEGMENT = T.let(T.unsafe(nil), Proc) + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 +class ActionDispatch::Journey::Format::Parameter < ::Struct + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:13 + def escape(value); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 + def escaper; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 + def escaper=(_); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 + def name=(_); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 + def [](*_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 + def inspect; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 + def keyword_init?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 + def members; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:12 + def new(*_arg0); end + end +end + +# The Formatter class is used for formatting URLs. For example, parameters +# passed to `url_for` in Rails will eventually call Formatter#generate. +# +# pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:12 +class ActionDispatch::Journey::Formatter + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:15 + def initialize(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:115 + def clear; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:119 + def eager_load!; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:61 + def generate(name, options, path_parameters); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:13 + def routes; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:219 + def build_cache; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:230 + def cache; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:125 + def extract_parameterized_parts(route, options, recall); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:152 + def match_route(name, options); end + + # Returns an array populated with missing keys if any are present. + # + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:191 + def missing_keys(route, parts); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:148 + def named_routes; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:174 + def non_recursive(cache, options); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:211 + def possibles(cache, options, depth = T.unsafe(nil)); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:34 +class ActionDispatch::Journey::Formatter::MissingRoute + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:37 + def initialize(constraints, missing_keys, unmatched_keys, routes, name); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:35 + def constraints; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:53 + def message; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:35 + def missing_keys; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:35 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:49 + def params; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:45 + def path(method_name); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:35 + def routes; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:35 + def unmatched_keys; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:20 +class ActionDispatch::Journey::Formatter::RouteWithParams + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:23 + def initialize(route, parameterized_parts, params); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:21 + def params; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/formatter.rb:29 + def path(_); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:9 +module ActionDispatch::Journey::GTG; end + +# pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:10 +class ActionDispatch::Journey::GTG::Builder + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:15 + def initialize(root); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:13 + def ast; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:13 + def endpoints; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:87 + def firstpos(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:108 + def lastpos(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:66 + def nullable?(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:13 + def root; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:21 + def transition_table; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:130 + def build_followpos; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:143 + def symbol(edge); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/gtg/builder.rb:11 +ActionDispatch::Journey::GTG::Builder::DUMMY_END_NODE = T.let(T.unsafe(nil), ActionDispatch::Journey::Nodes::Dummy) + +# pkg:gem/actionpack#lib/action_dispatch/journey/gtg/simulator.rb:8 +class ActionDispatch::Journey::GTG::MatchData + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/simulator.rb:11 + def initialize(memos); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/simulator.rb:9 + def memos; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/gtg/simulator.rb:16 +class ActionDispatch::Journey::GTG::Simulator + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/simulator.rb:27 + def initialize(transition_table); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/simulator.rb:31 + def memos(string); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/simulator.rb:25 + def tt; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/gtg/simulator.rb:23 +ActionDispatch::Journey::GTG::Simulator::INITIAL_STATE = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/journey/gtg/simulator.rb:17 +ActionDispatch::Journey::GTG::Simulator::STATIC_TOKENS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:10 +class ActionDispatch::Journey::GTG::TransitionTable + include ::ActionDispatch::Journey::NFA::Dot + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:17 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:168 + def []=(from, to, sym); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:33 + def accepting?(state); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:29 + def accepting_states; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:25 + def add_accepting(state); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:37 + def add_memo(idx, memo); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:103 + def as_json(options = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:45 + def eclosure(t); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:41 + def memo(idx); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:13 + def memos; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:49 + def move(t, full_string, token, start_index, token_matches_default); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:187 + def states; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:120 + def to_svg; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:194 + def transitions; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:130 + def visualizer(paths, title = T.unsafe(nil)); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/gtg/transition_table.rb:15 +ActionDispatch::Journey::GTG::TransitionTable::DEFAULT_EXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/journey/nfa/dot.rb:7 +module ActionDispatch::Journey::NFA; end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nfa/dot.rb:8 +module ActionDispatch::Journey::NFA::Dot + # pkg:gem/actionpack#lib/action_dispatch/journey/nfa/dot.rb:9 + def to_dot; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:68 +module ActionDispatch::Journey::Nodes; end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:182 +class ActionDispatch::Journey::Nodes::Binary < ::ActionDispatch::Journey::Nodes::Node + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:185 + def initialize(left, right); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:190 + def children; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:183 + def right; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:183 + def right=(_arg0); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:193 +class ActionDispatch::Journey::Nodes::Cat < ::ActionDispatch::Journey::Nodes::Binary + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:194 + def cat?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:195 + def type; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:134 +class ActionDispatch::Journey::Nodes::Dot < ::ActionDispatch::Journey::Nodes::Terminal + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:135 + def type; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:122 +class ActionDispatch::Journey::Nodes::Dummy < ::ActionDispatch::Journey::Nodes::Literal + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:123 + def initialize(x = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:127 + def literal?; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:159 +class ActionDispatch::Journey::Nodes::Group < ::ActionDispatch::Journey::Nodes::Unary + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:161 + def group?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:160 + def type; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:117 +class ActionDispatch::Journey::Nodes::Literal < ::ActionDispatch::Journey::Nodes::Terminal + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:118 + def literal?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:119 + def type; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:69 +class ActionDispatch::Journey::Nodes::Node + include ::Enumerable + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:74 + def initialize(left); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:108 + def cat?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:80 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:109 + def group?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:72 + def left; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:72 + def left=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:105 + def literal?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:72 + def memo; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:72 + def memo=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:96 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:107 + def star?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:104 + def symbol?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:106 + def terminal?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:88 + def to_dot; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:84 + def to_s; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:92 + def to_sym; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:100 + def type; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:198 +class ActionDispatch::Journey::Nodes::Or < ::ActionDispatch::Journey::Nodes::Node + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:201 + def initialize(children); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:199 + def children; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:205 + def type; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:130 +class ActionDispatch::Journey::Nodes::Slash < ::ActionDispatch::Journey::Nodes::Terminal + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:131 + def type; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:164 +class ActionDispatch::Journey::Nodes::Star < ::ActionDispatch::Journey::Nodes::Unary + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:167 + def initialize(left); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:177 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:165 + def regexp; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:165 + def regexp=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:174 + def star?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:175 + def type; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:138 +class ActionDispatch::Journey::Nodes::Symbol < ::ActionDispatch::Journey::Nodes::Terminal + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:145 + def initialize(left, regexp = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:141 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:139 + def regexp; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:139 + def regexp=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:140 + def symbol; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:152 + def symbol?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:151 + def type; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:143 +ActionDispatch::Journey::Nodes::Symbol::DEFAULT_EXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:144 +ActionDispatch::Journey::Nodes::Symbol::GREEDY_EXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:112 +class ActionDispatch::Journey::Nodes::Terminal < ::ActionDispatch::Journey::Nodes::Node + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:113 + def symbol; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:114 + def terminal?; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:155 +class ActionDispatch::Journey::Nodes::Unary < ::ActionDispatch::Journey::Nodes::Node + # pkg:gem/actionpack#lib/action_dispatch/journey/nodes/node.rb:156 + def children; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:8 +class ActionDispatch::Journey::Parser + include ::ActionDispatch::Journey::Nodes + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:15 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:20 + def parse(string); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:27 + def advance_token; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:31 + def do_parse; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:58 + def parse_expression; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:35 + def parse_expressions; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:74 + def parse_group; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:52 + def parse_or(lhs); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:68 + def parse_star; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:86 + def parse_terminal; end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/parser.rb:11 + def parse(string); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:7 +module ActionDispatch::Journey::Path; end + +# pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:8 +class ActionDispatch::Journey::Path::Pattern + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:11 + def initialize(ast, requirements, separators, anchored); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:163 + def =~(other); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:9 + def anchored; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:9 + def ast; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:25 + def build_formatter; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:29 + def eager_load!; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:159 + def match(other); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:165 + def match?(other); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:9 + def names; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:62 + def optional_names; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:58 + def required_names; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:9 + def requirements; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:36 + def requirements_anchored?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:177 + def requirements_for_missing_keys_check; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:169 + def source; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:9 + def spec; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:173 + def to_regexp; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:188 + def offsets; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:184 + def regexp_visitor; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:68 +class ActionDispatch::Journey::Path::Pattern::AnchoredRegexp < ::ActionDispatch::Journey::Visitors::Visitor + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:69 + def initialize(separator, matchers); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:76 + def accept(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:80 + def visit_CAT(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:100 + def visit_DOT(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:93 + def visit_GROUP(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:97 + def visit_LITERAL(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:111 + def visit_OR(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:102 + def visit_SLASH(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:106 + def visit_STAR(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:84 + def visit_SYMBOL(node); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:124 +class ActionDispatch::Journey::Path::Pattern::MatchData + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:127 + def initialize(names, offsets, match); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:141 + def [](x); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:133 + def captures; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:146 + def length; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:137 + def named_captures; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:125 + def names; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:150 + def post_match; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:154 + def to_s; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:117 +class ActionDispatch::Journey::Path::Pattern::UnanchoredRegexp < ::ActionDispatch::Journey::Path::Pattern::AnchoredRegexp + # pkg:gem/actionpack#lib/action_dispatch/journey/path/pattern.rb:118 + def accept(node); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:8 +class ActionDispatch::Journey::Route + # +path+ is a path constraint. + # `constraints` is a hash of constraints to be applied to this route. + # + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:79 + def initialize(name:, path:, app: T.unsafe(nil), constraints: T.unsafe(nil), required_defaults: T.unsafe(nil), defaults: T.unsafe(nil), via: T.unsafe(nil), precedence: T.unsafe(nil), scope_options: T.unsafe(nil), internal: T.unsafe(nil), source_location: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def app; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def ast; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:12 + def conditions; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def constraints; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def defaults; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:165 + def dispatcher?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:101 + def eager_load!; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:143 + def format(path_options); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:161 + def glob?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def internal; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:189 + def ip; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:169 + def matches?(request); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:138 + def parts; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def path; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def precedence; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:151 + def required_default?(key); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:155 + def required_defaults; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:126 + def required_keys; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:147 + def required_parts; end + + # Needed for `bin/rails routes`. Picks up succinctly defined requirements for a + # route, for example route + # + # get 'photo/:id', :controller => 'photos', :action => 'show', + # :id => /[A-Z]\d{5}/ + # + # will have {:controller=>"photos", :action=>"show", :[id=>/](A-Z){5}/} as + # requirements. + # + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:116 + def requirements; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:193 + def requires_matching_verb?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def scope_options; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:130 + def score(supplied_keys); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:141 + def segment_keys; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:122 + def segments; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:9 + def source_location; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:197 + def verb; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:14 +module ActionDispatch::Journey::Route::VerbMatchers + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:65 + def for(verbs); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:36 +class ActionDispatch::Journey::Route::VerbMatchers::All + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:37 + def call(_); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:38 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::DELETE + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::GET + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::HEAD + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::LINK + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::OPTIONS + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:41 +class ActionDispatch::Journey::Route::VerbMatchers::Or + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:44 + def initialize(verbs); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:49 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:42 + def verb; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::PATCH + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::POST + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::PUT + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::TRACE + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 +class ActionDispatch::Journey::Route::VerbMatchers::UNLINK + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def call(req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:17 + def verb; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:26 +class ActionDispatch::Journey::Route::VerbMatchers::Unknown + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:29 + def initialize(verb); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:33 + def call(request); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:27 + def verb; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:15 +ActionDispatch::Journey::Route::VerbMatchers::VERBS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/journey/route.rb:54 +ActionDispatch::Journey::Route::VerbMatchers::VERB_TO_CLASS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:7 +class ActionDispatch::Journey::Router + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:19 + def initialize(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:23 + def eager_load!; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:43 + def recognize(req, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:17 + def routes; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:17 + def routes=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:30 + def serve(req); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:107 + def custom_routes; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:111 + def filter_routes(path); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:115 + def match_head_routes(routes, req); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router.rb:103 + def simulator; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:8 +class ActionDispatch::Journey::Router::Utils + class << self + # pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:93 + def escape_fragment(fragment); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:85 + def escape_path(path); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:89 + def escape_segment(segment); end + + # Normalizes URI path. + # + # Strips off trailing slash and ensures there is a leading slash. Also converts + # downcase URL encoded string to uppercase. + # + # normalize_path("/foo") # => "/foo" + # normalize_path("/foo/") # => "/foo" + # normalize_path("foo") # => "/foo" + # normalize_path("") # => "/" + # normalize_path("/%ab") # => "/%AB" + # + # pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:19 + def normalize_path(path); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:83 +ActionDispatch::Journey::Router::Utils::ENCODER = T.let(T.unsafe(nil), ActionDispatch::Journey::Router::Utils::UriEncoder) + +# URI path and fragment escaping https://tools.ietf.org/html/rfc3986 +# +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:41 +class ActionDispatch::Journey::Router::Utils::UriEncoder + # pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:59 + def escape_fragment(fragment); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:63 + def escape_path(path); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:67 + def escape_segment(segment); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:72 + def escape(component, pattern); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:76 + def percent_encode(unsafe); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:48 +ActionDispatch::Journey::Router::Utils::UriEncoder::ALPHA = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:46 +ActionDispatch::Journey::Router::Utils::UriEncoder::DEC2HEX = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:49 +ActionDispatch::Journey::Router::Utils::UriEncoder::DIGIT = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:45 +ActionDispatch::Journey::Router::Utils::UriEncoder::EMPTY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:42 +ActionDispatch::Journey::Router::Utils::UriEncoder::ENCODE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:53 +ActionDispatch::Journey::Router::Utils::UriEncoder::ESCAPED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:55 +ActionDispatch::Journey::Router::Utils::UriEncoder::FRAGMENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:57 +ActionDispatch::Journey::Router::Utils::UriEncoder::PATH = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:56 +ActionDispatch::Journey::Router::Utils::UriEncoder::SEGMENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:51 +ActionDispatch::Journey::Router::Utils::UriEncoder::SUB_DELIMS = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:50 +ActionDispatch::Journey::Router::Utils::UriEncoder::UNRESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:43 +ActionDispatch::Journey::Router::Utils::UriEncoder::US_ASCII = T.let(T.unsafe(nil), Encoding) + +# pkg:gem/actionpack#lib/action_dispatch/journey/router/utils.rb:44 +ActionDispatch::Journey::Router::Utils::UriEncoder::UTF_8 = T.let(T.unsafe(nil), Encoding) + +# The Routing table. Contains all routes for a system. Routes can be added to +# the table by calling Routes#add_route. +# +# pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:9 +class ActionDispatch::Journey::Routes + include ::Enumerable + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:14 + def initialize(routes = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:67 + def add_route(name, mapping); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:12 + def anchored_routes; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:53 + def ast; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:39 + def clear; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:12 + def custom_routes; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:35 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:22 + def empty?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:31 + def last; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:26 + def length; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:45 + def partition_route(route); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:12 + def routes; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:60 + def simulator; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:29 + def size; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:75 + def visualizer; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/routes.rb:83 + def clear_cache!; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:9 +class ActionDispatch::Journey::Scanner + # pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:28 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:48 + def last_literal; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:44 + def last_string; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:37 + def next_token; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:33 + def scan_setup(str); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:69 + def next_byte_is_not_a_token?; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:55 + def scan; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:10 +ActionDispatch::Journey::Scanner::STATIC_TOKENS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:20 +class ActionDispatch::Journey::Scanner::Scanner < ::StringScanner + # https://github.com/ruby/strscan/pull/89 + # + # pkg:gem/actionpack#lib/action_dispatch/journey/scanner.rb:22 + def peek_byte; end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:55 +module ActionDispatch::Journey::Visitors; end + +# private +# def binary(node, seed) +# visit(node.right, visit(node.left, seed)) +# end +# +# def nary(node, seed) +# last_child = node.children.last +# node.children.inject(seed) { |s, c| +# string = visit(c, s) +# string << "|" unless last_child == c +# string +# } +# end +# +# def terminal(node, seed) +# seed + node.left +# end +# +# def visit_GROUP(node, seed) +# visit(node.left, seed.dup << "(") << ")" +# end +# +# INSTANCE = new +# end +# +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:228 +class ActionDispatch::Journey::Visitors::Dot < ::ActionDispatch::Journey::Visitors::FunctionalVisitor + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:229 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:234 + def accept(node, seed = T.unsafe(nil)); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:249 + def binary(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:256 + def nary(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:288 + def terminal(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:263 + def unary(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:273 + def visit_CAT(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:268 + def visit_GROUP(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:283 + def visit_OR(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:278 + def visit_STAR(node, seed); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:294 +ActionDispatch::Journey::Visitors::Dot::INSTANCE = T.let(T.unsafe(nil), ActionDispatch::Journey::Visitors::Dot) + +# Loop through the requirements AST. +# +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:161 +class ActionDispatch::Journey::Visitors::Each < ::ActionDispatch::Journey::Visitors::FunctionalVisitor + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:162 + def visit(node, block); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:167 +ActionDispatch::Journey::Visitors::Each::INSTANCE = T.let(T.unsafe(nil), ActionDispatch::Journey::Visitors::Each) + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:136 +class ActionDispatch::Journey::Visitors::FormatBuilder < ::ActionDispatch::Journey::Visitors::Visitor + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:137 + def accept(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:140 + def binary(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:138 + def terminal(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:144 + def visit_GROUP(n); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:146 + def visit_STAR(n); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:150 + def visit_SYMBOL(n); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:97 +class ActionDispatch::Journey::Visitors::FunctionalVisitor + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:100 + def accept(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:108 + def binary(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:113 + def nary(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:124 + def terminal(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:118 + def unary(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:104 + def visit(node, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:111 + def visit_CAT(n, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:128 + def visit_DOT(n, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:121 + def visit_GROUP(n, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:125 + def visit_LITERAL(n, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:116 + def visit_OR(n, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:127 + def visit_SLASH(n, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:122 + def visit_STAR(n, seed); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:126 + def visit_SYMBOL(n, seed); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:98 +ActionDispatch::Journey::Visitors::FunctionalVisitor::DISPATCH_CACHE = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:170 +class ActionDispatch::Journey::Visitors::String + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:171 + def accept(node, seed); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:199 +ActionDispatch::Journey::Visitors::String::INSTANCE = T.let(T.unsafe(nil), ActionDispatch::Journey::Visitors::String) + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:56 +class ActionDispatch::Journey::Visitors::Visitor + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:59 + def accept(node); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:68 + def binary(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:74 + def nary(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:85 + def terminal(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:79 + def unary(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:64 + def visit(node); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:72 + def visit_CAT(n); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:89 + def visit_DOT(n); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:82 + def visit_GROUP(n); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:86 + def visit_LITERAL(n); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:77 + def visit_OR(n); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:88 + def visit_SLASH(n); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:83 + def visit_STAR(n); end + + # pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:87 + def visit_SYMBOL(n); end +end + +# pkg:gem/actionpack#lib/action_dispatch/journey/visitors.rb:57 +ActionDispatch::Journey::Visitors::Visitor::DISPATCH_CACHE = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:4 +class ActionDispatch::LogSubscriber < ::ActiveSupport::LogSubscriber + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:5 + def backtrace_cleaner; end + + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:5 + def backtrace_cleaner=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:5 + def backtrace_cleaner?; end + + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:7 + def redirect(event); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:5 + def backtrace_cleaner; end + + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:5 + def backtrace_cleaner=(value); end + + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:5 + def backtrace_cleaner?; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:5 + def __class_attr_backtrace_cleaner; end + + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:5 + def __class_attr_backtrace_cleaner=(new_value); end + + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:25 + def __class_attr_log_levels; end + + # pkg:gem/actionpack#lib/action_dispatch/log_subscriber.rb:25 + def __class_attr_log_levels=(new_value); end + end +end + +# # Action Dispatch MiddlewareStack +# +# Read more about [Rails middleware +# stack](https://guides.rubyonrails.org/rails_on_rack.html#action-dispatcher-middleware-stack) +# in the guides. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:14 +class ActionDispatch::MiddlewareStack + include ::Enumerable + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:76 + def initialize(*args); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:93 + def [](i); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:166 + def build(app = T.unsafe(nil), &block); end + + # Deletes a middleware from the middleware stack. + # + # Returns the array of middlewares not including the deleted item, or returns + # nil if the target is not found. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:131 + def delete(target); end + + # Deletes a middleware from the middleware stack. + # + # Returns the array of middlewares not including the deleted item, or raises + # `RuntimeError` if the target is not found. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:139 + def delete!(target); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:81 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:106 + def insert(index, klass, *args, **, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:114 + def insert_after(index, *args, **, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:112 + def insert_before(index, klass, *args, **, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:89 + def last; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:74 + def middlewares; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:74 + def middlewares=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:143 + def move(target, source); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:153 + def move_after(target, source); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:151 + def move_before(target, source); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:85 + def size; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:120 + def swap(target, *args, **, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:97 + def unshift(klass, *args, **, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:161 + def use(klass, *args, **, &block); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:178 + def assert_index(index, where); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:184 + def build_middleware(klass, args, block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:188 + def index_of(klass); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:102 + def initialize_copy(other); end +end + +# This class is used to instrument the execution of a single middleware. It +# proxies the `call` method transparently and instruments the method call. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:54 +class ActionDispatch::MiddlewareStack::InstrumentationProxy + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:57 + def initialize(middleware, class_name); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:65 + def call(env); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:55 +ActionDispatch::MiddlewareStack::InstrumentationProxy::EVENT_NAME = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:15 +class ActionDispatch::MiddlewareStack::Middleware + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:18 + def initialize(klass, args, block); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:26 + def ==(middleware); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:16 + def args; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:16 + def block; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:43 + def build(app); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:47 + def build_instrumented(app); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:35 + def inspect; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:16 + def klass; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/stack.rb:24 + def name; end +end + +# pkg:gem/actionpack#lib/action_dispatch.rb:50 +class ActionDispatch::MissingController < ::NameError; end + +# pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:4 +class ActionDispatch::ParamBuilder + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:15 + def initialize(param_depth_limit); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:19 + def default; end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:19 + def default=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:62 + def from_hash(hash, encoding_template: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:46 + def from_pairs(pairs, encoding_template: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:42 + def from_query_string(qs, separator: T.unsafe(nil), encoding_template: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:13 + def param_depth_limit; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:163 + def make_params; end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:167 + def new_depth_limit(param_depth_limit); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:175 + def params_hash_has_key?(hash, key); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:171 + def params_hash_type?(obj); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:77 + def store_nested_param(params, name, v, depth, encoding_template = T.unsafe(nil)); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:19 + def default; end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:19 + def default=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:23 + def from_hash(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:23 + def from_pairs(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:23 + def from_query_string(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:25 + def ignore_leading_brackets; end + + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:33 + def ignore_leading_brackets=(value); end + + # -- + # This implementation is based on Rack::QueryParser, + # Copyright (C) 2007-2021 Leah Neukirchen + # + # pkg:gem/actionpack#lib/action_dispatch/http/param_builder.rb:9 + def make_default(param_depth_limit); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/param_error.rb:4 +class ActionDispatch::ParamError < ::ActionDispatch::Http::Parameters::ParseError + # pkg:gem/actionpack#lib/action_dispatch/http/param_error.rb:5 + def initialize(message = T.unsafe(nil)); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/param_error.rb:9 + def ===(other); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/param_error.rb:18 +class ActionDispatch::ParameterTypeError < ::ActionDispatch::ParamError; end + +# pkg:gem/actionpack#lib/action_dispatch/http/param_error.rb:24 +class ActionDispatch::ParamsTooDeepError < ::ActionDispatch::ParamError; end + +# # Action Dispatch PermissionsPolicy +# +# Configures the HTTP +# [Feature-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy) +# response header to specify which browser features the current +# document and its iframes can use. +# +# Example global policy: +# +# Rails.application.config.permissions_policy do |policy| +# policy.camera :none +# policy.gyroscope :none +# policy.microphone :none +# policy.usb :none +# policy.fullscreen :self +# policy.payment :self, "https://secure.example.com" +# end +# +# The Feature-Policy header has been renamed to Permissions-Policy. The +# Permissions-Policy requires a different implementation and isn't yet supported +# by all browsers. To avoid having to rename this middleware in the future we +# use the new name for the middleware but keep the old header name and +# implementation for now. +# +# pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:31 +class ActionDispatch::PermissionsPolicy + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:113 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def accelerometer(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def ambient_light_sensor(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def autoplay(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:132 + def build(context = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def camera(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:111 + def directives; end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def display_capture(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def encrypted_media(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def fullscreen(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def geolocation(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def gyroscope(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def hid(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def idle_detection(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def keyboard_map(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def magnetometer(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def microphone(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def midi(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def payment(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def picture_in_picture(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def screen_wake_lock(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def serial(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def sync_xhr(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def usb(*sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:123 + def web_share(*sources); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:150 + def apply_mapping(source); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:137 + def apply_mappings(sources); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:168 + def build_directive(sources, context); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:156 + def build_directives(context); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:118 + def initialize_copy(other); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:172 + def resolve_source(source, context); end +end + +# List of available permissions can be found at +# https://github.com/w3c/webappsec-permissions-policy/blob/main/features.md#policy-controlled-features +# +# pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:84 +ActionDispatch::PermissionsPolicy::DIRECTIVES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:77 +ActionDispatch::PermissionsPolicy::MAPPINGS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:32 +class ActionDispatch::PermissionsPolicy::Middleware + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:33 + def initialize(app); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:37 + def call(env); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:60 + def policy_empty?(policy); end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:56 + def policy_present?(headers); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:65 +module ActionDispatch::PermissionsPolicy::Request + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:68 + def permissions_policy; end + + # pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:72 + def permissions_policy=(policy); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/permissions_policy.rb:66 +ActionDispatch::PermissionsPolicy::Request::POLICY = T.let(T.unsafe(nil), String) + +# # Action Dispatch PublicExceptions +# +# When called, this middleware renders an error page. By default if an HTML +# response is expected it will render static error pages from the `/public` +# directory. For example when this middleware receives a 500 response it will +# render the template found in `/public/500.html`. If an internationalized +# locale is set, this middleware will attempt to render the template in +# `/public/500..html`. If an internationalized template is not found it +# will fall back on `/public/500.html`. +# +# When a request with a content type other than HTML is made, this middleware +# will attempt to convert error information into the appropriate response type. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/public_exceptions.rb:18 +class ActionDispatch::PublicExceptions + # pkg:gem/actionpack#lib/action_dispatch/middleware/public_exceptions.rb:21 + def initialize(public_path); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/public_exceptions.rb:25 + def call(env); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/public_exceptions.rb:19 + def public_path; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/public_exceptions.rb:19 + def public_path=(_arg0); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/public_exceptions.rb:39 + def render(status, content_type, body); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/public_exceptions.rb:48 + def render_format(status, content_type, body); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/public_exceptions.rb:53 + def render_html(status); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/query_parser.rb:7 +class ActionDispatch::QueryParser + class << self + # -- + # Note this departs from WHATWG's specified parsing algorithm by + # giving a nil value for keys that do not use '='. Callers that need + # the standard's interpretation can use `v.to_s`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/query_parser.rb:29 + def each_pair(s, separator = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/query_parser.rb:11 + def strict_query_string_separator; end + + # pkg:gem/actionpack#lib/action_dispatch/http/query_parser.rb:18 + def strict_query_string_separator=(value); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/query_parser.rb:9 +ActionDispatch::QueryParser::COMMON_SEP = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/query_parser.rb:8 +ActionDispatch::QueryParser::DEFAULT_SEP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/railtie.rb:12 +class ActionDispatch::Railtie < ::Rails::Railtie; end + +# # Action Dispatch Reloader +# +# ActionDispatch::Reloader wraps the request with callbacks provided by +# ActiveSupport::Reloader, intended to assist with code reloading during +# development. +# +# ActionDispatch::Reloader is included in the middleware stack only if reloading +# is enabled, which it is by the default in `development` mode. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/reloader.rb:14 +class ActionDispatch::Reloader < ::ActionDispatch::Executor; end + +# # Action Dispatch RemoteIp +# +# This middleware calculates the IP address of the remote client that is making +# the request. It does this by checking various headers that could contain the +# address, and then picking the last-set address that is not on the list of +# trusted IPs. This follows the precedent set by e.g. [the Tomcat +# server](https://issues.apache.org/bugzilla/show_bug.cgi?id=50453). A more +# detailed explanation of the algorithm is given at GetIp#calculate_ip. +# +# Some Rack servers concatenate repeated headers, like [HTTP RFC +# 2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2) requires. +# Some Rack servers simply drop preceding headers, and only report the value +# that was [given in the last +# header](https://andre.arko.net/2011/12/26/repeated-headers-and-ruby-web-servers). +# If you are behind multiple proxy servers (like NGINX to HAProxy to +# Unicorn) then you should test your Rack server to make sure your data is good. +# +# IF YOU DON'T USE A PROXY, THIS MAKES YOU VULNERABLE TO IP SPOOFING. This +# middleware assumes that there is at least one proxy sitting around and setting +# headers with the client's remote IP address. If you don't use a proxy, because +# you are hosted on e.g. Heroku without SSL, any client can claim to have any IP +# address by setting the `Forwarded` or `X-Forwarded-For` header. If you care +# about that, then you need to explicitly drop or ignore those headers sometime +# before this middleware runs. Alternatively, remove this middleware to avoid +# inadvertently relying on it. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:33 +class ActionDispatch::RemoteIp + # Create a new `RemoteIp` middleware instance. + # + # The `ip_spoofing_check` option is on by default. When on, an exception is + # raised if it looks like the client is trying to lie about its own IP address, + # such as when the request carries conflicting `Forwarded`, `X-Forwarded-For`, + # or `Client-Ip` headers. It makes sense to turn off this check on sites aimed + # at non-IP clients (like WAP devices), or behind proxies that set headers in + # an incorrect or confusing way (like AWS ELB). + # + # The `custom_proxies` argument can take an enumerable which will be used + # instead of `TRUSTED_PROXIES`. Any proxy setup will put the value you want in + # the middle (or at the beginning) of the `X-Forwarded-For` list, with your + # proxy servers after it. If your proxies aren't removed, pass them in via the + # `custom_proxies` parameter. That way, the middleware will ignore those IP + # addresses, and return the one that you want. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:68 + def initialize(app, ip_spoofing_check = T.unsafe(nil), custom_proxies = T.unsafe(nil)); end + + # Since the IP address may not be needed, we store the object here without + # calculating the IP to keep from slowing down the majority of requests. For + # those requests that do need to know the IP, the GetIp#calculate_ip method will + # calculate the memoized client IP address. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:96 + def call(env); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:51 + def check_ip; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:51 + def proxies; end +end + +# The GetIp class exists as a way to defer processing of the request data into +# an actual IP address. If the ActionDispatch::Request#remote_ip method is +# called, this class will calculate the value and then memoize it. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:105 +class ActionDispatch::RemoteIp::GetIp + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:114 + def initialize(req, check_ip, proxies); end + + # Sort through the various IP address headers, looking for the IP most likely to + # be the address of the actual remote client making this request. + # + # REMOTE_ADDR will be correct if the request is made directly against the Ruby + # process, on e.g. Heroku. When the request is proxied by another server like + # HAProxy or NGINX, the IP address that made the original request will be put in + # an `X-Forwarded-For` header. If there are multiple proxies, that header may + # contain a list of IPs. Other proxy services set the `Client-Ip` header + # instead, so we check that too. + # + # As discussed in [this post about Rails IP + # Spoofing](https://web.archive.org/web/20170626095448/https://blog.gingerlime.com/2012/rails-ip-spoofing-vulnerabilities-and-protection/), + # while the first IP in the list is likely to be the "originating" IP, it + # could also have been set by the client maliciously. + # + # In order to find the first address that is (probably) accurate, we take the + # list of IPs, remove known and trusted proxies, and then take the last address + # left, which was presumably set by one of those proxies. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:138 + def calculate_ip; end + + # Memoizes the value returned by #calculate_ip and returns it for + # ActionDispatch::Request to use. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:176 + def to_s; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:197 + def check_ip(client_ips, forwarded_ips); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:228 + def filter_proxies(ips); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:181 + def ips_from(header); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:187 + def raise_spoofing_error; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:216 + def sanitize_ips(ips); end +end + +# Parses X-Forwarded-For as Rack does, whatever `Rack::Request.forwarded_priority` says. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:107 +class ActionDispatch::RemoteIp::GetIp::XForwardedForParser < ::Rack::Request + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:109 + def forwarded_priority; end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:34 +class ActionDispatch::RemoteIp::IpSpoofAttackError < ::StandardError; end + +# The default trusted IPs list simply includes IP addresses that are guaranteed +# by the IP specification to be private addresses. Those will not be the +# ultimate client IP in production, and so are discarded. See +# https://en.wikipedia.org/wiki/Private_network for details. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/remote_ip.rb:40 +ActionDispatch::RemoteIp::TRUSTED_PROXIES = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:20 +class ActionDispatch::Request + include ::ActionDispatch::Flash::RequestMethods + include ::Rack::Request::Helpers + include ::ActionDispatch::Http::Cache::Request + include ::ActionDispatch::Http::MimeNegotiation + include ::ActionDispatch::Http::Parameters + include ::ActionDispatch::Http::FilterParameters + include ::ActionDispatch::Http::URL + include ::ActionDispatch::ContentSecurityPolicy::Request + include ::Rack::Request::Env + include ::ActionDispatch::RequestCookieMethods + include ::ActionDispatch::PermissionsPolicy::Request + extend ::ActionDispatch::Http::Parameters::ClassMethods + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:63 + def initialize(env); end + + # Override Rack's GET method to support indifferent access. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:400 + def GET; end + + # Override Rack's POST method to support indifferent access. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:413 + def POST; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def accept; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def accept_charset; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def accept_encoding; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def accept_language; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def auth_type; end + + # Returns the authorization header regardless of whether it was specified + # directly or through one of the proxy alternatives. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:465 + def authorization; end + + # The request body is an IO input stream. If the RAW_POST_DATA environment + # variable is already set, wrap it in a StringIO. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:362 + def body; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:382 + def body_stream; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def cache_control; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def client_ip; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:78 + def commit_cookie_jar!; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:497 + def commit_csrf_token; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:486 + def commit_flash; end + + # Returns the content length of the request as an integer. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:297 + def content_length; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:87 + def controller_class; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:93 + def controller_class_for(name); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:195 + def controller_instance; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:199 + def controller_instance=(controller); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:181 + def engine_script_name(_routes); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:185 + def engine_script_name=(name); end + + # Determine whether the request body contains form-data by checking the request + # `Content-Type` for one of the media-types: `application/x-www-form-urlencoded` + # or `multipart/form-data`. The list of form-data media types can be modified + # through the `FORM_DATA_MEDIA_TYPES` array. + # + # A request body is not assumed to contain form-data when no `Content-Type` + # header is provided and the request_method is POST. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:378 + def form_data?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def from; end + + # Returns the `String` full path including params of the last URL requested. + # + # # get "/articles" + # request.fullpath # => "/articles" + # + # # get "/articles?page=2" + # request.fullpath # => "/articles?page=2" + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:276 + def fullpath; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def gateway_interface; end + + # Provides access to the request's HTTP headers, for example: + # + # request.headers["Content-Type"] # => "text/plain" + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:237 + def headers; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:203 + def http_auth_salt; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:23 + def ignore_accept_header; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:23 + def ignore_accept_header=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:489 + def inspect; end + + # Returns the IP address of client as a `String`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:311 + def ip; end + + # Returns true if the request has a header matching the given key parameter. + # + # request.key? :ip_spoofing_check # => true + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:114 + def key?(key); end + + # True if the request came from localhost, 127.0.0.1, or ::1. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:473 + def local?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:482 + def logger; end + + # The `String` MIME type of the request. + # + # # get "/articles" + # request.media_type # => "application/x-www-form-urlencoded" + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:292 + def media_type; end + + # Returns the original value of the environment's REQUEST_METHOD, even if it was + # overridden by middleware. See #request_method for more information. + # + # For debugging purposes, when called with arguments this method will fall back + # to Object#method + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:217 + def method(*args, **); end + + # Returns a symbol form of the #method. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:230 + def method_symbol; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def negotiate; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def origin; end + + # Returns a `String` with the last requested path including their params. + # + # # get '/foo' + # request.original_fullpath # => '/foo' + # + # # get '/foo?bar' + # request.original_fullpath # => '/foo?bar' + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:265 + def original_fullpath; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def original_script_name; end + + # Returns the original request URL as a `String`. + # + # # get "/articles?page=2" + # request.original_url # => "http://www.example.com/articles?page=2" + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:284 + def original_url; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def path_translated; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def pragma; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:410 + def query_parameters; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:76 + def rack_request; end + + # Read the request body. This is useful for web services that need to work with + # raw requests directly. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:353 + def raw_post; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:144 + def raw_request_method; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def remote_addr; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def remote_host; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def remote_ident; end + + # Returns the IP address of client as a `String`, usually set by the RemoteIp + # middleware. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:317 + def remote_ip; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:321 + def remote_ip=(remote_ip); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def remote_user; end + + # Returns the unique request id, which is based on either the `X-Request-Id` + # header that can be generated by a firewall, load balancer, or web server, or + # by the RequestId middleware (which sets the `action_dispatch.request_id` + # environment variable). + # + # This unique ID is useful for tracing a request from end-to-end as part of + # logging or debugging. This relies on the Rack variable set by the + # ActionDispatch::RequestId middleware. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:336 + def request_id; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:340 + def request_id=(id); end + + # Returns the HTTP method that the application should see. In the case where the + # method was overridden by a middleware (for instance, if a HEAD request was + # converted to a GET, or if a _method parameter was used to determine the method + # the application should use), this method returns the overridden value, not the + # original. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:151 + def request_method; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:189 + def request_method=(request_method); end + + # Returns a symbol form of the #request_method. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:208 + def request_method_symbol; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:440 + def request_parameters; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:477 + def request_parameters=(params); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:442 + def request_parameters_list; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:493 + def reset_csrf_token; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:386 + def reset_session; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:169 + def route=(route); end + + # Returns the URI pattern of the matched route for the request, using the same + # format as `bin/rails routes`: + # + # request.route_uri_pattern # => "/:controller(/:action(/:id))(.:format)" + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:159 + def route_uri_pattern; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:173 + def routes; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:177 + def routes=(routes); end + + # Early Hints is an HTTP/2 status code that indicates hints to help a client + # start making preparations for processing the final response. + # + # If the env contains `rack.early_hints` then the server accepts HTTP2 push for + # link headers. + # + # The `send_early_hints` method accepts a hash of links as follows: + # + # send_early_hints("link" => "; rel=preload; as=style,; rel=preload") + # + # If you are using {javascript_include_tag}[rdoc-ref:ActionView::Helpers::AssetTagHelper#javascript_include_tag] + # or {stylesheet_link_tag}[rdoc-ref:ActionView::Helpers::AssetTagHelper#stylesheet_link_tag] + # the Early Hints headers are included by default if supported. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:254 + def send_early_hints(links); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def server_name; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def server_protocol; end + + # Returns the lowercase name of the HTTP server software. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:347 + def server_software; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:391 + def session=(session); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:395 + def session_options=(options); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:344 + def uuid; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def version; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def x_csrf_token; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def x_forwarded_for; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def x_forwarded_host; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:49 + def x_request_id; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:308 + def xhr?; end + + # Returns true if the `X-Requested-With` header contains "XMLHttpRequest" + # (case-insensitive), which may need to be manually added depending on the + # choice of JavaScript libraries and frameworks. + # + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:305 + def xml_http_request?; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:502 + def check_method(name); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:510 + def default_session; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:540 + def fallback_request_parameters; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:514 + def read_body_stream; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:526 + def reset_stream(body_stream); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:59 + def empty; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:23 + def ignore_accept_header; end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:23 + def ignore_accept_header=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:24 + def parameter_parsers; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:326 +ActionDispatch::Request::ACTION_DISPATCH_REQUEST_ID = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:35 +ActionDispatch::Request::ENV_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:135 +ActionDispatch::Request::HTTP_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:137 +ActionDispatch::Request::HTTP_METHOD_LOOKUP = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:33 +ActionDispatch::Request::LOCALHOST = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:81 +class ActionDispatch::Request::PASS_NOT_FOUND + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:82 + def action(_); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:84 + def action_encoding_template(action); end + + # pkg:gem/actionpack#lib/action_dispatch/http/request.rb:83 + def call(_); end + end +end + +# HTTP methods from [RFC 2518: HTTP Extensions for Distributed Authoring -- WEBDAV](https://www.ietf.org/rfc/rfc2518.txt) +# +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:121 +ActionDispatch::Request::RFC2518 = T.let(T.unsafe(nil), Array) + +# HTTP methods from [RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1](https://www.ietf.org/rfc/rfc2616.txt) +# +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:119 +ActionDispatch::Request::RFC2616 = T.let(T.unsafe(nil), Array) + +# HTTP methods from [RFC 3253: Versioning Extensions to WebDAV](https://www.ietf.org/rfc/rfc3253.txt) +# +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:123 +ActionDispatch::Request::RFC3253 = T.let(T.unsafe(nil), Array) + +# HTTP methods from [RFC 3648: WebDAV Ordered Collections Protocol](https://www.ietf.org/rfc/rfc3648.txt) +# +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:125 +ActionDispatch::Request::RFC3648 = T.let(T.unsafe(nil), Array) + +# HTTP methods from [RFC 3744: WebDAV Access Control Protocol](https://www.ietf.org/rfc/rfc3744.txt) +# +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:127 +ActionDispatch::Request::RFC3744 = T.let(T.unsafe(nil), Array) + +# HTTP methods from [RFC 4791: Calendaring Extensions to WebDAV](https://www.ietf.org/rfc/rfc4791.txt) +# +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:131 +ActionDispatch::Request::RFC4791 = T.let(T.unsafe(nil), Array) + +# HTTP methods from [RFC 5323: WebDAV SEARCH](https://www.ietf.org/rfc/rfc5323.txt) +# +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:129 +ActionDispatch::Request::RFC5323 = T.let(T.unsafe(nil), Array) + +# HTTP methods from [RFC 5789: PATCH Method for HTTP](https://www.ietf.org/rfc/rfc5789.txt) +# +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:133 +ActionDispatch::Request::RFC5789 = T.let(T.unsafe(nil), Array) + +# Session is responsible for lazily loading the session from store. +# +# pkg:gem/actionpack#lib/action_dispatch/request/session.rb:10 +class ActionDispatch::Request::Session + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:76 + def initialize(by, req, enabled: T.unsafe(nil)); end + + # Returns value of the key stored in the session or `nil` if the given key is + # not found in the session. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:114 + def [](key); end + + # Writes given value to given key of the session. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:154 + def []=(key, value); end + + # Clears the session. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:161 + def clear; end + + # Deletes given key from the session. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:194 + def delete(key); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:99 + def destroy; end + + # Returns the nested value specified by the sequence of keys, returning `nil` if + # any intermediate step is `nil`. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:127 + def dig(*keys); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:245 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:240 + def empty?; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:91 + def enabled?; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:230 + def exists?; end + + # Returns value of the given key from the session, or raises `KeyError` if can't + # find the given key and no default value is set. Returns default value if + # specified. + # + # session.fetch(:foo) + # # => KeyError: key not found: "foo" + # + # session.fetch(:foo, :bar) + # # => :bar + # + # session.fetch(:foo) do + # :bar + # end + # # => :bar + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:213 + def fetch(key, default = T.unsafe(nil), &block); end + + # Returns true if the session has the given key or false. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:134 + def has_key?(key); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:87 + def id; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:249 + def id_was; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:139 + def include?(key); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:222 + def inspect; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:138 + def key?(key); end + + # Returns keys of the session as Array. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:142 + def keys; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:236 + def loaded?; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:191 + def merge!(hash); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:95 + def options; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:158 + def store(key, value); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:171 + def to_h; end + + # Returns the session as Hash. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:167 + def to_hash; end + + # Updates the session with given Hash. + # + # session.to_hash + # # => {"session_id"=>"e29b9ea315edf98aad94cc78c34cc9b2"} + # + # session.update({ "foo" => "bar" }) + # # => {"session_id"=>"e29b9ea315edf98aad94cc78c34cc9b2", "foo" => "bar"} + # + # session.to_hash + # # => {"session_id"=>"e29b9ea315edf98aad94cc78c34cc9b2", "foo" => "bar"} + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:183 + def update(hash); end + + # Returns values of the session as Array. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:148 + def values; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:271 + def load!; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:267 + def load_for_delete!; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:255 + def load_for_read!; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:259 + def load_for_write!; end + + class << self + # Creates a session hash, merging the properties of the previous session if any. + # + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:19 + def create(store, req, default_options); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:43 + def delete(req); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:29 + def disabled(req); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:35 + def find(req); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:39 + def set(req, session); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/request/session.rb:11 +class ActionDispatch::Request::Session::DisabledSessionError < ::StandardError; end + +# pkg:gem/actionpack#lib/action_dispatch/request/session.rb:12 +ActionDispatch::Request::Session::ENV_SESSION_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/request/session.rb:13 +ActionDispatch::Request::Session::ENV_SESSION_OPTIONS_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/request/session.rb:47 +class ActionDispatch::Request::Session::Options + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:56 + def initialize(by, default_options); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:61 + def [](key); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:71 + def []=(k, v); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:65 + def id(req); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:72 + def to_hash; end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:73 + def values_at(*args); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:52 + def find(req); end + + # pkg:gem/actionpack#lib/action_dispatch/request/session.rb:48 + def set(req, options); end + end +end + +# Singleton object used to determine if an optional param wasn't specified. +# +# pkg:gem/actionpack#lib/action_dispatch/request/session.rb:16 +ActionDispatch::Request::Session::Unspecified = T.let(T.unsafe(nil), Object) + +# pkg:gem/actionpack#lib/action_dispatch/http/request.rb:57 +ActionDispatch::Request::TRANSFER_ENCODING = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:9 +class ActionDispatch::Request::Utils + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:10 + def perform_deep_munge; end + + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:10 + def perform_deep_munge=(val); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:31 + def check_param_encoding(params); end + + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:12 + def each_param_value(params, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:23 + def normalize_encode_params(params); end + + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:10 + def perform_deep_munge; end + + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:10 + def perform_deep_munge=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:46 + def set_binary_encoding(request, params, controller, action); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:85 +class ActionDispatch::Request::Utils::CustomParamEncoder + class << self + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:106 + def action_encoding_template(request, controller, action); end + + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:101 + def encode(request, params, controller, action); end + + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:86 + def encode_for_template(params, encoding_template); end + end +end + +# Remove nils from the params hash. +# +# pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:77 +class ActionDispatch::Request::Utils::NoNilParamEncoder < ::ActionDispatch::Request::Utils::ParamEncoder + class << self + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:78 + def handle_array(params); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:50 +class ActionDispatch::Request::Utils::ParamEncoder + class << self + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:71 + def handle_array(params); end + + # Convert nested Hash to HashWithIndifferentAccess. + # + # pkg:gem/actionpack#lib/action_dispatch/request/utils.rb:52 + def normalize_encode_params(params); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:12 +module ActionDispatch::RequestCookieMethods + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:50 + def authenticated_encrypted_cookie_salt; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:13 + def cookie_jar; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:30 + def cookie_jar=(jar); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:78 + def cookies_digest; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:82 + def cookies_rotations; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:74 + def cookies_same_site_protection; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:70 + def cookies_serializer; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:58 + def encrypted_cookie_cipher; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:42 + def encrypted_cookie_salt; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:46 + def encrypted_signed_cookie_salt; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:26 + def have_cookie_jar?; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:34 + def key_generator; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:66 + def secret_key_base; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:62 + def signed_cookie_digest; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:38 + def signed_cookie_salt; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:54 + def use_authenticated_cookie_encryption; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/cookies.rb:86 + def use_cookies_with_metadata; end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:9 +class ActionDispatch::RequestEncoder + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:21 + def initialize(mime_name, param_encoder, response_parser, content_type); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:34 + def accept_header; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:19 + def content_type; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:38 + def encode_params(params); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:19 + def response_parser; end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:47 + def encoder(name); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:42 + def parser(content_type); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:51 + def register_encoder(mime_name, param_encoder: T.unsafe(nil), response_parser: T.unsafe(nil), content_type: T.unsafe(nil)); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:10 +class ActionDispatch::RequestEncoder::IdentityEncoder + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:12 + def accept_header; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:11 + def content_type; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:13 + def encode_params(params); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/request_encoder.rb:14 + def response_parser; end +end + +# # Action Dispatch RequestId +# +# Makes a unique request id available to the `action_dispatch.request_id` env +# variable (which is then accessible through ActionDispatch::Request#request_id +# or the alias ActionDispatch::Request#uuid) and sends the same id to the client +# via the `X-Request-Id` header. +# +# The unique request id is either based on the `X-Request-Id` header in the +# request, which would typically be generated by a firewall, load balancer, or +# the web server, or, if this header is not available, a random uuid. If the +# header is accepted from the outside world, we sanitize it to a max of 255 +# chars and alphanumeric and dashes only. +# +# The unique request id can be used to trace a request end-to-end and would +# typically end up being part of log files from multiple pieces of the stack. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/request_id.rb:24 +class ActionDispatch::RequestId + # pkg:gem/actionpack#lib/action_dispatch/middleware/request_id.rb:25 + def initialize(app, header:); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/request_id.rb:31 + def call(env); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/request_id.rb:46 + def internal_request_id; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/request_id.rb:38 + def make_request_id(request_id); end +end + +# # Action Dispatch Response +# +# Represents an HTTP response generated by a controller action. Use it to +# retrieve the current state of the response, or customize the response. It can +# either represent a real HTTP response (i.e. one that is meant to be sent back +# to the web browser) or a TestResponse (i.e. one that is generated from +# integration tests). +# +# The Response object for the current request is exposed on controllers as +# ActionController::Metal#response. ActionController::Metal also provides a few +# additional methods that delegate to attributes of the Response such as +# ActionController::Metal#headers. +# +# Integration tests will likely also want to inspect responses in more detail. +# Methods such as Integration::RequestHelpers#get and +# Integration::RequestHelpers#post return instances of TestResponse (which +# inherits from Response) for this purpose. +# +# For example, the following demo integration test prints the body of the +# controller response to the console: +# +# class DemoControllerTest < ActionDispatch::IntegrationTest +# def test_print_root_path_to_console +# get('/') +# puts response.body +# end +# end +# +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:38 +class ActionDispatch::Response + include ::Rack::Response::Helpers + include ::ActionDispatch::Http::FilterRedirect + include ::ActionDispatch::Http::Cache::Response + include ::MonitorMixin + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:198 + def initialize(status = T.unsafe(nil), headers = T.unsafe(nil), body = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:89 + def [](*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:89 + def []=(*, **, &); end + + # Aliasing these off because AD::Http::Cache::Response defines them. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:107 + def _cache_control; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:108 + def _cache_control=(value); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:447 + def abort; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:224 + def await_commit; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:230 + def await_sent; end + + # Returns the content of the response as a string. This contains the contents of + # any calls to `render`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:370 + def body; end + + # Allows you to manually set or override the response body. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:385 + def body=(body); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:434 + def body_parts; end + + # The charset of the response. HTML wants to know the encoding of the content + # you're giving them, so we need to send that along. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:340 + def charset; end + + # Sets the HTTP character set. In case of `nil` parameter it sets the charset to + # `default_charset`. + # + # response.charset = 'utf-16' # => 'utf-16' + # response.charset = nil # => 'utf-8' + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:329 + def charset=(charset); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:443 + def close; end + + # Returns a string to ensure compatibility with `Net::HTTPResponse`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:351 + def code; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:234 + def commit!; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:258 + def committed?; end + + # Content type of response. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:309 + def content_type; end + + # Sets the HTTP response's content MIME type. For example, in the controller you + # could write this: + # + # response.content_type = "text/html" + # + # This method also accepts a symbol with the extension of the MIME type: + # + # response.content_type = :html + # + # If a character set has been defined for this response (see #charset=) then the + # character set information will also be included in the content type + # information. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:290 + def content_type=(content_type); end + + # Returns the response cookies, converted to a Hash of (name => value) pairs + # + # assert_equal 'AuthorOfNewPage', r.cookies['author'] + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:470 + def cookies; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:102 + def default_charset; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:102 + def default_charset=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:103 + def default_headers; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:103 + def default_headers=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:222 + def delete_header(key); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:91 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:220 + def get_header(key); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:219 + def has_header?(key); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:87 + def header; end + + # The headers for the response. + # + # header["Content-Type"] # => "text/plain" + # header["Content-Type"] = "application/json" + # header["Content-Type"] # => "application/json" + # + # Also aliased as `headers`. + # + # headers["Content-Type"] # => "text/plain" + # headers["Content-Type"] = "application/json" + # headers["Content-Type"] # => "application/json" + # + # Also aliased as `header` for compatibility. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:85 + def headers; end + + # Media type of response. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:314 + def media_type; end + + # Returns the corresponding message for the current HTTP status code: + # + # response.status = 200 + # response.message # => "OK" + # + # response.status = 404 + # response.message # => "Not Found" + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:363 + def message; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:465 + def prepare!; end + + # The location header we'll be responding with. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:441 + def redirect_url; end + + # The request that the response is responding to. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:67 + def request; end + + # The request that the response is responding to. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:67 + def request=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:430 + def reset_body!; end + + # The response code of the request. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:346 + def response_code; end + + # Send the file stored at `path` as the response body. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:425 + def send_file(path); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:242 + def sending!; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:257 + def sending?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:318 + def sending_file=(v); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:250 + def sent!; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:259 + def sent?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:221 + def set_header(key, v); end + + # The HTTP status code. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:70 + def status; end + + # Sets the HTTP status code. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:274 + def status=(status); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:366 + def status_message; end + + # The underlying body, as a streamable object. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:196 + def stream; end + + # Turns the Response into a Rack-compatible array of the status, headers, and + # body. Allows explicit splatting: + # + # status, headers, body = *response + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:461 + def to_a; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:380 + def write(string); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:536 + def assign_default_content_type_and_charset!; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:514 + def before_committed; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:522 + def before_sending; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:532 + def build_buffer(response, body); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:588 + def handle_no_content!; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:494 + def parse_content_type(content_type); end + + # Small internal convenience method to get the parsed version of the current + # content type header. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:504 + def parsed_content_type_header; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:595 + def rack_response(status, headers); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:508 + def set_content_type(content_type, charset); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:186 + def create(status = T.unsafe(nil), headers = T.unsafe(nil), body = T.unsafe(nil), default_headers: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:102 + def default_charset; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:102 + def default_charset=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:103 + def default_headers; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:103 + def default_headers=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:191 + def merge_default_headers(original, default); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:51 + def rack_status_code(status); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:114 +class ActionDispatch::Response::Buffer + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:115 + def initialize(response, buf); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:156 + def <<(string); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:168 + def abort; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:140 + def body; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:171 + def close; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:176 + def closed?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:158 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:124 + def respond_to?(method, include_private = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:132 + def to_ary; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:148 + def write(string); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:181 + def each_chunk(&block); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:122 +ActionDispatch::Response::Buffer::BODY_METHODS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:98 +ActionDispatch::Response::CONTENT_TYPE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:488 +ActionDispatch::Response::CONTENT_TYPE_PARSER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 +class ActionDispatch::Response::ContentTypeHeader < ::Struct + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 + def charset; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 + def charset=(_); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 + def mime_type; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 + def mime_type=(_); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 + def [](*_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 + def inspect; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 + def keyword_init?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 + def members; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:485 + def new(*_arg0); end + end +end + +# Avoid having to pass an open file handle as the response body. Rack::Sendfile +# will usually intercept the response and uses the path directly, so there is no +# reason to open the file. +# +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:403 +class ActionDispatch::Response::FileBody + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:406 + def initialize(path); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:410 + def body; end + + # Stream the file's contents if Rack::Sendfile isn't present. + # + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:415 + def each; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:404 + def to_path; end +end + +# To be deprecated: +# +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:64 +ActionDispatch::Response::Header = Rack::Headers + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:42 +ActionDispatch::Response::Headers = Rack::Headers + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:100 +ActionDispatch::Response::NO_CONTENT_CODES = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:486 +ActionDispatch::Response::NullContentTypeHeader = T.let(T.unsafe(nil), ActionDispatch::Response::ContentTypeHeader) + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:544 +class ActionDispatch::Response::RackBody + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:545 + def initialize(response); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:557 + def body; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:579 + def call(*arguments, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:551 + def close; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:575 + def each(*args, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:563 + def respond_to?(method, include_private = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:549 + def response; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:571 + def to_ary; end + + # pkg:gem/actionpack#lib/action_dispatch/http/response.rb:583 + def to_path; end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:561 +ActionDispatch::Response::RackBody::BODY_METHODS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:99 +ActionDispatch::Response::SET_COOKIE = T.let(T.unsafe(nil), String) + +# The routing module provides URL rewriting in native Ruby. It's a way to +# redirect incoming requests to controllers and actions. This replaces +# mod_rewrite rules. Best of all, Rails' Routing works with any web server. +# Routes are defined in `config/routes.rb`. +# +# Think of creating routes as drawing a map for your requests. The map tells +# them where to go based on some predefined pattern: +# +# Rails.application.routes.draw do +# Pattern 1 tells some request to go to one place +# Pattern 2 tell them to go to another +# ... +# end +# +# The following symbols are special: +# +# :controller maps to your controller name +# :action maps to an action with your controllers +# +# Other names simply map to a parameter as in the case of `:id`. +# +# ## Resources +# +# Resource routing allows you to quickly declare all of the common routes for a +# given resourceful controller. Instead of declaring separate routes for your +# `index`, `show`, `new`, `edit`, `create`, `update`, and `destroy` actions, a +# resourceful route declares them in a single line of code: +# +# resources :photos +# +# Sometimes, you have a resource that clients always look up without referencing +# an ID. A common example, /profile always shows the profile of the currently +# logged in user. In this case, you can use a singular resource to map /profile +# (rather than /profile/:id) to the show action. +# +# resource :profile +# +# It's common to have resources that are logically children of other resources: +# +# resources :magazines do +# resources :ads +# end +# +# You may wish to organize groups of controllers under a namespace. Most +# commonly, you might group a number of administrative controllers under an +# `admin` namespace. You would place these controllers under the +# `app/controllers/admin` directory, and you can group them together in your +# router: +# +# namespace "admin" do +# resources :posts, :comments +# end +# +# Alternatively, you can add prefixes to your path without using a separate +# directory by using `scope`. `scope` takes additional options which apply to +# all enclosed routes. +# +# scope path: "/cpanel", as: 'admin' do +# resources :posts, :comments +# end +# +# For more, see Routing::Mapper::Resources#resources, +# Routing::Mapper::Scoping#namespace, and Routing::Mapper::Scoping#scope. +# +# ## Non-resourceful routes +# +# For routes that don't fit the `resources` mold, you can use the HTTP helper +# methods `get`, `post`, `patch`, `put` and `delete`. +# +# get 'post/:id', to: 'posts#show' +# post 'post/:id', to: 'posts#create_comment' +# +# Now, if you POST to `/posts/:id`, it will route to the `create_comment` +# action. A GET on the same URL will route to the `show` action. +# +# If your route needs to respond to more than one HTTP method (or all methods) +# then using the `:via` option on `match` is preferable. +# +# match 'post/:id', to: 'posts#show', via: [:get, :post] +# +# ## Named routes +# +# Routes can be named by passing an `:as` option, allowing for easy reference +# within your source as `name_of_route_url` for the full URL and +# `name_of_route_path` for the URI path. +# +# Example: +# +# # In config/routes.rb +# get '/login', to: 'accounts#login', as: 'login' +# +# # With render, redirect_to, tests, etc. +# redirect_to login_url +# +# Arguments can be passed as well. +# +# redirect_to show_item_path(id: 25) +# +# Use `root` as a shorthand to name a route for the root path "/". +# +# # In config/routes.rb +# root to: 'blogs#index' +# +# # would recognize http://www.example.com/ as +# params = { controller: 'blogs', action: 'index' } +# +# # and provide these named routes +# root_url # => 'http://www.example.com/' +# root_path # => '/' +# +# Note: when using `controller`, the route is simply named after the method you +# call on the block parameter rather than map. +# +# # In config/routes.rb +# controller :blog do +# get 'blog/show' => :list +# get 'blog/delete' => :delete +# get 'blog/edit' => :edit +# end +# +# # provides named routes for show, delete, and edit +# link_to @article.title, blog_show_path(id: @article.id) +# +# ## Pretty URLs +# +# Routes can generate pretty URLs. For example: +# +# get '/articles/:year/:month/:day', to: 'articles#find_by_id', constraints: { +# year: /\d{4}/, +# month: /\d{1,2}/, +# day: /\d{1,2}/ +# } +# +# Using the route above, the URL "http://localhost:3000/articles/2005/11/06" +# maps to +# +# params = {year: '2005', month: '11', day: '06'} +# +# ## Regular Expressions and parameters +# You can specify a regular expression to define a format for a parameter. +# +# controller 'geocode' do +# get 'geocode/:postalcode', to: :show, constraints: { +# postalcode: /\d{5}(-\d{4})?/ +# } +# end +# +# Constraints can include the 'ignorecase' and 'extended syntax' regular +# expression modifiers: +# +# controller 'geocode' do +# get 'geocode/:postalcode', to: :show, constraints: { +# postalcode: /hx\d\d\s\d[a-z]{2}/i +# } +# end +# +# controller 'geocode' do +# get 'geocode/:postalcode', to: :show, constraints: { +# postalcode: /# Postalcode format +# \d{5} #Prefix +# (-\d{4})? #Suffix +# /x +# } +# end +# +# Using the multiline modifier will raise an `ArgumentError`. Encoding regular +# expression modifiers are silently ignored. The match will always use the +# default encoding or ASCII. +# +# ## External redirects +# +# You can redirect any path to another path using the redirect helper in your +# router: +# +# get "/stories", to: redirect("/posts") +# +# ## Unicode character routes +# +# You can specify unicode character routes in your router: +# +# get "こんにちは", to: "welcome#index" +# +# ## Routing to Rack Applications +# +# Instead of a String, like `posts#index`, which corresponds to the index action +# in the PostsController, you can specify any Rack application as the endpoint +# for a matcher: +# +# get "/application.js", to: Sprockets +# +# ## Reloading routes +# +# You can reload routes if you feel you must: +# +# Rails.application.reload_routes! +# +# This will clear all named routes and reload config/routes.rb if the file has +# been modified from last load. To absolutely force reloading, use `reload!`. +# +# ## Testing Routes +# +# The two main methods for testing your routes: +# +# ### `assert_routing` +# +# def test_movie_route_properly_splits +# opts = {controller: "plugin", action: "checkout", id: "2"} +# assert_routing "plugin/checkout/2", opts +# end +# +# `assert_routing` lets you test whether or not the route properly resolves into +# options. +# +# ### `assert_recognizes` +# +# def test_route_has_options +# opts = {controller: "plugin", action: "show", id: "12"} +# assert_recognizes opts, "/plugins/show/12" +# end +# +# Note the subtle difference between the two: `assert_routing` tests that a URL +# fits options while `assert_recognizes` tests that a URL breaks into parameters +# properly. +# +# In tests you can simply pass the URL or named route to `get` or `post`. +# +# def send_to_jail +# get '/jail' +# assert_response :success +# end +# +# def goes_to_login +# get login_url +# #... +# end +# +# ## View a list of all your routes +# +# $ bin/rails routes +# +# Target a specific controller with `-c`, or grep routes using `-g`. Useful in +# conjunction with `--expanded` which displays routes vertically. +# +# pkg:gem/actionpack#lib/action_dispatch/routing.rb:248 +module ActionDispatch::Routing + extend ::ActiveSupport::Autoload +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:158 +module ActionDispatch::Routing::ConsoleFormatter; end + +# pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:159 +class ActionDispatch::Routing::ConsoleFormatter::Base + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:160 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:177 + def footer(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:174 + def header(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:180 + def no_routes(engine, routes, filter); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:164 + def result; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:171 + def section(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:168 + def section_title(title); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:244 +class ActionDispatch::Routing::ConsoleFormatter::Expanded < ::ActionDispatch::Routing::ConsoleFormatter::Base + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:245 + def initialize(width: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:258 + def footer(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:254 + def section(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:250 + def section_title(title); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:263 + def draw_expanded_section(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:278 + def route_header(index:); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:204 +class ActionDispatch::Routing::ConsoleFormatter::Sheet < ::ActionDispatch::Routing::ConsoleFormatter::Base + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:217 + def footer(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:213 + def header(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:209 + def section(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:205 + def section_title(title); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:231 + def draw_header(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:222 + def draw_section(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:237 + def widths(routes); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:283 +class ActionDispatch::Routing::ConsoleFormatter::Unused < ::ActionDispatch::Routing::ConsoleFormatter::Sheet + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:284 + def header(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:292 + def no_routes(engine, routes, filter); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/endpoint.rb:7 +class ActionDispatch::Routing::Endpoint + # pkg:gem/actionpack#lib/action_dispatch/routing/endpoint.rb:11 + def app; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/endpoint.rb:8 + def dispatcher?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/endpoint.rb:14 + def engine?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/endpoint.rb:10 + def matches?(req); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/endpoint.rb:12 + def rack_app; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/endpoint.rb:9 + def redirect?; end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing.rb:260 +ActionDispatch::Routing::HTTP_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:305 +class ActionDispatch::Routing::HtmlTableFormatter + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:306 + def initialize(view); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:323 + def footer(routes); end + + # The header is part of the HTML page, so we don't construct it here. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:320 + def header(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:326 + def no_routes(*); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:339 + def result; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:315 + def section(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:311 + def section_title(title); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:14 +class ActionDispatch::Routing::Mapper + include ::ActionDispatch::Routing::Mapper::Base + include ::ActionDispatch::Routing::Mapper::HttpHelpers + include ::ActionDispatch::Routing::Redirection + include ::ActionDispatch::Routing::Mapper::Scoping + include ::ActionDispatch::Routing::Mapper::Concerns + include ::ActionDispatch::Routing::Mapper::Resources + include ::ActionDispatch::Routing::Mapper::CustomUrls + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2530 + def initialize(set); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:27 + def backtrace_cleaner; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:27 + def backtrace_cleaner=(val); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:407 + def normalize_name(name); end + + # Invokes Journey::Router::Utils.normalize_path, then ensures that /(:locale) + # becomes (/:locale). Except for root cases, where the former is the correct + # one. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:392 + def normalize_path(path); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:26 + def route_source_locations; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:26 + def route_source_locations=(val); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:15 +class ActionDispatch::Routing::Mapper::BacktraceCleaner < ::ActiveSupport::BacktraceCleaner + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:16 + def initialize; end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:411 +module ActionDispatch::Routing::Mapper::Base + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:653 + def default_url_options(options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:650 + def default_url_options=(options); end + + # Query if the following named route was already defined. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:662 + def has_named_route?(name); end + + # Matches a URL pattern to one or more routes. + # + # You should not use the `match` method in your router without specifying an + # HTTP method. + # + # If you want to expose your action to both GET and POST, use: + # + # # sets :controller, :action, and :id in params + # match ':controller/:action/:id', via: [:get, :post] + # + # Note that `:controller`, `:action`, and `:id` are interpreted as URL query + # parameters and thus available through `params` in an action. + # + # If you want to expose your action to GET, use `get` in the router: + # + # Instead of: + # + # match ":controller/:action/:id" + # + # Do: + # + # get ":controller/:action/:id" + # + # Two of these symbols are special, `:controller` maps to the controller and + # `:action` to the controller's action. A pattern can also map wildcard segments + # (globs) to params: + # + # get 'songs/*category/:title', to: 'songs#show' + # + # # 'songs/rock/classic/stairway-to-heaven' sets + # # params[:category] = 'rock/classic' + # # params[:title] = 'stairway-to-heaven' + # + # To match a wildcard parameter, it must have a name assigned to it. Without a + # variable name to attach the glob parameter to, the route can't be parsed. + # + # When a pattern points to an internal route, the route's `:action` and + # `:controller` should be set in options or hash shorthand. Examples: + # + # match 'photos/:id', to: 'photos#show', via: :get + # match 'photos/:id', controller: 'photos', action: 'show', via: :get + # + # A pattern can also point to a `Rack` endpoint i.e. anything that responds to + # `call`: + # + # match 'photos/:id', to: -> (hash) { [200, {}, ["Coming soon"]] }, via: :get + # match 'photos/:id', to: PhotoRackApp, via: :get + # # Yes, controller actions are just rack endpoints + # match 'photos/:id', to: PhotosController.action(:show), via: :get + # + # Because requesting various HTTP verbs with a single action has security + # implications, you must either specify the actions in the via options or use + # one of the [HttpHelpers](rdoc-ref:HttpHelpers) instead `match` + # + # ### Options + # + # Any options not seen here are passed on as params with the URL. + # + # :controller + # + # :action + # + # :param + # segment used to generate the routes). You can access that segment from + # your controller using `params[<:param>]`. In your router: + # + # resources :users, param: :name + # + # The `users` resource here will have the following routes generated for it: + # + # GET /users(.:format) + # POST /users(.:format) + # GET /users/new(.:format) + # GET /users/:name/edit(.:format) + # GET /users/:name(.:format) + # PATCH/PUT /users/:name(.:format) + # DELETE /users/:name(.:format) + # + # You can override `ActiveRecord::Base#to_param` of a related model to + # construct a URL: + # + # class User < ActiveRecord::Base + # def to_param + # name + # end + # end + # + # user = User.find_by(name: 'Phusion') + # user_path(user) # => "/users/Phusion" + # + # :path + # + # :module + # + # match 'path', to: 'c#a', module: 'sekret', controller: 'posts', via: :get + # # => Sekret::PostsController + # + # See `Scoping#namespace` for its scope equivalent. + # + # :as + # + # :via + # + # match 'path', to: 'c#a', via: :get + # match 'path', to: 'c#a', via: [:get, :post] + # match 'path', to: 'c#a', via: :all + # + # :to + # string representing a controller's action. + # + # match 'path', to: 'controller#action', via: :get + # match 'path', to: -> (env) { [200, {}, ["Success!"]] }, via: :get + # match 'path', to: RackApp, via: :get + # + # :on + # are `:member`, `:collection`, and `:new`. Only use within `resource(s)` + # block. For example: + # + # resource :bar do + # match 'foo', to: 'c#a', on: :member, via: [:get, :post] + # end + # + # Is equivalent to: + # + # resource :bar do + # member do + # match 'foo', to: 'c#a', via: [:get, :post] + # end + # end + # + # :constraints + # responds to `matches?`. In addition, constraints other than path can also + # be specified with any object that responds to `===` (e.g. String, Array, + # Range, etc.). + # + # match 'path/:id', constraints: { id: /[A-Z]\d{5}/ }, via: :get + # + # match 'json_only', constraints: { format: 'json' }, via: :get + # + # class PermitList + # def matches?(request) request.remote_ip == '1.2.3.4' end + # end + # match 'path', to: 'c#a', constraints: PermitList.new, via: :get + # + # See `Scoping#constraints` for more examples with its scope equivalent. + # + # :defaults + # + # # Sets params[:format] to 'jpg' by default + # match 'path', to: 'c#a', defaults: { format: 'jpg' }, via: :get + # + # See `Scoping#defaults` for its scope equivalent. + # + # :anchor + # the pattern matches any request prefixed with the given path. + # + # # Matches any request starting with 'path' + # match 'path', to: 'c#a', anchor: false, via: :get + # + # :format + # disable it by supplying `false`. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:587 + def match(path, options = T.unsafe(nil)); end + + # Mount a Rack-based application to be used within the application. + # + # mount SomeRackApp, at: "some_route" + # + # For options, see `match`, as `mount` uses it internally. + # + # All mounted applications come with routing helpers to access them. These are + # named after the class specified, so for the above example the helper is either + # `some_rack_app_path` or `some_rack_app_url`. To customize this helper's name, + # use the `:as` option: + # + # mount(SomeRackApp, at: "some_route", as: "exciting") + # + # This will generate the `exciting_path` and `exciting_url` helpers which can be + # used to navigate to this mounted app. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:605 + def mount(app = T.unsafe(nil), deprecated_options = T.unsafe(nil), as: T.unsafe(nil), via: T.unsafe(nil), at: T.unsafe(nil), defaults: T.unsafe(nil), constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), internal: T.unsafe(nil), **mapping, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:655 + def with_default_scope(scope, &block); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:689 + def app_name(app, rails_app); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:667 + def assign_deprecated_option(deprecated_options, key, method_name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:676 + def assign_deprecated_options(deprecated_options, options, method_name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:698 + def define_generate_prefix(app, name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:685 + def rails_app?(app); end +end + +# Routing Concerns allow you to declare common routes that can be reused inside +# others resources and routes. +# +# concern :commentable do +# resources :comments +# end +# +# concern :image_attachable do +# resources :images, only: :index +# end +# +# These concerns are used in Resources routing: +# +# resources :messages, concerns: [:commentable, :image_attachable] +# +# or in a scope or namespace: +# +# namespace :posts do +# concerns :commentable +# end +# +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2242 +module ActionDispatch::Routing::Mapper::Concerns + # Define a routing concern using a name. + # + # Concerns may be defined inline, using a block, or handled by another object, + # by passing that object as the second parameter. + # + # The concern object, if supplied, should respond to `call`, which will receive + # two parameters: + # + # * The current mapper + # * A hash of options which the concern object may use + # + # Options may also be used by concerns defined in a block by accepting a block + # parameter. So, using a block, you might do something as simple as limit the + # actions available on certain resources, passing standard resource options + # through the concern: + # + # concern :commentable do |options| + # resources :comments, options + # end + # + # resources :posts, concerns: :commentable + # resources :archived_posts do + # # Don't allow comments on archived posts + # concerns :commentable, only: [:index, :show] + # end + # + # Or, using a callable object, you might implement something more specific to + # your application, which would be out of place in your routes file. + # + # # purchasable.rb + # class Purchasable + # def initialize(defaults = {}) + # @defaults = defaults + # end + # + # def call(mapper, options = {}) + # options = @defaults.merge(options) + # mapper.resources :purchases + # mapper.resources :receipts + # mapper.resources :returns if options[:returnable] + # end + # end + # + # # routes.rb + # concern :purchasable, Purchasable.new(returnable: true) + # + # resources :toys, concerns: :purchasable + # resources :electronics, concerns: :purchasable + # resources :pets do + # concerns :purchasable, returnable: false + # end + # + # Any routing helpers can be used inside a concern. If using a callable, they're + # accessible from the Mapper that's passed to `call`. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2297 + def concern(name, callable = T.unsafe(nil), &block); end + + # Use the named concerns + # + # resources :posts do + # concerns :commentable + # end + # + # Concerns also work in any routes helper that you want to use: + # + # namespace :posts do + # concerns :commentable + # end + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2313 + def concerns(*args, **options); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:29 +class ActionDispatch::Routing::Mapper::Constraints < ::ActionDispatch::Routing::Endpoint + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:35 + def initialize(app, constraints, strategy); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:30 + def app; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:30 + def constraints; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:50 + def dispatcher?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:52 + def matches?(req); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:59 + def serve(req); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:66 + def constraint_args(constraint, request); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:33 +ActionDispatch::Routing::Mapper::Constraints::CALL = T.let(T.unsafe(nil), Proc) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:32 +ActionDispatch::Routing::Mapper::Constraints::SERVE = T.let(T.unsafe(nil), Proc) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2324 +module ActionDispatch::Routing::Mapper::CustomUrls + # Define custom URL helpers that will be added to the application's routes. This + # allows you to override and/or replace the default behavior of routing helpers, + # e.g: + # + # direct :homepage do + # "https://rubyonrails.org" + # end + # + # direct :commentable do |model| + # [ model, anchor: model.dom_id ] + # end + # + # direct :main do + # { controller: "pages", action: "index", subdomain: "www" } + # end + # + # The return value from the block passed to `direct` must be a valid set of + # arguments for `url_for` which will actually build the URL string. This can be + # one of the following: + # + # * A string, which is treated as a generated URL + # * A hash, e.g. `{ controller: "pages", action: "index" }` + # * An array, which is passed to `polymorphic_url` + # * An Active Model instance + # * An Active Model class + # + # + # NOTE: Other URL helpers can be called in the block but be careful not to + # invoke your custom URL helper again otherwise it will result in a stack + # overflow error. + # + # You can also specify default options that will be passed through to your URL + # helper definition, e.g: + # + # direct :browse, page: 1, size: 10 do |options| + # [ :products, options.merge(params.permit(:page, :size).to_h.symbolize_keys) ] + # end + # + # In this instance the `params` object comes from the context in which the block + # is executed, e.g. generating a URL inside a controller action or a view. If + # the block is executed where there isn't a `params` object such as this: + # + # Rails.application.routes.url_helpers.browse_path + # + # then it will raise a `NameError`. Because of this you need to be aware of the + # context in which you will use your custom URL helper when defining it. + # + # NOTE: The `direct` method can't be used inside of a scope block such as + # `namespace` or `scope` and will raise an error if it detects that it is. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2374 + def direct(name, options = T.unsafe(nil), &block); end + + # Define custom polymorphic mappings of models to URLs. This alters the behavior + # of `polymorphic_url` and consequently the behavior of `link_to`, `form_with` + # and `form_for` when passed a model instance, e.g: + # + # resource :basket + # + # resolve "Basket" do + # [:basket] + # end + # + # This will now generate "/basket" when a `Basket` instance is passed to + # `link_to`, `form_with` or `form_for` instead of the standard "/baskets/:id". + # + # NOTE: This custom behavior only applies to simple polymorphic URLs where a + # single model instance is passed and not more complicated forms, e.g: + # + # # config/routes.rb + # resource :profile + # namespace :admin do + # resources :users + # end + # + # resolve("User") { [:profile] } + # + # # app/views/application/_menu.html.erb + # link_to "Profile", @current_user + # link_to "Profile", [:admin, @current_user] + # + # The first `link_to` will generate "/profile" but the second will generate the + # standard polymorphic URL of "/admin/users/1". + # + # You can pass options to a polymorphic mapping - the arity for the block needs + # to be two as the instance is passed as the first argument, e.g: + # + # resolve "Basket", anchor: "items" do |basket, options| + # [:basket, options] + # end + # + # This generates the URL "/basket#items" because when the last item in an array + # passed to `polymorphic_url` is a hash then it's treated as options to the URL + # helper that gets called. + # + # NOTE: The `resolve` method can't be used inside of a scope block such as + # `namespace` or `scope` and will raise an error if it detects that it is. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2426 + def resolve(*args, &block); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2528 +ActionDispatch::Routing::Mapper::DEFAULT = T.let(T.unsafe(nil), Object) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:733 +module ActionDispatch::Routing::Mapper::HttpHelpers + # Define a route that recognizes HTTP CONNECT (and GET) requests. More + # specifically this recognizes HTTP/1 protocol upgrade requests and HTTP/2 + # CONNECT requests with the protocol pseudo header. For supported arguments, + # see [match](rdoc-ref:Base#match) + # + # connect 'live', to: 'live#index' + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:884 + def connect(*path_or_actions, as: T.unsafe(nil), to: T.unsafe(nil), controller: T.unsafe(nil), action: T.unsafe(nil), on: T.unsafe(nil), defaults: T.unsafe(nil), constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), internal: T.unsafe(nil), **mapping, &block); end + + # Define a route that only recognizes HTTP DELETE. For supported arguments, see + # [match](rdoc-ref:Base#match) + # + # delete 'broccoli', to: 'food#broccoli' + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:834 + def delete(*path_or_actions, as: T.unsafe(nil), to: T.unsafe(nil), controller: T.unsafe(nil), action: T.unsafe(nil), on: T.unsafe(nil), defaults: T.unsafe(nil), constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), internal: T.unsafe(nil), **mapping, &block); end + + # Define a route that only recognizes HTTP GET. For supported arguments, see + # [match](rdoc-ref:Base#match) + # + # get 'bacon', to: 'food#bacon' + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:738 + def get(*path_or_actions, as: T.unsafe(nil), to: T.unsafe(nil), controller: T.unsafe(nil), action: T.unsafe(nil), on: T.unsafe(nil), defaults: T.unsafe(nil), constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), internal: T.unsafe(nil), **mapping, &block); end + + # Define a route that only recognizes HTTP OPTIONS. For supported arguments, see + # [match](rdoc-ref:Base#match) + # + # options 'carrots', to: 'food#carrots' + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:858 + def options(*path_or_actions, as: T.unsafe(nil), to: T.unsafe(nil), controller: T.unsafe(nil), action: T.unsafe(nil), on: T.unsafe(nil), defaults: T.unsafe(nil), constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), internal: T.unsafe(nil), **mapping, &block); end + + # Define a route that only recognizes HTTP PATCH. For supported arguments, see + # [match](rdoc-ref:Base#match) + # + # patch 'bacon', to: 'food#bacon' + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:786 + def patch(*path_or_actions, as: T.unsafe(nil), to: T.unsafe(nil), controller: T.unsafe(nil), action: T.unsafe(nil), on: T.unsafe(nil), defaults: T.unsafe(nil), constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), internal: T.unsafe(nil), **mapping, &block); end + + # Define a route that only recognizes HTTP POST. For supported arguments, see + # [match](rdoc-ref:Base#match) + # + # post 'bacon', to: 'food#bacon' + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:762 + def post(*path_or_actions, as: T.unsafe(nil), to: T.unsafe(nil), controller: T.unsafe(nil), action: T.unsafe(nil), on: T.unsafe(nil), defaults: T.unsafe(nil), constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), internal: T.unsafe(nil), **mapping, &block); end + + # Define a route that only recognizes HTTP PUT. For supported arguments, see + # [match](rdoc-ref:Base#match) + # + # put 'bacon', to: 'food#bacon' + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:810 + def put(*path_or_actions, as: T.unsafe(nil), to: T.unsafe(nil), controller: T.unsafe(nil), action: T.unsafe(nil), on: T.unsafe(nil), defaults: T.unsafe(nil), constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), internal: T.unsafe(nil), **mapping, &block); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:83 +class ActionDispatch::Routing::Mapper::Mapping + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:132 + def initialize(set:, ast:, controller:, default_action:, to:, formatted:, via:, options_constraints:, anchor:, scope_params:, internal:, options:); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:190 + def application; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:87 + def ast; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:194 + def conditions; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:87 + def default_action; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:87 + def default_controller; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:87 + def defaults; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:183 + def make_route(name, precedence); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:87 + def path; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:87 + def required_defaults; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:87 + def requirements; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:87 + def scope_options; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:87 + def to; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:329 + def add_controller_module(controller, modyoule); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:290 + def app(blocks); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:348 + def blocks(callable_constraint); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:198 + def build_conditions(current_conditions, request_class); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:302 + def check_controller_and_action(path_params, controller, action); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:317 + def check_part(name, part, path_params, hash); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:355 + def constraints(options, path_params); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:369 + def dispatcher(raise_on_name_error); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:208 + def intern(object); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:286 + def normalize_defaults(options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:254 + def normalize_format(formatted); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:212 + def normalize_options!(options, path_params, modyoule); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:373 + def route_source_location; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:248 + def split_constraints(path_params, constraints); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:341 + def translate_controller(controller); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:270 + def verify_regexp_requirements(requirements, wildcard_options); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:90 + def build(scope, set, ast, controller, default_action, to, via, formatted, options_constraints, anchor, internal, options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:104 + def check_via(via); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:116 + def normalize_path(path, format); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:128 + def optional_format?(path, format); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:84 +ActionDispatch::Routing::Mapper::Mapping::ANCHOR_CHARACTERS_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:181 +ActionDispatch::Routing::Mapper::Mapping::JOINED_SEPARATORS = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:85 +ActionDispatch::Routing::Mapper::Mapping::OPTIONAL_FORMAT_REGEX = T.let(T.unsafe(nil), Regexp) + +# Resource routing allows you to quickly declare all of the common routes for a +# given resourceful controller. Instead of declaring separate routes for your +# `index`, `show`, `new`, `edit`, `create`, `update`, and `destroy` actions, a +# resourceful route declares them in a single line of code: +# +# resources :photos +# +# Sometimes, you have a resource that clients always look up without referencing +# an ID. A common example, /profile always shows the profile of the currently +# logged in user. In this case, you can use a singular resource to map /profile +# (rather than /profile/:id) to the show action. +# +# resource :profile +# +# It's common to have resources that are logically children of other resources: +# +# resources :magazines do +# resources :ads +# end +# +# You may wish to organize groups of controllers under a namespace. Most +# commonly, you might group a number of administrative controllers under an +# `admin` namespace. You would place these controllers under the +# `app/controllers/admin` directory, and you can group them together in your +# router: +# +# namespace "admin" do +# resources :posts, :comments +# end +# +# By default the `:id` parameter doesn't accept dots. If you need to use dots as +# part of the `:id` parameter add a constraint which overrides this restriction, +# e.g: +# +# resources :articles, id: /[^\/]+/ +# +# This allows any character other than a slash as part of your `:id`. +# +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1299 +module ActionDispatch::Routing::Mapper::Resources + # To add a route to the collection: + # + # resources :photos do + # collection do + # get 'search' + # end + # end + # + # This will enable Rails to recognize paths such as `/photos/search` with GET, + # and route to the search action of `PhotosController`. It will also create the + # `search_photos_url` and `search_photos_path` route helpers. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1707 + def collection(&block); end + + # Loads another routes file with the given `name` located inside the + # `config/routes` directory. In that file, you can use the normal routing DSL, + # but *do not* surround it with a `Rails.application.routes.draw` block. + # + # # config/routes.rb + # Rails.application.routes.draw do + # draw :admin # Loads `config/routes/admin.rb` + # draw "third_party/some_gem" # Loads `config/routes/third_party/some_gem.rb` + # end + # + # # config/routes/admin.rb + # namespace :admin do + # resources :accounts + # end + # + # # config/routes/third_party/some_gem.rb + # mount SomeGem::Engine, at: "/some_gem" + # + # **CAUTION:** Use this feature with care. Having multiple routes files can + # negatively impact discoverability and readability. For most applications — + # even those with a few hundred routes — it's easier for developers to have a + # single routes file. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1816 + def draw(name); end + + # Matches a URL pattern to one or more routes. For more information, see + # [match](rdoc-ref:Base#match). + # + # match 'path', to: 'controller#action', via: :post + # match 'otherpath', on: :member, via: :get + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1837 + def match(*path_or_actions, as: T.unsafe(nil), via: T.unsafe(nil), to: T.unsafe(nil), controller: T.unsafe(nil), action: T.unsafe(nil), on: T.unsafe(nil), defaults: T.unsafe(nil), constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), internal: T.unsafe(nil), **mapping, &block); end + + # To add a member route, add a member block into the resource block: + # + # resources :photos do + # member do + # get 'preview' + # end + # end + # + # This will recognize `/photos/1/preview` with GET, and route to the preview + # action of `PhotosController`. It will also create the `preview_photo_url` and + # `preview_photo_path` helpers. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1728 + def member(&block); end + + # See ActionDispatch::Routing::Mapper::Scoping#namespace. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1775 + def namespace(name, deprecated_options = T.unsafe(nil), as: T.unsafe(nil), path: T.unsafe(nil), shallow_path: T.unsafe(nil), shallow_prefix: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1754 + def nested(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1744 + def new(&block); end + + # Sometimes, you have a resource that clients always look up without referencing + # an ID. A common example, /profile always shows the profile of the currently + # logged in user. In this case, you can use a singular resource to map /profile + # (rather than /profile/:id) to the show action: + # + # resource :profile + # + # This creates six different routes in your application, all mapping to the + # `Profiles` controller (note that the controller is named after the plural): + # + # GET /profile/new + # GET /profile + # GET /profile/edit + # PATCH/PUT /profile + # DELETE /profile + # POST /profile + # + # If you want instances of a model to work with this resource via record + # identification (e.g. in `form_with` or `redirect_to`), you will need to call + # [resolve](rdoc-ref:CustomUrls#resolve): + # + # resource :profile + # resolve('Profile') { [:profile] } + # + # # Enables this to work with singular routes: + # form_with(model: @profile) {} + # + # ### Options + # Takes same options as [resources](rdoc-ref:#resources) + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1490 + def resource(*resources, concerns: T.unsafe(nil), **options, &block); end + + # In Rails, a resourceful route provides a mapping between HTTP verbs and URLs + # and controller actions. By convention, each action also maps to particular + # CRUD operations in a database. A single entry in the routing file, such as + # + # resources :photos + # + # creates seven different routes in your application, all mapping to the + # `Photos` controller: + # + # GET /photos + # GET /photos/new + # POST /photos + # GET /photos/:id + # GET /photos/:id/edit + # PATCH/PUT /photos/:id + # DELETE /photos/:id + # + # Resources can also be nested infinitely by using this block syntax: + # + # resources :photos do + # resources :comments + # end + # + # This generates the following comments routes: + # + # GET /photos/:photo_id/comments + # GET /photos/:photo_id/comments/new + # POST /photos/:photo_id/comments + # GET /photos/:photo_id/comments/:id + # GET /photos/:photo_id/comments/:id/edit + # PATCH/PUT /photos/:photo_id/comments/:id + # DELETE /photos/:photo_id/comments/:id + # + # ### Options + # Takes same options as [match](rdoc-ref:Base#match) as well as: + # + # :path_names + # actions. Actions not specified are not changed. + # + # resources :posts, path_names: { new: "brand_new" } + # + # The above example will now change /posts/new to /posts/brand_new. + # + # :path + # + # resources :posts, path: 'postings' + # + # The resource and all segments will now route to /postings instead of + # /posts. + # + # :only + # + # resources :cows, only: :show + # resources :cows, only: [:show, :index] + # + # :except + # + # resources :cows, except: :show + # resources :cows, except: [:show, :index] + # + # :shallow + # resource, generates shallow routes for all nested resources. + # + # resources :posts, shallow: true do + # resources :comments + # end + # + # Is the same as: + # + # resources :posts do + # resources :comments, except: [:show, :edit, :update, :destroy] + # end + # resources :comments, only: [:show, :edit, :update, :destroy] + # + # This allows URLs for resources that otherwise would be deeply nested such + # as a comment on a blog post like `/posts/a-long-permalink/comments/1234` + # to be shortened to just `/comments/1234`. + # + # Set `shallow: false` on a child resource to ignore a parent's shallow + # parameter. + # + # :shallow_path + # + # scope shallow_path: "sekret" do + # resources :posts do + # resources :comments, shallow: true + # end + # end + # + # The `comments` resource here will have the following routes generated for + # it: + # + # post_comments GET /posts/:post_id/comments(.:format) + # post_comments POST /posts/:post_id/comments(.:format) + # new_post_comment GET /posts/:post_id/comments/new(.:format) + # edit_comment GET /sekret/comments/:id/edit(.:format) + # comment GET /sekret/comments/:id(.:format) + # comment PATCH/PUT /sekret/comments/:id(.:format) + # comment DELETE /sekret/comments/:id(.:format) + # + # :shallow_prefix + # + # scope shallow_prefix: "sekret" do + # resources :posts do + # resources :comments, shallow: true + # end + # end + # + # The `comments` resource here will have the following routes generated for + # it: + # + # post_comments GET /posts/:post_id/comments(.:format) + # post_comments POST /posts/:post_id/comments(.:format) + # new_post_comment GET /posts/:post_id/comments/new(.:format) + # edit_sekret_comment GET /comments/:id/edit(.:format) + # sekret_comment GET /comments/:id(.:format) + # sekret_comment PATCH/PUT /comments/:id(.:format) + # sekret_comment DELETE /comments/:id(.:format) + # + # :format + # disable it by supplying `false`. + # + # :param + # + # + # ### Examples + # + # # routes call Admin::PostsController + # resources :posts, module: "admin" + # + # # resource actions are at /admin/posts. + # resources :posts, path: "admin/posts" + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1663 + def resources(*resources, concerns: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1457 + def resources_path_names(options); end + + # You can specify what Rails should route "/" to with the root method: + # + # root to: 'pages#main' + # + # For options, see `match`, as `root` uses it internally. + # + # You can also pass a string which will expand + # + # root 'pages#main' + # + # You should put the root route at the top of `config/routes.rb`, because this + # means it will be matched first. As this is the most popular route of most + # Rails applications, this is beneficial. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1903 + def root(path, options = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1783 + def shallow; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1790 + def shallow?; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1968 + def action_options?(options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2066 + def action_path(name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2195 + def add_route(action, controller, as, options_action, _path, to, via, formatted, anchor, options_constraints, internal, options_mapping); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2120 + def api_only?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1982 + def applicable_actions_for(method); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1963 + def apply_action_options(method, options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1928 + def apply_common_behavior_for(method, resources, shallow: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2041 + def canonical_action?(action); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2180 + def decomposed_match(path, controller, as, action, _path, to, via, formatted, anchor, options_constraints, internal, options_mapping, on = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2165 + def get_to_from_path(path, to, action); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2131 + def map_match(path_or_action, constraints: T.unsafe(nil), anchor: T.unsafe(nil), format: T.unsafe(nil), path: T.unsafe(nil), as: T.unsafe(nil), via: T.unsafe(nil), to: T.unsafe(nil), controller: T.unsafe(nil), action: T.unsafe(nil), on: T.unsafe(nil), internal: T.unsafe(nil), mapping: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2217 + def match_root_route(options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2082 + def name_for_action(as, action); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2018 + def nested_options; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1999 + def nested_scope?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2037 + def param_constraint; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2033 + def param_constraint?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1924 + def parent_resource; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2056 + def path_for_action(action, path); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2124 + def path_scope(path); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2070 + def prefix_name_for_action(as, action); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1995 + def resource_method_scope?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2010 + def resource_scope(resource, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1991 + def resource_scope?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1972 + def scope_action_options(method); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2108 + def set_member_mappings_for_resource; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2027 + def shallow_nesting_depth; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2045 + def shallow_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2176 + def using_match_shorthand?(path); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2003 + def with_scope_level(kind); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1304 +ActionDispatch::Routing::Mapper::Resources::CANONICAL_ACTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1303 +ActionDispatch::Routing::Mapper::Resources::RESOURCE_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1306 +class ActionDispatch::Routing::Mapper::Resources::Resource + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1319 + def initialize(entities, api_only, shallow, only: T.unsafe(nil), except: T.unsafe(nil), **options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1346 + def actions; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1354 + def available_actions; end + + # Checks for uncountable plurals, and appends "_index" if the plural and + # singular form are the same. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1378 + def collection_name; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1386 + def collection_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1317 + def controller; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1342 + def default_actions; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1374 + def member_name; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1388 + def member_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1362 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1398 + def nested_param; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1402 + def nested_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1394 + def new_scope(new_path); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1317 + def param; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1317 + def path; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1366 + def plural; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1382 + def resource_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1406 + def shallow?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1392 + def shallow_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1410 + def singleton?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1370 + def singular; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1413 + def invalid_only_except_options(valid_actions, only:, except:); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1308 + def default_actions(api_only); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1418 +class ActionDispatch::Routing::Mapper::Resources::SingletonResource < ::ActionDispatch::Routing::Mapper::Resources::Resource + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1429 + def initialize(entities, api_only, shallow, **options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1449 + def collection_name; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1436 + def default_actions; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1448 + def member_name; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1451 + def member_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1452 + def nested_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1440 + def plural; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1454 + def singleton?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1444 + def singular; end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1420 + def default_actions(api_only); end + end +end + +# CANONICAL_ACTIONS holds all actions that does not need a prefix or a path +# appended since they fit properly in their scope level. +# +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1302 +ActionDispatch::Routing::Mapper::Resources::VALID_ON_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2440 +class ActionDispatch::Routing::Mapper::Scope + include ::Enumerable + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2450 + def initialize(hash, parent = T.unsafe(nil), scope_level = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2509 + def [](key); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2476 + def action_name(name_prefix, prefix, collection_name, member_name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2517 + def each; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2513 + def frame; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2456 + def nested?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2501 + def new(hash); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2505 + def new_level(level); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2460 + def null?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2497 + def options; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2448 + def parent; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2472 + def resource_method_scope?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2493 + def resource_scope?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2468 + def resources?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2464 + def root?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2448 + def scope_level; end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2441 +ActionDispatch::Routing::Mapper::Scope::OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2446 +ActionDispatch::Routing::Mapper::Scope::RESOURCE_METHOD_SCOPES = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2445 +ActionDispatch::Routing::Mapper::Scope::RESOURCE_SCOPES = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:2525 +ActionDispatch::Routing::Mapper::Scope::ROOT = T.let(T.unsafe(nil), ActionDispatch::Routing::Mapper::Scope) + +# You may wish to organize groups of controllers under a namespace. Most +# commonly, you might group a number of administrative controllers under an +# `admin` namespace. You would place these controllers under the +# `app/controllers/admin` directory, and you can group them together in your +# router: +# +# namespace "admin" do +# resources :posts, :comments +# end +# +# This will create a number of routes for each of the posts and comments +# controller. For `Admin::PostsController`, Rails will create: +# +# GET /admin/posts +# GET /admin/posts/new +# POST /admin/posts +# GET /admin/posts/1 +# GET /admin/posts/1/edit +# PATCH/PUT /admin/posts/1 +# DELETE /admin/posts/1 +# +# If you want to route /posts (without the prefix /admin) to +# `Admin::PostsController`, you could use +# +# scope module: "admin" do +# resources :posts +# end +# +# or, for a single case +# +# resources :posts, module: "admin" +# +# If you want to route /admin/posts to `PostsController` (without the `Admin::` +# module prefix), you could use +# +# scope "/admin" do +# resources :posts +# end +# +# or, for a single case +# +# resources :posts, path: "/admin/posts" +# +# In each of these cases, the named routes remain the same as if you did not use +# scope. In the last case, the following paths map to `PostsController`: +# +# GET /admin/posts +# GET /admin/posts/new +# POST /admin/posts +# GET /admin/posts/1 +# GET /admin/posts/1/edit +# PATCH/PUT /admin/posts/1 +# DELETE /admin/posts/1 +# +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:958 +module ActionDispatch::Routing::Mapper::Scoping + # ### Parameter Restriction + # Allows you to constrain the nested routes based on a set of rules. For + # instance, in order to change the routes to allow for a dot character in the + # `id` parameter: + # + # constraints(id: /\d+\.\d+/) do + # resources :posts + # end + # + # Now routes such as `/posts/1` will no longer be valid, but `/posts/1.1` will + # be. The `id` parameter must match the constraint passed in for this example. + # + # You may use this to also restrict other parameters: + # + # resources :posts do + # constraints(post_id: /\d+\.\d+/) do + # resources :comments + # end + # end + # + # ### Restricting based on IP + # + # Routes can also be constrained to an IP or a certain range of IP addresses: + # + # constraints(ip: /192\.168\.\d+\.\d+/) do + # resources :posts + # end + # + # Any user connecting from the 192.168.* range will be able to see this + # resource, where as any user connecting outside of this range will be told + # there is no such route. + # + # ### Dynamic request matching + # + # Requests to routes can be constrained based on specific criteria: + # + # constraints(-> (req) { /iPhone/.match?(req.env["HTTP_USER_AGENT"]) }) do + # resources :iphones + # end + # + # You are able to move this logic out into a class if it is too complex for + # routes. This class must have a `matches?` method defined on it which either + # returns `true` if the user should be given access to that route, or `false` if + # the user should not. + # + # class Iphone + # def self.matches?(request) + # /iPhone/.match?(request.env["HTTP_USER_AGENT"]) + # end + # end + # + # An expected place for this code would be `lib/constraints`. + # + # This class is then used like this: + # + # constraints(Iphone) do + # resources :iphones + # end + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1176 + def constraints(constraints = T.unsafe(nil), &block); end + + # Scopes routes to a specific controller + # + # controller "food" do + # match "bacon", action: :bacon, via: :get + # end + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1052 + def controller(controller); end + + # Allows you to set default parameters for a route, such as this: + # + # defaults id: 'home' do + # match 'scoped_pages/(:id)', to: 'pages#show' + # end + # + # Using this, the `:id` parameter here will default to 'home'. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1187 + def defaults(defaults = T.unsafe(nil)); end + + # Scopes routes to a specific namespace. For example: + # + # namespace :admin do + # resources :posts + # end + # + # This generates the following routes: + # + # admin_posts GET /admin/posts(.:format) admin/posts#index + # admin_posts POST /admin/posts(.:format) admin/posts#create + # new_admin_post GET /admin/posts/new(.:format) admin/posts#new + # edit_admin_post GET /admin/posts/:id/edit(.:format) admin/posts#edit + # admin_post GET /admin/posts/:id(.:format) admin/posts#show + # admin_post PATCH/PUT /admin/posts/:id(.:format) admin/posts#update + # admin_post DELETE /admin/posts/:id(.:format) admin/posts#destroy + # + # ### Options + # + # The `:path`, `:as`, `:module`, `:shallow_path`, and `:shallow_prefix` options + # all default to the name of the namespace. + # + # For options, see `Base#match`. For `:shallow_path` option, see + # `Resources#resources`. + # + # # accessible through /sekret/posts rather than /admin/posts + # namespace :admin, path: "sekret" do + # resources :posts + # end + # + # # maps to Sekret::PostsController rather than Admin::PostsController + # namespace :admin, module: "sekret" do + # resources :posts + # end + # + # # generates sekret_posts_path rather than admin_posts_path + # namespace :admin, as: "sekret" do + # resources :posts + # end + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1097 + def namespace(name, deprecated_options = T.unsafe(nil), as: T.unsafe(nil), path: T.unsafe(nil), shallow_path: T.unsafe(nil), shallow_prefix: T.unsafe(nil), **options, &block); end + + # Scopes a set of routes to the given default options. + # + # Take the following route definition as an example: + # + # scope path: ":account_id", as: "account" do + # resources :projects + # end + # + # This generates helpers such as `account_projects_path`, just like `resources` + # does. The difference here being that the routes generated are like + # /:account_id/projects, rather than /accounts/:account_id/projects. + # + # ### Options + # + # Takes same options as `Base#match` and `Resources#resources`. + # + # # route /posts (without the prefix /admin) to Admin::PostsController + # scope module: "admin" do + # resources :posts + # end + # + # # prefix the posts resource's requests with '/admin' + # scope path: "/admin" do + # resources :posts + # end + # + # # prefix the routing helper name: sekret_posts_path instead of posts_path + # scope as: "sekret" do + # resources :posts + # end + # + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:989 + def scope(*args, only: T.unsafe(nil), except: T.unsafe(nil), **options); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1219 + def merge_action_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1203 + def merge_as_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1243 + def merge_blocks_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1235 + def merge_constraints_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1215 + def merge_controller_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1239 + def merge_defaults_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1227 + def merge_format_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1211 + def merge_module_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1249 + def merge_options_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1231 + def merge_path_names_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1195 + def merge_path_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1199 + def merge_shallow_path_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1207 + def merge_shallow_prefix_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1253 + def merge_shallow_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1257 + def merge_to_scope(parent, child); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1223 + def merge_via_scope(parent, child); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:1045 +ActionDispatch::Routing::Mapper::Scoping::POISON = T.let(T.unsafe(nil), Object) + +# pkg:gem/actionpack#lib/action_dispatch/routing/mapper.rb:24 +ActionDispatch::Routing::Mapper::URL_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:116 +class ActionDispatch::Routing::OptionRedirect < ::ActionDispatch::Routing::Redirect + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:145 + def inspect; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:117 + def options; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:119 + def path(params, request); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:91 +class ActionDispatch::Routing::PathRedirect < ::ActionDispatch::Routing::Redirect + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:106 + def inspect; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:94 + def path(params, request); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:111 + def interpolation_required?(string, params); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:92 +ActionDispatch::Routing::PathRedirect::URL_PARTS = T.let(T.unsafe(nil), Regexp) + +# # Action Dispatch Routing PolymorphicRoutes +# +# Polymorphic URL helpers are methods for smart resolution to a named route call +# when given an Active Record model instance. They are to be used in combination +# with ActionController::Resources. +# +# These methods are useful when you want to generate the correct URL or path to +# a RESTful resource without having to know the exact type of the record in +# question. +# +# Nested resources and/or namespaces are also supported, as illustrated in the +# example: +# +# polymorphic_url([:admin, @article, @comment]) +# +# results in: +# +# admin_article_comment_url(@article, @comment) +# +# ## Usage within the framework +# +# Polymorphic URL helpers are used in a number of places throughout the Rails +# framework: +# +# * `url_for`, so you can use it with a record as the argument, e.g. +# `url_for(@article)`; +# * ActionView::Helpers::FormHelper uses `polymorphic_path`, so you can write +# `form_with(model: @article)` without having to specify `:url` parameter for the +# form action; +# * `redirect_to` (which, in fact, uses `url_for`) so you can write +# `redirect_to(post)` in your controllers; +# * ActionView::Helpers::AtomFeedHelper, so you don't have to explicitly +# specify URLs for feed entries. +# +# +# ## Prefixed polymorphic helpers +# +# In addition to `polymorphic_url` and `polymorphic_path` methods, a number of +# prefixed helpers are available as a shorthand to `action: "..."` in options. +# Those are: +# +# * `edit_polymorphic_url`, `edit_polymorphic_path` +# * `new_polymorphic_url`, `new_polymorphic_path` +# +# +# Example usage: +# +# edit_polymorphic_path(@post) # => "/posts/1/edit" +# polymorphic_path(@post, format: :pdf) # => "/posts/1.pdf" +# +# ## Usage with mounted engines +# +# If you are using a mounted engine and you need to use a polymorphic_url +# pointing at the engine's routes, pass in the engine's route proxy as the first +# argument to the method. For example: +# +# polymorphic_url([blog, @post]) # calls blog.post_path(@post) +# form_with(model: [blog, @post]) # => "/blog/posts/1" +# +# pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:66 +module ActionDispatch::Routing::PolymorphicRoutes + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:156 + def edit_polymorphic_path(record_or_hash, options = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:156 + def edit_polymorphic_url(record_or_hash, options = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:156 + def new_polymorphic_path(record_or_hash, options = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:156 + def new_polymorphic_url(record_or_hash, options = T.unsafe(nil)); end + + # Returns the path component of a URL for the given record. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:133 + def polymorphic_path(record_or_hash_or_array, options = T.unsafe(nil)); end + + # Constructs a call to a named RESTful route for the given record and returns + # the resulting URL string. For example: + # + # # calls post_url(post) + # polymorphic_url(post) # => "http://example.com/posts/1" + # polymorphic_url([blog, post]) # => "http://example.com/blogs/1/posts/1" + # polymorphic_url([:admin, blog, post]) # => "http://example.com/admin/blogs/1/posts/1" + # polymorphic_url([user, :blog, post]) # => "http://example.com/users/1/blog/posts/1" + # polymorphic_url(Comment) # => "http://example.com/comments" + # + # #### Options + # + # * `:action` - Specifies the action prefix for the named route: `:new` or + # `:edit`. Default is no prefix. + # * `:routing_type` - Allowed values are `:path` or `:url`. Default is `:url`. + # + # + # Also includes all the options from `url_for`. These include such things as + # `:anchor` or `:trailing_slash`. Example usage is given below: + # + # polymorphic_url([blog, post], anchor: 'my_anchor') + # # => "http://example.com/blogs/1/posts/1#my_anchor" + # polymorphic_url([blog, post], anchor: 'my_anchor', script_name: "/my_app") + # # => "http://example.com/my_app/blogs/1/posts/1#my_anchor" + # + # For all of these options, see the documentation for + # [url_for](rdoc-ref:ActionDispatch::Routing::UrlFor). + # + # #### Functionality + # + # # an Article record + # polymorphic_url(record) # same as article_url(record) + # + # # a Comment record + # polymorphic_url(record) # same as comment_url(record) + # + # # it recognizes new records and maps to the collection + # record = Comment.new + # polymorphic_url(record) # same as comments_url() + # + # # the class of a record will also map to the collection + # polymorphic_url(Comment) # same as comments_url() + # + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:110 + def polymorphic_url(record_or_hash_or_array, options = T.unsafe(nil)); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:177 + def polymorphic_mapping(record); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:173 + def polymorphic_path_for_action(action, record_or_hash, options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:169 + def polymorphic_url_for_action(action, record_or_hash, options); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:185 +class ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:248 + def initialize(key_strategy, prefix, suffix); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:262 + def handle_class(klass); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:266 + def handle_class_call(target, klass); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:293 + def handle_list(list); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:270 + def handle_model(record); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:284 + def handle_model_call(target, record); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:254 + def handle_string(record); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:258 + def handle_string_call(target, str); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:246 + def prefix; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:246 + def suffix; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:347 + def get_method_for_class(klass); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:352 + def get_method_for_string(str); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:339 + def polymorphic_mapping(target, record); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:196 + def build(action, type); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:188 + def get(action, type); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:194 + def path; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:210 + def plural(prefix, suffix); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:214 + def polymorphic_method(recipient, record_or_hash_or_array, action, type, options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:206 + def singular(prefix, suffix); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:193 + def url; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/polymorphic_routes.rb:186 +ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder::CACHE = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:12 +class ActionDispatch::Routing::Redirect < ::ActionDispatch::Routing::Endpoint + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:15 + def initialize(status, block, source_location); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:13 + def block; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:37 + def build_response(req); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:23 + def call(env); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:69 + def inspect; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:65 + def path(params, request); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:21 + def redirect?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:13 + def status; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:78 + def escape(params); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:82 + def escape_fragment(params); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:86 + def escape_path(params); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:74 + def relative_path?(path); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:150 +module ActionDispatch::Routing::Redirection + # Redirect any path to another path: + # + # get "/stories" => redirect("/posts") + # + # This will redirect the user, while ignoring certain parts of the request, + # including query string, etc. `/stories`, `/stories?foo=bar`, etc all redirect + # to `/posts`. + # + # The redirect will use a `301 Moved Permanently` status code by default. This + # can be overridden with the `:status` option: + # + # get "/stories" => redirect("/posts", status: 307) + # + # You can also use interpolation in the supplied redirect argument: + # + # get 'docs/:article', to: redirect('/wiki/%{article}') + # + # Note that if you return a path without a leading slash then the URL is + # prefixed with the current SCRIPT_NAME environment variable. This is typically + # '/' but may be different in a mounted engine or where the application is + # deployed to a subdirectory of a website. + # + # Alternatively you can use one of the other syntaxes: + # + # The block version of redirect allows for the easy encapsulation of any logic + # associated with the redirect in question. Either the params and request are + # supplied as arguments, or just params, depending of how many arguments your + # block accepts. A string is required as a return value. + # + # get 'jokes/:number', to: redirect { |params, request| + # path = (params[:number].to_i.even? ? "wheres-the-beef" : "i-love-lamp") + # "http://#{request.host_with_port}/#{path}" + # } + # + # Note that the `do end` syntax for the redirect block wouldn't work, as Ruby + # would pass the block to `get` instead of `redirect`. Use `{ ... }` instead. + # + # The options version of redirect allows you to supply only the parts of the URL + # which need to change, it also supports interpolation of the path similar to + # the first example. + # + # get 'stores/:name', to: redirect(subdomain: 'stores', path: '/%{name}') + # get 'stores/:name(*all)', to: redirect(subdomain: 'stores', path: '/%{name}%{all}') + # get '/stories', to: redirect(path: '/posts') + # + # This will redirect the user, while changing only the specified parts of the + # request, for example the `path` option in the last example. `/stories`, + # `/stories?foo=bar`, redirect to `/posts` and `/posts?foo=bar` respectively. + # + # Finally, an object which responds to call can be supplied to redirect, + # allowing you to reuse common redirect routes. The call method must accept two + # arguments, params and request, and return a string. + # + # get 'accounts/:name' => redirect(SubdomainRedirector.new('api')) + # + # pkg:gem/actionpack#lib/action_dispatch/routing/redirection.rb:206 + def redirect(*args, &block); end +end + +# The RouteSet contains a collection of Route instances, representing the routes +# typically defined in `config/routes.rb`. +# +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:17 +class ActionDispatch::Routing::RouteSet + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:386 + def initialize(config = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:674 + def add_polymorphic_mapping(klass, options, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:643 + def add_route(mapping, name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:678 + def add_url_helper(name, options, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:417 + def api_only?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:464 + def append(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:903 + def call(env); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:488 + def clear!; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:438 + def default_env; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:421 + def default_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:425 + def default_scope=(new_default_scope); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:354 + def default_url_options; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:354 + def default_url_options=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:509 + def define_mounted_helper(name, script_namer = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:353 + def disable_clear_and_finalize; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:353 + def disable_clear_and_finalize=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:457 + def draw(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:354 + def draw_paths; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:354 + def draw_paths=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:406 + def eager_load!; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:639 + def empty?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:355 + def env_key; end + + # Generate the path indicated by the arguments, and return an array of the keys + # that were not used to generate it. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:818 + def extra_keys(options, recall = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:482 + def finalize!; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:846 + def find_script_name(options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:352 + def formatter; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:352 + def formatter=(_arg0); end + + # Returns a Route matching the given requirements, or `nil` if none are found. + # + # This is intended for use by tools such as Language Servers. + # + # Given the routes are defined as: + # + # resources :posts + # + # Then the following will return the Route for the `show` action: + # + # Rails.application.routes.from_requirements(controller: "posts", action: "show") + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:29 + def from_requirements(requirements); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:822 + def generate_extras(options, recall = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:536 + def generate_url_helpers(supports_path); end + + # Since the router holds references to many parts of the system like engines, + # controllers and the application itself, inspecting the route set can actually + # be really slow, therefore we default alias inspect to to_s. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:37 + def inspect; end + + # Contains all the mounted helpers across different engines and the `main_app` + # helper for the application. You can include this in your classes if you want + # to access routes for other engines. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:505 + def mounted_helpers; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:352 + def named_routes; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:352 + def named_routes=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:842 + def optimize_routes_generation?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:850 + def path_for(options, route_name = T.unsafe(nil), reserved = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:355 + def polymorphic_mappings; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:468 + def prepend(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:909 + def recognize_path(path, environment = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:924 + def recognize_path_with_request(req, path, extras, raise_on_missing: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:413 + def relative_url_root; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:429 + def request_class; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:353 + def resources_path_names; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:353 + def resources_path_names=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:352 + def router; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:352 + def router=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:357 + def routes; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:352 + def set; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:352 + def set=(_arg0); end + + # The `options` argument must be a hash whose keys are **symbols**. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:855 + def url_for(options, route_name = T.unsafe(nil), url_strategy = T.unsafe(nil), method_name = T.unsafe(nil), reserved = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:528 + def url_helpers(supports_path = T.unsafe(nil)); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:472 + def eval_block(block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:833 + def generate(route_name, options, recall = T.unsafe(nil), method_name = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:433 + def make_request(env); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:359 + def default_resources_path_names; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:363 + def new_with_config(config); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 +class ActionDispatch::Routing::RouteSet::Config < ::Struct + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def api_only; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def api_only=(_); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def default_scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def default_scope=(_); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def relative_url_root; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def relative_url_root=(_); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def [](*_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def inspect; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def keyword_init?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def members; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:382 + def new(*_arg0); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:682 +class ActionDispatch::Routing::RouteSet::CustomUrlHelper + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:685 + def initialize(name, defaults, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:683 + def block; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:691 + def call(t, args, only_path = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:683 + def defaults; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:683 + def name; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:703 + def eval_block(t, args, options); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:707 + def merge_defaults(options); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:384 +ActionDispatch::Routing::RouteSet::DEFAULT_CONFIG = T.let(T.unsafe(nil), ActionDispatch::Routing::RouteSet::Config) + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:39 +class ActionDispatch::Routing::RouteSet::Dispatcher < ::ActionDispatch::Routing::Endpoint + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:40 + def initialize(raise_on_name_error); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:44 + def dispatcher?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:46 + def serve(req); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:60 + def controller(req); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:64 + def dispatch(controller, action, req, res); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:712 +class ActionDispatch::Routing::RouteSet::Generator + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:715 + def initialize(named_route, options, recall, set); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:727 + def controller; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:731 + def current_controller; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:801 + def different_controller?; end + + # Generates a path from routes, returns a RouteWithParams or MissingRoute. + # MissingRoute will raise ActionController::UrlGenerationError. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:797 + def generate; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:713 + def named_route; end + + # Remove leading slashes from controllers + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:785 + def normalize_controller!; end + + # This pulls :controller, :action, and :id out of the recall. The recall key is + # only used if there is no key in the options or if the key in the options is + # identical. If any of :controller, :action or :id is not found, don't pull any + # more keys from the recall. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:767 + def normalize_controller_action_id!; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:743 + def normalize_options!; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:713 + def options; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:713 + def recall; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:713 + def set; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:735 + def use_recall_for(key); end + + # if the current controller is "foo/bar/baz" and controller: "baz/bat" is + # specified, the controller becomes "foo/baz/bat" + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:775 + def use_relative_controller!; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:807 + def named_route_exists?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:811 + def segment_keys; end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:497 +module ActionDispatch::Routing::RouteSet::MountedHelpers + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActionDispatch::Routing::UrlFor + + mixes_in_class_methods GeneratedClassMethods + + module GeneratedClassMethods + def default_url_options; end + def default_url_options=(value); end + def default_url_options?; end + end + + module GeneratedInstanceMethods + def default_url_options; end + def default_url_options=(value); end + def default_url_options?; end + end +end + +# A NamedRouteCollection instance is a collection of named routes, and also +# maintains an anonymous module that can be used to install helpers for the +# named routes. +# +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:82 +class ActionDispatch::Routing::RouteSet::NamedRouteCollection + include ::Enumerable + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:87 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:147 + def [](name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:146 + def []=(name, route); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:118 + def add(name, route); end + + # Given a `name`, defines name_path and name_url helpers. Used by 'direct', + # 'resolve', and 'polymorphic' route helpers. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:165 + def add_url_helper(name, defaults, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:148 + def clear; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:104 + def clear!; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:150 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:137 + def get(name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:100 + def helper_names; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:141 + def key?(name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:159 + def length; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:155 + def names; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:84 + def path_helpers_module; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:95 + def route_defined?(name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:84 + def url_helpers_module; end + + private + + # Create a URL helper allowing ordered parameters to be associated with + # corresponding dynamic segments, so you can do: + # + # foo_url(bar, baz, bang) + # + # Instead of: + # + # foo_url(bar: bar, baz: baz, bang: bang) + # + # Also allow options hash, so you can do: + # + # foo_url(bar, baz, bang, sort_by: 'baz') + # + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:333 + def define_url_helper(mod, name, helper, url_strategy); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:84 + def routes; end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:188 +class ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:271 + def initialize(route, options, route_name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:278 + def call(t, method_name, args, inner_options, url_strategy); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:290 + def handle_positional_args(controller_options, inner_options, args, result, path_params); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:201 + def route_name; end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:189 + def create(route, options, route_name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:197 + def optimize_helper?(route); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:203 +class ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper::OptimizedUrlHelper < ::ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:206 + def initialize(route, options, route_name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:204 + def arg_size; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:212 + def call(t, method_name, args, inner_options, url_strategy); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:243 + def optimize_routes_generation?(t); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:235 + def optimized_helper(args); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:247 + def parameterize_args(args); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:258 + def raise_generation_error(args); end +end + +# strategy for building URLs to send to the client +# +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:349 +ActionDispatch::Routing::RouteSet::PATH = T.let(T.unsafe(nil), Proc) + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:838 +ActionDispatch::Routing::RouteSet::RESERVED_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:69 +class ActionDispatch::Routing::RouteSet::StaticDispatcher < ::ActionDispatch::Routing::RouteSet::Dispatcher + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:70 + def initialize(controller_class); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:76 + def controller(_); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/route_set.rb:350 +ActionDispatch::Routing::RouteSet::UNKNOWN = T.let(T.unsafe(nil), Proc) + +# pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:10 +class ActionDispatch::Routing::RouteWrapper < ::SimpleDelegator + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:56 + def action; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:28 + def constraints; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:52 + def controller; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:17 + def endpoint; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:64 + def engine?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:60 + def internal?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:11 + def matches_filter?(filter, value); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:40 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:36 + def path; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:32 + def rack_app; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:44 + def reqs; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:68 + def to_h; end +end + +# This class is just used for displaying route information when someone +# executes `bin/rails routes` or looks at the RoutingError page. People should +# not use this class. +# +# pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:81 +class ActionDispatch::Routing::RoutesInspector + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:82 + def initialize(routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:87 + def format(formatter, filter = T.unsafe(nil)); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:147 + def filter_routes(routes, filter); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:98 + def format_routes(formatter, filter, engine_name, routes); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:115 + def load_engines_routes; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:128 + def normalize_filter(filter); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/inspector.rb:111 + def wrap_routes(routes); end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:9 +class ActionDispatch::Routing::RoutesProxy + include ::ActionDispatch::Routing::PolymorphicRoutes + include ::ActionDispatch::Routing::UrlFor + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:15 + def initialize(routes, scope, helpers, script_namer = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:13 + def _routes; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:10 + def default_url_options; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:10 + def default_url_options=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:10 + def default_url_options?; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:12 + def routes; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:12 + def routes=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:12 + def scope; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:12 + def scope=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:21 + def url_options; end + + private + + # Keeps the part of the script name provided by the global context via + # [ENV]("SCRIPT_NAME"), which `mount` doesn't know about since it depends on the + # specific request, but use our script name resolver for the mount point + # dependent part. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:55 + def merge_script_names(previous_script_name, new_script_name); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:32 + def method_missing(method, *args); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:28 + def respond_to_missing?(method, _); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:10 + def default_url_options; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:10 + def default_url_options=(value); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:10 + def default_url_options?; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:10 + def __class_attr_default_url_options; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/routes_proxy.rb:10 + def __class_attr_default_url_options=(new_value); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/routing.rb:259 +ActionDispatch::Routing::SEPARATORS = T.let(T.unsafe(nil), Array) + +# # Action Dispatch Routing UrlFor +# +# In `config/routes.rb` you define URL-to-controller mappings, but the reverse +# is also possible: a URL can be generated from one of your routing definitions. +# URL generation functionality is centralized in this module. +# +# See ActionDispatch::Routing for general information about routing and +# `config/routes.rb`. +# +# **Tip:** If you need to generate URLs from your models or some other place, +# then ActionDispatch::Routing::UrlFor is what you're looking for. Read on for +# an introduction. In general, this module should not be included on its own, as +# it is usually included by `url_helpers` (as in +# `Rails.application.routes.url_helpers`). +# +# ## URL generation from parameters +# +# As you may know, some functions, such as `ActionController::Base#url_for` and +# ActionView::Helpers::UrlHelper#link_to, can generate URLs given a set of +# parameters. For example, you've probably had the chance to write code like +# this in one of your views: +# +# <%= link_to('Click here', controller: 'users', +# action: 'new', message: 'Welcome!') %> +# # => Click here +# +# `link_to`, and all other functions that require URL generation functionality, +# actually use ActionDispatch::Routing::UrlFor under the hood. And in +# particular, they use the ActionDispatch::Routing::UrlFor#url_for method. One +# can generate the same path as the above example by using the following code: +# +# include ActionDispatch::Routing::UrlFor +# url_for(controller: 'users', +# action: 'new', +# message: 'Welcome!', +# only_path: true) +# # => "/users/new?message=Welcome%21" +# +# Notice the `only_path: true` part. This is because UrlFor has no information +# about the website hostname that your Rails app is serving. So if you want to +# include the hostname as well, then you must also pass the `:host` argument: +# +# include UrlFor +# url_for(controller: 'users', +# action: 'new', +# message: 'Welcome!', +# host: 'www.example.com') +# # => "http://www.example.com/users/new?message=Welcome%21" +# +# By default, all controllers and views have access to a special version of +# `url_for`, that already knows what the current hostname is. So if you use +# `url_for` in your controllers or your views, then you don't need to explicitly +# pass the `:host` argument. +# +# For convenience, mailers also include ActionDispatch::Routing::UrlFor. So +# within mailers, you can use url_for. However, mailers cannot access incoming +# web requests in order to derive hostname information, so you have to provide +# the `:host` option or set the default host using `default_url_options`. For +# more information on url_for in mailers see the ActionMailer::Base +# documentation. +# +# ## URL generation for named routes +# +# UrlFor also allows one to access methods that have been auto-generated from +# named routes. For example, suppose that you have a 'users' resource in your +# `config/routes.rb`: +# +# resources :users +# +# This generates, among other things, the method `users_path`. By default, this +# method is accessible from your controllers, views, and mailers. If you need to +# access this auto-generated method from other places (such as a model), then +# you can do that by including `Rails.application.routes.url_helpers` in your +# class: +# +# class User < ActiveRecord::Base +# include Rails.application.routes.url_helpers +# +# def base_uri +# user_path(self) +# end +# end +# +# User.find(1).base_uri # => "/users/1" +# +# pkg:gem/actionpack#lib/action_dispatch/routing/url_for.rb:92 +module ActionDispatch::Routing::UrlFor + include ::ActionDispatch::Routing::PolymorphicRoutes + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + + # pkg:gem/actionpack#lib/action_dispatch/routing/url_for.rb:111 + def initialize(*, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/routing/url_for.rb:182 + def full_url_for(options = T.unsafe(nil)); end + + # Allows calling direct or regular named route. + # + # resources :buckets + # + # direct :recordable do |recording| + # route_for(:bucket, recording.bucket) + # end + # + # direct :threadable do |threadable| + # route_for(:recordable, threadable.parent) + # end + # + # This maintains the context of the original caller on whether to return a path + # or full URL, e.g: + # + # threadable_path(threadable) # => "/buckets/1" + # threadable_url(threadable) # => "http://example.com/buckets/1" + # + # pkg:gem/actionpack#lib/action_dispatch/routing/url_for.rb:222 + def route_for(name, *args); end + + # Generate a URL based on the options provided, `default_url_options`, and the + # routes defined in `config/routes.rb`. The following options are supported: + # + # * `:only_path` - If true, the relative URL is returned. Defaults to `false`. + # * `:protocol` - The protocol to connect to. Defaults to `"http"`. + # * `:host` - Specifies the host the link should be targeted at. If + # `:only_path` is false, this option must be provided either explicitly, or + # via `default_url_options`. + # * `:subdomain` - Specifies the subdomain of the link, using the `tld_length` + # to split the subdomain from the host. If false, removes all subdomains + # from the host part of the link. + # * `:domain` - Specifies the domain of the link, using the `tld_length` to + # split the domain from the host. + # * `:tld_length` - Number of labels the TLD id composed of, only used if + # `:subdomain` or `:domain` are supplied. Defaults to + # `ActionDispatch::Http::URL.tld_length`, which in turn defaults to 1. + # * `:port` - Optionally specify the port to connect to. + # * `:anchor` - An anchor name to be appended to the path. + # * `:params` - The query parameters to be appended to the path. + # * `:path_params` - The query parameters that will only be used for the named + # dynamic segments of path. If unused, they will be discarded. + # * `:trailing_slash` - If true, adds a trailing slash, as in + # `"/archive/2009/"`. + # * `:script_name` - Specifies application path relative to domain root. If + # provided, prepends application path. + # + # + # Any other key (`:controller`, `:action`, etc.) given to `url_for` is forwarded + # to the Routes module. + # + # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', port: '8080' + # # => 'http://somehost.org:8080/tasks/testing' + # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', anchor: 'ok', only_path: true + # # => '/tasks/testing#ok' + # url_for controller: 'tasks', action: 'testing', trailing_slash: true + # # => 'http://somehost.org/tasks/testing/' + # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', number: '33' + # # => 'http://somehost.org/tasks/testing?number=33' + # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', script_name: "/myapp" + # # => 'http://somehost.org/myapp/tasks/testing' + # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', script_name: "/myapp", only_path: true + # # => '/myapp/tasks/testing' + # + # Missing routes keys may be filled in from the current request's parameters + # (e.g. `:controller`, `:action`, `:id`, and any other parameters that are + # placed in the path). Given that the current action has been reached through + # `GET /users/1`: + # + # url_for(only_path: true) # => '/users/1' + # url_for(only_path: true, action: 'edit') # => '/users/1/edit' + # url_for(only_path: true, action: 'edit', id: 2) # => '/users/2/edit' + # + # Notice that no `:id` parameter was provided to the first `url_for` call and + # the helper used the one from the route's path. Any path parameter implicitly + # used by `url_for` can always be overwritten like shown on the last `url_for` + # calls. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/url_for.rb:178 + def url_for(options = T.unsafe(nil)); end + + # Hook overridden in controller to add request information with + # `default_url_options`. Application logic should not go into url_options. + # + # pkg:gem/actionpack#lib/action_dispatch/routing/url_for.rb:118 + def url_options; end + + protected + + # pkg:gem/actionpack#lib/action_dispatch/routing/url_for.rb:227 + def optimize_routes_generation?; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/routing/url_for.rb:239 + def _routes_context; end + + # pkg:gem/actionpack#lib/action_dispatch/routing/url_for.rb:232 + def _with_routes(routes); end + + module GeneratedClassMethods + def default_url_options; end + def default_url_options=(value); end + def default_url_options?; end + end + + module GeneratedInstanceMethods + def default_url_options; end + def default_url_options=(value); end + def default_url_options?; end + end +end + +# # Action Dispatch SSL +# +# This middleware is added to the stack when `config.force_ssl = true`, and is +# passed the options set in `config.ssl_options`. It does three jobs to enforce +# secure HTTP requests: +# +# 1. **TLS redirect**: Permanently redirects `http://` requests to `https://` +# with the same URL host, path, etc. Enabled by default. Set +# `config.ssl_options` to modify the destination URL: +# +# config.ssl_options = { redirect: { host: "secure.widgets.com", port: 8080 }` +# +# Or set `redirect: false` to disable redirection. +# +# Requests can opt-out of redirection with `exclude`: +# +# config.ssl_options = { redirect: { exclude: -> request { request.path == "/up" } } } +# +# Cookies will not be flagged as secure for excluded requests. +# +# When proxying through a load balancer that terminates SSL, the forwarded +# request will appear as though it's HTTP instead of HTTPS to the application. +# This makes redirects and cookie security target HTTP instead of HTTPS. +# To make the server assume that the proxy already terminated SSL, and +# that the request really is HTTPS, set `config.assume_ssl` to `true`: +# +# config.assume_ssl = true +# +# 2. **Secure cookies**: Sets the `secure` flag on cookies to tell browsers +# they must not be sent along with `http://` requests. Enabled by default. +# Set `config.ssl_options` with `secure_cookies: false` to disable this +# feature. +# +# 3. **HTTP Strict Transport Security (HSTS)**: Tells the browser to remember +# this site as TLS-only and automatically redirect non-TLS requests. Enabled +# by default. Configure `config.ssl_options` with `hsts: false` to disable. +# +# Set `config.ssl_options` with `hsts: { ... }` to configure HSTS: +# +# * `expires`: How long, in seconds, these settings will stick. The +# minimum required to qualify for browser preload lists is 1 year. +# Defaults to 2 years (recommended). +# +# * `subdomains`: Set to `true` to tell the browser to apply these +# settings to all subdomains. This protects your cookies from +# interception by a vulnerable site on a subdomain. Defaults to `true`. +# +# * `preload`: Advertise that this site may be included in browsers' +# preloaded HSTS lists. HSTS protects your site on every visit *except +# the first visit* since it hasn't seen your HSTS header yet. To close +# this gap, browser vendors include a baked-in list of HSTS-enabled +# sites. Go to https://hstspreload.org to submit your site for +# inclusion. Defaults to `false`. +# +# +# To turn off HSTS, omitting the header is not enough. Browsers will +# remember the original HSTS directive until it expires. Instead, use the +# header to tell browsers to expire HSTS immediately. Setting `hsts: false` +# is a shortcut for `hsts: { expires: 0 }`. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:66 +class ActionDispatch::SSL + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:76 + def initialize(app, redirect: T.unsafe(nil), hsts: T.unsafe(nil), secure_cookies: T.unsafe(nil), ssl_default_redirect_status: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:88 + def call(env); end + + private + + # https://tools.ietf.org/html/rfc6797#section-6.1 + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:122 + def build_hsts_header(hsts); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:129 + def flag_cookies_as_secure!(headers); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:170 + def https_location_for(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:107 + def normalize_hsts_options(options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:153 + def redirect_to_https(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:160 + def redirection_status(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:103 + def set_hsts_header!(headers); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:72 + def default_hsts_options; end + end +end + +# :stopdoc: Default to 2 years as recommended on hstspreload.org. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:68 +ActionDispatch::SSL::HSTS_EXPIRES_IN = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/ssl.rb:70 +ActionDispatch::SSL::PERMANENT_REDIRECT_REQUEST_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:8 +class ActionDispatch::ServerTiming + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:52 + def initialize(app); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:58 + def call(env); end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:48 + def unsubscribe; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:9 +class ActionDispatch::ServerTiming::Subscriber + include ::Singleton::SingletonInstanceMethods + include ::Singleton + extend ::Singleton::SingletonClassMethods + + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:13 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:17 + def call(event); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:23 + def collect_events; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:32 + def ensure_subscribed; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:40 + def unsubscribe; end + + class << self + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:10 + def allocate; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:10 + def new(*_arg0); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/server_timing.rb:11 +ActionDispatch::ServerTiming::Subscriber::KEY = T.let(T.unsafe(nil), Symbol) + +# pkg:gem/actionpack#lib/action_dispatch.rb:106 +module ActionDispatch::Session + class << self + # pkg:gem/actionpack#lib/action_dispatch.rb:113 + def resolve_store(session_store); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:102 +class ActionDispatch::Session::AbstractSecureStore < ::Rack::Session::Abstract::PersistedSecure + include ::ActionDispatch::Session::Compatibility + include ::ActionDispatch::Session::StaleSessionCheck + include ::ActionDispatch::Session::SessionObject + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:107 + def generate_sid; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:112 + def set_cookie(request, response, cookie); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:91 +class ActionDispatch::Session::AbstractStore < ::Rack::Session::Abstract::Persisted + include ::ActionDispatch::Session::Compatibility + include ::ActionDispatch::Session::StaleSessionCheck + include ::ActionDispatch::Session::SessionObject + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:97 + def set_cookie(request, response, cookie); end +end + +# # Action Dispatch Session CacheStore +# +# A session store that uses an ActiveSupport::Cache::Store to store the +# sessions. This store is most useful if you don't store critical data in your +# sessions and you don't need them to live for extended periods of time. +# +# #### Options +# * `cache` - The cache to use. If it is not specified, `Rails.cache` +# will be used. +# * `expire_after` - The length of time a session will be stored before +# automatically expiring. By default, the `:expires_in` option of the cache +# is used. +# * `check_collisions` - Check if newly generated session ids aren't already in use. +# If for some reason 128 bits of randomness aren't considered secure enough to avoid +# collisions, this option can be enabled to ensure newly generated ids aren't in use. +# By default, it is set to `false` to avoid additional cache write operations. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:26 +class ActionDispatch::Session::CacheStore < ::ActionDispatch::Session::AbstractSecureStore + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:29 + def initialize(app, options = T.unsafe(nil)); end + + # Remove a session from the cache. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:59 + def delete_session(env, sid, options); end + + # Get a session from the cache. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:37 + def find_session(req, sid); end + + # Set a session in the cache. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:47 + def write_session(req, sid, session, options); end + + private + + # Turn the session id into a cache key. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:67 + def cache_key(id); end + + # Writing back a session that another request deleted, such as on logout, + # would restore it. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:77 + def destroyed_since_loaded?(req, sid); end + + # The request-local cache still holds the entry this request loaded, so + # a lookup through it cannot see a delete made by another request. + # + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:85 + def exist_in_backend?(key); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:93 + def generate_sid; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:71 + def get_session_with_fallback(sid); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/cache_store.rb:27 +ActionDispatch::Session::CacheStore::LOADED_SESSION_ID = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:22 +module ActionDispatch::Session::Compatibility + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:25 + def initialize(app, options = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:33 + def generate_sid; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:40 + def initialize_sid; end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:45 + def make_request(env); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:23 +ActionDispatch::Session::Compatibility::DEFAULT_SAME_SITE = T.let(T.unsafe(nil), Proc) + +# # Action Dispatch Session CookieStore +# +# This cookie-based session store is the Rails default. It is dramatically +# faster than the alternatives. +# +# Sessions typically contain at most a user ID and flash message; both fit +# within the 4096 bytes cookie size limit. A `CookieOverflow` exception is +# raised if you attempt to store more than 4096 bytes of data. +# +# The cookie jar used for storage is automatically configured to be the best +# possible option given your application's configuration. +# +# Your cookies will be encrypted using your application's `secret_key_base`. +# This goes a step further than signed cookies in that encrypted cookies cannot +# be altered or read by users. This is the default starting in Rails 4. +# +# Configure your session store in an initializer: +# +# Rails.application.config.session_store :cookie_store, key: '_your_app_session' +# +# In the development and test environments your application's `secret_key_base` +# is generated by Rails and stored in a temporary file in +# `tmp/local_secret.txt`. In all other environments, it is stored encrypted in +# the `config/credentials.yml.enc` file. +# +# If your application was not updated to Rails 5.2 defaults, the +# `secret_key_base` will be found in the old `config/secrets.yml` file. +# +# Note that changing your `secret_key_base` will invalidate all existing +# session. Additionally, you should take care to make sure you are not relying +# on the ability to decode signed cookies generated by your app in external +# applications or JavaScript before changing it. +# +# Because CookieStore extends `Rack::Session::Abstract::Persisted`, many of the +# options described there can be used to customize the session cookie that is +# generated. For example: +# +# Rails.application.config.session_store :cookie_store, expire_after: 14.days +# +# would set the session cookie to expire automatically 14 days after creation. +# Other useful options include `:key`, `:secure`, `:httponly`, and `:same_site`. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:52 +class ActionDispatch::Session::CookieStore < ::ActionDispatch::Session::AbstractSecureStore + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:62 + def initialize(app, options = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:67 + def delete_session(req, session_id, options); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:74 + def load_session(req); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:121 + def cookie_jar(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:83 + def extract_session_id(req); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:117 + def get_cookie(req); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:102 + def persistent_session_id!(data, sid = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:113 + def set_cookie(request, session_id, cookie); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:90 + def unpacked_cookie_data(req); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:108 + def write_session(req, sid, session_data, options); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:53 +class ActionDispatch::Session::CookieStore::SessionId + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:56 + def initialize(session_id, cookie_value = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/cookie_store.rb:54 + def cookie_value; end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:76 +module ActionDispatch::Session::SessionObject + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:77 + def commit_session(req, res); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:86 + def loaded_session?(session); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:82 + def prepare_session(req); end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:13 +class ActionDispatch::Session::SessionRestoreError < ::StandardError + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:14 + def initialize; end +end + +# pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:50 +module ActionDispatch::Session::StaleSessionCheck + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:55 + def extract_session_id(env); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:51 + def load_session(env); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/session/abstract_store.rb:59 + def stale_session_check!; end +end + +# # Action Dispatch ShowExceptions +# +# This middleware rescues any exception returned by the application and calls an +# exceptions app that will wrap it in a format for the end user. +# +# The exceptions app should be passed as a parameter on initialization of +# `ShowExceptions`. Every time there is an exception, `ShowExceptions` will +# store the exception in `env["action_dispatch.exception"]`, rewrite the +# `PATH_INFO` to the exception status code, and call the Rack app. +# +# In Rails applications, the exceptions app can be configured with +# `config.exceptions_app`, which defaults to ActionDispatch::PublicExceptions. +# +# If the application returns a response with the `X-Cascade` header set to +# `"pass"`, this middleware will send an empty response as a result with the +# correct status code. If any exception happens inside the exceptions app, this +# middleware catches the exceptions and returns a failsafe response. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/show_exceptions.rb:25 +class ActionDispatch::ShowExceptions + # pkg:gem/actionpack#lib/action_dispatch/middleware/show_exceptions.rb:26 + def initialize(app, exceptions_app); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/show_exceptions.rb:31 + def call(env); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/middleware/show_exceptions.rb:67 + def fallback_to_html_format_if_invalid_mime_type(request); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/show_exceptions.rb:83 + def pass_response(status); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/show_exceptions.rb:48 + def render_exception(request, wrapper); end +end + +# # Action Dispatch Static +# +# This middleware serves static files from disk, if available. If no file is +# found, it hands off to the main app. +# +# In Rails apps, this middleware is configured to serve assets from the +# `public/` directory. +# +# Only GET and HEAD requests are served. POST and other HTTP methods are handed +# off to the main app. +# +# Only files in the root directory are served; path traversal is denied. +# +# pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:20 +class ActionDispatch::Static + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:21 + def initialize(app, path, index: T.unsafe(nil), headers: T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/middleware/static.rb:26 + def call(env); end +end + +# pkg:gem/actionpack#lib/action_dispatch/structured_event_subscriber.rb:4 +class ActionDispatch::StructuredEventSubscriber < ::ActiveSupport::StructuredEventSubscriber + # pkg:gem/actionpack#lib/action_dispatch/structured_event_subscriber.rb:5 + def redirect(event); end +end + +# # System Testing +# +# System tests let you test applications in the browser. Because system tests +# use a real browser experience, you can test all of your JavaScript easily from +# your test suite. +# +# To create a system test in your application, extend your test class from +# `ApplicationSystemTestCase`. System tests use Capybara as a base and allow you +# to configure the settings through the `application_system_test_case.rb` file, +# which is created when you generate your first system test. +# +# Here is an example system test: +# +# require "application_system_test_case" +# +# class Users::CreateTest < ApplicationSystemTestCase +# test "adding a new user" do +# visit users_path +# click_on 'New User' +# +# fill_in 'Name', with: 'Arya' +# click_on 'Create User' +# +# assert_text 'Arya' +# end +# end +# +# When generating system tests, an +# `application_system_test_case.rb` file will also be generated containing the +# base class for system testing. This is where you can change the driver, add +# Capybara settings, and other configuration for your system tests. +# +# require "test_helper" +# +# class ApplicationSystemTestCase < ActionDispatch::SystemTestCase +# driven_by :selenium, using: :chrome, screen_size: [1400, 1400] +# end +# +# By default, `ActionDispatch::SystemTestCase` is driven by the Selenium driver, +# with the Chrome browser, and a browser size of 1400x1400. +# +# Changing the driver configuration options is easy. Let's say you want to use +# the Firefox browser instead of Chrome. In your +# `application_system_test_case.rb` file add the following: +# +# require "test_helper" +# +# class ApplicationSystemTestCase < ActionDispatch::SystemTestCase +# driven_by :selenium, using: :firefox +# end +# +# `driven_by` has a required argument for the driver name. The keyword arguments +# are `:using` for the browser and `:screen_size` to change the size of the +# browser screen. These two options are not applicable for headless drivers and +# will be silently ignored if passed. +# +# Headless browsers such as headless Chrome and headless Firefox are also +# supported. You can use these browsers by setting the `:using` argument to +# `:headless_chrome` or `:headless_firefox`. +# +# To use a headless driver, like Cuprite, update your Gemfile to use Cuprite +# instead of Selenium and then declare the driver name in the +# `application_system_test_case.rb` file. In this case, you would leave out the +# `:using` option because the driver is headless, but you can still use +# `:screen_size` to change the size of the browser screen, also you can use +# `:options` to pass options supported by the driver. Please refer to your +# driver documentation to learn about supported options. +# +# require "test_helper" +# require "capybara/cuprite" +# +# class ApplicationSystemTestCase < ActionDispatch::SystemTestCase +# driven_by :cuprite, screen_size: [1400, 1400], options: +# { js_errors: true } +# end +# +# Some drivers require browser capabilities to be passed as a block instead of +# through the `options` hash. +# +# As an example, if you want to add mobile emulation on chrome, you'll have to +# create an instance of selenium's `Chrome::Options` object and add capabilities +# with a block. +# +# The block will be passed an instance of `::Options` where you can +# define the capabilities you want. Please refer to your driver documentation to +# learn about supported options. +# +# class ApplicationSystemTestCase < ActionDispatch::SystemTestCase +# driven_by :selenium, using: :chrome, screen_size: [1024, 768] do |driver_option| +# driver_option.add_emulation(device_name: 'iPhone 6') +# driver_option.add_extension('path/to/chrome_extension.crx') +# end +# end +# +# Because `ActionDispatch::SystemTestCase` is a shim between Capybara and Rails, +# any driver that is supported by Capybara is supported by system tests as long +# as you include the required gems and files. +# +# pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:114 +class ActionDispatch::SystemTestCase < ::ActiveSupport::TestCase + include ::Capybara::DSL + include ::Capybara::Minitest::Assertions + include ::ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown + include ::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper + include ::ActionText::SystemTestHelper + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:122 + def initialize(*); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:191 + def method_missing(name, *, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:199 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:173 + def url_helpers; end + + class << self + # System Test configuration options + # + # The default settings are Selenium, using Chrome, with a screen size of + # 1400x1400. + # + # Examples: + # + # driven_by :cuprite + # + # driven_by :selenium, screen_size: [800, 800] + # + # driven_by :selenium, using: :chrome + # + # driven_by :selenium, using: :headless_chrome + # + # driven_by :selenium, using: :firefox + # + # driven_by :selenium, using: :headless_firefox + # + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:158 + def driven_by(driver, using: T.unsafe(nil), screen_size: T.unsafe(nil), options: T.unsafe(nil), &capabilities); end + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:138 + def driver; end + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:138 + def driver=(value); end + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:138 + def driver?; end + + # Configuration for the System Test application server. + # + # By default this is localhost. This method allows the host and port to be specified manually. + # + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:167 + def served_by(host:, port:); end + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:128 + def start_application; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:138 + def __class_attr_driver; end + + # pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:138 + def __class_attr_driver=(new_value); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/system_test_case.rb:120 +ActionDispatch::SystemTestCase::DEFAULT_HOST = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:6 +module ActionDispatch::SystemTesting; end + +# pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:7 +class ActionDispatch::SystemTesting::Browser + # pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:10 + def initialize(name); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:35 + def configure; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:8 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:25 + def options; end + + # driver_path is lazily initialized by default. Eagerly set it to avoid race + # conditions when using parallel tests. + # + # pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:41 + def preload; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:14 + def type; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:51 + def default_chrome_options; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:59 + def default_firefox_options; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/browser.rb:65 + def resolve_driver_path(namespace); end +end + +# pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:7 +class ActionDispatch::SystemTesting::Driver + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:10 + def initialize(driver_type, **options, &capabilities); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:8 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:27 + def use; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:51 + def browser_options; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:38 + def register; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:61 + def register_cuprite(app); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:69 + def register_playwright(app); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:65 + def register_rack_test(app); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:55 + def register_selenium(app); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:34 + def registerable?; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/driver.rb:80 + def setup; end +end + +# pkg:gem/actionpack#lib/action_dispatch/system_testing/server.rb:7 +class ActionDispatch::SystemTesting::Server + # pkg:gem/actionpack#lib/action_dispatch/system_testing/server.rb:14 + def run; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/server.rb:28 + def set_port; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/server.rb:24 + def set_server; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/server.rb:19 + def setup; end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/system_testing/server.rb:9 + def silence_puma; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/server.rb:9 + def silence_puma=(_arg0); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:7 +module ActionDispatch::SystemTesting::TestHelpers; end + +# Screenshot helper for system testing. +# +# pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:9 +module ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper + # Takes a screenshot of the current page in the browser if the test failed. + # + # `take_failed_screenshot` is called during system test teardown. + # + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:53 + def take_failed_screenshot; end + + # Takes a screenshot of the current page in the browser. + # + # `take_screenshot` can be used at any point in your system tests to take a + # screenshot of the current state. This can be useful for debugging or + # automating visual testing. You can take multiple screenshots per test to + # investigate changes at different points during your test. These will be named + # with a sequential prefix (or 'failed' for failing tests) + # + # The default screenshots directory is `tmp/screenshots` but you can set a + # different one with `Capybara.save_path` + # + # You can use the `html` argument or set the + # `RAILS_SYSTEM_TESTING_SCREENSHOT_HTML` environment variable to save the HTML + # from the page that is being screenshotted so you can investigate the elements + # on the page at the time of the screenshot + # + # You can use the `screenshot` argument or set the + # `RAILS_SYSTEM_TESTING_SCREENSHOT` environment variable to control the output. + # Possible values are: + # `simple` (default) + # + # `inline` + # (https://iterm2.com/documentation-images.html). + # + # `artifact` + # format (https://buildkite.github.io/terminal-to-html/inline-images/). + # + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:41 + def take_screenshot(html: T.unsafe(nil), screenshot: T.unsafe(nil)); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:61 + def _screenshot_counter; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:61 + def _screenshot_counter=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:106 + def absolute_html_path; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:98 + def absolute_image_path; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:90 + def absolute_path; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:134 + def display_image(html:, screenshot_output:); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:154 + def failed?; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:63 + def html_from_env?; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:86 + def html_path; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:76 + def image_name; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:82 + def image_path; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:67 + def increment_unique; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:150 + def inline_base64(path); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:120 + def output_type; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:102 + def relative_image_path; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:111 + def save_html; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:115 + def save_image; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:94 + def screenshots_dir; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:130 + def show(img); end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:158 + def supports_screenshot?; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:72 + def unique; end +end + +# pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb:8 +module ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb:15 + def after_teardown; end + + # pkg:gem/actionpack#lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb:9 + def before_teardown; end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/test_helpers/page_dump_helper.rb:4 +module ActionDispatch::TestHelpers; end + +# pkg:gem/actionpack#lib/action_dispatch/testing/test_helpers/page_dump_helper.rb:5 +module ActionDispatch::TestHelpers::PageDumpHelper + # Saves the content of response body to a file and tries to open it in your browser. + # Launchy must be present in your Gemfile for the page to open automatically. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/test_helpers/page_dump_helper.rb:10 + def save_and_open_page(path = T.unsafe(nil)); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_helpers/page_dump_helper.rb:30 + def html_dump_default_path; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_helpers/page_dump_helper.rb:23 + def open_file(path); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_helpers/page_dump_helper.rb:15 + def save_page(path = T.unsafe(nil)); end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/test_helpers/page_dump_helper.rb:6 +class ActionDispatch::TestHelpers::PageDumpHelper::InvalidResponse < ::StandardError; end + +# pkg:gem/actionpack#lib/action_dispatch/testing/test_process.rb:9 +module ActionDispatch::TestProcess + include ::ActionDispatch::TestProcess::FixtureFile + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_process.rb:34 + def assigns(key = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_process.rb:48 + def cookies; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_process.rb:44 + def flash; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_process.rb:52 + def redirect_to_url; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_process.rb:40 + def session; end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/test_process.rb:10 +module ActionDispatch::TestProcess::FixtureFile + # Shortcut for + # `Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_fixture_path, path), type)`: + # + # post :change_avatar, params: { avatar: file_fixture_upload('david.png', 'image/png') } + # + # Default fixture files location is `test/fixtures/files`. + # + # To upload binary files on Windows, pass `:binary` as the last parameter. This + # will not affect other platforms: + # + # post :change_avatar, params: { avatar: file_fixture_upload('david.png', 'image/png', :binary) } + # + # pkg:gem/actionpack#lib/action_dispatch/testing/test_process.rb:22 + def file_fixture_upload(path, mime_type = T.unsafe(nil), binary = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_process.rb:29 + def fixture_file_upload(path, mime_type = T.unsafe(nil), binary = T.unsafe(nil)); end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:9 +class ActionDispatch::TestRequest < ::ActionDispatch::Request + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:68 + def accept=(mime_types); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:48 + def action=(action_name); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:32 + def host=(host); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:52 + def if_modified_since=(last_modified); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:56 + def if_none_match=(etag); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:44 + def path=(path); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:36 + def port=(number); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:60 + def remote_addr=(addr); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:28 + def request_method=(method); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:40 + def request_uri=(uri); end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:64 + def user_agent=(user_agent); end + + class << self + # Create a new test request with default `env` values. + # + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:17 + def create(env = T.unsafe(nil)); end + + private + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:23 + def default_env; end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/testing/test_request.rb:10 +ActionDispatch::TestRequest::DEFAULT_ENV = T.let(T.unsafe(nil), Hash) + +# Integration test methods such as Integration::RequestHelpers#get and +# Integration::RequestHelpers#post return objects of class TestResponse, which +# represent the HTTP response results of the requested controller actions. +# +# See Response for more information on controller response objects. +# +# pkg:gem/actionpack#lib/action_dispatch/testing/test_response.rb:13 +class ActionDispatch::TestResponse < ::ActionDispatch::Response + # Returns a parsed body depending on the response MIME type. When a parser + # corresponding to the MIME type is not found, it returns the raw body. + # + # #### Examples + # get "/posts" + # response.content_type # => "text/html; charset=utf-8" + # response.parsed_body.class # => Nokogiri::HTML5::Document + # response.parsed_body.to_html # => "\n\n..." + # + # assert_pattern { response.parsed_body.at("main") => { content: "Hello, world" } } + # + # response.parsed_body.at("main") => {name:, content:} + # assert_equal "main", name + # assert_equal "Some main content", content + # + # get "/posts.json" + # response.content_type # => "application/json; charset=utf-8" + # response.parsed_body.class # => Array + # response.parsed_body # => [{"id"=>42, "title"=>"Title"},... + # + # assert_pattern { response.parsed_body => [{ id: 42 }] } + # + # get "/posts/42.json" + # response.content_type # => "application/json; charset=utf-8" + # response.parsed_body.class # => ActiveSupport::HashWithIndifferentAccess + # response.parsed_body # => {"id"=>42, "title"=>"Title"} + # + # assert_pattern { response.parsed_body => [{ title: /title/i }] } + # + # response.parsed_body => {id:, title:} + # assert_equal 42, id + # assert_equal "Title", title + # + # pkg:gem/actionpack#lib/action_dispatch/testing/test_response.rb:50 + def parsed_body; end + + # pkg:gem/actionpack#lib/action_dispatch/testing/test_response.rb:54 + def response_parser; end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/testing/test_response.rb:14 + def from_response(response); end + end +end + +# :markup: markdown +# +# pkg:gem/actionpack#lib/action_pack/gem_version.rb:5 +module ActionPack + class << self + # Returns the currently loaded version of Action Pack as a `Gem::Version`. + # + # pkg:gem/actionpack#lib/action_pack/gem_version.rb:7 + def gem_version; end + + # Returns the currently loaded version of Action Pack as a `Gem::Version`. + # + # pkg:gem/actionpack#lib/action_pack/version.rb:9 + def version; end + end +end + +# pkg:gem/actionpack#lib/action_pack/gem_version.rb:11 +module ActionPack::VERSION; end + +# pkg:gem/actionpack#lib/action_pack/gem_version.rb:12 +ActionPack::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actionpack#lib/action_pack/gem_version.rb:13 +ActionPack::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actionpack#lib/action_pack/gem_version.rb:15 +ActionPack::VERSION::PRE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_pack/gem_version.rb:17 +ActionPack::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_pack/gem_version.rb:14 +ActionPack::VERSION::TINY = T.let(T.unsafe(nil), Integer) + +module ActionView::RoutingUrlFor + include ::ActionDispatch::Routing::PolymorphicRoutes + include ::ActionDispatch::Routing::UrlFor +end + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:7 +module Mime + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:51 + def [](type); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:64 + def fetch(type, &block); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:56 + def symbols; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:60 + def valid_symbols?(symbols); end + end +end + +# ALL isn't a real MIME type, so we don't register it for lookup with the other +# concrete types. It's a wildcard match that we use for `respond_to` negotiation +# internals. +# +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:363 +Mime::ALL = T.let(T.unsafe(nil), Mime::AllType) + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:349 +class Mime::AllType < ::Mime::Type + include ::Singleton::SingletonInstanceMethods + include ::Singleton + extend ::Singleton::SingletonClassMethods + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:352 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:356 + def all?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:357 + def html?; end + + class << self + private + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:350 + def allocate; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:350 + def new(*_arg0); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:47 +Mime::EXTENSION_LOOKUP = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:48 +Mime::LOOKUP = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:8 +class Mime::Mimes + include ::Enumerable + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:13 + def initialize; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:23 + def <<(type); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:30 + def delete_if; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:19 + def each(&block); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:9 + def symbols; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:41 + def valid_symbols?(symbols); end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:365 +class Mime::NullType + include ::Singleton::SingletonInstanceMethods + include ::Singleton + extend ::Singleton::SingletonClassMethods + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:368 + def nil?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:376 + def ref; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:372 + def to_s; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:383 + def method_missing(method, *, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:379 + def respond_to_missing?(method, _); end + + class << self + private + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:366 + def allocate; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:366 + def new(*_arg0); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:46 +Mime::SET = T.let(T.unsafe(nil), Mime::Mimes) + +# Encapsulates the notion of a MIME type. Can be used at render time, for +# example, with: +# +# class PostsController < ActionController::Base +# def show +# @post = Post.find(params[:id]) +# +# respond_to do |format| +# format.html +# format.ics { render body: @post.to_ics, mime_type: Mime::Type.lookup("text/calendar") } +# format.xml { render xml: @post } +# end +# end +# end +# +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:84 +class Mime::Type + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:264 + def initialize(string, symbol = T.unsafe(nil), synonyms = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:297 + def ==(mime_type); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:289 + def ===(list); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:311 + def =~(mime_type); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:327 + def all?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:304 + def eql?(other); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:255 + def hash; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:323 + def html?; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:317 + def match?(mime_type); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:285 + def ref; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:85 + def symbol; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:273 + def to_s; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:277 + def to_str; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:281 + def to_sym; end + + protected + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:330 + def string; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:330 + def synonyms; end + + private + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:336 + def method_missing(method, *, **, &); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:344 + def respond_to_missing?(method, include_private = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:334 + def to_a; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:333 + def to_ary; end + + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:167 + def lookup(string); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:175 + def lookup_by_extension(extension); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:200 + def parse(accept_header); end + + # For an input of `'text'`, returns `[Mime[:json], Mime[:xml], Mime[:ics], + # Mime[:html], Mime[:css], Mime[:csv], Mime[:js], Mime[:yaml], Mime[:text]]`. + # + # For an input of `'application'`, returns `[Mime[:html], Mime[:js], Mime[:xml], + # Mime[:yaml], Mime[:atom], Mime[:json], Mime[:rss], Mime[:url_encoded_form]]`. + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:236 + def parse_data_with_trailing_star(type); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:227 + def parse_trailing_star(accept_header); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:186 + def register(string, symbol, mime_type_synonyms = T.unsafe(nil), extension_synonyms = T.unsafe(nil), skip_lookup = T.unsafe(nil)); end + + # Registers an alias that's not used on MIME type lookup, but can be referenced + # directly. Especially useful for rendering different HTML versions depending on + # the user agent, like an iPhone. + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:182 + def register_alias(string, symbol, extension_synonyms = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:163 + def register_callback(&block); end + + # This method is opposite of register method. + # + # To unregister a MIME type: + # + # Mime::Type.unregister(:mobile) + # + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:245 + def unregister(symbol); end + end +end + +# A simple helper class used in parsing the accept header. +# +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:90 +class Mime::Type::AcceptItem + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:94 + def initialize(index, name, q = T.unsafe(nil)); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:101 + def <=>(item); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:91 + def index; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:91 + def index=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:91 + def name; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:91 + def name=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:91 + def q; end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:91 + def q=(_arg0); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:92 + def to_s; end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:108 +class Mime::Type::AcceptList + class << self + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:151 + def find_item_by_name(array, name); end + + # pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:109 + def sort!(list); end + end +end + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:262 +class Mime::Type::InvalidMimeType < ::StandardError; end + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:257 +Mime::Type::MIME_NAME = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:259 +Mime::Type::MIME_PARAMETER = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:258 +Mime::Type::MIME_PARAMETER_VALUE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionpack#lib/action_dispatch/http/mime_type.rb:260 +Mime::Type::MIME_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionpack#lib/action_dispatch.rb:35 +module Rack; end + +# pkg:gem/actionpack#lib/action_dispatch/http/response.rb:42 +class Rack::Headers < ::Hash; end diff --git a/sorbet/rbi/gems/actiontext@8.1.4.1.rbi b/sorbet/rbi/gems/actiontext@8.1.4.1.rbi new file mode 100644 index 000000000..e3b4a6019 --- /dev/null +++ b/sorbet/rbi/gems/actiontext@8.1.4.1.rbi @@ -0,0 +1,1462 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `actiontext` gem. +# Please instead update this file by running `bin/tapioca gem actiontext`. + + +# :markup: markdown +# :include: ../README.md +# :markup: markdown +# +# pkg:gem/actiontext#lib/action_text/gem_version.rb:5 +module ActionText + extend ::ActiveSupport::Autoload + + class << self + # pkg:gem/actiontext#lib/action_text/deprecator.rb:6 + def deprecator; end + + # Returns the currently loaded version of Action Text as a `Gem::Version`. + # + # pkg:gem/actiontext#lib/action_text/gem_version.rb:7 + def gem_version; end + + # pkg:gem/actiontext#lib/action_text.rb:47 + def html_document_class; end + + # pkg:gem/actiontext#lib/action_text.rb:53 + def html_document_fragment_class; end + + # pkg:gem/actiontext#lib/action_text/engine.rb:15 + def railtie_helpers_paths; end + + # pkg:gem/actiontext#lib/action_text/engine.rb:15 + def railtie_namespace; end + + # pkg:gem/actiontext#lib/action_text/engine.rb:15 + def railtie_routes_url_helpers(include_path_helpers = T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/engine.rb:15 + def table_name_prefix; end + + # pkg:gem/actiontext#lib/action_text/engine.rb:15 + def use_relative_model_naming?; end + + # Returns the currently loaded version of Action Text as a `Gem::Version`. + # + # pkg:gem/actiontext#lib/action_text/version.rb:9 + def version; end + end +end + +# # Action Text Attachable +# +# Include this module to make a record attachable to an ActionText::Content. +# +# class Person < ApplicationRecord +# include ActionText::Attachable +# end +# +# person = Person.create! name: "Javan" +# html = %Q() +# content = ActionText::Content.new(html) +# content.attachables # => [person] +# +# pkg:gem/actiontext#lib/action_text/attachable.rb:18 +module ActionText::Attachable + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionText::Attachable::ClassMethods + + # pkg:gem/actiontext#lib/action_text/attachable.rb:83 + def attachable_content_type; end + + # pkg:gem/actiontext#lib/action_text/attachable.rb:87 + def attachable_filename; end + + # pkg:gem/actiontext#lib/action_text/attachable.rb:91 + def attachable_filesize; end + + # pkg:gem/actiontext#lib/action_text/attachable.rb:95 + def attachable_metadata; end + + # Returns the Signed Global ID for the attachable. The purpose of the ID is set + # to 'attachable' so it can't be reused for other purposes. + # + # pkg:gem/actiontext#lib/action_text/attachable.rb:79 + def attachable_sgid; end + + # pkg:gem/actiontext#lib/action_text/attachable.rb:99 + def previewable_attachable?; end + + # Returns the path to the partial that is used for rendering the attachable. + # Defaults to `to_partial_path`. + # + # Override to render a different partial: + # + # class User < ApplicationRecord + # def to_attachable_partial_path + # "users/attachable" + # end + # end + # + # pkg:gem/actiontext#lib/action_text/attachable.rb:127 + def to_attachable_partial_path; end + + # pkg:gem/actiontext#lib/action_text/attachable.rb:131 + def to_rich_text_attributes(attributes = T.unsafe(nil)); end + + # Returns the path to the partial that is used for rendering the attachable in + # Trix. Defaults to `to_partial_path`. + # + # Override to render a different partial: + # + # class User < ApplicationRecord + # def to_trix_content_attachment_partial_path + # "users/trix_content_attachment" + # end + # end + # + # pkg:gem/actiontext#lib/action_text/attachable.rb:113 + def to_trix_content_attachment_partial_path; end + + private + + # pkg:gem/actiontext#lib/action_text/attachable.rb:144 + def attribute_names_for_serialization; end + + # pkg:gem/actiontext#lib/action_text/attachable.rb:148 + def read_attribute_for_serialization(key); end + + class << self + # pkg:gem/actiontext#lib/action_text/attachable.rb:43 + def from_attachable_sgid(sgid, options = T.unsafe(nil)); end + + # Extracts the `ActionText::Attachable` from the attachment HTML node: + # + # person = Person.create! name: "Javan" + # html = %Q() + # fragment = ActionText::Fragment.wrap(html) + # attachment_node = fragment.find_all(ActionText::Attachment.tag_name).first + # ActionText::Attachable.from_node(attachment_node) # => person + # + # pkg:gem/actiontext#lib/action_text/attachable.rb:31 + def from_node(node); end + + private + + # pkg:gem/actiontext#lib/action_text/attachable.rb:50 + def attachable_from_sgid(sgid); end + end +end + +# pkg:gem/actiontext#lib/action_text/attachable.rb:57 +module ActionText::Attachable::ClassMethods + # pkg:gem/actiontext#lib/action_text/attachable.rb:58 + def from_attachable_sgid(sgid); end + + # pkg:gem/actiontext#lib/action_text/attachable.rb:72 + def to_missing_attachable_partial_path; end +end + +# pkg:gem/actiontext#lib/action_text/attachable.rb:21 +ActionText::Attachable::LOCATOR_NAME = T.let(T.unsafe(nil), String) + +# pkg:gem/actiontext#lib/action_text.rb:30 +module ActionText::Attachables + extend ::ActiveSupport::Autoload +end + +# pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:7 +class ActionText::Attachables::ContentAttachment + include ::ActiveModel::Validations + include ::ActiveSupport::Callbacks + include ::ActiveModel::Validations::HelperMethods + include ::ActiveModel::Conversion + include ::ActiveModel::ForbiddenAttributesProtection + include ::ActiveModel::AttributeAssignment + include ::ActiveModel::API + include ::ActiveModel::Access + include ::ActiveModel::Model + extend ::ActiveModel::Validations::ClassMethods + extend ::ActiveModel::Naming + extend ::ActiveModel::Callbacks + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + extend ::ActiveModel::Translation + extend ::ActiveModel::Validations::HelperMethods + extend ::ActiveModel::Conversion::ClassMethods + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def __callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _run_validate_callbacks(&block); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _run_validate_callbacks!(&block); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _validate_callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _validators; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _validators?; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:20 + def attachable_plain_text_representation(caption); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:15 + def content; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:15 + def content=(_arg0); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:15 + def content_type; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:15 + def content_type=(_arg0); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def model_name(&); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def param_delimiter=(_arg0); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:24 + def to_html; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:32 + def to_partial_path; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:28 + def to_s; end + + private + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:37 + def content_instance; end + + class << self + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def __callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def __callbacks=(value); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _validate_callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _validate_callbacks=(value); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _validators; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _validators=(value); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def _validators?; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:10 + def from_node(node); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def param_delimiter; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def param_delimiter=(value); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def param_delimiter?; end + + private + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def __class_attr___callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def __class_attr__validators; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def __class_attr__validators=(new_value); end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def __class_attr_param_delimiter; end + + # pkg:gem/actiontext#lib/action_text/attachables/content_attachment.rb:8 + def __class_attr_param_delimiter=(new_value); end + end +end + +# pkg:gem/actiontext#lib/action_text/attachables/missing_attachable.rb:7 +class ActionText::Attachables::MissingAttachable + extend ::ActiveModel::Naming + + # pkg:gem/actiontext#lib/action_text/attachables/missing_attachable.rb:12 + def initialize(sgid); end + + # pkg:gem/actiontext#lib/action_text/attachables/missing_attachable.rb:24 + def model; end + + # pkg:gem/actiontext#lib/action_text/attachables/missing_attachable.rb:8 + def model_name(&); end + + # pkg:gem/actiontext#lib/action_text/attachables/missing_attachable.rb:16 + def to_partial_path; end +end + +# pkg:gem/actiontext#lib/action_text/attachables/missing_attachable.rb:10 +ActionText::Attachables::MissingAttachable::DEFAULT_PARTIAL_PATH = T.let(T.unsafe(nil), String) + +# pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:7 +class ActionText::Attachables::RemoteImage + extend ::ActiveModel::Naming + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:32 + def initialize(attributes = T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:39 + def attachable_plain_text_representation(caption); end + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:30 + def content_type; end + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:30 + def height; end + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:8 + def model_name(&); end + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:43 + def to_partial_path; end + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:30 + def url; end + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:30 + def width; end + + class << self + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:11 + def from_node(node); end + + private + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:22 + def attributes_from_node(node); end + + # pkg:gem/actiontext#lib/action_text/attachables/remote_image.rb:18 + def content_type_is_image?(content_type); end + end +end + +# # Action Text Attachment +# +# Attachments serialize attachables to HTML or plain text. +# +# class Person < ApplicationRecord +# include ActionText::Attachable +# end +# +# attachable = Person.create! name: "Javan" +# attachment = ActionText::Attachment.from_attachable(attachable) +# attachment.to_html # => " " "[racecar.jpg]" + # + # Use the `caption` when set: + # + # attachment = ActionText::Attachment.from_attachable(attachable, caption: "Vroom vroom") + # attachment.to_plain_text # => "[Vroom vroom]" + # + # The presentation can be overridden by implementing the + # `attachable_plain_text_representation` method: + # + # class Person < ApplicationRecord + # include ActionText::Attachable + # + # def attachable_plain_text_representation + # "[#{name}]" + # end + # end + # + # attachable = Person.create! name: "Javan" + # attachment = ActionText::Attachment.from_attachable(attachable) + # attachment.to_plain_text # => "[Javan]" + # + # pkg:gem/actiontext#lib/action_text/attachment.rb:110 + def to_plain_text; end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:127 + def to_s; end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:81 + def with_full_attributes; end + + private + + # pkg:gem/actiontext#lib/action_text/attachment.rb:140 + def attachable_attributes; end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:136 + def node_attributes; end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:66 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:144 + def sgid_attributes; end + + class << self + # pkg:gem/actiontext#lib/action_text/attachment.rb:27 + def fragment_by_canonicalizing_attachments(content); end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:39 + def from_attachable(attachable, attributes = T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:35 + def from_attachables(attachables); end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:45 + def from_attributes(attributes, attachable = T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:31 + def from_node(node, attachable = T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:22 + def tag_name; end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:22 + def tag_name=(val); end + + private + + # pkg:gem/actiontext#lib/action_text/attachment.rb:52 + def node_from_attributes(attributes); end + + # pkg:gem/actiontext#lib/action_text/attachment.rb:58 + def process_attributes(attributes); end + end +end + +# pkg:gem/actiontext#lib/action_text/attachment.rb:24 +ActionText::Attachment::ATTRIBUTES = T.let(T.unsafe(nil), Array) + +# pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:6 +class ActionText::AttachmentGallery + include ::ActiveModel::Validations + include ::ActiveSupport::Callbacks + include ::ActiveModel::Validations::HelperMethods + include ::ActiveModel::Conversion + include ::ActiveModel::ForbiddenAttributesProtection + include ::ActiveModel::AttributeAssignment + include ::ActiveModel::API + include ::ActiveModel::Access + include ::ActiveModel::Model + extend ::ActiveModel::Validations::ClassMethods + extend ::ActiveModel::Naming + extend ::ActiveModel::Callbacks + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + extend ::ActiveModel::Translation + extend ::ActiveModel::Validations::HelperMethods + extend ::ActiveModel::Conversion::ClassMethods + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:54 + def initialize(node); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def __callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _run_validate_callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _run_validate_callbacks!(&block); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _validate_callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _validators; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _validators?; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:58 + def attachments; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:68 + def inspect; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def model_name(&); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:52 + def node; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def param_delimiter=(_arg0); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:64 + def size; end + + class << self + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def __callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def __callbacks=(value); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _validate_callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _validate_callbacks=(value); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _validators; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _validators=(value); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def _validators?; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:43 + def attachment_selector; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:27 + def find_attachment_gallery_nodes(content); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:13 + def fragment_by_canonicalizing_attachment_galleries(content); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:19 + def fragment_by_replacing_attachment_gallery_nodes(content); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:39 + def from_node(node); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def param_delimiter; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def param_delimiter=(value); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def param_delimiter?; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:47 + def selector; end + + private + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def __class_attr___callbacks; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def __class_attr__validators; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def __class_attr__validators=(new_value); end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def __class_attr_param_delimiter; end + + # pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:7 + def __class_attr_param_delimiter=(new_value); end + end +end + +# pkg:gem/actiontext#lib/action_text/attachment_gallery.rb:9 +ActionText::AttachmentGallery::TAG_NAME = T.let(T.unsafe(nil), String) + +# pkg:gem/actiontext#lib/action_text.rb:38 +module ActionText::Attachments + extend ::ActiveSupport::Autoload +end + +# pkg:gem/actiontext#lib/action_text/attachments/caching.rb:7 +module ActionText::Attachments::Caching + # pkg:gem/actiontext#lib/action_text/attachments/caching.rb:8 + def cache_key(*args); end + + private + + # pkg:gem/actiontext#lib/action_text/attachments/caching.rb:13 + def cache_digest; end +end + +# pkg:gem/actiontext#lib/action_text/attachments/minification.rb:7 +module ActionText::Attachments::Minification + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionText::Attachments::Minification::ClassMethods +end + +# pkg:gem/actiontext#lib/action_text/attachments/minification.rb:10 +module ActionText::Attachments::Minification::ClassMethods + # pkg:gem/actiontext#lib/action_text/attachments/minification.rb:11 + def fragment_by_minifying_attachments(content); end +end + +# pkg:gem/actiontext#lib/action_text/attachments/trix_conversion.rb:9 +module ActionText::Attachments::TrixConversion + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionText::Attachments::TrixConversion::ClassMethods + + # pkg:gem/actiontext#lib/action_text/attachments/trix_conversion.rb:24 + def to_trix_attachment(content = T.unsafe(nil)); end + + private + + # pkg:gem/actiontext#lib/action_text/attachments/trix_conversion.rb:31 + def trix_attachment_content; end +end + +# pkg:gem/actiontext#lib/action_text/attachments/trix_conversion.rb:12 +module ActionText::Attachments::TrixConversion::ClassMethods + # pkg:gem/actiontext#lib/action_text/attachments/trix_conversion.rb:13 + def fragment_by_converting_trix_attachments(content); end + + # pkg:gem/actiontext#lib/action_text/attachments/trix_conversion.rb:19 + def from_trix_attachment(trix_attachment); end +end + +# pkg:gem/actiontext#lib/action_text/attribute.rb:6 +module ActionText::Attribute + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionText::Attribute::ClassMethods +end + +# pkg:gem/actiontext#lib/action_text/attribute.rb:9 +module ActionText::Attribute::ClassMethods + # pkg:gem/actiontext#lib/action_text/attribute.rb:53 + def has_rich_text(name, encrypted: T.unsafe(nil), strict_loading: T.unsafe(nil), store_if_blank: T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/attribute.rb:100 + def rich_text_association_names; end + + # pkg:gem/actiontext#lib/action_text/attribute.rb:95 + def with_all_rich_text; end +end + +# # Action Text Content +# +# The `ActionText::Content` class wraps an HTML fragment to add support for +# parsing, rendering and serialization. It can be used to extract links and +# attachments, convert the fragment to plain text, or serialize the fragment to +# the database. +# +# The ActionText::RichText record serializes the `body` attribute as +# `ActionText::Content`. +# +# class Message < ActiveRecord::Base +# has_rich_text :content +# end +# +# message = Message.create!(content: "

Funny times!

") +# body = message.content.body # => # +# body.to_s # => "

Funny times!

" +# body.to_plain_text # => "Funny times!" +# +# pkg:gem/actiontext#lib/action_text/content.rb:24 +class ActionText::Content + include ::ActionText::ContentHelper + include ::ActionText::Serialization + include ::ActionText::Rendering + extend ::ActionText::Serialization::ClassMethods + extend ::ActionText::Rendering::ClassMethods + + # pkg:gem/actiontext#lib/action_text/content.rb:40 + def initialize(content = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/content.rb:170 + def ==(other); end + + # pkg:gem/actiontext#lib/action_text/content.rb:93 + def append_attachables(attachables); end + + # pkg:gem/actiontext#lib/action_text/content.rb:162 + def as_json(*); end + + # Extracts ActionText::Attachable objects from the HTML fragment: + # + # attachable = ActiveStorage::Blob.first + # html = %Q() + # content = ActionText::Content.new(html) + # content.attachables # => [attachable] + # + # pkg:gem/actiontext#lib/action_text/content.rb:87 + def attachables; end + + # pkg:gem/actiontext#lib/action_text/content.rb:71 + def attachment_galleries; end + + # Extracts ActionText::Attachment objects from the HTML fragment: + # + # attachable = ActiveStorage::Blob.first + # html = %Q() + # content = ActionText::Content.new(html) + # content.attachments # => [# ["http://example.com/"] + # + # pkg:gem/actiontext#lib/action_text/content.rb:55 + def links; end + + # pkg:gem/actiontext#lib/action_text/content.rb:30 + def present?(*, **, &); end + + # pkg:gem/actiontext#lib/action_text/content.rb:25 + def render(*, **, &); end + + # pkg:gem/actiontext#lib/action_text/content.rb:109 + def render_attachment_galleries(&block); end + + # pkg:gem/actiontext#lib/action_text/content.rb:98 + def render_attachments(**options, &block); end + + # pkg:gem/actiontext#lib/action_text/content.rb:139 + def to_html; end + + # pkg:gem/actiontext#lib/action_text/content.rb:147 + def to_partial_path; end + + # Returns a plain-text version of the markup contained by the content, with tags + # removed but HTML entities encoded. + # + # content = ActionText::Content.new("

Funny times!

") + # content.to_plain_text # => "Funny times!" + # + # content = ActionText::Content.new("
safe
") + # content.to_plain_text # => "safe" + # + # NOTE: that the returned string is not HTML safe and should not be rendered in + # browsers without additional sanitization. + # + # content = ActionText::Content.new("<script>alert()</script>") + # content.to_plain_text # => "" + # ActionText::ContentHelper.sanitizer.sanitize(content.to_plain_text) # => "" + # + # pkg:gem/actiontext#lib/action_text/content.rb:131 + def to_plain_text; end + + # pkg:gem/actiontext#lib/action_text/content.rb:143 + def to_rendered_html_with_layout; end + + # Safely transforms Content into an HTML String. + # + # content = ActionText::Content.new("

Funny times!

") + # content.to_s # => "

Funny times!

" + # + # content = ActionText::Content.new("
safe
") + # content.to_s # => "
safeunsafe
" + # + # pkg:gem/actiontext#lib/action_text/content.rb:158 + def to_s; end + + # pkg:gem/actiontext#lib/action_text/content.rb:135 + def to_trix_html; end + + private + + # pkg:gem/actiontext#lib/action_text/content.rb:187 + def attachment_for_node(node, with_full_attributes: T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/content.rb:192 + def attachment_gallery_for_node(node); end + + # pkg:gem/actiontext#lib/action_text/content.rb:183 + def attachment_gallery_nodes; end + + # pkg:gem/actiontext#lib/action_text/content.rb:179 + def attachment_nodes; end + + class << self + # pkg:gem/actiontext#lib/action_text/content.rb:33 + def fragment_by_canonicalizing_content(content); end + + # pkg:gem/actiontext#lib/action_text/content.rb:25 + def renderer; end + + # pkg:gem/actiontext#lib/action_text/content.rb:25 + def renderer=(obj); end + end +end + +module ActionText::ContentHelper + def allowed_attributes; end + def allowed_attributes=(val); end + def allowed_tags; end + def allowed_tags=(val); end + def render_action_text_attachment(attachment, locals: T.unsafe(nil)); end + def render_action_text_attachments(content); end + def render_action_text_content(content); end + def sanitize_action_text_content(content); end + def sanitize_content_attachment(content_attachment); end + def sanitizer; end + def sanitizer=(val); end + def sanitizer_allowed_attributes; end + def sanitizer_allowed_tags; end + def scrubber; end + def scrubber=(val); end + + class << self + def allowed_attributes; end + def allowed_attributes=(val); end + def allowed_tags; end + def allowed_tags=(val); end + def sanitizer; end + def sanitizer=(val); end + def scrubber; end + def scrubber=(val); end + end +end + +class ActionText::EncryptedRichText < ::ActionText::RichText + include ::ActionText::EncryptedRichText::GeneratedAttributeMethods + include ::ActionText::EncryptedRichText::GeneratedAssociationMethods + + class << self + private + + def __class_attr__validators; end + def __class_attr__validators=(new_value); end + def __class_attr_defined_enums; end + def __class_attr_defined_enums=(new_value); end + def __class_attr_encrypted_attributes; end + def __class_attr_encrypted_attributes=(new_value); end + end +end + +module ActionText::EncryptedRichText::GeneratedAssociationMethods; end +module ActionText::EncryptedRichText::GeneratedAttributeMethods; end + +# pkg:gem/actiontext#lib/action_text/encryption.rb:6 +module ActionText::Encryption + # pkg:gem/actiontext#lib/action_text/encryption.rb:14 + def decrypt; end + + # pkg:gem/actiontext#lib/action_text/encryption.rb:7 + def encrypt; end + + private + + # pkg:gem/actiontext#lib/action_text/encryption.rb:26 + def decrypt_rich_texts; end + + # pkg:gem/actiontext#lib/action_text/encryption.rb:22 + def encrypt_rich_texts; end + + # pkg:gem/actiontext#lib/action_text/encryption.rb:34 + def encryptable_rich_texts; end + + # pkg:gem/actiontext#lib/action_text/encryption.rb:30 + def has_encrypted_rich_texts?; end +end + +# pkg:gem/actiontext#lib/action_text/engine.rb:14 +class ActionText::Engine < ::Rails::Engine; end + +# # Action Text FixtureSet +# +# Fixtures are a way of organizing data that you want to test against; in short, +# sample data. +# +# To learn more about fixtures, read the ActiveRecord::FixtureSet documentation. +# +# ### YAML +# +# Like other Active Record-backed models, ActionText::RichText records inherit +# from ActiveRecord::Base instances and can therefore be populated by fixtures. +# +# Consider an `Article` class: +# +# class Article < ApplicationRecord +# has_rich_text :content +# end +# +# To declare fixture data for the related `content`, first declare fixture data +# for `Article` instances in `test/fixtures/articles.yml`: +# +# first: +# title: An Article +# +# Then declare the ActionText::RichText fixture data in +# `test/fixtures/action_text/rich_texts.yml`, making sure to declare each +# entry's `record:` key as a polymorphic relationship: +# +# first: +# record: first (Article) +# name: content +# body:
Hello, world.
+# +# When processed, Active Record will insert database records for each fixture +# entry and will ensure the Action Text relationship is intact. +# +# pkg:gem/actiontext#lib/action_text/fixture_set.rb:41 +class ActionText::FixtureSet + class << self + # Fixtures support Action Text attachments as part of their `body` HTML. + # + # ### Examples + # + # For example, consider a second `Article` fixture declared in + # `test/fixtures/articles.yml`: + # + # second: + # title: Another Article + # + # You can attach a mention of `articles(:first)` to `second`'s `content` by + # embedding a call to `ActionText::FixtureSet.attachment` in the `body:` value + # in `test/fixtures/action_text/rich_texts.yml`: + # + # second: + # record: second (Article) + # name: content + # body:
Hello, <%= ActionText::FixtureSet.attachment("articles", :first) %>
+ # + # pkg:gem/actiontext#lib/action_text/fixture_set.rb:61 + def attachment(fixture_set_name, label, column_type: T.unsafe(nil)); end + end +end + +# pkg:gem/actiontext#lib/action_text/fragment.rb:6 +class ActionText::Fragment + # pkg:gem/actiontext#lib/action_text/fragment.rb:28 + def initialize(source); end + + # pkg:gem/actiontext#lib/action_text/fragment.rb:26 + def deconstruct(*, **, &); end + + # pkg:gem/actiontext#lib/action_text/fragment.rb:32 + def find_all(selector); end + + # pkg:gem/actiontext#lib/action_text/fragment.rb:41 + def replace(selector); end + + # pkg:gem/actiontext#lib/action_text/fragment.rb:24 + def source; end + + # pkg:gem/actiontext#lib/action_text/fragment.rb:54 + def to_html; end + + # pkg:gem/actiontext#lib/action_text/fragment.rb:50 + def to_plain_text; end + + # pkg:gem/actiontext#lib/action_text/fragment.rb:58 + def to_s; end + + # pkg:gem/actiontext#lib/action_text/fragment.rb:36 + def update; end + + class << self + # pkg:gem/actiontext#lib/action_text/fragment.rb:19 + def from_html(html); end + + # pkg:gem/actiontext#lib/action_text/fragment.rb:8 + def wrap(fragment_or_html); end + end +end + +# pkg:gem/actiontext#lib/action_text/html_conversion.rb:6 +module ActionText::HtmlConversion + extend ::ActionText::HtmlConversion + + # pkg:gem/actiontext#lib/action_text/html_conversion.rb:17 + def create_element(tag_name, attributes = T.unsafe(nil)); end + + # pkg:gem/actiontext#lib/action_text/html_conversion.rb:13 + def fragment_for_html(html); end + + # pkg:gem/actiontext#lib/action_text/html_conversion.rb:9 + def node_to_html(node); end + + private + + # pkg:gem/actiontext#lib/action_text/html_conversion.rb:22 + def document; end +end + +# pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:6 +module ActionText::PlainTextConversion + extend ::ActionText::PlainTextConversion + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:9 + def node_to_plain_text(node); end + + private + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:118 + def break_if_nested_list(node, text); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:94 + def bullet_for_li_node(node); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:107 + def indentation_for_li_node(node); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:114 + def list_node_depth_for_node(node); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:103 + def list_node_name_for_li_node(node); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:40 + def plain_text_for_block(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:72 + def plain_text_for_blockquote_node(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:56 + def plain_text_for_br_node(node, _child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:28 + def plain_text_for_child_values(child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:64 + def plain_text_for_div_node(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:68 + def plain_text_for_figcaption_node(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:45 + def plain_text_for_h1_node(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:82 + def plain_text_for_li_node(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:48 + def plain_text_for_list(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:16 + def plain_text_for_node(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:53 + def plain_text_for_ol_node(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:45 + def plain_text_for_p_node(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:37 + def plain_text_for_script_node(node, _child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:37 + def plain_text_for_style_node(node, _child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:60 + def plain_text_for_text_node(node, _child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:53 + def plain_text_for_ul_node(node, child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:32 + def plain_text_for_unsupported_node(node, _child_values); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:24 + def plain_text_method_for_node(node); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:90 + def remove_trailing_newlines(text); end +end + +# pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:126 +class ActionText::PlainTextConversion::BottomUpReducer + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:127 + def initialize(node); end + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:132 + def reduce(&block); end + + private + + # pkg:gem/actiontext#lib/action_text/plain_text_conversion.rb:141 + def traverse_bottom_up(node, &block); end +end + +class ActionText::Record < ::ActiveRecord::Base + include ::ActionText::Record::GeneratedAttributeMethods + include ::ActionText::Record::GeneratedAssociationMethods + + class << self + private + + def __class_attr__validators; end + def __class_attr__validators=(new_value); end + def __class_attr_defined_enums; end + def __class_attr_defined_enums=(new_value); end + end +end + +module ActionText::Record::GeneratedAssociationMethods; end +module ActionText::Record::GeneratedAttributeMethods; end + +# pkg:gem/actiontext#lib/action_text/rendering.rb:8 +module ActionText::Rendering + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionText::Rendering::ClassMethods +end + +# pkg:gem/actiontext#lib/action_text/rendering.rb:16 +module ActionText::Rendering::ClassMethods + # pkg:gem/actiontext#lib/action_text/rendering.rb:17 + def action_controller_renderer; end + + # pkg:gem/actiontext#lib/action_text/rendering.rb:29 + def render(*args, &block); end + + # pkg:gem/actiontext#lib/action_text/rendering.rb:21 + def with_renderer(renderer); end +end + +class ActionText::RichText < ::ActionText::Record + include ::ActionText::RichText::GeneratedAttributeMethods + include ::ActionText::RichText::GeneratedAssociationMethods + + def _run_commit_callbacks(&block); end + def _run_create_callbacks(&block); end + def _run_destroy_callbacks(&block); end + def _run_save_callbacks(&block); end + def _run_touch_callbacks(&block); end + def _run_update_callbacks(&block); end + def autosave_associated_records_for_embeds_attachments(*args); end + def autosave_associated_records_for_embeds_blobs(*args); end + def autosave_associated_records_for_record(*args); end + def blank?(*, **, &); end + def empty?(*, **, &); end + def nil?(*, **, &); end + def present?(*, **, &); end + def to_plain_text; end + def to_s(*, **, &); end + def to_trix_html; end + def validate_associated_records_for_embeds_attachments(*args); end + def validate_associated_records_for_embeds_blobs(*args); end + + class << self + def with_attached_embeds(*args, **); end + + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr__reflections; end + def __class_attr__reflections=(new_value); end + def __class_attr__validators; end + def __class_attr__validators=(new_value); end + def __class_attr_attachment_reflections; end + def __class_attr_attachment_reflections=(new_value); end + def __class_attr_defined_enums; end + def __class_attr_defined_enums=(new_value); end + end +end + +module ActionText::RichText::GeneratedAssociationMethods + def embeds; end + def embeds=(attachables); end + def embeds_attachment_ids; end + def embeds_attachment_ids=(ids); end + def embeds_attachments; end + def embeds_attachments=(value); end + def embeds_blob_ids; end + def embeds_blob_ids=(ids); end + def embeds_blobs; end + def embeds_blobs=(value); end + def record; end + def record=(value); end + def record_changed?; end + def record_previously_changed?; end + def reload_record; end + def reset_record; end +end + +module ActionText::RichText::GeneratedAttributeMethods; end + +# pkg:gem/actiontext#lib/action_text/serialization.rb:6 +module ActionText::Serialization + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionText::Serialization::ClassMethods + + # pkg:gem/actiontext#lib/action_text/serialization.rb:34 + def _dump(*); end +end + +# pkg:gem/actiontext#lib/action_text/serialization.rb:9 +module ActionText::Serialization::ClassMethods + # pkg:gem/actiontext#lib/action_text/serialization.rb:31 + def _load(content); end + + # pkg:gem/actiontext#lib/action_text/serialization.rb:14 + def dump(content); end + + # pkg:gem/actiontext#lib/action_text/serialization.rb:10 + def load(content); end +end + +# pkg:gem/actiontext#lib/action_text/system_test_helper.rb:6 +module ActionText::SystemTestHelper + # pkg:gem/actiontext#lib/action_text/system_test_helper.rb:46 + def fill_in_rich_text_area(locator = T.unsafe(nil), with:, **); end + + # Locates a Trix editor and fills it in with the given HTML. + # + # The editor can be found by: + # + # * its `id` + # * its `placeholder` + # * the text from its `label` element + # * its `aria-label` + # * the `name` of its input + # + # Additional options are forwarded to Capybara as filters + # + # Examples: + # + # # + # fill_in_rich_textarea "message_content", with: "Hello world!" + # + # # + # fill_in_rich_textarea "Your message here", with: "Hello world!" + # + # # + # # + # fill_in_rich_textarea "Message content", with: "Hello world!" + # + # # + # fill_in_rich_textarea "Message content", with: "Hello world!" + # + # # + # # + # fill_in_rich_textarea "message[content]", with: "Hello world!" + # + # pkg:gem/actiontext#lib/action_text/system_test_helper.rb:37 + def fill_in_rich_textarea(locator = T.unsafe(nil), with:, **); end +end + +module ActionText::TagHelper + def rich_text_area_tag(name, value = T.unsafe(nil), options = T.unsafe(nil), &block); end + def rich_textarea_tag(name, value = T.unsafe(nil), options = T.unsafe(nil), &block); end + + class << self + def id; end + def id=(val); end + end +end + +# pkg:gem/actiontext#lib/action_text/trix_attachment.rb:6 +class ActionText::TrixAttachment + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:53 + def initialize(node); end + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:57 + def attributes; end + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:51 + def node; end + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:61 + def to_html; end + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:65 + def to_s; end + + private + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:70 + def attachment_attributes; end + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:74 + def composed_attributes; end + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:82 + def read_json_attribute(name); end + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:78 + def read_json_object_attribute(name); end + + class << self + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:21 + def from_attributes(attributes); end + + private + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:35 + def process_attributes(attributes); end + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:39 + def transform_attribute_keys(attributes); end + + # pkg:gem/actiontext#lib/action_text/trix_attachment.rb:43 + def typecast_attribute_values(attributes); end + end +end + +# pkg:gem/actiontext#lib/action_text/trix_attachment.rb:11 +ActionText::TrixAttachment::ATTRIBUTES = T.let(T.unsafe(nil), Array) + +# pkg:gem/actiontext#lib/action_text/trix_attachment.rb:12 +ActionText::TrixAttachment::ATTRIBUTE_TYPES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actiontext#lib/action_text/trix_attachment.rb:10 +ActionText::TrixAttachment::COMPOSED_ATTRIBUTES = T.let(T.unsafe(nil), Array) + +# pkg:gem/actiontext#lib/action_text/trix_attachment.rb:8 +ActionText::TrixAttachment::SELECTOR = T.let(T.unsafe(nil), String) + +# pkg:gem/actiontext#lib/action_text/trix_attachment.rb:7 +ActionText::TrixAttachment::TAG_NAME = T.let(T.unsafe(nil), String) + +# pkg:gem/actiontext#lib/action_text/gem_version.rb:11 +module ActionText::VERSION; end + +# pkg:gem/actiontext#lib/action_text/gem_version.rb:12 +ActionText::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actiontext#lib/action_text/gem_version.rb:13 +ActionText::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actiontext#lib/action_text/gem_version.rb:15 +ActionText::VERSION::PRE = T.let(T.unsafe(nil), String) + +# pkg:gem/actiontext#lib/action_text/gem_version.rb:17 +ActionText::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/actiontext#lib/action_text/gem_version.rb:14 +ActionText::VERSION::TINY = T.let(T.unsafe(nil), Integer) + +module ActionView::Helpers + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::TextHelper + include ::ActionView::Helpers::UrlHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::TextHelper + include ::ActionView::Helpers::FormTagHelper + include ::ActionView::Helpers::FormHelper + include ::ActionView::Helpers::TranslationHelper + + mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods + mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods +end + +class ActionView::Helpers::FormBuilder + def rich_text_area(method, options = T.unsafe(nil), &block); end + def rich_textarea(method, options = T.unsafe(nil), &block); end +end + +module ActionView::Helpers::FormHelper + include ::ActionView::Helpers::UrlHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::TextHelper + include ::ActionView::Helpers::FormTagHelper + + mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods + mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods + + def rich_text_area(object_name, method, options = T.unsafe(nil), &block); end + def rich_textarea(object_name, method, options = T.unsafe(nil), &block); end +end + +module ActionView::Helpers::Tags; end + +class ActionView::Helpers::Tags::ActionText < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::Placeholderable + + def dom_id(*, **, &); end + def render(&block); end +end diff --git a/sorbet/rbi/gems/actionview@8.1.4.1.rbi b/sorbet/rbi/gems/actionview@8.1.4.1.rbi new file mode 100644 index 000000000..6789c278b --- /dev/null +++ b/sorbet/rbi/gems/actionview@8.1.4.1.rbi @@ -0,0 +1,14763 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `actionview` gem. +# Please instead update this file by running `bin/tapioca gem actionview`. + + +class ActionController::Base < ::ActionController::Metal + include ::ActionDispatch::Routing::PolymorphicRoutes + include ::ActionController::Head + include ::AbstractController::Caching::ConfigMethods + include ::ActionController::BasicImplicitRender + extend ::AbstractController::Helpers::Resolution + extend ::ActionController::Renderers::DeprecatedEscapeJsonResponses +end + +# :include: ../README.rdoc +# :markup: markdown +# +# pkg:gem/actionview#lib/action_view/gem_version.rb:3 +module ActionView + extend ::ActiveSupport::Autoload + + class << self + # pkg:gem/actionview#lib/action_view/deprecator.rb:4 + def deprecator; end + + # pkg:gem/actionview#lib/action_view.rb:110 + def eager_load!; end + + # Returns the currently loaded version of Action View as a +Gem::Version+. + # + # pkg:gem/actionview#lib/action_view/gem_version.rb:5 + def gem_version; end + + # pkg:gem/actionview#lib/action_view.rb:95 + def render_tracker; end + + # pkg:gem/actionview#lib/action_view.rb:97 + def render_tracker=(value); end + + # Returns the currently loaded version of Action View as a +Gem::Version+. + # + # pkg:gem/actionview#lib/action_view/version.rb:7 + def version; end + end +end + +# This class defines the interface for a renderer. Each class that +# subclasses +AbstractRenderer+ is used by the base +Renderer+ class to +# render a specific type of object. +# +# The base +Renderer+ class uses its +render+ method to delegate to the +# renderers. These currently consist of +# +# PartialRenderer - Used for rendering partials +# TemplateRenderer - Used for rendering other types of templates +# StreamingTemplateRenderer - Used for streaming +# +# Whenever the +render+ method is called on the base +Renderer+ class, a new +# renderer object of the correct type is created, and the +render+ method on +# that new object is called in turn. This abstracts the set up and rendering +# into a separate classes for partials and templates. +# +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:21 +class ActionView::AbstractRenderer + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:24 + def initialize(lookup_context); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:22 + def any_templates?(*, **, &); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:22 + def formats(*, **, &); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:28 + def render; end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:22 + def template_exists?(*, **, &); end + + private + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:182 + def build_rendered_collection(templates, spacer); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:178 + def build_rendered_template(content, template); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:159 + def extract_details(options); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:171 + def prepend_formats(formats); end +end + +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:157 +ActionView::AbstractRenderer::NO_DETAILS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:32 +module ActionView::AbstractRenderer::ObjectRendering + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:37 + def initialize(lookup_context, options); end + + private + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:43 + def local_variable(path); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:92 + def merge_prefix_into_object_path(prefix, object_path); end + + # Obtains the path to where the object's partial is located. If the object + # responds to +to_partial_path+, then +to_partial_path+ will be called and + # will provide the path. If the object does not respond to +to_partial_path+, + # then an +ArgumentError+ is raised. + # + # If +prefix_partial_path_with_controller_namespace+ is true, then this + # method will prefix the partial paths with a namespace. + # + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:76 + def partial_path(object, view); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:61 + def raise_invalid_identifier(path); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:65 + def raise_invalid_option_as(as); end +end + +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:54 +ActionView::AbstractRenderer::ObjectRendering::IDENTIFIER_ERROR_MESSAGE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:57 +ActionView::AbstractRenderer::ObjectRendering::OPTION_AS_ERROR_MESSAGE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:33 +ActionView::AbstractRenderer::ObjectRendering::PREFIXED_PARTIAL_NAMES = T.let(T.unsafe(nil), Concurrent::Map) + +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:110 +class ActionView::AbstractRenderer::RenderedCollection + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:117 + def initialize(rendered_templates, spacer); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:122 + def body; end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:126 + def format; end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:115 + def rendered_templates; end + + class << self + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:111 + def empty(format); end + end +end + +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:130 +class ActionView::AbstractRenderer::RenderedCollection::EmptyCollection + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:133 + def initialize(format); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:137 + def body; end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:131 + def format; end +end + +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:141 +class ActionView::AbstractRenderer::RenderedTemplate + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:144 + def initialize(body, template); end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:142 + def body; end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:149 + def format; end + + # pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:142 + def template; end +end + +# pkg:gem/actionview#lib/action_view/renderer/abstract_renderer.rb:153 +ActionView::AbstractRenderer::RenderedTemplate::EMPTY_SPACER = T.let(T.unsafe(nil), T.untyped) + +# = Action View Errors +# +# pkg:gem/actionview#lib/action_view/template/error.rb:8 +class ActionView::ActionViewError < ::StandardError; end + +# = Action View \Base +# +# Action View templates can be written in several ways. +# If the template file has a .erb extension, then it uses the erubi[https://rubygems.org/gems/erubi] +# template system which can embed Ruby into an HTML document. +# If the template file has a .builder extension, then Jim Weirich's Builder::XmlMarkup library is used. +# +# == ERB +# +# You trigger ERB by using embeddings such as <% %>, <% -%>, and <%= %>. The <%= %> tag set is used when you want output. Consider the +# following loop for names: +# +# Names of all the people +# <% @people.each do |person| %> +# Name: <%= person.name %>
+# <% end %> +# +# The loop is set up in regular embedding tags <% %>, and the name is written using the output embedding tag <%= %>. Note that this +# is not just a usage suggestion. Regular output functions like print or puts won't work with ERB templates. So this would be wrong: +# +# <%# WRONG %> +# Hi, Mr. <% puts "Frodo" %> +# +# If you absolutely must write from within a function use +concat+. +# +# When on a line that only contains whitespaces except for the tag, <% %> suppresses leading and trailing whitespace, +# including the trailing newline. <% %> and <%- -%> are the same. +# Note however that <%= %> and <%= -%> are different: only the latter removes trailing whitespaces. +# +# === Using sub templates +# +# Using sub templates allows you to sidestep tedious replication and extract common display structures in shared templates. The +# classic example is the use of a header and footer (even though the Action Pack-way would be to use Layouts): +# +# <%= render "application/header" %> +# Something really specific and terrific +# <%= render "application/footer" %> +# +# As you see, we use the output embeddings for the render methods. The render call itself will just return a string holding the +# result of the rendering. The output embedding writes it to the current template. +# +# But you don't have to restrict yourself to static includes. Templates can share variables amongst themselves by using instance +# variables defined using the regular embedding tags. Like this: +# +# <% @page_title = "A Wonderful Hello" %> +# <%= render "application/header" %> +# +# Now the header can pick up on the @page_title variable and use it for outputting a title tag: +# +# <%= @page_title %> +# +# === Passing local variables to sub templates +# +# You can pass local variables to sub templates by using a hash with the variable names as keys and the objects as values: +# +# <%= render "application/header", { headline: "Welcome", person: person } %> +# +# These can now be accessed in application/header with: +# +# Headline: <%= headline %> +# First name: <%= person.first_name %> +# +# The local variables passed to sub templates can be accessed as a hash using the local_assigns hash. This lets you access the +# variables as: +# +# Headline: <%= local_assigns[:headline] %> +# +# This is useful in cases where you aren't sure if the local variable has been assigned. Alternatively, you could also use +# defined? headline to first check if the variable has been assigned before using it. +# +# By default, templates will accept any locals as keyword arguments. To restrict what locals a template accepts, add a locals: magic comment: +# +# <%# locals: (headline:) %> +# +# Headline: <%= headline %> +# +# In cases where the local variables are optional, declare the keyword argument with a default value: +# +# <%# locals: (headline: nil) %> +# +# <% unless headline.nil? %> +# Headline: <%= headline %> +# <% end %> +# +# Read more about strict locals in {Action View Overview}[https://guides.rubyonrails.org/action_view_overview.html#strict-locals] +# in the guides. +# +# === Template caching +# +# By default, \Rails will compile each template to a method in order to render it. When you alter a template, +# \Rails will check the file's modification time and recompile it in development mode. +# +# == Builder +# +# Builder templates are a more programmatic alternative to ERB. They are especially useful for generating XML content. An XmlMarkup object +# named +xml+ is automatically made available to templates with a .builder extension. +# +# Here are some basic examples: +# +# xml.em("emphasized") # => emphasized +# xml.em { xml.b("emph & bold") } # => emph & bold +# xml.a("A Link", "href" => "http://onestepback.org") # => A Link +# xml.target("name" => "compile", "option" => "fast") # => +# # NOTE: order of attributes is not specified. +# +# Any method with a block will be treated as an XML markup tag with nested markup in the block. For example, the following: +# +# xml.div do +# xml.h1(@person.name) +# xml.p(@person.bio) +# end +# +# would produce something like: +# +#
+#

David Heinemeier Hansson

+#

A product of Danish Design during the Winter of '79...

+#
+# +# Here is a full-length RSS example actually used on Basecamp: +# +# xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do +# xml.channel do +# xml.title(@feed_title) +# xml.link(@url) +# xml.description "Basecamp: Recent items" +# xml.language "en-us" +# xml.ttl "40" +# +# @recent_items.each do |item| +# xml.item do +# xml.title(item_title(item)) +# xml.description(item_description(item)) if item_description(item) +# xml.pubDate(item_pubDate(item)) +# xml.guid(@person.firm.account.url + @recent_items.url(item)) +# xml.link(@person.firm.account.url + @recent_items.url(item)) +# +# xml.tag!("dc:creator", item.author_name) if item_has_creator?(item) +# end +# end +# end +# end +# +# For more information on Builder please consult the {source code}[https://github.com/rails/builder]. +# +# pkg:gem/actionview#lib/action_view/base.rb:158 +class ActionView::Base + include ::ActionView::Context + include ::ERB::Escape + include ::ERB::Util + include ::ActiveSupport::CoreExt::ERBUtil + include ::ActiveSupport::CoreExt::ERBUtilPrivate + include ::ActiveSupport::Benchmarkable + include ::ActionView::Helpers::ActiveModelHelper + include ::ActionView::Helpers::AssetUrlHelper + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + include ::ActionView::Helpers::TagHelper + include ::ActionView::Helpers::AssetTagHelper + include ::ActionView::Helpers::AtomFeedHelper + include ::ActionView::Helpers::CacheHelper + include ::ActionView::Helpers::ContentExfiltrationPreventionHelper + include ::ActionView::Helpers::UrlHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::ControllerHelper + include ::ActionView::Helpers::CspHelper + include ::ActionView::Helpers::CsrfHelper + include ::ActionView::Helpers::DateHelper + include ::ActionView::Helpers::DebugHelper + include ::ActionView::Helpers::TextHelper + include ::ActionView::Helpers::FormTagHelper + include ::ActionView::ModelNaming + include ::ActionView::RecordIdentifier + include ::ActionView::Helpers::FormHelper + include ::ActionView::Helpers::TranslationHelper + include ::ActionView::Helpers::FormOptionsHelper + include ::ActionView::Helpers::JavaScriptHelper + include ::ActionView::Helpers::NumberHelper + include ::ActionView::Helpers::RenderingHelper + include ::ActionView::Helpers + include ::ActionCable::Helpers::ActionCableHelper + extend ::ActionView::Helpers::UrlHelper::ClassMethods + extend ::ActionView::Helpers::SanitizeHelper::ClassMethods + + # :startdoc: + # + # pkg:gem/actionview#lib/action_view/base.rb:249 + def initialize(lookup_context, assigns, controller); end + + # pkg:gem/actionview#lib/action_view/base.rb:182 + def _routes; end + + # pkg:gem/actionview#lib/action_view/base.rb:182 + def _routes=(_arg0); end + + # pkg:gem/actionview#lib/action_view/base.rb:182 + def _routes?; end + + # pkg:gem/actionview#lib/action_view/base.rb:264 + def _run(method, template, locals, buffer, add_to_stack: T.unsafe(nil), has_strict_locals: T.unsafe(nil), &block); end + + # pkg:gem/actionview#lib/action_view/base.rb:180 + def annotate_rendered_view_with_filenames; end + + # pkg:gem/actionview#lib/action_view/base.rb:180 + def annotate_rendered_view_with_filenames=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:228 + def assign(new_assigns); end + + # pkg:gem/actionview#lib/action_view/base.rb:224 + def assigns; end + + # pkg:gem/actionview#lib/action_view/base.rb:224 + def assigns=(_arg0); end + + # pkg:gem/actionview#lib/action_view/base.rb:177 + def automatically_disable_submit_tag; end + + # pkg:gem/actionview#lib/action_view/base.rb:177 + def automatically_disable_submit_tag=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:287 + def compiled_method_container; end + + # pkg:gem/actionview#lib/action_view/base.rb:224 + def config; end + + # pkg:gem/actionview#lib/action_view/base.rb:224 + def config=(_arg0); end + + # pkg:gem/actionview#lib/action_view/base.rb:159 + def debug_missing_translation; end + + # pkg:gem/actionview#lib/action_view/base.rb:159 + def debug_missing_translation=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:174 + def default_formats; end + + # pkg:gem/actionview#lib/action_view/base.rb:174 + def default_formats=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:162 + def field_error_proc; end + + # pkg:gem/actionview#lib/action_view/base.rb:162 + def field_error_proc=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:226 + def formats(*, **, &); end + + # pkg:gem/actionview#lib/action_view/base.rb:226 + def formats=(arg); end + + # pkg:gem/actionview#lib/action_view/base.rb:295 + def in_rendering_context(options); end + + # pkg:gem/actionview#lib/action_view/base.rb:226 + def locale(*, **, &); end + + # pkg:gem/actionview#lib/action_view/base.rb:226 + def locale=(arg); end + + # pkg:gem/actionview#lib/action_view/base.rb:183 + def logger; end + + # pkg:gem/actionview#lib/action_view/base.rb:183 + def logger=(_arg0); end + + # pkg:gem/actionview#lib/action_view/base.rb:183 + def logger?; end + + # pkg:gem/actionview#lib/action_view/base.rb:223 + def lookup_context; end + + # pkg:gem/actionview#lib/action_view/base.rb:171 + def prefix_partial_path_with_controller_namespace; end + + # pkg:gem/actionview#lib/action_view/base.rb:171 + def prefix_partial_path_with_controller_namespace=(_arg0); end + + # pkg:gem/actionview#lib/action_view/base.rb:171 + def prefix_partial_path_with_controller_namespace?; end + + # pkg:gem/actionview#lib/action_view/base.rb:187 + def remove_hidden_field_autocomplete; end + + # pkg:gem/actionview#lib/action_view/base.rb:187 + def remove_hidden_field_autocomplete=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:166 + def streaming_completion_on_exception; end + + # pkg:gem/actionview#lib/action_view/base.rb:166 + def streaming_completion_on_exception=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:226 + def view_paths(*, **, &); end + + # pkg:gem/actionview#lib/action_view/base.rb:226 + def view_paths=(arg); end + + # pkg:gem/actionview#lib/action_view/base.rb:223 + def view_renderer; end + + class << self + # pkg:gem/actionview#lib/action_view/base.rb:182 + def _routes; end + + # pkg:gem/actionview#lib/action_view/base.rb:182 + def _routes=(value); end + + # pkg:gem/actionview#lib/action_view/base.rb:182 + def _routes?; end + + # pkg:gem/actionview#lib/action_view/base.rb:180 + def annotate_rendered_view_with_filenames; end + + # pkg:gem/actionview#lib/action_view/base.rb:180 + def annotate_rendered_view_with_filenames=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:177 + def automatically_disable_submit_tag; end + + # pkg:gem/actionview#lib/action_view/base.rb:177 + def automatically_disable_submit_tag=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:192 + def cache_template_loading; end + + # pkg:gem/actionview#lib/action_view/base.rb:196 + def cache_template_loading=(value); end + + # pkg:gem/actionview#lib/action_view/base.rb:218 + def changed?(other); end + + # pkg:gem/actionview#lib/action_view/base.rb:159 + def debug_missing_translation; end + + # pkg:gem/actionview#lib/action_view/base.rb:159 + def debug_missing_translation=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:314 + def default_form_builder; end + + # pkg:gem/actionview#lib/action_view/base.rb:314 + def default_form_builder=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:174 + def default_formats; end + + # pkg:gem/actionview#lib/action_view/base.rb:174 + def default_formats=(val); end + + # :stopdoc: + # + # pkg:gem/actionview#lib/action_view/base.rb:235 + def empty; end + + # pkg:gem/actionview#lib/action_view/base.rb:190 + def erb_trim_mode=(arg); end + + # pkg:gem/actionview#lib/action_view/base.rb:162 + def field_error_proc; end + + # pkg:gem/actionview#lib/action_view/base.rb:162 + def field_error_proc=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:183 + def logger; end + + # pkg:gem/actionview#lib/action_view/base.rb:183 + def logger=(value); end + + # pkg:gem/actionview#lib/action_view/base.rb:183 + def logger?; end + + # pkg:gem/actionview#lib/action_view/base.rb:171 + def prefix_partial_path_with_controller_namespace; end + + # pkg:gem/actionview#lib/action_view/base.rb:171 + def prefix_partial_path_with_controller_namespace=(value); end + + # pkg:gem/actionview#lib/action_view/base.rb:171 + def prefix_partial_path_with_controller_namespace?; end + + # pkg:gem/actionview#lib/action_view/base.rb:187 + def remove_hidden_field_autocomplete; end + + # pkg:gem/actionview#lib/action_view/base.rb:187 + def remove_hidden_field_autocomplete=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:166 + def streaming_completion_on_exception; end + + # pkg:gem/actionview#lib/action_view/base.rb:166 + def streaming_completion_on_exception=(val); end + + # pkg:gem/actionview#lib/action_view/base.rb:243 + def with_context(context, assigns = T.unsafe(nil), controller = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/base.rb:204 + def with_empty_template_cache; end + + # pkg:gem/actionview#lib/action_view/base.rb:239 + def with_view_paths(view_paths, assigns = T.unsafe(nil), controller = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/base.rb:200 + def xss_safe?; end + + private + + # pkg:gem/actionview#lib/action_view/base.rb:182 + def __class_attr__routes; end + + # pkg:gem/actionview#lib/action_view/base.rb:182 + def __class_attr__routes=(new_value); end + + # pkg:gem/actionview#lib/action_view/base.rb:183 + def __class_attr_logger; end + + # pkg:gem/actionview#lib/action_view/base.rb:183 + def __class_attr_logger=(new_value); end + + # pkg:gem/actionview#lib/action_view/base.rb:171 + def __class_attr_prefix_partial_path_with_controller_namespace; end + + # pkg:gem/actionview#lib/action_view/base.rb:171 + def __class_attr_prefix_partial_path_with_controller_namespace=(new_value); end + end +end + +# pkg:gem/actionview#lib/action_view/cache_expiry.rb:4 +module ActionView::CacheExpiry; end + +# pkg:gem/actionview#lib/action_view/cache_expiry.rb:5 +class ActionView::CacheExpiry::ViewReloader + # pkg:gem/actionview#lib/action_view/cache_expiry.rb:6 + def initialize(watcher:, &block); end + + # pkg:gem/actionview#lib/action_view/cache_expiry.rb:21 + def execute; end + + # pkg:gem/actionview#lib/action_view/cache_expiry.rb:16 + def updated?; end + + private + + # pkg:gem/actionview#lib/action_view/cache_expiry.rb:64 + def all_view_paths; end + + # pkg:gem/actionview#lib/action_view/cache_expiry.rb:37 + def build_watcher; end + + # pkg:gem/actionview#lib/action_view/cache_expiry.rb:60 + def dirs_to_watch; end + + # pkg:gem/actionview#lib/action_view/cache_expiry.rb:55 + def rebuild_watcher; end + + # pkg:gem/actionview#lib/action_view/cache_expiry.rb:33 + def reload!; end +end + +# pkg:gem/actionview#lib/action_view/renderer/partial_renderer/collection_caching.rb:6 +module ActionView::CollectionCaching + extend ::ActiveSupport::Concern + + private + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer/collection_caching.rb:20 + def cache_collection_render(instrumentation_payload, view, template, collection); end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer/collection_caching.rb:54 + def callable_cache_key?; end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer/collection_caching.rb:58 + def collection_by_cache_keys(view, template, collection); end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer/collection_caching.rb:71 + def expanded_cache_key(key, view, template, digest_path); end + + # `order_by` is an enumerable object containing keys of the cache, + # all keys are passed in whether found already or not. + # + # `cached_partials` is a hash. If the value exists + # it represents the rendered partial from the cache + # otherwise `Hash#fetch` will take the value of its block. + # + # This method expects a block that will return the rendered + # partial. An example is to render all results + # for each element that was not found in the cache and store it as an array. + # Order it so that the first empty cache element in `cached_partials` + # corresponds to the first element in `rendered_partials`. + # + # If the partial is not already cached it will also be + # written back to the underlying cache store. + # + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer/collection_caching.rb:91 + def fetch_or_cache_partial(cached_partials, template, order_by:); end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer/collection_caching.rb:16 + def will_cache?(options, view); end +end + +# pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:33 +class ActionView::CollectionRenderer < ::ActionView::PartialRenderer + include ::ActionView::AbstractRenderer::ObjectRendering + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:130 + def render_collection_derive_partial(collection, context, block); end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:112 + def render_collection_with_partial(collection, partial, context, block); end + + private + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:182 + def collection_with_template(view, template, layout, collection); end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:153 + def render_collection(collection, view, path, template, layout, block); end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:148 + def retrieve_variable(path); end +end + +# pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:36 +class ActionView::CollectionRenderer::CollectionIterator + include ::Enumerable + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:39 + def initialize(collection); end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:43 + def each(&blk); end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:51 + def length; end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:55 + def preload!; end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:47 + def size; end +end + +# pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:100 +class ActionView::CollectionRenderer::MixedCollectionIterator < ::ActionView::CollectionRenderer::CollectionIterator + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:101 + def initialize(collection, paths); end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:106 + def each_with_info; end +end + +# pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:78 +class ActionView::CollectionRenderer::PreloadCollectionIterator < ::ActionView::CollectionRenderer::SameCollectionIterator + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:79 + def initialize(collection, path, variables, relation); end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:89 + def each_with_info; end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:85 + def from_collection(collection); end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:95 + def preload!; end +end + +# pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:60 +class ActionView::CollectionRenderer::SameCollectionIterator < ::ActionView::CollectionRenderer::CollectionIterator + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:61 + def initialize(collection, path, variables); end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:71 + def each_with_info; end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:67 + def from_collection(collection); end +end + +# = Action View Context +# +# Action View contexts are supplied to Action Controller to render a template. +# The default Action View context is ActionView::Base. +# +# In order to work with Action Controller, a Context must just include this +# module. The initialization of the variables used by the context +# (@output_buffer, @view_flow, and @virtual_path) is responsibility of the +# object that includes this module (although you can call _prepare_context +# defined below). +# +# pkg:gem/actionview#lib/action_view/context.rb:14 +module ActionView::Context + # Encapsulates the interaction with the view flow so it + # returns the correct buffer on +yield+. This is usually + # overwritten by helpers to add more behavior. + # + # pkg:gem/actionview#lib/action_view/context.rb:27 + def _layout_for(name = T.unsafe(nil)); end + + # Prepares the context by setting the appropriate instance variables. + # + # pkg:gem/actionview#lib/action_view/context.rb:18 + def _prepare_context; end + + # pkg:gem/actionview#lib/action_view/context.rb:15 + def output_buffer; end + + # pkg:gem/actionview#lib/action_view/context.rb:15 + def output_buffer=(_arg0); end + + # pkg:gem/actionview#lib/action_view/context.rb:15 + def view_flow; end + + # pkg:gem/actionview#lib/action_view/context.rb:15 + def view_flow=(_arg0); end +end + +# pkg:gem/actionview#lib/action_view/dependency_tracker.rb:8 +class ActionView::DependencyTracker + extend ::ActiveSupport::Autoload + + class << self + # pkg:gem/actionview#lib/action_view/dependency_tracker.rb:17 + def find_dependencies(name, template, view_paths = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker.rb:24 + def register_tracker(extension, tracker); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker.rb:35 + def remove_tracker(handler); end + end +end + +# pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:5 +class ActionView::DependencyTracker::ERBTracker + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:72 + def initialize(name, template, view_paths = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:76 + def dependencies; end + + private + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:104 + def add_dependencies(render_dependencies, arguments, pattern); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:112 + def add_dynamic_dependency(dependencies, dependency); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:118 + def add_static_dependency(dependencies, dependency, quote_type); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:88 + def directory; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:158 + def explicit_dependencies; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:80 + def name; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:92 + def render_dependencies; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:84 + def source; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:80 + def template; end + + class << self + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:68 + def call(name, template, view_paths = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:64 + def supports_view_paths?; end + end +end + +# pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:6 +ActionView::DependencyTracker::ERBTracker::EXPLICIT_DEPENDENCY = T.let(T.unsafe(nil), Regexp) + +# A valid ruby identifier - suitable for class, method and specially variable names +# +# pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:9 +ActionView::DependencyTracker::ERBTracker::IDENTIFIER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:58 +ActionView::DependencyTracker::ERBTracker::LAYOUT_DEPENDENCY = T.let(T.unsafe(nil), Regexp) + +# Part of any hash containing the :layout key +# +# pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:36 +ActionView::DependencyTracker::ERBTracker::LAYOUT_HASH_KEY = T.let(T.unsafe(nil), Regexp) + +# Part of any hash containing the :partial key +# +# pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:30 +ActionView::DependencyTracker::ERBTracker::PARTIAL_HASH_KEY = T.let(T.unsafe(nil), Regexp) + +# Matches: +# partial: "comments/comment", collection: @all_comments => "comments/comment" +# (object: @single_comment, partial: "comments/comment") => "comments/comment" +# +# "comments/comments" +# 'comments/comments' +# ('comments/comments') +# +# (@topic) => "topics/topic" +# topics => "topics/topic" +# (message.topics) => "topics/topic" +# +# pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:52 +ActionView::DependencyTracker::ERBTracker::RENDER_ARGUMENTS = T.let(T.unsafe(nil), Regexp) + +# A simple string literal. e.g. "School's out!" +# +# pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:23 +ActionView::DependencyTracker::ERBTracker::STRING = T.let(T.unsafe(nil), Regexp) + +# Any kind of variable name. e.g. @instance, @@class, $global or local. +# Possibly following a method call chain +# +# pkg:gem/actionview#lib/action_view/dependency_tracker/erb_tracker.rb:16 +ActionView::DependencyTracker::ERBTracker::VARIABLE_OR_METHOD_CHAIN = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:5 +class ActionView::DependencyTracker::RubyTracker + # pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:20 + def initialize(name, template, view_paths = T.unsafe(nil), parser_class: T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:12 + def dependencies; end + + private + + # pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:38 + def explicit_dependencies; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:26 + def name; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:28 + def render_dependencies; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:26 + def template; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:26 + def view_paths; end + + class << self + # pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:8 + def call(name, template, view_paths = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:16 + def supports_view_paths?; end + end +end + +# pkg:gem/actionview#lib/action_view/dependency_tracker/ruby_tracker.rb:6 +ActionView::DependencyTracker::RubyTracker::EXPLICIT_DEPENDENCY = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionview#lib/action_view/dependency_tracker/wildcard_resolver.rb:5 +class ActionView::DependencyTracker::WildcardResolver + # pkg:gem/actionview#lib/action_view/dependency_tracker/wildcard_resolver.rb:6 + def initialize(view_paths, dependencies); end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/wildcard_resolver.rb:13 + def resolve; end + + private + + # pkg:gem/actionview#lib/action_view/dependency_tracker/wildcard_resolver.rb:20 + def explicit_dependencies; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/wildcard_resolver.rb:22 + def resolved_wildcard_dependencies; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/wildcard_resolver.rb:20 + def view_paths; end + + # pkg:gem/actionview#lib/action_view/dependency_tracker/wildcard_resolver.rb:20 + def wildcard_dependencies; end +end + +# pkg:gem/actionview#lib/action_view/digestor.rb:6 +class ActionView::Digestor + class << self + # Supported options: + # + # * name - Template name + # * format - Template format + # * +finder+ - An instance of ActionView::LookupContext + # * dependencies - An array of dependent views + # + # pkg:gem/actionview#lib/action_view/digestor.rb:16 + def digest(name:, finder:, format: T.unsafe(nil), dependencies: T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/digestor.rb:38 + def logger; end + + # Create a dependency tree for template named +name+. + # + # pkg:gem/actionview#lib/action_view/digestor.rb:43 + def tree(name, finder, partial = T.unsafe(nil), seen = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/digestor.rb:71 + def find_template(finder, name, prefixes, partial, keys); end + end +end + +# pkg:gem/actionview#lib/action_view/digestor.rb:125 +class ActionView::Digestor::Injected < ::ActionView::Digestor::Node + # pkg:gem/actionview#lib/action_view/digestor.rb:126 + def digest(finder, _ = T.unsafe(nil)); end +end + +# pkg:gem/actionview#lib/action_view/digestor.rb:121 +class ActionView::Digestor::Missing < ::ActionView::Digestor::Node + # pkg:gem/actionview#lib/action_view/digestor.rb:122 + def digest(finder, _ = T.unsafe(nil)); end +end + +# pkg:gem/actionview#lib/action_view/digestor.rb:78 +class ActionView::Digestor::Node + # pkg:gem/actionview#lib/action_view/digestor.rb:86 + def initialize(name, logical_name, template, children = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/digestor.rb:79 + def children; end + + # pkg:gem/actionview#lib/action_view/digestor.rb:97 + def dependency_digest(finder, stack); end + + # pkg:gem/actionview#lib/action_view/digestor.rb:93 + def digest(finder, stack = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/digestor.rb:79 + def logical_name; end + + # pkg:gem/actionview#lib/action_view/digestor.rb:79 + def name; end + + # pkg:gem/actionview#lib/action_view/digestor.rb:79 + def template; end + + # pkg:gem/actionview#lib/action_view/digestor.rb:110 + def to_dep_map(seen = T.unsafe(nil)); end + + class << self + # pkg:gem/actionview#lib/action_view/digestor.rb:81 + def create(name, logical_name, template, partial); end + end +end + +# pkg:gem/actionview#lib/action_view/digestor.rb:129 +class ActionView::Digestor::NullLogger + class << self + # pkg:gem/actionview#lib/action_view/digestor.rb:130 + def debug(_); end + + # pkg:gem/actionview#lib/action_view/digestor.rb:131 + def error(_); end + end +end + +# pkg:gem/actionview#lib/action_view/digestor.rb:119 +class ActionView::Digestor::Partial < ::ActionView::Digestor::Node; end + +# pkg:gem/actionview#lib/action_view.rb:35 +ActionView::ENCODING_FLAG = T.let(T.unsafe(nil), String) + +# pkg:gem/actionview#lib/action_view/template/error.rb:11 +class ActionView::EncodingError < ::StandardError; end + +# A resolver that loads files from the filesystem. +# +# pkg:gem/actionview#lib/action_view/template/resolver.rb:90 +class ActionView::FileSystemResolver < ::ActionView::Resolver + # pkg:gem/actionview#lib/action_view/template/resolver.rb:93 + def initialize(path); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:115 + def ==(resolver); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:117 + def all_template_paths; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:126 + def built_templates; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:101 + def clear_cache; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:112 + def eql?(resolver); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:91 + def path; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:110 + def to_path; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:107 + def to_s; end + + private + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:131 + def _find_all(name, prefix, partial, details, key, locals); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:150 + def build_unbound_template(template); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:208 + def escape_entry(entry); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:180 + def filter_and_sort_by_details(templates, requested_details); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:146 + def source_for_template(template); end + + # Safe glob within @path + # + # pkg:gem/actionview#lib/action_view/template/resolver.rb:195 + def template_glob(glob); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:163 + def unbound_templates_from_path(path); end +end + +# pkg:gem/actionview#lib/action_view/helpers/capture_helper.rb:6 +module ActionView::Helpers + include ::ActiveSupport::Benchmarkable + include ::ActionView::Helpers::ActiveModelHelper + include ::ActionView::Helpers::AssetUrlHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + include ::ActionView::Helpers::TagHelper + include ::ActionView::Helpers::AssetTagHelper + include ::ActionView::Helpers::AtomFeedHelper + include ::ActionView::Helpers::CacheHelper + include ::ActionView::Helpers::ContentExfiltrationPreventionHelper + include ::ActionView::Helpers::ControllerHelper + include ::ActionView::Helpers::CspHelper + include ::ActionView::Helpers::CsrfHelper + include ::ActionView::Helpers::DateHelper + include ::ActionView::Helpers::DebugHelper + include ::ActionView::Helpers::TextHelper + include ::ActionView::Helpers::FormOptionsHelper + include ::ActionView::Helpers::JavaScriptHelper + include ::ActionView::Helpers::NumberHelper + include ::ActionView::Helpers::RenderingHelper + extend ::ActiveSupport::Autoload + extend ::ActiveSupport::Concern + include ::ActionView::Helpers::UrlHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::TextHelper + include ::ActionView::Helpers::FormTagHelper + include ::ActionView::Helpers::FormHelper + include ::ActionView::Helpers::TranslationHelper + + mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods + mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods + + class << self + # pkg:gem/actionview#lib/action_view/helpers.rb:35 + def eager_load!; end + end +end + +# pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:8 +module ActionView::Helpers::ActiveModelHelper; end + +# = Active \Model Instance Tag \Helpers +# +# pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:12 +module ActionView::Helpers::ActiveModelInstanceTag + # pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:20 + def content_tag(type, options, *); end + + # pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:36 + def error_message; end + + # pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:28 + def error_wrapping(html_tag); end + + # pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:13 + def object; end + + # pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:24 + def tag(type, options, *); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:41 + def object_has_errors?; end + + # pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:45 + def select_markup_helper?(type); end + + # pkg:gem/actionview#lib/action_view/helpers/active_model_helper.rb:49 + def tag_generate_errors?(options); end +end + +# = Action View Asset Tag \Helpers +# +# This module provides methods for generating HTML that links views to assets such +# as images, JavaScripts, stylesheets, and feeds. These methods do not verify +# the assets exist before linking to them: +# +# image_tag("rails.png") +# # => +# stylesheet_link_tag("application") +# # => +# +# pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:21 +module ActionView::Helpers::AssetTagHelper + include ::ActionView::Helpers::AssetUrlHelper + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + include ::ActionView::Helpers::TagHelper + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:28 + def apply_stylesheet_media_default; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:28 + def apply_stylesheet_media_default=(val); end + + # Returns an HTML audio tag for the +sources+. If +sources+ is a string, + # a single audio tag will be returned. If +sources+ is an array, an audio + # tag with nested source tags for each source will be returned. The + # +sources+ can be full paths, files that exist in your public audios + # directory, or Active Storage attachments. + # + # When the last parameter is a hash you can add HTML attributes using that + # parameter. + # + # audio_tag("sound") + # # => + # audio_tag("sound.wav") + # # => + # audio_tag("sound.wav", autoplay: true, controls: true) + # # => + # audio_tag("sound.wav", "sound.mid") + # # => + # + # Active Storage blobs (audios that are uploaded by the users of your app): + # + # audio_tag(user.name_pronunciation_audio) + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:612 + def audio_tag(*sources); end + + # Returns a link tag that browsers and feed readers can use to auto-detect + # an RSS, Atom, or JSON feed. The +type+ can be :rss (default), + # :atom, or :json. Control the link options in url_for format + # using the +url_options+. You can modify the LINK tag itself in +tag_options+. + # + # ==== Options + # + # * :rel - Specify the relation of this link, defaults to "alternate" + # * :type - Override the auto-generated mime type + # * :title - Specify the title of the link, defaults to the +type+ + # + # ==== Examples + # + # auto_discovery_link_tag + # # => + # auto_discovery_link_tag(:atom) + # # => + # auto_discovery_link_tag(:json) + # # => + # auto_discovery_link_tag(:rss, {action: "feed"}) + # # => + # auto_discovery_link_tag(:rss, {action: "feed"}, {title: "My RSS"}) + # # => + # auto_discovery_link_tag(:rss, {controller: "news", action: "feed"}) + # # => + # auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {title: "Example RSS"}) + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:279 + def auto_discovery_link_tag(type = T.unsafe(nil), url_options = T.unsafe(nil), tag_options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:29 + def auto_include_nonce_for_scripts; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:29 + def auto_include_nonce_for_scripts=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:30 + def auto_include_nonce_for_styles; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:30 + def auto_include_nonce_for_styles=(val); end + + # Returns a link tag for a favicon managed by the asset pipeline. + # + # If a page has no link like the one generated by this helper, browsers + # ask for /favicon.ico automatically, and cache the file if the + # request succeeds. If the favicon changes it is hard to get it updated. + # + # To have better control applications may let the asset pipeline manage + # their favicon storing the file under app/assets/images, and + # using this helper to generate its corresponding link tag. + # + # The helper gets the name of the favicon file as first argument, which + # defaults to "favicon.ico", and also supports +:rel+ and +:type+ options + # to override their defaults, "icon" and "image/x-icon" + # respectively: + # + # favicon_link_tag + # # => + # + # favicon_link_tag 'myicon.ico' + # # => + # + # Mobile Safari looks for a different link tag, pointing to an image that + # will be used if you add the page to the home screen of an iOS device. + # The following call would generate such a tag: + # + # favicon_link_tag 'mb-icon.png', rel: 'apple-touch-icon', type: 'image/png' + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:320 + def favicon_link_tag(source = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:26 + def image_decoding; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:26 + def image_decoding=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:25 + def image_loading; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:25 + def image_loading=(val); end + + # Returns an HTML image tag for the +source+. The +source+ can be a full + # path, a file, or an Active Storage attachment. + # + # ==== Options + # + # You can add HTML attributes using the +options+. The +options+ supports + # additional keys for convenience and conformance: + # + # * :size - Supplied as "#{width}x#{height}" or "#{number}", so "30x45" becomes + # width="30" height="45", and "50" becomes width="50" height="50". + # :size will be ignored if the value is not in the correct format. + # * :srcset - If supplied as a hash or array of [source, descriptor] + # pairs, each image path will be expanded before the list is formatted as a string. + # + # ==== Examples + # + # Assets (images that are part of your app): + # + # image_tag("icon") + # # => + # image_tag("icon.png") + # # => + # image_tag("icon.png", size: "16x10", alt: "Edit Entry") + # # => Edit Entry + # image_tag("/icons/icon.gif", size: "16") + # # => + # image_tag("/icons/icon.gif", height: '32', width: '32') + # # => + # image_tag("/icons/icon.gif", class: "menu_icon") + # # => + # image_tag("/icons/icon.gif", data: { title: 'Rails Application' }) + # # => + # image_tag("icon.png", srcset: { "icon_2x.png" => "2x", "icon_4x.png" => "4x" }) + # # => + # image_tag("pic.jpg", srcset: [["pic_1024.jpg", "1024w"], ["pic_1980.jpg", "1980w"]], sizes: "100vw") + # # => + # + # Active Storage blobs (images that are uploaded by the users of your app): + # + # image_tag(user.avatar) + # # => + # image_tag(user.avatar.variant(resize_to_limit: [100, 100])) + # # => + # image_tag(user.avatar.variant(resize_to_limit: [100, 100]), size: '100') + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:449 + def image_tag(source, options = T.unsafe(nil)); end + + # Returns an HTML script tag for each of the +sources+ provided. + # + # Sources may be paths to JavaScript files. Relative paths are assumed to be relative + # to assets/javascripts, full paths are assumed to be relative to the document + # root. Relative paths are idiomatic, use absolute paths only when needed. + # + # When passing paths, the ".js" extension is optional. If you do not want ".js" + # appended to the path extname: false can be set on the options. + # + # You can modify the HTML attributes of the script tag by passing a hash as the + # last argument. + # + # When the Asset Pipeline is enabled, you can pass the name of your manifest as + # source, and include other JavaScript or CoffeeScript files inside the manifest. + # + # If the server supports HTTP Early Hints, and the +defer+ option is not + # enabled, \Rails will push a 103 Early Hints response that links + # to the assets. + # + # ==== Options + # + # When the last parameter is a hash you can add HTML attributes using that + # parameter. This includes but is not limited to the following options: + # + # * :extname - Append an extension to the generated URL unless the extension + # already exists. This only applies for relative URLs. + # * :protocol - Sets the protocol of the generated URL. This option only + # applies when a relative URL and +host+ options are provided. + # * :host - When a relative URL is provided the host is added to the + # that path. + # * :skip_pipeline - This option is used to bypass the asset pipeline + # when it is set to true. + # * :nonce - When set to true, adds an automatic nonce value if + # you have Content Security Policy enabled. + # * :async - When set to +true+, adds the +async+ HTML + # attribute, allowing the script to be fetched in parallel to be parsed + # and evaluated as soon as possible. + # * :defer - When set to +true+, adds the +defer+ HTML + # attribute, which indicates to the browser that the script is meant to + # be executed after the document has been parsed. Additionally, prevents + # sending the Preload Links header. + # * :nopush - Specify if the use of server push is not desired + # for the script. Defaults to +true+. + # + # Any other specified options will be treated as HTML attributes for the + # +script+ tag. + # + # For more information regarding how the :async and :defer + # options affect the + # + # javascript_include_tag "xmlhr", host: "localhost", protocol: "https" + # # => + # + # javascript_include_tag "template.jst", extname: false + # # => + # + # javascript_include_tag "xmlhr.js" + # # => + # + # javascript_include_tag "common.javascript", "/elsewhere/cools" + # # => + # # + # + # javascript_include_tag "http://www.example.com/xmlhr" + # # => + # + # javascript_include_tag "http://www.example.com/xmlhr.js" + # # => + # + # javascript_include_tag "http://www.example.com/xmlhr.js", nonce: true + # # => + # + # javascript_include_tag "http://www.example.com/xmlhr.js", async: true + # # => + # + # javascript_include_tag "http://www.example.com/xmlhr.js", defer: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:115 + def javascript_include_tag(*sources); end + + # Returns an HTML picture tag for the +sources+. If +sources+ is a string, + # a single picture tag will be returned. If +sources+ is an array, a picture + # tag with nested source tags for each source will be returned. The + # +sources+ can be full paths, files that exist in your public images + # directory, or Active Storage attachments. Since the picture tag requires + # an img tag, the last element you provide will be used for the img tag. + # For complete control over the picture tag, a block can be passed, which + # will populate the contents of the tag accordingly. + # + # ==== Options + # + # When the last parameter is a hash you can add HTML attributes using that + # parameter. Apart from all the HTML supported options, the following are supported: + # + # * :image - Hash of options that are passed directly to the +image_tag+ helper. + # + # ==== Examples + # + # picture_tag("picture.webp") + # # => + # picture_tag("gold.png", :image => { :size => "20" }) + # # => + # picture_tag("gold.png", :image => { :size => "45x70" }) + # # => + # picture_tag("picture.webp", "picture.png") + # # => + # picture_tag("picture.webp", "picture.png", :image => { alt: "Image" }) + # # => Image + # picture_tag(["picture.webp", "picture.png"], :image => { alt: "Image" }) + # # => Image + # picture_tag(:class => "my-class") { tag(:source, :srcset => image_path("picture.webp")) + image_tag("picture.png", :alt => "Image") } + # # => Image + # picture_tag { tag(:source, :srcset => image_path("picture-small.webp"), :media => "(min-width: 600px)") + tag(:source, :srcset => image_path("picture-big.webp")) + image_tag("picture.png", :alt => "Image") } + # # => Image + # + # Active Storage blobs (images that are uploaded by the users of your app): + # + # picture_tag(user.profile_picture) + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:510 + def picture_tag(*sources, &block); end + + # Returns a link tag that browsers can use to preload the +source+. + # The +source+ can be the path of a resource managed by asset pipeline, + # a full path, or an URI. + # + # ==== Options + # + # * :type - Override the auto-generated mime type, defaults to the mime type for +source+ extension. + # * :as - Override the auto-generated value for as attribute, calculated using +source+ extension and mime type. + # * :crossorigin - Specify the crossorigin attribute, required to load cross-origin resources. + # * :nopush - Specify if the use of server push is not desired for the resource. Defaults to +false+. + # * :integrity - Specify the integrity attribute. + # + # ==== Examples + # + # preload_link_tag("custom_theme.css") + # # => + # + # preload_link_tag("/videos/video.webm") + # # => + # + # preload_link_tag(post_path(format: :json), as: "fetch") + # # => + # + # preload_link_tag("worker.js", as: "worker") + # # => + # + # preload_link_tag("//example.com/font.woff2") + # # => + # + # preload_link_tag("//example.com/font.woff2", crossorigin: "use-credentials") + # # => + # + # preload_link_tag("/media/audio.ogg", nopush: true) + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:363 + def preload_link_tag(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:27 + def preload_links_header; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:27 + def preload_links_header=(val); end + + # Returns a stylesheet link tag for the sources specified as arguments. + # + # When passing paths, the .css extension is optional. + # If you don't specify an extension, .css will be appended automatically. + # If you do not want .css appended to the path, + # set extname: false in the options. + # You can modify the link attributes by passing a hash as the last argument. + # + # If the server supports HTTP Early Hints, \Rails will push a 103 Early + # Hints response that links to the assets. + # + # ==== Options + # + # * :extname - Append an extension to the generated URL unless the extension + # already exists. This only applies for relative URLs. + # * :protocol - Sets the protocol of the generated URL. This option only + # applies when a relative URL and +host+ options are provided. + # * :host - When a relative URL is provided the host is added to the + # that path. + # * :skip_pipeline - This option is used to bypass the asset pipeline + # when it is set to true. + # * :nonce - When set to true, adds an automatic nonce value if + # you have Content Security Policy enabled. + # * :nopush - Specify if the use of server push is not desired + # for the stylesheet. Defaults to +true+. + # + # ==== Examples + # + # stylesheet_link_tag "style" + # # => + # + # stylesheet_link_tag "style.css" + # # => + # + # stylesheet_link_tag "http://www.example.com/style.css" + # # => + # + # stylesheet_link_tag "style.less", extname: false, skip_pipeline: true, rel: "stylesheet/less" + # # => + # + # stylesheet_link_tag "style", media: "all" + # # => + # + # stylesheet_link_tag "style", media: "print" + # # => + # + # stylesheet_link_tag "random.styles", "/css/stylish" + # # => + # # + # + # stylesheet_link_tag "style", nonce: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:207 + def stylesheet_link_tag(*sources); end + + # Returns an HTML video tag for the +sources+. If +sources+ is a string, + # a single video tag will be returned. If +sources+ is an array, a video + # tag with nested source tags for each source will be returned. The + # +sources+ can be full paths, files that exist in your public videos + # directory, or Active Storage attachments. + # + # ==== Options + # + # When the last parameter is a hash you can add HTML attributes using that + # parameter. The following options are supported: + # + # * :poster - Set an image (like a screenshot) to be shown + # before the video loads. The path is calculated like the +src+ of +image_tag+. + # * :size - Supplied as "#{width}x#{height}" or "#{number}", so "30x45" becomes + # width="30" height="45", and "50" becomes width="50" height="50". + # :size will be ignored if the value is not in the correct format. + # * :poster_skip_pipeline will bypass the asset pipeline when using + # the :poster option instead using an asset in the public folder. + # + # ==== Examples + # + # video_tag("trailer") + # # => + # video_tag("trailer.ogg") + # # => + # video_tag("trailer.ogg", controls: true, preload: 'none') + # # => + # video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png") + # # => + # video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png", poster_skip_pipeline: true) + # # => + # video_tag("/trailers/hd.avi", size: "16x16") + # # => + # video_tag("/trailers/hd.avi", size: "16") + # # => + # video_tag("/trailers/hd.avi", height: '32', width: '32') + # # => + # video_tag("trailer.ogg", "trailer.flv") + # # => + # video_tag(["trailer.ogg", "trailer.flv"]) + # # => + # video_tag(["trailer.ogg", "trailer.flv"], size: "160x120") + # # => + # + # Active Storage blobs (videos that are uploaded by the users of your app): + # + # video_tag(user.intro_video) + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:580 + def video_tag(*sources); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:653 + def check_for_image_tag_errors(options); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:644 + def extract_dimensions(size); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:617 + def multiple_sources_tag_builder(type, sources); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:634 + def resolve_asset_source(asset_type, source, skip_pipeline); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:659 + def resolve_link_as(extname, mime_type); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:673 + def send_preload_links_header(preload_links, max_header_size: T.unsafe(nil)); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:28 + def apply_stylesheet_media_default; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:28 + def apply_stylesheet_media_default=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:29 + def auto_include_nonce_for_scripts; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:29 + def auto_include_nonce_for_scripts=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:30 + def auto_include_nonce_for_styles; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:30 + def auto_include_nonce_for_styles=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:26 + def image_decoding; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:26 + def image_decoding=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:25 + def image_loading; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:25 + def image_loading=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:27 + def preload_links_header; end + + # pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:27 + def preload_links_header=(val); end + end +end + +# Some HTTP client and proxies have a 4kiB header limit, but more importantly +# including preload links has diminishing returns so it's best to not go overboard +# +# pkg:gem/actionview#lib/action_view/helpers/asset_tag_helper.rb:671 +ActionView::Helpers::AssetTagHelper::MAX_HEADER_SIZE = T.let(T.unsafe(nil), Integer) + +# = Action View Asset URL \Helpers +# +# This module provides methods for generating asset paths and +# URLs. +# +# image_path("rails.png") +# # => "/assets/rails.png" +# +# image_url("rails.png") +# # => "http://www.example.com/assets/rails.png" +# +# === Using asset hosts +# +# By default, \Rails links to these assets on the current host in the public +# folder, but you can direct \Rails to link to assets from a dedicated asset +# server by setting ActionController::Base.asset_host in the application +# configuration, typically in config/environments/production.rb. +# For example, you'd define assets.example.com to be your asset +# host this way, inside the configure block of your environment-specific +# configuration files or config/application.rb: +# +# config.action_controller.asset_host = "assets.example.com" +# +# Helpers take that into account: +# +# image_tag("rails.png") +# # => +# stylesheet_link_tag("application") +# # => +# +# Browsers open a limited number of simultaneous connections to a single +# host. The exact number varies by browser and version. This limit may cause +# some asset downloads to wait for previous assets to finish before they can +# begin. You can use the %d wildcard in the +asset_host+ to +# distribute the requests over four hosts. For example, +# assets%d.example.com will spread the asset requests over +# "assets0.example.com", ..., "assets3.example.com". +# +# image_tag("rails.png") +# # => +# stylesheet_link_tag("application") +# # => +# +# This may improve the asset loading performance of your application. +# It is also possible the combination of additional connection overhead +# (DNS, SSL) and the overall browser connection limits may result in this +# solution being slower. You should be sure to measure your actual +# performance across targeted browsers both before and after this change. +# +# To implement the corresponding hosts you can either set up four actual +# hosts or use wildcard DNS to CNAME the wildcard to a single asset host. +# You can read more about setting up your DNS CNAME records from your ISP. +# +# Note: This is purely a browser performance optimization and is not meant +# for server load balancing. See https://www.die.net/musings/page_load_time/ +# for background and https://www.browserscope.org/?category=network for +# connection limit data. +# +# Alternatively, you can exert more control over the asset host by setting +# +asset_host+ to a proc like this: +# +# ActionController::Base.asset_host = Proc.new { |source| +# "http://assets#{OpenSSL::Digest::SHA256.hexdigest(source).to_i(16) % 2 + 1}.example.com" +# } +# image_tag("rails.png") +# # => +# stylesheet_link_tag("application") +# # => +# +# The example above generates "http://assets1.example.com" and +# "http://assets2.example.com". This option is useful for example if +# you need fewer/more than four hosts, custom host names, etc. +# +# As you see the proc takes a +source+ parameter. That's a string with the +# absolute path of the asset, for example "/assets/rails.png". +# +# ActionController::Base.asset_host = Proc.new { |source| +# if source.end_with?('.css') +# "http://stylesheets.example.com" +# else +# "http://assets.example.com" +# end +# } +# image_tag("rails.png") +# # => +# stylesheet_link_tag("application") +# # => +# +# Alternatively you may ask for a second parameter +request+. That one is +# particularly useful for serving assets from an SSL-protected page. The +# example proc below disables asset hosting for HTTPS connections, while +# still sending assets for plain HTTP requests from asset hosts. If you don't +# have SSL certificates for each of the asset hosts this technique allows you +# to avoid warnings in the client about mixed media. +# Note that the +request+ parameter might not be supplied, e.g. when the assets +# are precompiled with the command bin/rails assets:precompile. Make sure to use a +# +Proc+ instead of a lambda, since a +Proc+ allows missing parameters and sets them +# to +nil+. +# +# config.action_controller.asset_host = Proc.new { |source, request| +# if request && request.ssl? +# "#{request.protocol}#{request.host_with_port}" +# else +# "#{request.protocol}assets.example.com" +# end +# } +# +# You can also implement a custom asset host object that responds to +call+ +# and takes either one or two parameters just like the proc. +# +# config.action_controller.asset_host = AssetHostingWithMinimumSsl.new( +# "http://asset%d.example.com", "https://asset1.example.com" +# ) +# +# pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:121 +module ActionView::Helpers::AssetUrlHelper + # This is the entry point for all assets. + # When using an asset pipeline gem (e.g. propshaft or sprockets-rails), the + # behavior is "enhanced". You can bypass the asset pipeline by passing in + # skip_pipeline: true to the options. + # + # All other asset *_path helpers delegate through this method. + # + # === With the asset pipeline + # + # All options passed to +asset_path+ will be passed to +compute_asset_path+ + # which is implemented by asset pipeline gems. + # + # asset_path("application.js") # => "/assets/application-60aa4fdc5cea14baf5400fba1abf4f2a46a5166bad4772b1effe341570f07de9.js" + # asset_path('application.js', host: 'example.com') # => "//example.com/assets/application.js" + # asset_path("application.js", host: 'example.com', protocol: 'https') # => "https://example.com/assets/application.js" + # + # === Without the asset pipeline (skip_pipeline: true) + # + # Accepts a type option that can specify the asset's extension. No error + # checking is done to verify the source passed into +asset_path+ is valid + # and that the file exists on disk. + # + # asset_path("application.js", skip_pipeline: true) # => "application.js" + # asset_path("filedoesnotexist.png", skip_pipeline: true) # => "filedoesnotexist.png" + # asset_path("application", type: :javascript, skip_pipeline: true) # => "/javascripts/application.js" + # asset_path("application", type: :stylesheet, skip_pipeline: true) # => "/stylesheets/application.css" + # + # === Options applying to all assets + # + # Below lists scenarios that apply to +asset_path+ whether or not you're + # using the asset pipeline. + # + # - All fully qualified URLs are returned immediately. This bypasses the + # asset pipeline and all other behavior described. + # + # asset_path("http://www.example.com/js/xmlhr.js") # => "http://www.example.com/js/xmlhr.js" + # + # - All assets that begin with a forward slash are assumed to be full + # URLs and will not be expanded. This will bypass the asset pipeline. + # + # asset_path("/foo.png") # => "/foo.png" + # + # - All blank strings will be returned immediately. This bypasses the + # asset pipeline and all other behavior described. + # + # asset_path("") # => "" + # + # - If config.relative_url_root is specified, all assets will have that + # root prepended. + # + # Rails.application.config.relative_url_root = "bar" + # asset_path("foo.js", skip_pipeline: true) # => "bar/foo.js" + # + # - A different asset host can be specified via config.action_controller.asset_host + # this is commonly used in conjunction with a CDN. + # + # Rails.application.config.action_controller.asset_host = "assets.example.com" + # asset_path("foo.js", skip_pipeline: true) # => "http://assets.example.com/foo.js" + # + # - An extension name can be specified manually with extname. + # + # asset_path("foo", skip_pipeline: true, extname: ".js") # => "/foo.js" + # asset_path("foo.css", skip_pipeline: true, extname: ".js") # => "/foo.css.js" + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:187 + def asset_path(source, options = T.unsafe(nil)); end + + # Computes the full URL to an asset in the public directory. This + # will use +asset_path+ internally, so most of their behaviors + # will be the same. If +:host+ options is set, it overwrites global + # +config.action_controller.asset_host+ setting. + # + # All other options provided are forwarded to +asset_path+ call. + # + # asset_url "application.js" # => http://example.com/assets/application.js + # asset_url "application.js", host: "http://cdn.example.com" # => http://cdn.example.com/assets/application.js + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:231 + def asset_url(source, options = T.unsafe(nil)); end + + # Computes the path to an audio asset in the public audios directory. + # Full paths from the document root will be passed through. + # Used internally by +audio_tag+ to build the audio path. + # + # audio_path("horse") # => /audios/horse + # audio_path("horse.wav") # => /audios/horse.wav + # audio_path("sounds/horse.wav") # => /audios/sounds/horse.wav + # audio_path("/sounds/horse.wav") # => /sounds/horse.wav + # audio_path("http://www.example.com/sounds/horse.wav") # => http://www.example.com/sounds/horse.wav + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:430 + def audio_path(source, options = T.unsafe(nil)); end + + # Computes the full URL to an audio asset in the public audios directory. + # This will use +audio_path+ internally, so most of their behaviors will be the same. + # Since +audio_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ + # options is set, it overwrites global +config.action_controller.asset_host+ setting. + # + # audio_url "horse.wav", host: "http://stage.example.com" # => http://stage.example.com/audios/horse.wav + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:442 + def audio_url(source, options = T.unsafe(nil)); end + + # Compute extname to append to asset path. Returns +nil+ if + # nothing should be added. + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:243 + def compute_asset_extname(source, options = T.unsafe(nil)); end + + # Pick an asset host for this source. Returns +nil+ if no host is set, + # the host if no wildcard is set, the host interpolated with the + # numbers 0-3 if it contains %d (the number is the source hash mod 4), + # or the value returned from invoking call on an object responding to call + # (proc or otherwise). + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:277 + def compute_asset_host(source = T.unsafe(nil), options = T.unsafe(nil)); end + + # Computes asset path to public directory. Plugins and + # extensions can override this method to point to custom assets + # or generate digested paths or query strings. + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:266 + def compute_asset_path(source, options = T.unsafe(nil)); end + + # Computes the path to a font asset. + # Full paths from the document root will be passed through. + # + # font_path("font") # => /fonts/font + # font_path("font.ttf") # => /fonts/font.ttf + # font_path("dir/font.ttf") # => /fonts/dir/font.ttf + # font_path("/dir/font.ttf") # => /dir/font.ttf + # font_path("http://www.example.com/dir/font.ttf") # => http://www.example.com/dir/font.ttf + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:455 + def font_path(source, options = T.unsafe(nil)); end + + # Computes the full URL to a font asset. + # This will use +font_path+ internally, so most of their behaviors will be the same. + # Since +font_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ + # options is set, it overwrites global +config.action_controller.asset_host+ setting. + # + # font_url "font.ttf", host: "http://stage.example.com" # => http://stage.example.com/fonts/font.ttf + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:467 + def font_url(source, options = T.unsafe(nil)); end + + # Computes the path to an image asset. + # Full paths from the document root will be passed through. + # Used internally by +image_tag+ to build the image path: + # + # image_path("edit") # => "/assets/edit" + # image_path("edit.png") # => "/assets/edit.png" + # image_path("icons/edit.png") # => "/assets/icons/edit.png" + # image_path("/icons/edit.png") # => "/icons/edit.png" + # image_path("http://www.example.com/img/edit.png") # => "http://www.example.com/img/edit.png" + # + # If you have images as application resources this method may conflict with their named routes. + # The alias +path_to_image+ is provided to avoid that. \Rails uses the alias internally, and + # plugin authors are encouraged to do so. + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:378 + def image_path(source, options = T.unsafe(nil)); end + + # Computes the full URL to an image asset. + # This will use +image_path+ internally, so most of their behaviors will be the same. + # Since +image_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ + # options is set, it overwrites global +config.action_controller.asset_host+ setting. + # + # image_url "edit.png", host: "http://stage.example.com" # => http://stage.example.com/assets/edit.png + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:390 + def image_url(source, options = T.unsafe(nil)); end + + # Computes the path to a JavaScript asset in the public javascripts directory. + # If the +source+ filename has no extension, .js will be appended (except for explicit URIs) + # Full paths from the document root will be passed through. + # Used internally by +javascript_include_tag+ to build the script path. + # + # javascript_path "xmlhr" # => /assets/xmlhr.js + # javascript_path "dir/xmlhr.js" # => /assets/dir/xmlhr.js + # javascript_path "/dir/xmlhr" # => /dir/xmlhr.js + # javascript_path "http://www.example.com/js/xmlhr" # => http://www.example.com/js/xmlhr + # javascript_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:321 + def javascript_path(source, options = T.unsafe(nil)); end + + # Computes the full URL to a JavaScript asset in the public javascripts directory. + # This will use +javascript_path+ internally, so most of their behaviors will be the same. + # Since +javascript_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ + # options is set, it overwrites global +config.action_controller.asset_host+ setting. + # + # javascript_url "js/xmlhr.js", host: "http://stage.example.com" # => http://stage.example.com/assets/js/xmlhr.js + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:333 + def javascript_url(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:219 + def path_to_asset(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:433 + def path_to_audio(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:458 + def path_to_font(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:381 + def path_to_image(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:324 + def path_to_javascript(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:351 + def path_to_stylesheet(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:407 + def path_to_video(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:270 + def public_compute_asset_path(source, options = T.unsafe(nil)); end + + # Computes the path to a stylesheet asset in the public stylesheets directory. + # If the +source+ filename has no extension, .css will be appended (except for explicit URIs). + # Full paths from the document root will be passed through. + # Used internally by +stylesheet_link_tag+ to build the stylesheet path. + # + # stylesheet_path "style" # => /assets/style.css + # stylesheet_path "dir/style.css" # => /assets/dir/style.css + # stylesheet_path "/dir/style.css" # => /dir/style.css + # stylesheet_path "http://www.example.com/css/style" # => http://www.example.com/css/style + # stylesheet_path "http://www.example.com/css/style.css" # => http://www.example.com/css/style.css + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:348 + def stylesheet_path(source, options = T.unsafe(nil)); end + + # Computes the full URL to a stylesheet asset in the public stylesheets directory. + # This will use +stylesheet_path+ internally, so most of their behaviors will be the same. + # Since +stylesheet_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ + # options is set, it overwrites global +config.action_controller.asset_host+ setting. + # + # stylesheet_url "css/style.css", host: "http://stage.example.com" # => http://stage.example.com/assets/css/style.css + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:360 + def stylesheet_url(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:234 + def url_to_asset(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:445 + def url_to_audio(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:470 + def url_to_font(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:393 + def url_to_image(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:336 + def url_to_javascript(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:363 + def url_to_stylesheet(source, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:419 + def url_to_video(source, options = T.unsafe(nil)); end + + # Computes the path to a video asset in the public videos directory. + # Full paths from the document root will be passed through. + # Used internally by +video_tag+ to build the video path. + # + # video_path("hd") # => /videos/hd + # video_path("hd.avi") # => /videos/hd.avi + # video_path("trailers/hd.avi") # => /videos/trailers/hd.avi + # video_path("/trailers/hd.avi") # => /trailers/hd.avi + # video_path("http://www.example.com/vid/hd.avi") # => http://www.example.com/vid/hd.avi + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:404 + def video_path(source, options = T.unsafe(nil)); end + + # Computes the full URL to a video asset in the public videos directory. + # This will use +video_path+ internally, so most of their behaviors will be the same. + # Since +video_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ + # options is set, it overwrites global +config.action_controller.asset_host+ setting. + # + # video_url "hd.avi", host: "http://stage.example.com" # => http://stage.example.com/videos/hd.avi + # + # pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:416 + def video_url(source, options = T.unsafe(nil)); end +end + +# aliased to avoid conflicts with an asset_url named route +# +# pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:236 +ActionView::Helpers::AssetUrlHelper::ASSET_EXTENSIONS = T.let(T.unsafe(nil), Hash) + +# Maps asset types to public directory. +# +# pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:254 +ActionView::Helpers::AssetUrlHelper::ASSET_PUBLIC_DIRECTORIES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionview#lib/action_view/helpers/asset_url_helper.rb:122 +ActionView::Helpers::AssetUrlHelper::URI_REGEXP = T.let(T.unsafe(nil), Regexp) + +# = Action View Atom Feed \Helpers +# +# pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:6 +module ActionView::Helpers::AtomFeedHelper + # Adds easy defaults to writing Atom feeds with the Builder template engine (this does not work on ERB or any other + # template languages). + # + # Full usage example: + # + # config/routes.rb: + # Rails.application.routes.draw do + # resources :posts + # root to: "posts#index" + # end + # + # app/controllers/posts_controller.rb: + # class PostsController < ApplicationController + # # GET /posts.html + # # GET /posts.atom + # def index + # @posts = Post.all + # + # respond_to do |format| + # format.html + # format.atom + # end + # end + # end + # + # app/views/posts/index.atom.builder: + # atom_feed do |feed| + # feed.title("My great blog!") + # feed.updated(@posts[0].created_at) if @posts.length > 0 + # + # @posts.each do |post| + # feed.entry(post) do |entry| + # entry.title(post.title) + # entry.content(post.body, type: 'html') + # + # entry.author do |author| + # author.name("DHH") + # end + # end + # end + # end + # + # The options for atom_feed are: + # + # * :language: Defaults to "en-US". + # * :root_url: The HTML alternative that this feed is doubling for. Defaults to / on the current host. + # * :url: The URL for this feed. Defaults to the current URL. + # * :id: The id for this feed. Defaults to "tag:localhost,2005:/posts", in this case. + # * :schema_date: The date at which the tag scheme for the feed was first used. A good default is the year you + # created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information. If not specified, + # 2005 is used (as an "I don't care" value). + # * :instruct: Hash of XML processing instructions in the form {target => {attribute => value, }} or {target => [{attribute => value, }, ]} + # + # Other namespaces can be added to the root element: + # + # app/views/posts/index.atom.builder: + # atom_feed({'xmlns:app' => 'http://www.w3.org/2007/app', + # 'xmlns:openSearch' => 'http://a9.com/-/spec/opensearch/1.1/'}) do |feed| + # feed.title("My great blog!") + # feed.updated((@posts.first.created_at)) + # feed.tag!('openSearch:totalResults', 10) + # + # @posts.each do |post| + # feed.entry(post) do |entry| + # entry.title(post.title) + # entry.content(post.body, type: 'html') + # entry.tag!('app:edited', Time.now) + # + # entry.author do |author| + # author.name("DHH") + # end + # end + # end + # end + # + # The Atom spec defines five elements (content rights title subtitle + # summary) which may directly contain XHTML content if type: 'xhtml' + # is specified as an attribute. If so, this helper will take care of + # the enclosing div and XHTML namespace declaration. Example usage: + # + # entry.summary type: 'xhtml' do |xhtml| + # xhtml.p pluralize(order.line_items.count, "line item") + # xhtml.p "Shipped to #{order.address}" + # xhtml.p "Paid by #{order.pay_type}" + # end + # + # + # atom_feed yields an +AtomFeedBuilder+ instance. Nested elements yield + # an +AtomBuilder+ instance. + # + # pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:96 + def atom_feed(options = T.unsafe(nil), &block); end +end + +# pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:127 +class ActionView::Helpers::AtomFeedHelper::AtomBuilder + # pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:130 + def initialize(xml); end + + private + + # Delegate to XML Builder, first wrapping the element in an XHTML + # namespaced div element if the method and arguments indicate + # that an xhtml_block? is desired. + # + # pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:138 + def method_missing(method, *arguments, &block); end + + # True if the method name matches one of the five elements defined + # in the Atom spec as potentially containing XHTML content and + # if type: 'xhtml' is, in fact, specified. + # + # pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:153 + def xhtml_block?(method, arguments); end +end + +# pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:128 +ActionView::Helpers::AtomFeedHelper::AtomBuilder::XHTML_TAG_NAMES = T.let(T.unsafe(nil), Set) + +# pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:161 +class ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder < ::ActionView::Helpers::AtomFeedHelper::AtomBuilder + # pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:162 + def initialize(xml, view, feed_options = T.unsafe(nil)); end + + # Creates an entry tag for a specific record and prefills the id using class and id. + # + # ==== Options + # + # * :published: Time first published. Defaults to the created_at attribute on the record if one such exists. + # * :updated: Time of update. Defaults to the updated_at attribute on the record if one such exists. + # * :url: The URL for this entry or +false+ or +nil+ for not having a link tag. Defaults to the +polymorphic_url+ for the record. + # * :id: The ID for this entry. Defaults to "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}" + # * :type: The TYPE for this entry. Defaults to "text/html". + # + # pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:180 + def entry(record, options = T.unsafe(nil)); end + + # Accepts a Date or Time object and inserts it in the proper format. If +nil+ is passed, current time in UTC is used. + # + # pkg:gem/actionview#lib/action_view/helpers/atom_feed_helper.rb:167 + def updated(date_or_time = T.unsafe(nil)); end +end + +# = Action View Cache \Helpers +# +# pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:6 +module ActionView::Helpers::CacheHelper + # This helper exposes a method for caching fragments of a view + # rather than an entire action or page. This technique is useful + # caching pieces like menus, lists of new topics, static HTML + # fragments, and so on. This method takes a block that contains + # the content you wish to cache. + # + # The best way to use this is by doing recyclable key-based cache expiration + # on top of a cache store like Memcached or Redis that'll automatically + # kick out old entries. + # + # When using this method, you list the cache dependency as the name of the cache, like so: + # + # <% cache project do %> + # All the topics on this project + # <%= render project.topics %> + # <% end %> + # + # This approach will assume that when a new topic is added, you'll touch + # the project. The cache key generated from this call will be something like: + # + # views/template/action:7a1156131a6928cb0026877f8b749ac9/projects/123 + # ^template path ^template tree digest ^class ^id + # + # This cache key is stable, but it's combined with a cache version derived from the project + # record. When the project updated_at is touched, the #cache_version changes, even + # if the key stays stable. This means that unlike a traditional key-based cache expiration + # approach, you won't be generating cache trash, unused keys, simply because the dependent + # record is updated. + # + # If your template cache depends on multiple sources (try to avoid this to keep things simple), + # you can name all these dependencies as part of an array: + # + # <% cache [ project, current_user ] do %> + # All the topics on this project + # <%= render project.topics %> + # <% end %> + # + # This will include both records as part of the cache key and updating either of them will + # expire the cache. + # + # ==== \Template digest + # + # The template digest that's added to the cache key is computed by taking an MD5 of the + # contents of the entire template file. This ensures that your caches will automatically + # expire when you change the template file. + # + # Note that the MD5 is taken of the entire template file, not just what's within the + # cache do/end call. So it's possible that changing something outside of that call will + # still expire the cache. + # + # Additionally, the digestor will automatically look through your template file for + # explicit and implicit dependencies, and include those as part of the digest. + # + # The digestor can be bypassed by passing skip_digest: true as an option to the cache call: + # + # <% cache project, skip_digest: true do %> + # All the topics on this project + # <%= render project.topics %> + # <% end %> + # + # ==== Implicit dependencies + # + # Most template dependencies can be derived from calls to render in the template itself. + # Here are some examples of render calls that Cache Digests knows how to decode: + # + # render partial: "comments/comment", collection: commentable.comments + # render "comments/comments" + # render 'comments/comments' + # render('comments/comments') + # + # render "header" # translates to render("comments/header") + # + # render(@topic) # translates to render("topics/topic") + # render(topics) # translates to render("topics/topic") + # render(message.topics) # translates to render("topics/topic") + # + # It's not possible to derive all render calls like that, though. + # Here are a few examples of things that can't be derived: + # + # render group_of_attachments + # render @project.documents.where(published: true).order('created_at') + # + # You will have to rewrite those to the explicit form: + # + # render partial: 'attachments/attachment', collection: group_of_attachments + # render partial: 'documents/document', collection: @project.documents.where(published: true).order('created_at') + # + # One last type of dependency can be determined implicitly: + # + # render "maintenance_tasks/runs/info/#{run.status}" + # + # Because the value passed to render ends in interpolation, Action View + # will mark all partials within the "maintenance_tasks/runs/info" folder as + # dependencies. + # + # === Explicit dependencies + # + # Sometimes you'll have template dependencies that can't be derived at all. This is typically + # the case when you have template rendering that happens in helpers. Here's an example: + # + # <%= render_sortable_todolists @project.todolists %> + # + # You'll need to use a special comment format to call those out: + # + # <%# Template Dependency: todolists/todolist %> + # <%= render_sortable_todolists @project.todolists %> + # + # In some cases, like a single table inheritance setup, you might have + # a bunch of explicit dependencies. Instead of writing every template out, + # you can use a wildcard to match any template in a directory: + # + # <%# Template Dependency: events/* %> + # <%= render_categorizable_events @person.events %> + # + # This marks every template in the directory as a dependency. To find those + # templates, the wildcard path must be absolutely defined from app/views or paths + # otherwise added with +prepend_view_path+ or +append_view_path+. + # This way the wildcard for app/views/recordings/events would be recordings/events/* etc. + # + # The pattern used to match explicit dependencies is /# Template Dependency: (\S+)/, + # so it's important that you type it out just so. + # You can only declare one template dependency per line. + # + # === External dependencies + # + # If you use a helper method, for example, inside a cached block and + # you then update that helper, you'll have to bump the cache as well. + # It doesn't really matter how you do it, but the MD5 of the template file + # must change. One recommendation is to simply be explicit in a comment, like: + # + # <%# Helper Dependency Updated: May 6, 2012 at 6pm %> + # <%= some_helper_method(person) %> + # + # Now all you have to do is change that timestamp when the helper method changes. + # + # === Collection Caching + # + # When rendering a collection of objects that each use the same partial, a :cached + # option can be passed. + # + # For collections rendered such: + # + # <%= render partial: 'projects/project', collection: @projects, cached: true %> + # + # The cached: true will make Action View's rendering read several templates + # from cache at once instead of one call per template. + # + # Templates in the collection not already cached are written to cache. + # + # Works great alongside individual template fragment caching. + # For instance if the template the collection renders is cached like: + # + # # projects/_project.html.erb + # <% cache project do %> + # <%# ... %> + # <% end %> + # + # Any collection renders will find those cached templates when attempting + # to read multiple templates at once. + # + # If your collection cache depends on multiple sources (try to avoid this to keep things simple), + # you can name all these dependencies as part of a block that returns an array: + # + # <%= render partial: 'projects/project', collection: @projects, cached: -> project { [ project, current_user ] } %> + # + # This will include both records as part of the cache key and updating either of them will + # expire the cache. + # + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:176 + def cache(name = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # This helper returns the name of a cache key for a given fragment cache + # call. By supplying skip_digest: true to cache, the digestion of cache + # fragments can be manually bypassed. This is useful when cache fragments + # cannot be manually expired unless you know the exact key which is the + # case when using memcached. + # + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:248 + def cache_fragment_name(name = T.unsafe(nil), skip_digest: T.unsafe(nil), digest_path: T.unsafe(nil)); end + + # Cache fragments of a view if +condition+ is true + # + # <% cache_if admin?, project do %> + # All the topics on this project + # <%= render project.topics %> + # <% end %> + # + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:223 + def cache_if(condition, name = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # Cache fragments of a view unless +condition+ is true + # + # <% cache_unless admin?, project do %> + # All the topics on this project + # <%= render project.topics %> + # <% end %> + # + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:239 + def cache_unless(condition, name = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # Returns whether the current view fragment is within a +cache+ block. + # + # Useful when certain fragments aren't cacheable: + # + # <% cache project do %> + # <% raise StandardError, "Caching private data!" if caching? %> + # <% end %> + # + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:196 + def caching?; end + + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:256 + def digest_path_from_template(template); end + + # Raises UncacheableFragmentError when called from within a +cache+ block. + # + # Useful to denote helper methods that can't participate in fragment caching: + # + # def project_name_with_time(project) + # uncacheable! + # "#{project.name} - #{Time.now}" + # end + # + # # Which will then raise if used within a `cache` block: + # <% cache project do %> + # <%= project_name_with_time(project) %> + # <% end %> + # + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:213 + def uncacheable!; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:278 + def fragment_for(name = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:267 + def fragment_name_with_digest(name, digest_path); end + + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:288 + def read_fragment_for(name, options); end + + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:292 + def write_fragment_for(name, options, &block); end +end + +# pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:297 +module ActionView::Helpers::CacheHelper::CachingRegistry + extend ::ActionView::Helpers::CacheHelper::CachingRegistry + + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:300 + def caching?; end + + # pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:304 + def track_caching; end +end + +# pkg:gem/actionview#lib/action_view/helpers/cache_helper.rb:7 +class ActionView::Helpers::CacheHelper::UncacheableFragmentError < ::StandardError; end + +# = Action View Capture \Helpers +# +# \CaptureHelper exposes methods to let you extract generated markup which +# can be used in other parts of a template or layout file. +# +# It provides a method to capture blocks into variables through #capture and +# a way to capture a block of markup for use in a layout through #content_for. +# +# As well as provides a method when using streaming responses through #provide. +# See ActionController::Streaming for more information. +# +# pkg:gem/actionview#lib/action_view/helpers/capture_helper.rb:17 +module ActionView::Helpers::CaptureHelper + # The capture method extracts part of a template as a string object. + # You can then use this object anywhere in your templates, layout, or helpers. + # + # The capture method can be used in \ERB templates... + # + # <% @greeting = capture do %> + # Welcome to my shiny new web page! The date and time is + # <%= Time.now %> + # <% end %> + # + # ...and Builder (RXML) templates. + # + # @timestamp = capture do + # "The current timestamp is #{Time.now}." + # end + # + # You can then use that variable anywhere else. For example: + # + # + # <%= @greeting %> + # + # <%= @greeting %> + # + # + # + # The return of capture is the string generated by the block. For Example: + # + # @greeting # => "Welcome to my shiny new web page! The date and time is 2018-09-06 11:09:16 -0500" + # + # pkg:gem/actionview#lib/action_view/helpers/capture_helper.rb:47 + def capture(*, **, &block); end + + # Calling content_for stores a block of markup in an identifier for later use. + # In order to access this stored content in other templates, helper modules + # or the layout, you would pass the identifier as an argument to content_for. + # + # Note: yield can still be used to retrieve the stored content, but calling + # yield doesn't work in helper modules, while content_for does. + # + # <% content_for :not_authorized do %> + # alert('You are not authorized to do that!') + # <% end %> + # + # You can then use content_for :not_authorized anywhere in your templates. + # + # <%= content_for :not_authorized if current_user.nil? %> + # + # This is equivalent to: + # + # <%= yield :not_authorized if current_user.nil? %> + # + # content_for, however, can also be used in helper modules. + # + # module StorageHelper + # def stored_content + # content_for(:storage) || "Your storage is empty" + # end + # end + # + # This helper works just like normal helpers. + # + # <%= stored_content %> + # + # You can also use the yield syntax alongside an existing call to + # yield in a layout. For example: + # + # <%# This is the layout %> + # + # + # My Website + # <%= yield :script %> + # + # + # <%= yield %> + # + # + # + # And now, we'll create a view that has a content_for call that + # creates the script identifier. + # + # <%# This is our view %> + # Please login! + # + # <% content_for :script do %> + # + # <% end %> + # + # Then, in another view, you could to do something like this: + # + # <%= link_to 'Logout', action: 'logout', remote: true %> + # + # <% content_for :script do %> + # <%= javascript_include_tag :defaults %> + # <% end %> + # + # That will place +script+ tags for your default set of JavaScript files on the page; + # this technique is useful if you'll only be using these scripts in a few views. + # + # Note that content_for concatenates (default) the blocks it is given for a particular + # identifier in order. For example: + # + # <% content_for :navigation do %> + #
  • <%= link_to 'Home', action: 'index' %>
  • + # <% end %> + # + # And in another place: + # + # <% content_for :navigation do %> + #
  • <%= link_to 'Login', action: 'login' %>
  • + # <% end %> + # + # Then, in another template or layout, this code would render both links in order: + # + #
      <%= content_for :navigation %>
    + # + # If the flush parameter is +true+ content_for replaces the blocks it is given. For example: + # + # <% content_for :navigation do %> + #
  • <%= link_to 'Home', action: 'index' %>
  • + # <% end %> + # + # <%# Add some other content, or use a different template: %> + # + # <% content_for :navigation, flush: true do %> + #
  • <%= link_to 'Login', action: 'login' %>
  • + # <% end %> + # + # Then, in another template or layout, this code would render only the last link: + # + #
      <%= content_for :navigation %>
    + # + # Lastly, simple content can be passed as a parameter: + # + # <% content_for :script, javascript_include_tag(:defaults) %> + # + # WARNING: content_for is ignored in caches. So you shouldn't use it for elements that will be fragment cached. + # + # pkg:gem/actionview#lib/action_view/helpers/capture_helper.rb:172 + def content_for(name, content = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # content_for? checks whether any content has been captured yet using content_for. + # + # Useful to render parts of your layout differently based on what is in your views. + # + # <%# This is the layout %> + # + # + # My Website + # <%= yield :script %> + # + # + # <%= yield %> + # <%= yield :right_col %> + # + # + # + # pkg:gem/actionview#lib/action_view/helpers/capture_helper.rb:215 + def content_for?(name); end + + # The same as +content_for+ but when used with streaming flushes + # straight back to the layout. In other words, if you want to + # concatenate several times to the same buffer when rendering a given + # template, you should use +content_for+, if not, use +provide+ to tell + # the layout to stop looking for more contents. + # + # See ActionController::Streaming for more information. + # + # pkg:gem/actionview#lib/action_view/helpers/capture_helper.rb:194 + def provide(name, content = T.unsafe(nil), &block); end + + # Use an alternate output buffer for the duration of the block. + # Defaults to a new empty string. + # + # pkg:gem/actionview#lib/action_view/helpers/capture_helper.rb:221 + def with_output_buffer(buf = T.unsafe(nil)); end +end + +# pkg:gem/actionview#lib/action_view/helpers/content_exfiltration_prevention_helper.rb:5 +module ActionView::Helpers::ContentExfiltrationPreventionHelper + # pkg:gem/actionview#lib/action_view/helpers/content_exfiltration_prevention_helper.rb:6 + def prepend_content_exfiltration_prevention; end + + # pkg:gem/actionview#lib/action_view/helpers/content_exfiltration_prevention_helper.rb:6 + def prepend_content_exfiltration_prevention=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/content_exfiltration_prevention_helper.rb:61 + def prevent_content_exfiltration(html); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/content_exfiltration_prevention_helper.rb:6 + def prepend_content_exfiltration_prevention; end + + # pkg:gem/actionview#lib/action_view/helpers/content_exfiltration_prevention_helper.rb:6 + def prepend_content_exfiltration_prevention=(val); end + end +end + +# Close any open tags that support CDATA (textarea, xmp) before each form tag. +# This prevents attackers from injecting unclosed tags that could capture +# form contents. +# +# For example, an attacker might inject: +# +#
    or +# the end of the document would be captured by the attacker's +# + # + # textarea(:comment, :text, size: "20x30") + # # => + # + # textarea(:application, :notes, cols: 40, rows: 15, class: 'app_input') + # # => + # + # textarea(:entry, :body, size: "20x20", disabled: 'disabled') + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:1277 + def textarea(object_name, method, options = T.unsafe(nil)); end + + # Returns a text_field of type "time". + # + # The default value is generated by trying to call +strftime+ with "%T.%L" + # on the object's value. If you pass include_seconds: false, it will be + # formatted by trying to call +strftime+ with "%H:%M" on the object's value. + # It is also possible to override this by passing the "value" option. + # + # ==== Options + # + # Supports the same options as FormTagHelper#time_field_tag. + # + # ==== Examples + # + # time_field("task", "started_at") + # # => + # + # You can create values for the "min" and "max" attributes by passing + # instances of Date or Time to the options hash. + # + # time_field("task", "started_at", min: Time.now) + # # => + # + # Alternatively, you can pass a String formatted as an ISO8601 time as the + # values for "min" and "max." + # + # time_field("task", "started_at", min: "01:00:00") + # # => + # + # By default, provided times will be formatted including seconds. You can render just the hour + # and minute by passing include_seconds: false. Some browsers will render a simpler UI + # if you exclude seconds in the timestamp format. + # + # time_field("task", "started_at", value: Time.now, include_seconds: false) + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:1479 + def time_field(object_name, method, options = T.unsafe(nil)); end + + # Returns a text_field of type "url". + # + # url_field("user", "homepage") + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:1559 + def url_field(object_name, method, options = T.unsafe(nil)); end + + # Returns a text_field of type "week". + # + # week_field("user", "born_on") + # # => + # + # The default value is generated by trying to call +strftime+ with "%Y-W%W" + # on the object's value, which makes it behave as expected for instances + # of DateTime and ActiveSupport::TimeWithZone. + # + # @user.born_on = Date.new(1984, 5, 12) + # week_field("user", "born_on") + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:1550 + def week_field(object_name, method, options = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:465 + def apply_form_for_options!(object, options); end + + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:1624 + def default_form_builder_class; end + + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:1595 + def html_options_for_form_with(url_for_options = T.unsafe(nil), model = T.unsafe(nil), html: T.unsafe(nil), local: T.unsafe(nil), skip_enforcing_utf8: T.unsafe(nil), **options); end + + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:1610 + def instantiate_builder(record_name, record_object, options); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:481 + def form_with_generates_ids; end + + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:481 + def form_with_generates_ids=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:479 + def form_with_generates_remote_forms; end + + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:479 + def form_with_generates_remote_forms=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:483 + def multiple_file_field_include_hidden; end + + # pkg:gem/actionview#lib/action_view/helpers/form_helper.rb:483 + def multiple_file_field_include_hidden=(val); end + end +end + +# = Action View Form Option \Helpers +# +# Provides a number of methods for turning different kinds of containers into a set of option tags. +# +# The #collection_select, #select and #time_zone_select methods take an options parameter, a hash: +# +# * :include_blank - set to true or a prompt string if the first option element of the select element is a blank. Useful if there is not a default value required for the select element. +# +# select(:post, :category, Post::CATEGORIES, { include_blank: true }) +# +# could become: +# +# +# +# Another common case is a select tag for a belongs_to-associated object. +# +# Example with @post.person_id => 2: +# +# select(:post, :person_id, Person.all.collect { |p| [ p.name, p.id ] }, { include_blank: "None" }) +# +# could become: +# +# +# +# * :prompt - set to true or a prompt string. When the select element doesn't have a value yet, this prepends an option with a generic prompt -- "Please select" -- or the given prompt string. +# +# select(:post, :person_id, Person.all.collect { |p| [ p.name, p.id ] }, { prompt: "Select Person" }) +# +# could become: +# +# +# +# * :index - like the other form helpers, #select can accept an :index option to manually set the ID used in the resulting output. Unlike other helpers, #select expects this +# option to be in the +html_options+ parameter. +# +# select("album[]", :genre, %w[ rap rock country ], {}, { index: nil }) +# +# becomes: +# +# +# +# * :disabled - can be a single value or an array of values that will be disabled options in the final output. +# +# select(:post, :category, Post::CATEGORIES, { disabled: "restricted" }) +# +# could become: +# +# +# +# When used with the #collection_select helper, :disabled can also be a Proc that identifies those options that should be disabled. +# +# collection_select(:post, :category_id, Category.all, :id, :name, { disabled: -> (category) { category.archived? } }) +# +# If the categories "2008 stuff" and "Christmas" return true when the method archived? is called, this would return: +# +# +# pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:93 +module ActionView::Helpers::FormOptionsHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + include ::ActionView::Helpers::TagHelper + include ::ActionView::Helpers::TextHelper + extend ::ActionView::Helpers::SanitizeHelper::ClassMethods + + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:792 + def collection_check_boxes(object, method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Returns check box tags for the collection of existing return values of + # +method+ for +object+'s class. The value returned from calling +method+ + # on the instance +object+ will be selected. If calling +method+ returns + # +nil+, no selection is made. + # + # The :value_method and :text_method parameters are + # methods to be called on each member of +collection+. The return values + # are used as the +value+ attribute and contents of each check box tag, + # respectively. They can also be any object that responds to +call+, such + # as a +proc+, that will be called for each member of the +collection+ to + # retrieve the value/text. + # + # Example object structure for use with this method: + # class Post < ActiveRecord::Base + # has_and_belongs_to_many :authors + # end + # class Author < ActiveRecord::Base + # has_and_belongs_to_many :posts + # def name_with_initial + # "#{first_name.first}. #{last_name}" + # end + # end + # + # Sample usage (selecting the associated Author for an instance of Post, @post): + # collection_checkboxes(:post, :author_ids, Author.all, :id, :name_with_initial) + # + # If @post.author_ids is already [1], this would return: + # + # + # + # + # + # + # + # + # It is also possible to customize the way the elements will be shown by + # giving a block to the method: + # collection_checkboxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| + # b.label { b.checkbox } + # end + # + # The argument passed to the block is a special kind of builder for this + # collection, which has the ability to generate the label and check box + # for the current item in the collection, with proper text and value. + # Using it, you can change the label and check box display order or even + # use the label as wrapper, as in the example above. + # + # The builder methods label and checkbox also accept + # extra HTML options: + # collection_checkboxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| + # b.label(class: "checkbox") { b.checkbox(class: "checkbox") } + # end + # + # There are also three special methods available: object, text and + # value, which are the current item being rendered, its text and value methods, + # respectively. You can use them like this: + # collection_checkboxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| + # b.label(:"data-value" => b.value) { b.checkbox + b.text } + # end + # + # ==== Gotcha + # + # When no selection is made for a collection of checkboxes most + # web browsers will not send any value. + # + # For example, if we have a +User+ model with +category_ids+ field and we + # have the following code in our update action: + # + # @user.update(params[:user]) + # + # If no +category_ids+ are selected then we can safely assume this field + # will not be updated. + # + # This is possible thanks to a hidden field generated by the helper method + # for every collection of checkboxes. + # This hidden field is given the same field name as the checkboxes with a + # blank value. + # + # In the rare case you don't want this hidden field, you can pass the + # include_hidden: false option to the helper method. + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:789 + def collection_checkboxes(object, method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Returns radio button tags for the collection of existing return values + # of +method+ for +object+'s class. The value returned from calling + # +method+ on the instance +object+ will be selected. If calling +method+ + # returns +nil+, no selection is made. + # + # The :value_method and :text_method parameters are + # methods to be called on each member of +collection+. The return values + # are used as the +value+ attribute and contents of each radio button tag, + # respectively. They can also be any object that responds to +call+, such + # as a +proc+, that will be called for each member of the +collection+ to + # retrieve the value/text. + # + # Example object structure for use with this method: + # + # class Post < ActiveRecord::Base + # belongs_to :author + # end + # + # class Author < ActiveRecord::Base + # has_many :posts + # + # def name_with_initial + # "#{first_name.first}. #{last_name}" + # end + # end + # + # Sample usage (selecting the associated Author for an instance of Post, @post): + # collection_radio_buttons(:post, :author_id, Author.all, :id, :name_with_initial) + # + # If @post.author_id is already 1, this would return: + # + # + # + # + # + # + # + # It is also possible to customize the way the elements will be shown by + # giving a block to the method: + # collection_radio_buttons(:post, :author_id, Author.all, :id, :name_with_initial) do |b| + # b.label { b.radio_button } + # end + # + # The argument passed to the block is a special kind of builder for this + # collection, which has the ability to generate the label and radio button + # for the current item in the collection, with proper text and value. + # Using it, you can change the label and radio button display order or + # even use the label as wrapper, as in the example above. + # + # The builder methods label and radio_button also accept + # extra HTML options: + # collection_radio_buttons(:post, :author_id, Author.all, :id, :name_with_initial) do |b| + # b.label(class: "radio_button") { b.radio_button(class: "radio_button") } + # end + # + # There are also three special methods available: object, text and + # value, which are the current item being rendered, its text and value methods, + # respectively. You can use them like this: + # collection_radio_buttons(:post, :author_id, Author.all, :id, :name_with_initial) do |b| + # b.label(:"data-value" => b.value) { b.radio_button + b.text } + # end + # + # ==== Gotcha + # + # The HTML specification says when nothing is selected on a collection of radio buttons + # web browsers do not send any value to server. + # Unfortunately this introduces a gotcha: + # if a +User+ model has a +category_id+ field and in the form no category is selected, no +category_id+ parameter is sent. So, + # any strong parameters idiom like: + # + # params.expect(user: [...]) + # + # will raise an error since no {user: ...} will be present. + # + # To prevent this the helper generates an auxiliary hidden field before + # every collection of radio buttons. The hidden field has the same name as collection radio button and blank value. + # + # In case if you don't want the helper to generate this hidden field you can specify + # include_hidden: false option. + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:705 + def collection_radio_buttons(object, method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Returns + # + # + # + # + # + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:198 + def collection_select(object, method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end + + # Returns + # + # + # + # + # + # + # + # + # + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:257 + def grouped_collection_select(object, method, collection, group_method, group_label_method, option_key_method, option_value_method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end + + # Returns a string of tags, like #options_for_select, but + # wraps them with tags: + # + # grouped_options = [ + # ['North America', + # [['United States','US'],'Canada']], + # ['Europe', + # ['Denmark','Germany','France']] + # ] + # grouped_options_for_select(grouped_options) + # + # grouped_options = { + # 'North America' => [['United States','US'], 'Canada'], + # 'Europe' => ['Denmark','Germany','France'] + # } + # grouped_options_for_select(grouped_options) + # + # Possible output: + # + # + # + # + # + # + # + # + # + # + # ==== Parameters + # + # * +grouped_options+ - Accepts a nested array or hash of strings. The first value serves as the + # label while the second value must be an array of options. The second value can be a + # nested array of text-value pairs. See options_for_select for more info. + # Ex. ["North America",[["United States","US"],["Canada","CA"]]] + # An optional third value can be provided as HTML attributes for the optgroup. + # Ex. ["North America",[["United States","US"],["Canada","CA"]], { disabled: "disabled" }] + # * +selected_key+ - A value equal to the +value+ attribute for one of the tags, + # which will have the +selected+ attribute set. Note: It is possible for this value to match multiple options + # as you might have the same option in multiple groups. Each will then get selected="selected". + # + # ==== Options + # + # * :prompt - set to true or a prompt string. When the select element doesn't have a value yet, this + # prepends an option with a generic prompt - "Please select" - or the given prompt string. + # * :divider - the divider for the options groups. + # + # grouped_options = [ + # [['United States','US'], 'Canada'], + # ['Denmark','Germany','France'] + # ] + # grouped_options_for_select(grouped_options, nil, divider: '---------') + # + # Possible output: + # + # + # + # + # + # + # + # + # + # + # Note: Only the and tags are returned, so you still have to + # wrap the output in an appropriate tag. + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:466 + def option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = T.unsafe(nil)); end + + # Accepts a container (hash, array, enumerable, your type) and returns a string of option tags. Given a container + # where the elements respond to first and last (such as a two-element array), the "lasts" serve as option values and + # the "firsts" as option text. Hashes are turned into this form automatically, so the keys become "firsts" and values + # become lasts. If +selected+ is specified, the matching "last" or element will get the selected option-tag. +selected+ + # may also be an array of values to be selected when using a multiple select. + # + # options_for_select([["Dollar", "$"], ["Kroner", "DKK"]]) + # # => + # # => + # + # options_for_select([ "VISA", "MasterCard" ], "MasterCard") + # # => + # # => + # + # options_for_select({ "Basic" => "$20", "Plus" => "$40" }, "$40") + # # => + # # => + # + # options_for_select([ "VISA", "MasterCard", "Discover" ], ["VISA", "Discover"]) + # # => + # # => + # # => + # + # You can optionally provide HTML attributes as the last element of the array. + # + # options_for_select([ "Denmark", ["USA", { class: 'bold' }], "Sweden" ], ["USA", "Sweden"]) + # # => + # # => + # # => + # + # options_for_select([["Dollar", "$", { class: "bold" }], ["Kroner", "DKK", { onclick: "alert('HI');" }]]) + # # => + # # => + # + # If you wish to specify disabled option tags, set +selected+ to be a hash, with :disabled being either a value + # or array of values to be disabled. In this case, you can use :selected to specify selected option tags. + # + # options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], disabled: "Super Platinum") + # # => + # # => + # # => + # # => + # + # options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], disabled: ["Advanced", "Super Platinum"]) + # # => + # # => + # # => + # # => + # + # options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], selected: "Free", disabled: "Super Platinum") + # # => + # # => + # # => + # # => + # + # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:357 + def options_for_select(container, selected = T.unsafe(nil)); end + + # Returns a string of option tags that have been compiled by iterating over the +collection+ and assigning + # the result of a call to the +value_method+ as the option value and the +text_method+ as the option text. + # + # options_from_collection_for_select(@people, 'id', 'name') + # # => + # + # This is more often than not used inside a #select_tag like this example: + # + # select_tag 'person', options_from_collection_for_select(@people, 'id', 'name') + # + # The +value_method+ and +text_method+ can be a method name to call on each member of the +collection+, + # or a Proc that will be called for each member of the +collection+: + # + # options_from_collection_for_select(@people, Proc.new { |person| person.id }, Proc.new { |person| person.name }) + # + # If +selected+ is specified as a value or array of values, the element(s) returning a match on +value_method+ + # will be selected option tag(s). + # + # If +selected+ is specified as a Proc, those members of the collection that return true for the anonymous + # function are the selected values. + # + # +selected+ can also be a hash, specifying both :selected and/or :disabled values as required. + # + # Be sure to specify the same class as the +value_method+ when specifying selected or disabled options. + # Failure to do this will produce undesired results. Example: + # options_from_collection_for_select(@people, 'id', 'name', '1') + # Will not select a person with the id of 1 because 1 (an Integer) is not the same as '1' (a string) + # options_from_collection_for_select(@people, 'id', 'name', 1) + # should produce the desired results. + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:405 + def options_from_collection_for_select(collection, value_method, text_method, selected = T.unsafe(nil)); end + + # Create a select tag and a series of contained option tags for the provided object and method. + # The option currently held by the object will be selected, provided that the object is available. + # + # There are two possible formats for the +choices+ parameter, corresponding to other helpers' output: + # + # * A flat collection (see options_for_select). + # * A nested collection (see grouped_options_for_select). + # + # Example with @post.person_id => 2: + # + # select :post, :person_id, Person.all.collect { |p| [ p.name, p.id ] }, { include_blank: true } + # + # would become: + # + # + # + # This can be used to provide a default set of options in the standard way: before rendering the create form, a + # new model instance is assigned the default options and bound to @model_name. Usually this model is not saved + # to the database. Instead, a second model object is created when the create request is received. + # This allows the user to submit a form page more than once with the expected results of creating multiple records. + # In addition, this allows a single partial to be used to generate form inputs for both edit and create forms. + # + # By default, post.person_id is the selected option. Specify selected: value to use a different selection + # or selected: nil to leave all options unselected. Similarly, you can specify values to be disabled in the option + # tags by specifying the :disabled option. This can either be a single value or an array of values to be disabled. + # + # A block can be passed to #select to customize how the options tags will be rendered. This + # is useful when the options tag has complex attributes. + # + # select(report, :campaign_ids) do + # available_campaigns.each do |c| + # tag.option(c.name, value: c.id, data: { tags: c.tags.to_json }) + # end + # end + # + # ==== Gotcha + # + # The HTML specification says when +multiple+ parameter passed to select and all options got deselected + # web browsers do not send any value to server. Unfortunately this introduces a gotcha: + # if a +User+ model has many +roles+ and have +role_ids+ accessor, and in the form that edits roles of the user + # the user deselects all roles from +role_ids+ multiple select box, no +role_ids+ parameter is sent. So, + # any mass-assignment idiom like + # + # @user.update(params[:user]) + # + # wouldn't update roles. + # + # To prevent this the helper generates an auxiliary hidden field before + # every multiple select. The hidden field has the same name as multiple select and blank value. + # + # Note: The client either sends only the hidden field (representing + # the deselected multiple select box), or both fields. This means that the resulting array + # always contains a blank string. + # + # In case if you don't want the helper to generate this hidden field you can specify + # include_hidden: false option. + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:158 + def select(object, method, choices = T.unsafe(nil), options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Returns a string of option tags for pretty much any time zone in the + # world. Supply an ActiveSupport::TimeZone name as +selected+ to have it + # marked as the selected option tag. You can also supply an array of + # ActiveSupport::TimeZone objects as +priority_zones+, so that they will + # be listed above the rest of the (long) list. (You can use + # ActiveSupport::TimeZone.us_zones as a convenience for obtaining a list + # of the US time zones, or a Regexp to select the zones of your choice) + # + # The +selected+ parameter must be either +nil+, or a string that names + # an ActiveSupport::TimeZone. + # + # By default, +model+ is the ActiveSupport::TimeZone constant (which can + # be obtained in Active Record as a value object). The +model+ parameter + # must respond to +all+ and return an array of objects that represent time + # zones; each object must respond to +name+. If a Regexp is given it will + # attempt to match the zones using match? method. + # + # NOTE: Only the option tags are returned, you have to wrap this call in + # a regular HTML select tag. + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:585 + def time_zone_options_for_select(selected = T.unsafe(nil), priority_zones = T.unsafe(nil), model = T.unsafe(nil)); end + + # Returns select and option tags for the given object and method, using + # #time_zone_options_for_select to generate the list of option tags. + # + # In addition to the :include_blank option documented above, + # this method also supports a :model option, which defaults + # to ActiveSupport::TimeZone. This may be used by users to specify a + # different time zone model object. (See #time_zone_options_for_select + # for more information.) + # + # You can also supply an array of ActiveSupport::TimeZone objects + # as +priority_zones+ so that they will be listed above the rest of the + # (long) list. You can use ActiveSupport::TimeZone.us_zones for a list + # of US time zones, ActiveSupport::TimeZone.country_zones(country_code) + # for another country's time zones, or a Regexp to select the zones of + # your choice. + # + # Finally, this method supports a :default option, which selects + # a default ActiveSupport::TimeZone if the object's time zone is +nil+. + # + # time_zone_select(:user, :time_zone, nil, include_blank: true) + # + # time_zone_select(:user, :time_zone, nil, default: "Pacific Time (US & Canada)") + # + # time_zone_select(:user, :time_zone, ActiveSupport::TimeZone.us_zones, default: "Pacific Time (US & Canada)") + # + # time_zone_select(:user, :time_zone, [ ActiveSupport::TimeZone["Alaska"], ActiveSupport::TimeZone["Hawaii"] ]) + # + # time_zone_select(:user, :time_zone, /Australia/) + # + # time_zone_select(:user, :time_zone, ActiveSupport::TimeZone.all.sort, model: ActiveSupport::TimeZone) + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:291 + def time_zone_select(object, method, priority_zones = T.unsafe(nil), options = T.unsafe(nil), html_options = T.unsafe(nil)); end + + # Returns a string of option tags for the days of the week. + # + # ====Options + # + # * :index_as_value - Defaults to false, set to true to use the indexes from + # I18n.translate("date.day_names") as the values. By default, Sunday is always 0. + # * :day_format - The I18n key of the array to use for the weekday options. + # Defaults to +:day_names+, set to +:abbr_day_names+ for abbreviations. + # * :beginning_of_week - Defaults to Date.beginning_of_week. + # + # NOTE: Only the option tags are returned, you have to wrap this call in + # a regular HTML select tag. + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:618 + def weekday_options_for_select(selected = T.unsafe(nil), index_as_value: T.unsafe(nil), day_format: T.unsafe(nil), beginning_of_week: T.unsafe(nil)); end + + # Returns select and option tags for the given object and method, using + # #weekday_options_for_select to generate the list of option tags. + # + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:297 + def weekday_select(object, method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:817 + def extract_selected_and_disabled(selected); end + + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:828 + def extract_values_from_collection(collection, value_method, selected); end + + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:795 + def option_html_attributes(element); end + + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:803 + def option_text_and_value(option); end + + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:813 + def option_value_selected?(value, selected); end + + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:842 + def prompt_text(prompt); end + + # pkg:gem/actionview#lib/action_view/helpers/form_options_helper.rb:838 + def value_for_collection(item, value); end +end + +# = Action View Form Tag \Helpers +# +# Provides a number of methods for creating form tags that don't rely on an Active Record object assigned to the template like +# FormHelper does. Instead, you provide the names and values manually. +# +# NOTE: The HTML options disabled, readonly, and multiple can all be treated as booleans. So specifying +# disabled: true will give disabled="disabled". +# +# pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:18 +module ActionView::Helpers::FormTagHelper + include ::ActionView::Helpers::ContentExfiltrationPreventionHelper + extend ::ActiveSupport::Concern + include ::ActionView::Helpers::UrlHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::TextHelper + + mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods + mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods + + # Creates a button element that defines a submit button, + # reset button or a generic button which can be used in + # JavaScript, for example. You can use the button tag as a regular + # submit tag but it isn't supported in legacy browsers. However, + # the button tag does allow for richer labels such as images and emphasis, + # so this helper will also accept a block. By default, it will create + # a button tag with type submit, if type is not given. + # + # ==== Options + # * :data - This option can be used to add custom data attributes. + # * :disabled - If true, the user will not be able to + # use this input. + # * Any other key creates standard HTML options for the tag. + # + # ==== Examples + # button_tag + # # => + # + # button_tag 'Reset', type: 'reset' + # # => + # + # button_tag 'Button', type: 'button' + # # => + # + # button_tag 'Reset', type: 'reset', disabled: true + # # => + # + # button_tag(type: 'button') do + # content_tag(:strong, 'Ask me!') + # end + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:571 + def button_tag(content_or_options = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:469 + def check_box_tag(name, *args); end + + # :call-seq: + # checkbox_tag(name, options = {}) + # checkbox_tag(name, value, options = {}) + # checkbox_tag(name, value, checked, options = {}) + # + # Creates a check box form input tag. + # + # ==== Options + # * :value - The value of the input. Defaults to "1". + # * :checked - If set to true, the checkbox will be checked by default. + # * :disabled - If set to true, the user will not be able to use this input. + # * Any other key creates standard HTML options for the tag. + # + # ==== Examples + # checkbox_tag 'accept' + # # => + # + # checkbox_tag 'rock', 'rock music' + # # => + # + # checkbox_tag 'receive_email', 'yes', true + # # => + # + # checkbox_tag 'tos', 'yes', false, class: 'accept_tos' + # # => + # + # checkbox_tag 'eula', 'accepted', false, disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:459 + def checkbox_tag(name, *args); end + + # Creates a text field of type "color". + # + # ==== Options + # + # Supports the same options as #text_field_tag. + # + # ==== Examples + # + # color_field_tag 'name' + # # => + # + # color_field_tag 'color', '#DEF726' + # # => + # + # color_field_tag 'color', nil, class: 'special_input' + # # => + # + # color_field_tag 'color', '#DEF726', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:671 + def color_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a text field of type "date". + # + # ==== Options + # + # Supports the same options as #text_field_tag. + # + # ==== Examples + # + # date_field_tag 'name' + # # => + # + # date_field_tag 'date', '2014-12-31' + # # => + # + # date_field_tag 'date', nil, class: 'special_input' + # # => + # + # date_field_tag 'date', '2014-12-31', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:741 + def date_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a text field of type "datetime-local". + # + # ==== Options + # + # Supports the same options as #text_field_tag. Additionally, supports: + # + # * :min - The minimum acceptable value. + # * :max - The maximum acceptable value. + # * :step - The acceptable value granularity. + # * :include_seconds - Include seconds in the output timestamp format (true by default). + # + # ==== Examples + # + # datetime_field_tag 'name' + # # => + # + # datetime_field_tag 'datetime', '2014-01-01T01:01' + # # => + # + # datetime_field_tag 'datetime', nil, class: 'special_input' + # # => + # + # datetime_field_tag 'datetime', '2014-01-01T01:01', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:800 + def datetime_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:804 + def datetime_local_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:28 + def default_enforce_utf8; end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:28 + def default_enforce_utf8=(val); end + + # Creates a text field of type "email". + # + # ==== Options + # + # Supports the same options as #text_field_tag. + # + # ==== Examples + # + # email_field_tag 'name' + # # => + # + # email_field_tag 'email', 'email@example.com' + # # => + # + # email_field_tag 'email', nil, class: 'special_input' + # # => + # + # email_field_tag 'email', 'email@example.com', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:902 + def email_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:25 + def embed_authenticity_token_in_remote_forms; end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:25 + def embed_authenticity_token_in_remote_forms=(val); end + + # Generate an HTML id attribute value for the given name and + # field combination + # + # Return the value generated by the FormBuilder for the given + # attribute name. + # + # <%= label_tag :post, :title %> + # <%= text_field :post, :title, aria: { describedby: field_id(:post, :title, :error) } %> + # <%= tag.span("is blank", id: field_id(:post, :title, :error) %> + # + # In the example above, the element built by + # the call to text_field declares an + # aria-describedby attribute referencing the + # element, sharing a common id root (post_title, in this + # case). + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:101 + def field_id(object_name, method_name, *suffixes, index: T.unsafe(nil), namespace: T.unsafe(nil)); end + + # Generate an HTML name attribute value for the given name and + # field combination + # + # Return the value generated by the FormBuilder for the given + # attribute name. + # + # <%= text_field :post, :title, name: field_name(:post, :title, :subtitle) %> + # <%# => %> + # + # <%= text_field :post, :tag, name: field_name(:post, :tag, multiple: true) %> + # <%# => %> + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:131 + def field_name(object_name, method_name, *method_names, multiple: T.unsafe(nil), index: T.unsafe(nil)); end + + # Creates a field set for grouping HTML form elements. + # + # legend will become the fieldset's title (optional as per W3C). + # options accept the same values as tag. + # + # ==== Examples + # <%= field_set_tag do %> + #

    <%= text_field_tag 'name' %>

    + # <% end %> + # # =>

    + # + # <%= field_set_tag 'Your details' do %> + #

    <%= text_field_tag 'name' %>

    + # <% end %> + # # =>
    Your details

    + # + # <%= field_set_tag nil, class: 'format' do %> + #

    <%= text_field_tag 'name' %>

    + # <% end %> + # # =>

    + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:643 + def field_set_tag(legend = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:650 + def fieldset_tag(legend = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # Creates a file upload field. If you are using file uploads then you will also need + # to set the multipart option for the form tag: + # + # <%= form_tag '/upload', multipart: true do %> + # <%= file_field_tag "file" %> + # <%= submit_tag %> + # <% end %> + # + # The specified URL will then be passed a File object containing the selected file, or if the field + # was left blank, a StringIO object. + # + # ==== Options + # * Creates standard HTML attributes for the tag. + # * :disabled - If set to true, the user will not be able to use this input. + # * :multiple - If set to true, *in most updated browsers* the user will be allowed to select multiple files. + # * :accept - If set to one or multiple mime-types, the user will be suggested a filter when choosing a file. You still need to set up model validations. + # + # ==== Examples + # file_field_tag 'attachment' + # # => + # + # file_field_tag 'avatar', class: 'profile_input' + # # => + # + # file_field_tag 'picture', disabled: true + # # => + # + # file_field_tag 'resume', value: '~/resume.doc' + # # => + # + # file_field_tag 'user_pic', accept: 'image/png,image/gif,image/jpeg' + # # => + # + # file_field_tag 'file', accept: 'text/html', class: 'upload', value: 'index.html' + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:350 + def file_field_tag(name, options = T.unsafe(nil)); end + + # Starts a form tag that points the action to a URL configured with url_for_options just like + # ActionController::Base#url_for. The method for the form defaults to POST. + # + # ==== Options + # * :multipart - If set to true, the enctype is set to "multipart/form-data". + # * :method - The method to use when submitting the form, usually either "get" or "post". + # If "patch", "put", "delete", or another verb is used, a hidden input with name _method + # is added to simulate the verb over post. + # * :authenticity_token - Authenticity token to use in the form. Use only if you need to + # pass custom authenticity token string, or to not add authenticity_token field at all + # (by passing false). Remote forms may omit the embedded authenticity token + # by setting config.action_view.embed_authenticity_token_in_remote_forms = false. + # This is helpful when you're fragment-caching the form. Remote forms get the + # authenticity token from the meta tag, so embedding is unnecessary unless you + # support browsers without JavaScript. + # * :remote - If set to true, will allow the Unobtrusive JavaScript drivers to control the + # submit behavior. By default this behavior is an ajax submit. + # * :enforce_utf8 - If set to false, a hidden input with name utf8 is not output. + # * Any other key creates standard HTML attributes for the tag. + # + # ==== Examples + # form_tag('/posts') + # # => + # + # form_tag('/posts/1', method: :put) + # # => ... ... + # + # form_tag('/upload', multipart: true) + # # => + # + # <%= form_tag('/posts') do -%> + #
    <%= submit_tag 'Save' %>
    + # <% end -%> + # # =>
    + # + # <%= form_tag('/posts', remote: true) %> + # # =>
    + # + # form_tag(false, method: :get) + # # => + # + # form_tag('http://far.away.com/form', authenticity_token: false) + # # form without authenticity token + # + # form_tag('http://far.away.com/form', authenticity_token: "cf50faa3fe97702ca1ae") + # # form with custom authenticity token + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:77 + def form_tag(url_for_options = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # Creates a hidden form input field used to transmit data that would be lost due to HTTP's statelessness or + # data that should be hidden from the user. + # + # ==== Options + # * Creates standard HTML attributes for the tag. + # + # ==== Examples + # hidden_field_tag 'tags_list' + # # => + # + # hidden_field_tag 'token', 'VUBJKB23UIVI1UU1VOBVI@' + # # => + # + # hidden_field_tag 'collected_input', '', onchange: "alert('Input collected!')" + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:307 + def hidden_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Displays an image which when clicked will submit the form. + # + # source is passed to AssetTagHelper#path_to_image + # + # ==== Options + # * :data - This option can be used to add custom data attributes. + # * :disabled - If set to true, the user will not be able to use this input. + # * Any other key creates standard HTML options for the tag. + # + # ==== Data attributes + # + # * confirm: 'question?' - This will add a JavaScript confirm + # prompt with the question specified. If the user accepts, the form is + # processed normally, otherwise no action is taken. + # + # ==== Examples + # image_submit_tag("login.png") + # # => + # + # image_submit_tag("purchase.png", disabled: true) + # # => + # + # image_submit_tag("search.png", class: 'search_button', alt: 'Find') + # # => + # + # image_submit_tag("agree.png", disabled: true, class: "agree_disagree_button") + # # => + # + # image_submit_tag("save.png", data: { confirm: "Are you sure?" }) + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:617 + def image_submit_tag(source, options = T.unsafe(nil)); end + + # Creates a label element. Accepts a block. + # + # ==== Options + # * Creates standard HTML attributes for the tag. + # + # ==== Examples + # label_tag 'name' + # # => + # + # label_tag 'name', 'Your name' + # # => + # + # label_tag 'name', nil, class: 'small_label' + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:280 + def label_tag(name = T.unsafe(nil), content_or_options = T.unsafe(nil), options = T.unsafe(nil), &block); end + + # Creates a text field of type "month". + # + # ==== Options + # + # Supports the same options as #text_field_tag. Additionally, supports: + # + # * :min - The minimum acceptable value. + # * :max - The maximum acceptable value. + # * :step - The acceptable value granularity. + # + # ==== Examples + # + # month_field_tag 'name' + # # => + # + # month_field_tag 'month', '2014-01' + # # => + # + # month_field_tag 'month', nil, class: 'special_input' + # # => + # + # month_field_tag 'month', '2014-01', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:829 + def month_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a number field. + # + # ==== Options + # + # Supports the same options as #text_field_tag. Additionally, supports: + # + # * :min - The minimum acceptable value. + # * :max - The maximum acceptable value. + # * :in - A range specifying the :min and + # :max values. + # * :within - Same as :in. + # * :step - The acceptable value granularity. + # + # ==== Examples + # + # number_field_tag 'quantity' + # # => + # + # number_field_tag 'quantity', '1' + # # => + # + # number_field_tag 'quantity', nil, class: 'special_input' + # # => + # + # number_field_tag 'quantity', nil, min: 1 + # # => + # + # number_field_tag 'quantity', nil, max: 9 + # # => + # + # number_field_tag 'quantity', nil, in: 1...10 + # # => + # + # number_field_tag 'quantity', nil, within: 1...10 + # # => + # + # number_field_tag 'quantity', nil, min: 1, max: 10 + # # => + # + # number_field_tag 'quantity', nil, min: 1, max: 10, step: 2 + # # => + # + # number_field_tag 'quantity', '1', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:950 + def number_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a password field, a masked text field that will hide the users input behind a mask character. + # + # ==== Options + # * :disabled - If set to true, the user will not be able to use this input. + # * :size - The number of visible characters that will fit in the input. + # * :maxlength - The maximum number of characters that the browser will allow the user to enter. + # * Any other key creates standard HTML attributes for the tag. + # + # ==== Examples + # password_field_tag 'pass' + # # => + # + # password_field_tag 'secret', 'Your secret here' + # # => + # + # password_field_tag 'masked', nil, class: 'masked_input_field' + # # => + # + # password_field_tag 'token', '', size: 15 + # # => + # + # password_field_tag 'key', nil, maxlength: 16 + # # => + # + # password_field_tag 'confirm_pass', nil, disabled: true + # # => + # + # password_field_tag 'pin', '1234', maxlength: 4, size: 6, class: "pin_input" + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:383 + def password_field_tag(name = T.unsafe(nil), value = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:720 + def phone_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # :call-seq: + # radio_button_tag(name, value, options = {}) + # radio_button_tag(name, value, checked, options = {}) + # + # Creates a radio button; use groups of radio buttons named the same to allow users to + # select from a group of options. + # + # ==== Options + # * :checked - If set to true, the radio button will be selected by default. + # * :disabled - If set to true, the user will not be able to use this input. + # * Any other key creates standard HTML options for the tag. + # + # ==== Examples + # radio_button_tag 'favorite_color', 'maroon' + # # => + # + # radio_button_tag 'receive_updates', 'no', true + # # => + # + # radio_button_tag 'time_slot', "3:00 p.m.", false, disabled: true + # # => + # + # radio_button_tag 'color', "green", true, class: "color_input" + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:496 + def radio_button_tag(name, value, *args); end + + # Creates a range form element. + # + # ==== Options + # + # Supports the same options as #number_field_tag. + # + # ==== Examples + # + # range_field_tag 'quantity', '1' + # # => + # + # range_field_tag 'quantity', in: 1...10 + # # => + # + # range_field_tag 'quantity', min: 1, max: 10, step: 2 + # # => + # + # search_field_tag 'search', 'Enter your search query here' + # # => + # + # search_field_tag 'search', nil, class: 'special_input' + # # => + # + # search_field_tag 'search', 'Enter your search query here', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:694 + def search_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a dropdown selection box, or if the :multiple option is set to true, a multiple + # choice selection box. + # + # Helpers::FormOptions can be used to create common select boxes such as countries, time zones, or + # associated records. option_tags is a string containing the option tags for the select box. + # + # ==== Options + # * :multiple - If set to true, the selection will allow multiple choices. + # * :disabled - If set to true, the user will not be able to use this input. + # * :include_blank - If set to true, an empty option will be created. If set to a string, the string will be used as the option's content and the value will be empty. + # * :prompt - Create a prompt option with blank value and the text asking user to select something. + # * Any other key creates standard HTML attributes for the tag. + # + # ==== Examples + # select_tag "people", options_from_collection_for_select(@people, "id", "name") + # # + # + # select_tag "people", options_from_collection_for_select(@people, "id", "name", "1") + # # + # + # select_tag "people", raw("") + # # => + # + # select_tag "count", raw("") + # # => + # + # select_tag "colors", raw(""), multiple: true + # # => + # + # select_tag "locations", raw("") + # # => + # + # select_tag "access", raw(""), multiple: true, class: 'form_input', id: 'unique_id' + # # => + # + # select_tag "people", options_from_collection_for_select(@people, "id", "name"), include_blank: true + # # => + # + # select_tag "people", options_from_collection_for_select(@people, "id", "name"), include_blank: "All" + # # => + # + # select_tag "people", options_from_collection_for_select(@people, "id", "name"), prompt: "Select something" + # # => + # + # select_tag "destination", raw(""), disabled: true + # # => + # + # select_tag "credit_card", options_for_select([ "VISA", "MasterCard" ], "MasterCard") + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:200 + def select_tag(name, option_tags = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a submit button with the text value as the caption. + # + # ==== Options + # * :data - This option can be used to add custom data attributes. + # * :disabled - If true, the user will not be able to use this input. + # * Any other key creates standard HTML options for the tag. + # + # ==== Examples + # submit_tag + # # => + # + # submit_tag "Edit this article" + # # => + # + # submit_tag "Save edits", disabled: true + # # => + # + # submit_tag nil, class: "form_submit" + # # => + # + # submit_tag "Edit", class: "edit_button" + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:530 + def submit_tag(value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a text field of type "tel". + # + # ==== Options + # + # Supports the same options as #text_field_tag. + # + # ==== Examples + # + # telephone_field_tag 'name' + # # => + # + # telephone_field_tag 'tel', '0123456789' + # # => + # + # telephone_field_tag 'tel', nil, class: 'special_input' + # # => + # + # telephone_field_tag 'tel', '0123456789', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:717 + def telephone_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:428 + def text_area_tag(name, content = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a standard text field; use these text fields to input smaller chunks of text like a username + # or a search query. + # + # ==== Options + # * :disabled - If set to true, the user will not be able to use this input. + # * :size - The number of visible characters that will fit in the input. + # * :maxlength - The maximum number of characters that the browser will allow the user to enter. + # * :placeholder - The text contained in the field by default which is removed when the field receives focus. + # If set to true, use the translation found in the current I18n locale + # (through helpers.placeholder..). + # * Any other key creates standard HTML attributes for the tag. + # + # ==== Examples + # text_field_tag 'name' + # # => + # + # text_field_tag 'query', 'Enter your search query here' + # # => + # + # text_field_tag 'search', nil, placeholder: 'Enter search term...' + # # => + # + # text_field_tag 'request', nil, class: 'special_input' + # # => + # + # text_field_tag 'address', '', size: 75 + # # => + # + # text_field_tag 'zip', nil, maxlength: 5 + # # => + # + # text_field_tag 'payment_amount', '$0.00', disabled: true + # # => + # + # text_field_tag 'ip', '0.0.0.0', maxlength: 15, size: 20, class: "ip-input" + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:262 + def text_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a text input area; use a textarea for longer text inputs such as blog posts or descriptions. + # + # ==== Options + # * :size - A string specifying the dimensions (columns by rows) of the textarea (e.g., "25x10"). + # * :rows - Specify the number of rows in the textarea + # * :cols - Specify the number of columns in the textarea + # * :disabled - If set to true, the user will not be able to use this input. + # * :escape - By default, the contents of the text input are HTML escaped. + # If you need unescaped contents, set this to false. + # * Any other key creates standard HTML attributes for the tag. + # + # ==== Examples + # textarea_tag 'post' + # # => + # + # textarea_tag 'bio', @user.bio + # # => + # + # textarea_tag 'body', nil, rows: 10, cols: 25 + # # => + # + # textarea_tag 'body', nil, size: "25x10" + # # => + # + # textarea_tag 'description', "Description goes here.", disabled: true + # # => + # + # textarea_tag 'comment', nil, class: 'comment_input' + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:416 + def textarea_tag(name, content = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a text field of type "time". + # + # ==== Options + # + # Supports the same options as #text_field_tag. Additionally, supports: + # + # * :min - The minimum acceptable value. + # * :max - The maximum acceptable value. + # * :step - The acceptable value granularity. + # * :include_seconds - Include seconds and ms in the output timestamp format (true by default). + # + # ==== Examples + # + # time_field_tag 'name' + # # => + # + # time_field_tag 'time', '01:01' + # # => + # + # time_field_tag 'time', nil, class: 'special_input' + # # => + # + # time_field_tag 'time', '01:01', include_seconds: true + # # => + # + # time_field_tag 'time', '01:01', min: '00:00', max: '23:59', step: 1 + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:772 + def time_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates a text field of type "url". + # + # ==== Options + # + # Supports the same options as #text_field_tag. + # + # ==== Examples + # + # url_field_tag 'name' + # # => + # + # url_field_tag 'url', 'http://rubyonrails.org' + # # => + # + # url_field_tag 'url', nil, class: 'special_input' + # # => + # + # url_field_tag 'url', 'http://rubyonrails.org', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:879 + def url_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + # Creates the hidden UTF-8 enforcer tag. Override this method in a helper + # to customize the tag. + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:981 + def utf8_enforcer_tag; end + + # Creates a text field of type "week". + # + # ==== Options + # + # Supports the same options as #text_field_tag. Additionally, supports: + # + # * :min - The minimum acceptable value. + # * :max - The maximum acceptable value. + # * :step - The acceptable value granularity. + # + # ==== Examples + # + # week_field_tag 'name' + # # => + # + # week_field_tag 'week', '2014-W01' + # # => + # + # week_field_tag 'week', nil, class: 'special_input' + # # => + # + # week_field_tag 'week', '2014-W01', class: 'special_input', disabled: true + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:856 + def week_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:1083 + def convert_direct_upload_option_to_url(options); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:1021 + def extra_tags_for_form(html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:1051 + def form_tag_html(html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:1057 + def form_tag_with_body(html_options, content); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:994 + def html_options_for_form(url_for_options, options); end + + # see http://www.w3.org/TR/html4/types.html#type-name + # + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:1064 + def sanitize_to_id(name); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:1068 + def set_default_disable_with(value, tag_options); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:28 + def default_enforce_utf8; end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:28 + def default_enforce_utf8=(val); end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:25 + def embed_authenticity_token_in_remote_forms; end + + # pkg:gem/actionview#lib/action_view/helpers/form_tag_helper.rb:25 + def embed_authenticity_token_in_remote_forms=(val); end + end +end + +# = Action View JavaScript \Helpers +# +# pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:6 +module ActionView::Helpers::JavaScriptHelper + # pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:7 + def auto_include_nonce; end + + # pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:7 + def auto_include_nonce=(val); end + + # Escapes carriage returns and single and double quotes for JavaScript segments. + # + # Also available through the alias j(). This is particularly helpful in JavaScript + # responses, like: + # + # $('some_element').replaceWith('<%= j render 'some/element_template' %>'); + # + # pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:30 + def escape_javascript(javascript); end + + # pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:40 + def j(javascript); end + + # pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:95 + def javascript_cdata_section(content); end + + # Returns a JavaScript tag with the +content+ inside. Example: + # javascript_tag "alert('All is good')" + # + # Returns: + # + # + # +html_options+ may be a hash of attributes for the \ + # + # Instead of passing the content as an argument, you can also use a block + # in which case, you pass your +html_options+ as the first parameter. + # + # <%= javascript_tag type: 'application/javascript' do -%> + # alert('All is good') + # <% end -%> + # + # If you have a content security policy enabled then you can add an automatic + # nonce value by passing nonce: true as part of +html_options+. Example: + # + # <%= javascript_tag nonce: true do -%> + # alert('All is good') + # <% end -%> + # + # pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:77 + def javascript_tag(content_or_options_with_block = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:7 + def auto_include_nonce; end + + # pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:7 + def auto_include_nonce=(val); end + end +end + +# pkg:gem/actionview#lib/action_view/helpers/javascript_helper.rb:9 +ActionView::Helpers::JavaScriptHelper::JS_ESCAPE_MAP = T.let(T.unsafe(nil), Hash) + +# = Action View Number \Helpers +# +# Provides methods for converting numbers into formatted strings. +# Methods are provided for phone numbers, currency, percentage, +# precision, positional notation, file size, and pretty printing. +# +# Most methods expect a +number+ argument, and will return it +# unchanged if can't be converted into a valid number. +# +# pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:17 +module ActionView::Helpers::NumberHelper + # Delegates to ActiveSupport::NumberHelper#number_to_currency. + # + # number_to_currency("1234") # => "$1234.00" + # + # Additionally, supports a +:raise+ option that will cause + # InvalidNumberError to be raised if +number+ is not a valid number: + # + # number_to_currency("12x34") # => "$12x34" + # number_to_currency("12x34", raise: true) # => InvalidNumberError + # + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:55 + def number_to_currency(number, options = T.unsafe(nil)); end + + # Delegates to ActiveSupport::NumberHelper#number_to_human. + # + # number_to_human("1234") # => "1.23 Thousand" + # + # Additionally, supports a +:raise+ option that will cause + # InvalidNumberError to be raised if +number+ is not a valid number: + # + # number_to_human("12x34") # => "12x34" + # number_to_human("12x34", raise: true) # => InvalidNumberError + # + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:125 + def number_to_human(number, options = T.unsafe(nil)); end + + # Delegates to ActiveSupport::NumberHelper#number_to_human_size. + # + # number_to_human_size("1234") # => "1.21 KB" + # + # Additionally, supports a +:raise+ option that will cause + # InvalidNumberError to be raised if +number+ is not a valid number: + # + # number_to_human_size("12x34") # => "12x34" + # number_to_human_size("12x34", raise: true) # => InvalidNumberError + # + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:111 + def number_to_human_size(number, options = T.unsafe(nil)); end + + # Delegates to ActiveSupport::NumberHelper#number_to_percentage. + # + # number_to_percentage("99") # => "99.000%" + # + # Additionally, supports a +:raise+ option that will cause + # InvalidNumberError to be raised if +number+ is not a valid number: + # + # number_to_percentage("99x") # => "99x%" + # number_to_percentage("99x", raise: true) # => InvalidNumberError + # + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:69 + def number_to_percentage(number, options = T.unsafe(nil)); end + + # Delegates to ActiveSupport::NumberHelper#number_to_phone. + # + # number_to_phone("1234567890") # => "123-456-7890" + # + # Additionally, supports a +:raise+ option that will cause + # InvalidNumberError to be raised if +number+ is not a valid number: + # + # number_to_phone("12x34") # => "12x34" + # number_to_phone("12x34", raise: true) # => InvalidNumberError + # + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:37 + def number_to_phone(number, options = T.unsafe(nil)); end + + # Delegates to ActiveSupport::NumberHelper#number_to_delimited. + # + # number_with_delimiter("1234") # => "1,234" + # + # Additionally, supports a +:raise+ option that will cause + # InvalidNumberError to be raised if +number+ is not a valid number: + # + # number_with_delimiter("12x34") # => "12x34" + # number_with_delimiter("12x34", raise: true) # => InvalidNumberError + # + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:83 + def number_with_delimiter(number, options = T.unsafe(nil)); end + + # Delegates to ActiveSupport::NumberHelper#number_to_rounded. + # + # number_with_precision("1234") # => "1234.000" + # + # Additionally, supports a +:raise+ option that will cause + # InvalidNumberError to be raised if +number+ is not a valid number: + # + # number_with_precision("12x34") # => "12x34" + # number_with_precision("12x34", raise: true) # => InvalidNumberError + # + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:97 + def number_with_precision(number, options = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:130 + def delegate_number_helper_method(method, number, options); end + + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:149 + def escape_units(units); end + + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:139 + def escape_unsafe_options(options); end + + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:172 + def parse_float(number, raise_error); end + + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:168 + def valid_float?(number); end + + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:155 + def wrap_with_output_safety_handling(number, raise_on_invalid, &block); end +end + +# Raised when argument +number+ param given to the helpers is invalid and +# the option +:raise+ is set to +true+. +# +# pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:20 +class ActionView::Helpers::NumberHelper::InvalidNumberError < ::StandardError + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:22 + def initialize(number); end + + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:21 + def number; end + + # pkg:gem/actionview#lib/action_view/helpers/number_helper.rb:21 + def number=(_arg0); end +end + +# = Action View Raw Output \Helpers +# +# pkg:gem/actionview#lib/action_view/helpers/output_safety_helper.rb:8 +module ActionView::Helpers::OutputSafetyHelper + # This method outputs without escaping a string. Since escaping tags is + # now default, this can be used when you don't want \Rails to automatically + # escape tags. This is not recommended if the data is coming from the user's + # input. + # + # For example: + # + # raw @user.name + # # => 'Jimmy Tables' + # + # pkg:gem/actionview#lib/action_view/helpers/output_safety_helper.rb:18 + def raw(stringish); end + + # This method returns an HTML safe string similar to what Array#join + # would return. The array is flattened, and all items, including + # the supplied separator, are HTML escaped unless they are HTML + # safe, and the returned string is marked as HTML safe. + # + # safe_join([tag.p("foo"), "

    bar

    "], "
    ") + # # => "

    foo

    <br><p>bar</p>" + # + # safe_join([tag.p("foo"), tag.p("bar")], tag.br) + # # => "

    foo


    bar

    " + # + # pkg:gem/actionview#lib/action_view/helpers/output_safety_helper.rb:33 + def safe_join(array, sep = T.unsafe(nil)); end + + # Converts the array to a comma-separated sentence where the last element is + # joined by the connector word. This is the html_safe-aware version of + # ActiveSupport's Array#to_sentence. + # + # pkg:gem/actionview#lib/action_view/helpers/output_safety_helper.rb:42 + def to_sentence(array, options = T.unsafe(nil)); end +end + +# # Action View Rendering Helpers +# +# Implements methods that allow rendering from a view context. In order to use +# this module, all you need is to implement view_renderer that returns an +# ActionView::Renderer object. +# +# pkg:gem/actionview#lib/action_view/helpers/rendering_helper.rb:12 +module ActionView::Helpers::RenderingHelper + # Overrides _layout_for in the context object so it supports the case a block is + # passed to a partial. Returns the contents that are yielded to a layout, given + # a name or a block. + # + # You can think of a layout as a method that is called with a block. If the user + # calls `yield :some_name`, the block, by default, returns + # `content_for(:some_name)`. If the user calls simply `yield`, the default block + # returns `content_for(:layout)`. + # + # The user can override this default by passing a block to the layout: + # + # # The template + # <%= render layout: "my_layout" do %> + # Content + # <% end %> + # + # # The layout + # + # <%= yield %> + # + # + # In this case, instead of the default block, which would return `content_for(:layout)`, + # this method returns the block that was passed in to `render :layout`, and the response + # would be + # + # + # Content + # + # + # Finally, the block can take block arguments, which can be passed in by + # `yield`: + # + # # The template + # <%= render layout: "my_layout" do |customer| %> + # Hello <%= customer.name %> + # <% end %> + # + # # The layout + # + # <%= yield Struct.new(:name).new("David") %> + # + # + # In this case, the layout would receive the block passed into `render :layout`, + # and the struct specified would be passed into the block as an argument. The result + # would be + # + # + # Hello David + # + # + # pkg:gem/actionview#lib/action_view/helpers/rendering_helper.rb:207 + def _layout_for(*args, &block); end + + # Renders a template and returns the result. + # + # Pass the template to render as the first argument. This is shorthand + # syntax for partial rendering, so the template filename should be + # prefixed with an underscore. The partial renderer looks for the partial + # template in the directory of the calling template first. + # + # <% # app/views/posts/new.html.erb %> + # <%= render "form" %> + # # => renders app/views/posts/_form.html.erb + # + # Use the complete view path to render a partial from another directory. + # + # <% # app/views/posts/show.html.erb %> + # <%= render "comments/form" %> + # # => renders app/views/comments/_form.html.erb + # + # Without the rendering mode, the second argument can be a Hash of local + # variable assignments for the template. + # + # <% # app/views/posts/new.html.erb %> + # <%= render "form", post: Post.new %> + # # => renders app/views/posts/_form.html.erb + # + # If the first argument responds to `render_in`, the template will be rendered + # by calling `render_in` with the current view context. + # + # class Greeting + # def render_in(view_context) + # view_context.render html: "

    Hello, World

    " + # end + # + # def format + # :html + # end + # end + # + # <%= render Greeting.new %> + # # => "

    Hello, World

    " + # + # #### Rendering Mode + # + # Pass the rendering mode as first argument to override it. + # + # `:partial` + # + # <%= render partial: "form", locals: { post: Post.new } %> + # # => renders app/views/posts/_form.html.erb + # + # `:file` + # unsanitized user input. + # + # <%= render file: "/path/to/some/file" %> + # # => renders /path/to/some/file + # + # `:inline` + # + # <% name = "World" %> + # <%= render inline: "

    Hello, <%= name %>!

    " %> + # # => renders "

    Hello, World!

    " + # + # `:body` + # + # <%= render body: "Hello, World!" %> + # # => renders "Hello, World!" + # + # `:plain` + # + # <%= render plain: "Hello, World!" %> + # # => renders "Hello, World!" + # + # `:html` + # `:html`. If the string is not `html_safe?`, performs HTML escaping on + # the string before rendering. + # + # <%= render html: "

    Hello, World!

    ".html_safe %> + # # => renders "

    Hello, World!

    " + # + # <%= render html: "

    Hello, World!

    " %> + # # => renders "<h1>Hello, World!</h1>" + # + # `:renderable` + # context. The format is determined by calling `format` on the + # renderable if it responds to `format`, falling back to `:html` by + # default. + # + # <%= render renderable: Greeting.new %> + # # => renders "

    Hello, World

    " + # + # + # #### Options + # + # `:locals` + # + # <%= render inline: "

    Hello, <%= name %>!

    ", locals: { name: "World" } %> + # # => renders "

    Hello, World!

    " + # + # `:formats` + # + # <% # app/views/posts/show.html.erb %> + # <%= render template: "posts/content", formats: [:text] %> + # # => renders app/views/posts/content.text.erb + # + # `:variants` + # + # <% # app/views/posts/show.html.erb %> + # <%= render template: "posts/content", variants: [:tablet] %> + # # => renders app/views/posts/content.html+tablet.erb + # + # `:handlers` + # + # <% # app/views/posts/show.html.erb %> + # <%= render template: "posts/content", handlers: [:builder] %> + # # => renders app/views/posts/content.html.builder + # + # pkg:gem/actionview#lib/action_view/helpers/rendering_helper.rb:138 + def render(options = T.unsafe(nil), locals = T.unsafe(nil), &block); end +end + +# = Action View Sanitize \Helpers +# +# The SanitizeHelper module provides a set of methods for scrubbing text of undesired HTML elements. +# These helper methods extend Action View making them callable within your template files. +# +# pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:12 +module ActionView::Helpers::SanitizeHelper + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods + + # Sanitizes HTML input, stripping all but known-safe tags and attributes. + # + # It also strips +href+ / +src+ attributes with unsafe protocols like +javascript:+, while + # also protecting against attempts to use Unicode, ASCII, and hex character references to work + # around these protocol filters. + # + # The default sanitizer is +Rails::HTML5::SafeListSanitizer+. See {Rails HTML + # Sanitizers}[https://github.com/rails/rails-html-sanitizer] for more information. + # + # Custom sanitization rules can also be provided. + # + # Warning: Adding disallowed tags or attributes to the allowlists may introduce + # vulnerabilities into your application. Please rely on the default allowlists whenever + # possible, because they are curated to maintain security and safety. If you think that the + # default allowlists should be expanded, please {open an issue on the rails-html-sanitizer + # project}[https://github.com/rails/rails-html-sanitizer/issues]. + # + # Please note that sanitizing user-provided text does not guarantee that the + # resulting markup is valid or even well-formed. + # + # The output is markup, which is safe only as element content. Do not use it in an attribute + # value; use +strip_tags+ or a tag helper such as tag.a(title: ...) instead. + # + # ==== Options + # + # [+:tags+] + # An array of allowed tags. + # + # [+:attributes+] + # An array of allowed attributes. + # + # [+:scrubber+] + # A {Rails::HTML scrubber}[https://github.com/rails/rails-html-sanitizer] + # or {Loofah::Scrubber}[https://github.com/flavorjones/loofah] object that + # defines custom sanitization rules. A custom scrubber takes precedence over + # custom tags and attributes. + # + # ==== Examples + # + # ===== Normal use + # + # <%= sanitize @comment.body %> + # + # ===== Providing custom lists of permitted tags and attributes + # + # <%= sanitize @comment.body, tags: %w(strong em a), attributes: %w(href) %> + # + # ===== Providing a custom +Rails::HTML+ scrubber + # + # class CommentScrubber < Rails::HTML::PermitScrubber + # def initialize + # super + # self.tags = %w( form script comment blockquote ) + # self.attributes = %w( style ) + # end + # + # def skip_node?(node) + # node.text? + # end + # end + # + # + # + # <%= sanitize @comment.body, scrubber: CommentScrubber.new %> + # + # See {Rails HTML Sanitizer}[https://github.com/rails/rails-html-sanitizer] for + # documentation about +Rails::HTML+ scrubbers. + # + # ===== Providing a custom +Loofah::Scrubber+ + # + # scrubber = Loofah::Scrubber.new do |node| + # node.remove if node.name == 'script' + # end + # + # + # + # <%= sanitize @comment.body, scrubber: scrubber %> + # + # See {Loofah's documentation}[https://github.com/flavorjones/loofah] for more + # information about defining custom +Loofah::Scrubber+ objects. + # + # ==== Global Configuration + # + # To set the default allowed tags or attributes across your application: + # + # # In config/application.rb + # config.action_view.sanitized_allowed_tags = ['strong', 'em', 'a'] + # config.action_view.sanitized_allowed_attributes = ['href', 'title'] + # + # The default, starting in \Rails 7.1, is to use an HTML5 parser for sanitization (if it is + # available, see NOTE below). If you wish to revert back to the previous HTML4 behavior, you + # can do so by setting the following in your application configuration: + # + # # In config/application.rb + # config.action_view.sanitizer_vendor = Rails::HTML4::Sanitizer + # + # Or, if you're upgrading from a previous version of \Rails and wish to opt into the HTML5 + # behavior: + # + # # In config/application.rb + # config.action_view.sanitizer_vendor = Rails::HTML5::Sanitizer + # + # NOTE: +Rails::HTML5::Sanitizer+ is not supported on JRuby, so on JRuby platforms \Rails will + # fall back to using +Rails::HTML4::Sanitizer+. + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:121 + def sanitize(html, options = T.unsafe(nil)); end + + # Sanitizes a block of CSS code. Used by #sanitize when it comes across a style attribute. + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:126 + def sanitize_css(style); end + + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:13 + def sanitizer_vendor; end + + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:13 + def sanitizer_vendor=(val); end + + # Strips all link tags from +html+ leaving just the link text. + # + # strip_links('Ruby on Rails') + # # => Ruby on Rails + # + # strip_links('Please e-mail me at me@email.com.') + # # => Please e-mail me at me@email.com. + # + # strip_links('Blog: Visit.') + # # => Blog: Visit. + # + # strip_links('<malformed & link') + # # => <malformed & link + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:161 + def strip_links(html); end + + # Strips all HTML tags from +html+, including comments and special characters. + # + # strip_tags("Strip these tags!") + # # => Strip these tags! + # + # strip_tags("Bold no more! See more here...") + # # => Bold no more! See more here... + # + # strip_tags("
    Welcome to my website!
    ") + # # => Welcome to my website! + # + # strip_tags("> A quote from Smith & Wesson") + # # => > A quote from Smith & Wesson + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:143 + def strip_tags(html); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:13 + def sanitizer_vendor; end + + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:13 + def sanitizer_vendor=(val); end + end +end + +# pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:165 +module ActionView::Helpers::SanitizeHelper::ClassMethods + # Gets the Rails::HTML::FullSanitizer instance used by +strip_tags+. Replace with + # any object that responds to +sanitize+. + # + # class Application < Rails::Application + # config.action_view.full_sanitizer = MySpecialSanitizer.new + # end + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:186 + def full_sanitizer; end + + # Gets the Rails::HTML::FullSanitizer instance used by +strip_tags+. Replace with + # any object that responds to +sanitize+. + # + # class Application < Rails::Application + # config.action_view.full_sanitizer = MySpecialSanitizer.new + # end + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:166 + def full_sanitizer=(_arg0); end + + # Gets the Rails::HTML::LinkSanitizer instance used by +strip_links+. + # Replace with any object that responds to +sanitize+. + # + # class Application < Rails::Application + # config.action_view.link_sanitizer = MySpecialSanitizer.new + # end + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:196 + def link_sanitizer; end + + # Gets the Rails::HTML::LinkSanitizer instance used by +strip_links+. + # Replace with any object that responds to +sanitize+. + # + # class Application < Rails::Application + # config.action_view.link_sanitizer = MySpecialSanitizer.new + # end + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:166 + def link_sanitizer=(_arg0); end + + # Gets the Rails::HTML::SafeListSanitizer instance used by sanitize and +sanitize_css+. + # Replace with any object that responds to +sanitize+. + # + # class Application < Rails::Application + # config.action_view.safe_list_sanitizer = MySpecialSanitizer.new + # end + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:206 + def safe_list_sanitizer; end + + # Gets the Rails::HTML::SafeListSanitizer instance used by sanitize and +sanitize_css+. + # Replace with any object that responds to +sanitize+. + # + # class Application < Rails::Application + # config.action_view.safe_list_sanitizer = MySpecialSanitizer.new + # end + # + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:166 + def safe_list_sanitizer=(_arg0); end + + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:176 + def sanitized_allowed_attributes; end + + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:172 + def sanitized_allowed_tags; end + + # pkg:gem/actionview#lib/action_view/helpers/sanitize_helper.rb:168 + def sanitizer_vendor; end +end + +# = Action View Tag \Helpers +# +# Provides methods to generate HTML tags programmatically both as a modern +# HTML5 compliant builder style and legacy XHTML compliant tags. +# +# pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:16 +module ActionView::Helpers::TagHelper + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + + # Returns a CDATA section with the given +content+. CDATA sections + # are used to escape blocks of text containing characters which would + # otherwise be recognized as markup. CDATA sections begin with the string + # and end with (and may not contain) the string ]]>. + # + # cdata_section("") + # # => ]]> + # + # cdata_section(File.read("hello_world.txt")) + # # => + # + # cdata_section("hello]]>world") + # # => world]]> + # + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:567 + def cdata_section(content); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:552 + def class_names(*args); end + + # Returns an HTML block tag of type +name+ surrounding the +content+. Add + # HTML attributes by passing an attributes hash to +options+. + # Instead of passing the content as an argument, you can also use a block + # in which case, you pass your +options+ as the second parameter. + # Set escape to false to disable escaping. + # Note: this is legacy syntax, see +tag+ method description for details. + # + # ==== Options + # The +options+ hash can be used with attributes with no value like (disabled and + # readonly), which you can give a value of true in the +options+ hash. You can use + # symbols or strings for the attribute names. + # + # ==== Examples + # content_tag(:p, "Hello world!") + # # =>

    Hello world!

    + # content_tag(:div, content_tag(:p, "Hello world!"), class: "strong") + # # =>

    Hello world!

    + # content_tag(:div, "Hello world!", class: ["strong", "highlight"]) + # # =>
    Hello world!
    + # content_tag(:div, "Hello world!", class: ["strong", { highlight: current_user.admin? }]) + # # =>
    Hello world!
    + # content_tag("select", options, multiple: true) + # # => + # + # <%= content_tag :div, class: "strong" do -%> + # Hello world! + # <% end -%> + # # =>
    Hello world!
    + # + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:525 + def content_tag(name, content_or_options_with_block = T.unsafe(nil), options = T.unsafe(nil), escape = T.unsafe(nil), &block); end + + # Returns an escaped version of +html+ without affecting existing escaped entities. + # + # escape_once("1 < 2 & 3") + # # => "1 < 2 & 3" + # + # escape_once("<< Accept & Checkout") + # # => "<< Accept & Checkout" + # + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:579 + def escape_once(html); end + + # Returns an HTML tag. + # + # === Building HTML tags + # + # Builds HTML5 compliant tags with a tag proxy. Every tag can be built with: + # + # tag.(optional content, options) + # + # where tag name can be e.g. br, div, section, article, or any tag really. + # + # ==== Passing content + # + # Tags can pass content to embed within it: + # + # tag.h1 'All titles fit to print' # =>

    All titles fit to print

    + # + # tag.div tag.p('Hello world!') # =>

    Hello world!

    + # + # Content can also be captured with a block, which is useful in templates: + # + # <%= tag.p do %> + # The next great American novel starts here. + # <% end %> + # # =>

    The next great American novel starts here.

    + # + # ==== Options + # + # Use symbol keyed options to add attributes to the generated tag. + # + # tag.section class: %w( kitties puppies ) + # # =>
    + # + # tag.section id: dom_id(@post) + # # =>
    + # + # Pass +true+ for any attributes that can render with no values, like +disabled+ and +readonly+. + # + # tag.input type: 'text', disabled: true + # # => + # + # HTML5 data-* and aria-* attributes can be set with a + # single +data+ or +aria+ key pointing to a hash of sub-attributes. + # + # To play nicely with JavaScript conventions, sub-attributes are dasherized. + # + # tag.article data: { user_id: 123 } + # # =>
    + # + # Thus data-user-id can be accessed as dataset.userId. + # + # Data attribute values are encoded to JSON, with the exception of strings, symbols, and + # BigDecimals. + # This may come in handy when using jQuery's HTML5-aware .data() + # from 1.4.3. + # + # tag.div data: { city_state: %w( Chicago IL ) } + # # =>
    + # + # The generated tag names and attributes are escaped by default. This can be disabled using + # +escape+. + # + # tag.img src: 'open & shut.png' + # # => + # + # tag.img src: 'open & shut.png', escape: false + # # => + # + # The tag builder respects + # {HTML5 void elements}[https://www.w3.org/TR/html5/syntax.html#void-elements] + # if no content is passed, and omits closing tags for those elements. + # + # # A standard element: + # tag.div # =>
    + # + # # A void element: + # tag.br # =>
    + # + # Note that when using the block form options should be wrapped in + # parenthesis. + # + # <%= tag.a(href: "/about", class: "font-bold") do %> + # About the author + # <% end %> + # # => About the author + # + # === Building HTML attributes + # + # Transforms a Hash into HTML attributes, ready to be interpolated into + # ERB. Includes or omits boolean attributes based on their truthiness. + # Transforms keys nested within + # aria: or data: objects into aria- and data- + # prefixed attributes: + # + # > + # # => + # + # + # # => + # + # === Legacy syntax + # + # The following format is for legacy syntax support. It will be deprecated in future versions of \Rails. + # + # tag(name, options = nil, open = false, escape = true) + # + # It returns an empty HTML tag of type +name+ which by default is XHTML + # compliant. Set +open+ to true to create an open tag compatible + # with HTML 4.0 and below. Add HTML attributes by passing an attributes + # hash to +options+. Set +escape+ to false to disable attribute value + # escaping. + # + # ==== Options + # + # You can use symbols or strings for the attribute names. + # + # Use +true+ with boolean attributes that can render with no value, like + # +disabled+ and +readonly+. + # + # HTML5 data-* attributes can be set with a single +data+ key + # pointing to a hash of sub-attributes. + # + # ==== Examples + # + # tag("br") + # # =>
    + # + # tag("br", nil, true) + # # =>
    + # + # tag("input", type: 'text', disabled: true) + # # => + # + # tag("input", type: 'text', class: ["strong", "highlight"]) + # # => + # + # tag("img", src: "open & shut.png") + # # => + # + # tag("img", { src: "open & shut.png" }, false, false) + # # => + # + # tag("div", data: { name: 'Stephen', city_state: %w(Chicago IL) }) + # # =>
    + # + # tag("div", class: { highlight: current_user.admin? }) + # # =>
    + # + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:488 + def tag(name = T.unsafe(nil), options = T.unsafe(nil), open = T.unsafe(nil), escape = T.unsafe(nil)); end + + # Returns a string of tokens built from +args+. + # + # ==== Examples + # token_list("foo", "bar") + # # => "foo bar" + # token_list("foo", "foo bar") + # # => "foo bar" + # token_list({ foo: true, bar: false }) + # # => "foo" + # token_list(nil, false, 123, "", "foo", { bar: true }) + # # => "123 foo bar" + # + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:547 + def token_list(*args); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:589 + def build_tag_values(*args); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:584 + def ensure_valid_html5_tag_name(name); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:609 + def tag_builder; end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:607 + def build_tag_values(*args); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:587 + def ensure_valid_html5_tag_name(name); end + end +end + +# pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:33 +ActionView::Helpers::TagHelper::ARIA_PREFIXES = T.let(T.unsafe(nil), Set) + +# pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:20 +ActionView::Helpers::TagHelper::BOOLEAN_ATTRIBUTES = T.let(T.unsafe(nil), Set) + +# pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:34 +ActionView::Helpers::TagHelper::DATA_PREFIXES = T.let(T.unsafe(nil), Set) + +# pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:42 +ActionView::Helpers::TagHelper::PRE_CONTENT_STRINGS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:36 +ActionView::Helpers::TagHelper::TAG_TYPES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:46 +class ActionView::Helpers::TagHelper::TagBuilder + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:213 + def initialize(view_context); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def a(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def abbr(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def address(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def animate(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def animate_motion(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def animate_transform(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def area(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def article(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def aside(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # Transforms a Hash into HTML Attributes, ready to be interpolated into + # ERB. + # + # > + # # => + # + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:222 + def attributes(attributes); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def audio(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def b(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def base(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def bdi(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def bdo(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def blockquote(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def body(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def br(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def button(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def canvas(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def caption(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def circle(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def cite(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def code(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def col(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def colgroup(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:226 + def content_tag_string(name, content, options, escape = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def data(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def datalist(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def dd(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def del(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def details(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def dfn(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def dialog(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def div(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def dl(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def dt(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def ellipse(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def em(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def embed(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def fieldset(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def figcaption(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def figure(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def footer(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def form(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def h1(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def h2(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def h3(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def h4(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def h5(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def h6(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def head(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def header(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def hgroup(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def hr(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def html(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def i(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def iframe(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def img(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def input(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def ins(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def kbd(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def keygen(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def label(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def legend(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def li(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def line(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def link(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def main(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def map(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def mark(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def menu(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def meta(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def meter(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def nav(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def noscript(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def object(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def ol(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def optgroup(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def option(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def output(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def p(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def path(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def picture(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def polygon(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def polyline(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def portal(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def pre(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def progress(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def q(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def rect(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def rp(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def rt(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def ruby(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def s(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def samp(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def script(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def search(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def section(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def select(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def set(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def slot(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def small(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def source(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def span(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def stop(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def strong(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def style(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def sub(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def summary(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def sup(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def table(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:235 + def tag_options(options, escape = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def tbody(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def td(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def template(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def textarea(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def tfoot(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def th(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def thead(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def time(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def title(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def tr(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def track(escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def u(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def ul(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def use(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def var(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def video(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def view(content = T.unsafe(nil), escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:80 + def wbr(escape: T.unsafe(nil), **options, &block); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:300 + def boolean_tag_option(key); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:333 + def method_missing(called, *args, escape: T.unsafe(nil), **options, &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:321 + def prefix_tag_option(prefix, key, value, escape); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:329 + def respond_to_missing?(*args); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:296 + def self_closing_tag_string(name, options, escape = T.unsafe(nil), tag_suffix = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:304 + def tag_option(key, value, escape); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:290 + def tag_string(name, content = T.unsafe(nil), options, escape: T.unsafe(nil), &block); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:47 + def define_element(name, code_generator:, method_name: T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:67 + def define_self_closing_element(name, code_generator:, method_name: T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tag_helper.rb:58 + def define_void_element(name, code_generator:, method_name: T.unsafe(nil)); end + end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags.rb:5 +module ActionView::Helpers::Tags + extend ::ActiveSupport::Autoload +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:6 +class ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + include ::ActionView::Helpers::TagHelper + include ::ActionView::Helpers::ContentExfiltrationPreventionHelper + include ::ActionView::Helpers::UrlHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::TextHelper + include ::ActionView::Helpers::FormTagHelper + include ::ActionView::Helpers::ActiveModelInstanceTag + extend ::ActionView::Helpers::UrlHelper::ClassMethods + extend ::ActionView::Helpers::SanitizeHelper::ClassMethods + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:11 + def initialize(object_name, method_name, template_object, options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:9 + def object; end + + # This is what child classes implement. + # + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:31 + def render; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:97 + def add_default_name_and_field(options, field = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:83 + def add_default_name_and_field_for_value(tag_value, options, field = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:108 + def add_default_name_and_id(options, field = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:95 + def add_default_name_and_id_for_value(tag_value, options, field = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:134 + def generate_ids?; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:126 + def name_and_id_index(options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:74 + def retrieve_autoindex(pre_match); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:63 + def retrieve_object(object); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:118 + def sanitized_method_name; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:122 + def sanitized_value(value); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:114 + def tag_id(index = T.unsafe(nil), namespace = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:110 + def tag_name(multiple = T.unsafe(nil), index = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:36 + def value; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:46 + def value_before_type_cast; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/base.rb:58 + def value_came_from_user?; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/check_box.rb:8 +class ActionView::Helpers::Tags::CheckBox < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::Checkable + + # pkg:gem/actionview#lib/action_view/helpers/tags/check_box.rb:11 + def initialize(object_name, method_name, template_object, checked_value, unchecked_value, options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/check_box.rb:17 + def render; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/check_box.rb:42 + def checked?(value); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/check_box.rb:59 + def hidden_field_for_checkbox(options); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/checkable.rb:6 +module ActionView::Helpers::Tags::Checkable + # pkg:gem/actionview#lib/action_view/helpers/tags/checkable.rb:7 + def input_checked?(options); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/collection_check_boxes.rb:8 +class ActionView::Helpers::Tags::CollectionCheckBoxes < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::CollectionHelpers + include ::ActionView::Helpers::FormOptionsHelper + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_check_boxes.rb:22 + def render(&block); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_check_boxes.rb:31 + def hidden_field_name; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_check_boxes.rb:27 + def render_component(builder); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/collection_check_boxes.rb:12 +class ActionView::Helpers::Tags::CollectionCheckBoxes::CheckBoxBuilder < ::ActionView::Helpers::Tags::CollectionHelpers::Builder + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_check_boxes.rb:19 + def check_box(extra_html_options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_check_boxes.rb:13 + def checkbox(extra_html_options = T.unsafe(nil)); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:6 +module ActionView::Helpers::Tags::CollectionHelpers + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:30 + def initialize(object_name, method_name, template_object, collection, value_method, text_method, options, html_options); end + + private + + # Generate default options for collection helpers, such as :checked and + # :disabled. + # + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:47 + def default_html_options_for_collection(item, value); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:117 + def hidden_field; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:123 + def hidden_field_name; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:40 + def instantiate_builder(builder_class, item, value, text, html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:85 + def render_collection; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:96 + def render_collection_for(builder_class, &block); end + + # Sanitize the attribute name used for the label's `for` attribute + # in collection helpers. When the value is nil or results in an + # empty sanitized string, skip the trailing underscore to match the + # id generated by add_default_name_and_id_for_value. + # + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:75 + def sanitize_attribute_name(value); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:7 +class ActionView::Helpers::Tags::CollectionHelpers::Builder + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:10 + def initialize(template_object, object_name, method_name, object, sanitized_attribute_name, text, value, input_html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:22 + def label(label_html_options = T.unsafe(nil), &block); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:8 + def object; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:8 + def text; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_helpers.rb:8 + def value; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/collection_radio_buttons.rb:8 +class ActionView::Helpers::Tags::CollectionRadioButtons < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::CollectionHelpers + include ::ActionView::Helpers::FormOptionsHelper + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_radio_buttons.rb:20 + def render(&block); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_radio_buttons.rb:25 + def render_component(builder); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/collection_radio_buttons.rb:12 +class ActionView::Helpers::Tags::CollectionRadioButtons::RadioButtonBuilder < ::ActionView::Helpers::Tags::CollectionHelpers::Builder + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_radio_buttons.rb:13 + def radio_button(extra_html_options = T.unsafe(nil)); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/collection_select.rb:6 +class ActionView::Helpers::Tags::CollectionSelect < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::SelectRenderer + include ::ActionView::Helpers::FormOptionsHelper + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_select.rb:10 + def initialize(object_name, method_name, template_object, collection, value_method, text_method, options, html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/collection_select.rb:19 + def render; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/color_field.rb:6 +class ActionView::Helpers::Tags::ColorField < ::ActionView::Helpers::Tags::TextField + # pkg:gem/actionview#lib/action_view/helpers/tags/color_field.rb:7 + def render; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/color_field.rb:15 + def validate_color_string(string); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/date_field.rb:6 +class ActionView::Helpers::Tags::DateField < ::ActionView::Helpers::Tags::DatetimeField + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/date_field.rb:8 + def format_datetime(value); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/date_select.rb:8 +class ActionView::Helpers::Tags::DateSelect < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::SelectRenderer + + # pkg:gem/actionview#lib/action_view/helpers/tags/date_select.rb:11 + def initialize(object_name, method_name, template_object, options, html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/date_select.rb:17 + def render; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/date_select.rb:32 + def datetime_selector(options, html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/date_select.rb:45 + def default_datetime(options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/date_select.rb:28 + def select_type; end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/tags/date_select.rb:22 + def select_type; end + end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/datetime_field.rb:6 +class ActionView::Helpers::Tags::DatetimeField < ::ActionView::Helpers::Tags::TextField + # pkg:gem/actionview#lib/action_view/helpers/tags/datetime_field.rb:7 + def render; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/datetime_field.rb:17 + def datetime_value(value); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/datetime_field.rb:25 + def format_datetime(value); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/datetime_field.rb:29 + def parse_datetime(value); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/datetime_local_field.rb:6 +class ActionView::Helpers::Tags::DatetimeLocalField < ::ActionView::Helpers::Tags::DatetimeField + # pkg:gem/actionview#lib/action_view/helpers/tags/datetime_local_field.rb:7 + def initialize(object_name, method_name, template_object, options = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/datetime_local_field.rb:19 + def format_datetime(value); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/tags/datetime_local_field.rb:13 + def field_type; end + end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/datetime_select.rb:6 +class ActionView::Helpers::Tags::DatetimeSelect < ::ActionView::Helpers::Tags::DateSelect; end + +# pkg:gem/actionview#lib/action_view/helpers/tags/email_field.rb:6 +class ActionView::Helpers::Tags::EmailField < ::ActionView::Helpers::Tags::TextField; end + +# pkg:gem/actionview#lib/action_view/helpers/tags/file_field.rb:6 +class ActionView::Helpers::Tags::FileField < ::ActionView::Helpers::Tags::TextField + # pkg:gem/actionview#lib/action_view/helpers/tags/file_field.rb:7 + def render; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/file_field.rb:23 + def hidden_field_for_multiple_file(options); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/grouped_collection_select.rb:6 +class ActionView::Helpers::Tags::GroupedCollectionSelect < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::SelectRenderer + include ::ActionView::Helpers::FormOptionsHelper + + # pkg:gem/actionview#lib/action_view/helpers/tags/grouped_collection_select.rb:10 + def initialize(object_name, method_name, template_object, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/grouped_collection_select.rb:21 + def render; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/hidden_field.rb:6 +class ActionView::Helpers::Tags::HiddenField < ::ActionView::Helpers::Tags::TextField + # pkg:gem/actionview#lib/action_view/helpers/tags/hidden_field.rb:7 + def render; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/label.rb:6 +class ActionView::Helpers::Tags::Label < ::ActionView::Helpers::Tags::Base + # pkg:gem/actionview#lib/action_view/helpers/tags/label.rb:34 + def initialize(object_name, method_name, template_object, content_or_options = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/label.rb:48 + def render(&block); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/label.rb:71 + def render_component(builder); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/label.rb:7 +class ActionView::Helpers::Tags::Label::LabelBuilder + # pkg:gem/actionview#lib/action_view/helpers/tags/label.rb:10 + def initialize(template_object, object_name, method_name, object, tag_value); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/label.rb:8 + def object; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/label.rb:29 + def to_s; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/label.rb:18 + def translation; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/month_field.rb:6 +class ActionView::Helpers::Tags::MonthField < ::ActionView::Helpers::Tags::DatetimeField + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/month_field.rb:8 + def format_datetime(value); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/number_field.rb:6 +class ActionView::Helpers::Tags::NumberField < ::ActionView::Helpers::Tags::TextField + # pkg:gem/actionview#lib/action_view/helpers/tags/number_field.rb:7 + def render; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/password_field.rb:6 +class ActionView::Helpers::Tags::PasswordField < ::ActionView::Helpers::Tags::TextField + # pkg:gem/actionview#lib/action_view/helpers/tags/password_field.rb:7 + def render; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/placeholderable.rb:6 +module ActionView::Helpers::Tags::Placeholderable + # pkg:gem/actionview#lib/action_view/helpers/tags/placeholderable.rb:7 + def initialize(*); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/radio_button.rb:8 +class ActionView::Helpers::Tags::RadioButton < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::Checkable + + # pkg:gem/actionview#lib/action_view/helpers/tags/radio_button.rb:11 + def initialize(object_name, method_name, template_object, tag_value, options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/radio_button.rb:16 + def render; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/radio_button.rb:26 + def checked?(value); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/range_field.rb:6 +class ActionView::Helpers::Tags::RangeField < ::ActionView::Helpers::Tags::NumberField; end + +# pkg:gem/actionview#lib/action_view/helpers/tags/search_field.rb:6 +class ActionView::Helpers::Tags::SearchField < ::ActionView::Helpers::Tags::TextField + # pkg:gem/actionview#lib/action_view/helpers/tags/search_field.rb:7 + def render; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/select.rb:6 +class ActionView::Helpers::Tags::Select < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::SelectRenderer + include ::ActionView::Helpers::FormOptionsHelper + + # pkg:gem/actionview#lib/action_view/helpers/tags/select.rb:10 + def initialize(object_name, method_name, template_object, choices, options, html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/select.rb:19 + def render; end + + private + + # Grouped choices look like this: + # + # [nil, []] + # { nil => [] } + # + # pkg:gem/actionview#lib/action_view/helpers/tags/select.rb:39 + def grouped_choices?; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/select_renderer.rb:6 +module ActionView::Helpers::Tags::SelectRenderer + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/select_renderer.rb:38 + def add_options(option_tags, options, value = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/select_renderer.rb:33 + def placeholder_required?(html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/select_renderer.rb:8 + def select_content_tag(option_tags, options, html_options); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/tel_field.rb:6 +class ActionView::Helpers::Tags::TelField < ::ActionView::Helpers::Tags::TextField; end + +# pkg:gem/actionview#lib/action_view/helpers/tags/text_area.rb:8 +class ActionView::Helpers::Tags::TextArea < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::Placeholderable + + # pkg:gem/actionview#lib/action_view/helpers/tags/text_area.rb:11 + def render; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/text_field.rb:8 +class ActionView::Helpers::Tags::TextField < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::Placeholderable + + # pkg:gem/actionview#lib/action_view/helpers/tags/text_field.rb:11 + def render; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/text_field.rb:27 + def field_type; end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/tags/text_field.rb:21 + def field_type; end + end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/time_field.rb:6 +class ActionView::Helpers::Tags::TimeField < ::ActionView::Helpers::Tags::DatetimeField + # pkg:gem/actionview#lib/action_view/helpers/tags/time_field.rb:7 + def initialize(object_name, method_name, template_object, options = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/time_field.rb:13 + def format_datetime(value); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/time_select.rb:6 +class ActionView::Helpers::Tags::TimeSelect < ::ActionView::Helpers::Tags::DateSelect; end + +# pkg:gem/actionview#lib/action_view/helpers/tags/time_zone_select.rb:6 +class ActionView::Helpers::Tags::TimeZoneSelect < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::SelectRenderer + include ::ActionView::Helpers::FormOptionsHelper + + # pkg:gem/actionview#lib/action_view/helpers/tags/time_zone_select.rb:10 + def initialize(object_name, method_name, template_object, priority_zones, options, html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/time_zone_select.rb:17 + def render; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/translator.rb:6 +class ActionView::Helpers::Tags::Translator + # pkg:gem/actionview#lib/action_view/helpers/tags/translator.rb:7 + def initialize(object, object_name, method_and_value, scope:); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/translator.rb:14 + def translate; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/translator.rb:31 + def human_attribute_name; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/translator.rb:22 + def i18n_default; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/translator.rb:20 + def method_and_value; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/translator.rb:20 + def model; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/translator.rb:20 + def object_name; end + + # pkg:gem/actionview#lib/action_view/helpers/tags/translator.rb:20 + def scope; end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/url_field.rb:6 +class ActionView::Helpers::Tags::UrlField < ::ActionView::Helpers::Tags::TextField; end + +# pkg:gem/actionview#lib/action_view/helpers/tags/week_field.rb:6 +class ActionView::Helpers::Tags::WeekField < ::ActionView::Helpers::Tags::DatetimeField + private + + # pkg:gem/actionview#lib/action_view/helpers/tags/week_field.rb:8 + def format_datetime(value); end +end + +# pkg:gem/actionview#lib/action_view/helpers/tags/weekday_select.rb:6 +class ActionView::Helpers::Tags::WeekdaySelect < ::ActionView::Helpers::Tags::Base + include ::ActionView::Helpers::Tags::SelectRenderer + include ::ActionView::Helpers::FormOptionsHelper + + # pkg:gem/actionview#lib/action_view/helpers/tags/weekday_select.rb:10 + def initialize(object_name, method_name, template_object, options, html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/tags/weekday_select.rb:16 + def render; end +end + +# = Action View Text \Helpers +# +# The TextHelper module provides a set of methods for filtering, formatting +# and transforming strings, which can reduce the amount of inline Ruby code in +# your views. These helper methods extend Action View making them callable +# within your template files. +# +# ==== Sanitization +# +# Most text helpers that generate HTML output sanitize the given input by default, +# but do not escape it. This means HTML tags will appear in the page but all malicious +# code will be removed. Let's look at some examples using the +simple_format+ method: +# +# simple_format('Example') +# # => "

    Example

    " +# +# simple_format('Example') +# # => "

    Example

    " +# +# If you want to escape all content, you should invoke the +h+ method before +# calling the text helper. +# +# simple_format h('Example') +# # => "

    <a href=\"http://example.com/\">Example</a>

    " +# +# pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:36 +module ActionView::Helpers::TextHelper + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + include ::ActionView::Helpers::TagHelper + extend ::ActiveSupport::Concern + include ::ActionView::Helpers::SanitizeHelper + + mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods + + # The preferred method of outputting text in your views is to use the + # <%= "text" %> eRuby syntax. The regular +puts+ and +print+ methods + # do not operate as expected in an eRuby code block. If you absolutely must + # output text within a non-output code block (i.e., <% %>), you + # can use the +concat+ method. + # + # <% concat "hello" %> is equivalent to <%= "hello" %> + # + # <% + # unless signed_in? + # concat link_to("Sign In", action: :sign_in) + # end + # %> + # + # is equivalent to + # + # <% unless signed_in? %> + # <%= link_to "Sign In", action: :sign_in %> + # <% end %> + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:63 + def concat(string); end + + # Returns the current cycle string after a cycle has been started. Useful + # for complex table highlighting or any other design need which requires + # the current cycle string in more than one place. + # + # <%# Alternate background colors %> + # <% @items = [1,2,3,4] %> + # <% @items.each do |item| %> + #
    "> + # <%= item %> + #
    + # <% end %> + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:477 + def current_cycle(name = T.unsafe(nil)); end + + # Creates a Cycle object whose +to_s+ method cycles through elements of an + # array every time it is called. This can be used for example, to alternate + # classes for table rows. You can use named cycles to allow nesting in loops. + # Passing a Hash as the last parameter with a :name key will create a + # named cycle. The default name for a cycle without a +:name+ key is + # "default". You can manually reset a cycle by calling reset_cycle + # and passing the name of the cycle. The current cycle string can be obtained + # anytime using the current_cycle method. + # + # <%# Alternate CSS classes for even and odd numbers... %> + # <% @items = [1,2,3,4] %> + # + # <% @items.each do |item| %> + # "> + # + # + # <% end %> + #
    <%= item %>
    + # + # + # <%# Cycle CSS classes for rows, and text colors for values within each row %> + # <% @items = [ + # { first: "Robert", middle: "Daniel", last: "James" }, + # { first: "Emily", middle: "Shannon", maiden: "Pike", last: "Hicks" }, + # { first: "June", middle: "Dae", last: "Jones" }, + # ] %> + # <% @items.each do |item| %> + # "> + # + # <% item.values.each do |value| %> + # <%# Create a named cycle "colors" %> + # "> + # <%= value %> + # + # <% end %> + # <% reset_cycle("colors") %> + # + # + # <% end %> + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:453 + def cycle(first_value, *values); end + + # Extracts the first occurrence of +phrase+ plus surrounding text from + # +text+. An omission marker is prepended / appended if the start / end of + # the result does not coincide with the start / end of +text+. The result + # is always stripped in any case. Returns +nil+ if +phrase+ isn't found. + # + # ==== Options + # + # [+:radius+] + # The number of characters (or tokens — see +:separator+ option) around + # +phrase+ to include in the result. Defaults to 100. + # + # [+:omission+] + # The marker to prepend / append when the start / end of the excerpt + # does not coincide with the start / end of +text+. Defaults to + # "...". + # + # [+:separator+] + # The separator between tokens to count for +:radius+. Defaults to + # "", which treats each character as a token. + # + # ==== Examples + # + # excerpt('This is an example', 'an', radius: 5) + # # => "...s is an exam..." + # + # excerpt('This is an example', 'is', radius: 5) + # # => "This is a..." + # + # excerpt('This is an example', 'is') + # # => "This is an example" + # + # excerpt('This next thing is an example', 'ex', radius: 2) + # # => "...next..." + # + # excerpt('This is also an example', 'an', radius: 8, omission: ' ') + # # => " is also an example" + # + # excerpt('This is a very beautiful morning', 'very', separator: ' ', radius: 1) + # # => "...a very beautiful..." + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:251 + def excerpt(text, phrase, options = T.unsafe(nil)); end + + # Highlights occurrences of +phrases+ in +text+ by formatting them with a + # highlighter string. +phrases+ can be one or more strings or regular + # expressions. The result will be marked HTML safe. By default, +text+ is + # sanitized before highlighting to prevent possible XSS attacks. + # + # If a block is specified, it will be used instead of the highlighter + # string. Each occurrence of a phrase will be passed to the block, and its + # return value will be inserted into the final result. + # + # ==== Options + # + # [+:highlighter+] + # The highlighter string. Uses \1 as the placeholder for a + # phrase. Defaults to "\1". The numbered placeholders + # \0 to \9 are expanded; other +String#sub+ replacement escapes + # are not. The phrase is HTML escaped, quotes included. This option + # is ignored if a block is specified. + # + # WARNING: Put a placeholder only in element content or inside a + # quoted attribute value. HTML escaping does not make the phrase safe + # in an unquoted attribute value, in a URL, JavaScript or CSS + # context, or in an attribute whose value is HTML, such as +srcdoc+. + # + # [+:sanitize+] + # Whether to sanitize +text+ before highlighting. Defaults to true. + # + # ==== Examples + # + # highlight('You searched for: rails', 'rails') + # # => "You searched for: rails" + # + # highlight('You searched for: rails', /for|rails/) + # # => "You searched for: rails" + # + # highlight('You searched for: ruby, rails, dhh', 'actionpack') + # # => "You searched for: ruby, rails, dhh" + # + # highlight('You searched for: rails', ['for', 'rails'], highlighter: '\1') + # # => "You searched for: rails" + # + # highlight('You searched for: rails', 'rails', highlighter: '\1') + # # => "You searched for: rails" + # + # highlight('You searched for: rails', 'rails') { |match| link_to(search_path(q: match)) } + # # => "You searched for: rails" + # + # highlight('ruby on rails', 'rails', sanitize: false) + # # => "ruby on rails" + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:181 + def highlight(text, phrases, options = T.unsafe(nil), &block); end + + # Attempts to pluralize the +singular+ word unless +count+ is 1. If + # +plural+ is supplied, it will use that when count is > 1, otherwise + # it will use the Inflector to determine the plural form for the given locale, + # which defaults to +I18n.locale+. + # + # The word will be pluralized using rules defined for the locale + # (you must define your own inflection rules for languages other than English). + # See ActiveSupport::Inflector.pluralize. + # + # pluralize(1, 'person') + # # => "1 person" + # + # pluralize(2, 'person') + # # => "2 people" + # + # pluralize(3, 'person', plural: 'users') + # # => "3 users" + # + # pluralize(0, 'person') + # # => "0 people" + # + # pluralize(2, 'Person', locale: :de) + # # => "2 Personen" + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:313 + def pluralize(count, singular, plural_arg = T.unsafe(nil), plural: T.unsafe(nil), locale: T.unsafe(nil)); end + + # Resets a cycle so that it starts from the first element the next time + # it is called. Pass in +name+ to reset a named cycle. + # + # <%# Alternate CSS classes for even and odd numbers... %> + # <% @items = [[1,2,3,4], [5,6,3], [3,4,5,6,7,4]] %> + # + # <% @items.each do |item| %> + # "> + # <% item.each do |value| %> + # "> + # <%= value %> + # + # <% end %> + # + # <% reset_cycle("colors") %> + # + # <% end %> + #
    + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:500 + def reset_cycle(name = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:67 + def safe_concat(string); end + + # Returns +text+ transformed into HTML using simple formatting rules. + # Two or more consecutive newlines (\n\n or \r\n\r\n) are + # considered a paragraph and wrapped in

    tags. One newline + # (\n or \r\n) is considered a linebreak and a + #
    tag is appended. This method does not remove the + # newlines from the +text+. + # + # You can pass any HTML attributes into html_options. These + # will be added to all created paragraphs. + # + # ==== Options + # * :sanitize - If +false+, does not sanitize +text+. + # * :sanitize_options - Any extra options you want appended to the sanitize. + # * :wrapper_tag - String representing the wrapper tag, defaults to "p". + # + # ==== Examples + # my_text = "Here is some basic text...\n...with a line break." + # + # simple_format(my_text) + # # => "

    Here is some basic text...\n
    ...with a line break.

    " + # + # simple_format(my_text, {}, wrapper_tag: "div") + # # => "
    Here is some basic text...\n
    ...with a line break.
    " + # + # more_text = "We want to put a paragraph...\n\n...right there." + # + # simple_format(more_text) + # # => "

    We want to put a paragraph...

    \n\n

    ...right there.

    " + # + # simple_format("Look ma! A class!", class: 'description') + # # => "

    Look ma! A class!

    " + # + # simple_format("Unblinkable.") + # # => "

    Unblinkable.

    " + # + # simple_format("Blinkable! It's true.", {}, sanitize: false) + # # => "

    Blinkable! It's true.

    " + # + # simple_format("Continue", {}, { sanitize_options: { attributes: %w[target href] } }) + # # => "

    Continue

    " + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:399 + def simple_format(text, html_options = T.unsafe(nil), options = T.unsafe(nil)); end + + # Truncates +text+ if it is longer than a specified +:length+. If +text+ + # is truncated, an omission marker will be appended to the result for a + # total length not exceeding +:length+. + # + # You can also pass a block to render and append extra content after the + # omission marker when +text+ is truncated. However, this content _can_ + # cause the total length to exceed +:length+ characters. + # + # The result will be escaped unless escape: false is specified. + # In any case, the result will be marked HTML-safe. Care should be taken + # if +text+ might contain HTML tags or entities, because truncation could + # produce invalid HTML, such as unbalanced or incomplete tags. + # + # ==== Options + # + # [+:length+] + # The maximum number of characters that should be returned, excluding + # any extra content from the block. Defaults to 30. + # + # [+:omission+] + # The string to append after truncating. Defaults to "...". + # + # [+:separator+] + # A string or regexp used to find a breaking point at which to truncate. + # By default, truncation can occur at any character in +text+. + # + # [+:escape+] + # Whether to escape the result. Defaults to true. + # + # ==== Examples + # + # truncate("Once upon a time in a world far far away") + # # => "Once upon a time in a world..." + # + # truncate("Once upon a time in a world far far away", length: 17) + # # => "Once upon a ti..." + # + # truncate("Once upon a time in a world far far away", length: 17, separator: ' ') + # # => "Once upon a..." + # + # truncate("And they found that many people were sleeping better.", length: 25, omission: '... (continued)') + # # => "And they f... (continued)" + # + # truncate("

    Once upon a time in a world far far away

    ") + # # => "<p>Once upon a time in a wo..." + # + # truncate("

    Once upon a time in a world far far away

    ", escape: false) + # # => "

    Once upon a time in a wo..." + # + # truncate("Once upon a time in a world far far away") { link_to "Continue", "#" } + # # => "Once upon a time in a world...Continue" + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:122 + def truncate(text, options = T.unsafe(nil), &block); end + + # Wraps the +text+ into lines no longer than +line_width+ width. This method + # breaks on the first whitespace character that does not exceed +line_width+ + # (which is 80 by default). + # + # word_wrap('Once upon a time') + # # => "Once upon a time" + # + # word_wrap('Once upon a time, in a kingdom called Far Far Away, a king fell ill, and finding a successor to the throne turned out to be more trouble than anyone could have imagined...') + # # => "Once upon a time, in a kingdom called Far Far Away, a king fell ill, and finding\na successor to the throne turned out to be more trouble than anyone could have\nimagined..." + # + # word_wrap('Once upon a time', line_width: 8) + # # => "Once\nupon a\ntime" + # + # word_wrap('Once upon a time', line_width: 1) + # # => "Once\nupon\na\ntime" + # + # You can also specify a custom +break_sequence+ ("\n" by default): + # + # word_wrap('Once upon a time', line_width: 1, break_sequence: "\r\n") + # # => "Once\r\nupon\r\na\r\ntime" + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:343 + def word_wrap(text, line_width: T.unsafe(nil), break_sequence: T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:563 + def cut_excerpt_part(part_position, part, separator, options); end + + # The cycle helpers need to store the cycles in a place that is + # guaranteed to be reset every time a page is rendered, so it + # uses an instance variable of ActionView::Base. + # + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:545 + def get_cycle(name); end + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:550 + def set_cycle(name, cycle_object); end + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:555 + def split_paragraphs(text); end +end + +# pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:505 +class ActionView::Helpers::TextHelper::Cycle + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:508 + def initialize(first_value, *values); end + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:517 + def current_value; end + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:513 + def reset; end + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:521 + def to_s; end + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:506 + def values; end + + private + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:528 + def next_index; end + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:532 + def previous_index; end + + # pkg:gem/actionview#lib/action_view/helpers/text_helper.rb:536 + def step_index(n); end +end + +# = Action View Translation \Helpers +# +# pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:9 +module ActionView::Helpers::TranslationHelper + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + include ::ActionView::Helpers::TagHelper + extend ::ActiveSupport::Concern + + # pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:119 + def l(object, **options); end + + # Delegates to I18n.localize with no additional functionality. + # + # See https://www.rubydoc.info/gems/i18n/I18n/Backend/Base:localize + # for more information. + # + # pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:116 + def localize(object, **options); end + + # pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:110 + def t(key, **options); end + + # Delegates to I18n#translate but also performs three additional + # functions. + # + # First, it will ensure that any thrown +MissingTranslation+ messages will + # be rendered as inline spans that: + # + # * Have a translation-missing class applied + # * Contain the missing key as the value of the +title+ attribute + # * Have a titleized version of the last key segment as text + # + # For example, the value returned for the missing translation key + # "blog.post.title" will be: + # + # Title + # + # This allows for views to display rather reasonable strings while still + # giving developers a way to find missing translations. + # + # If you would prefer missing translations to raise an error, you can + # opt out of span-wrapping behavior globally by setting + # config.i18n.raise_on_missing_translations = true or + # individually by passing raise: true as an option to + # translate. + # + # Second, if the key starts with a period translate will scope + # the key by the current partial. Calling translate(".foo") from + # the people/index.html.erb template is equivalent to calling + # translate("people.index.foo"). This makes it less + # repetitive to translate many keys within the same partial and provides + # a convention to scope keys consistently. + # + # Third, the translation will be marked as html_safe if the key + # has the suffix "_html" or the last element of the key is "html". Calling + # translate("footer_html") or translate("footer.html") + # will return an HTML safe string that won't be escaped by other HTML + # helper methods. This naming convention helps to identify translations + # that include HTML tags so that you know what kind of output to expect + # when you call translate in a template and translators know which keys + # they can provide HTML values for. + # + # To access the translated text along with the fully resolved + # translation key, translate accepts a block: + # + # <%= translate(".relative_key") do |translation, resolved_key| %> + # <%= translation %> + # <% end %> + # + # This enables annotate translated text to be aware of the scope it was + # resolved against. + # + # pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:73 + def translate(key, **options); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:142 + def missing_translation(key, options); end + + # pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:128 + def scope_key_by_partial(key); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:15 + def raise_on_missing_translations; end + + # pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:15 + def raise_on_missing_translations=(_arg0); end + end +end + +# pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:122 +ActionView::Helpers::TranslationHelper::MISSING_TRANSLATION = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actionview#lib/action_view/helpers/translation_helper.rb:125 +ActionView::Helpers::TranslationHelper::NO_DEFAULT = T.let(T.unsafe(nil), Array) + +# = Action View URL \Helpers +# +# Provides a set of methods for making links and getting URLs that +# depend on the routing subsystem (see ActionDispatch::Routing). +# This allows you to use the same format for links in views +# and controllers. +# +# pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:17 +module ActionView::Helpers::UrlHelper + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + include ::ActionView::Helpers::TagHelper + include ::ActionView::Helpers::ContentExfiltrationPreventionHelper + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods + + # Generates a form containing a single button that submits to the URL created + # by the set of +options+. This is the safest method to ensure links that + # cause changes to your data are not triggered by search bots or accelerators. + # + # You can control the form and button behavior with +html_options+. Most + # values in +html_options+ are passed through to the button element. For + # example, passing a +:class+ option within +html_options+ will set the + # class attribute of the button element. + # + # The class attribute of the form element can be set by passing a + # +:form_class+ option within +html_options+. It defaults to + # "button_to" to allow styling of the form and its children. + # + # The form submits a POST request by default if the object is not persisted; + # conversely, if the object is persisted, it will submit a PATCH request. + # To specify a different HTTP verb use the +:method+ option within +html_options+. + # + # If the HTML button generated from +button_to+ does not work with your layout, you can + # consider using the +link_to+ method with the +data-turbo-method+ + # attribute as described in the +link_to+ documentation. + # + # ==== Options + # The +options+ hash accepts the same options as +url_for+. To generate a + # element without an [action] attribute, pass + # false: + # + # <%= button_to "New", false %> + # # => " + # # + # # + # #

    " + # + # Most values in +html_options+ are passed through to the button element, + # but there are a few special options: + # + # * :method - \Symbol of HTTP verb. Supported verbs are :post, :get, + # :delete, :patch, and :put. By default it will be :post. + # * :disabled - If set to true, it will generate a disabled button. + # * :data - This option can be used to add custom data attributes. + # * :form - This hash will be form attributes + # * :form_class - This controls the class of the form within which the submit button will + # be placed + # * :params - \Hash of parameters to be rendered as hidden fields within the form. + # + # ==== Examples + # <%= button_to "New", action: "new" %> + # # => "
    + # # + # # + # #
    " + # + # <%= button_to "New", new_article_path %> + # # => "
    + # # + # # + # #
    " + # + # <%= button_to "New", new_article_path, params: { time: Time.now } %> + # # => "
    + # # + # # + # # + # #
    " + # + # <%= button_to [:make_happy, @user] do %> + # Make happy <%= @user.name %> + # <% end %> + # # => "
    + # # + # # + # #
    " + # + # <%= button_to "New", { action: "new" }, form_class: "new-thing" %> + # # => "
    + # # + # # + # #
    " + # + # <%= button_to "Create", { action: "create" }, form: { "data-type" => "json" } %> + # # => "
    + # # + # # + # #
    " + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:296 + def button_to(name = T.unsafe(nil), options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:35 + def button_to_generates_button_tag; end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:35 + def button_to_generates_button_tag=(val); end + + # True if the current request URI was generated by the given +options+. + # + # ==== Examples + # Let's say we're in the http://www.example.com/shop/checkout?order=desc&page=1 action. + # + # current_page?(action: 'process') + # # => false + # + # current_page?(action: 'checkout') + # # => true + # + # current_page?(controller: 'library', action: 'checkout') + # # => false + # + # current_page?(controller: 'shop', action: 'checkout') + # # => true + # + # current_page?(controller: 'shop', action: 'checkout', order: 'asc') + # # => false + # + # current_page?(controller: 'shop', action: 'checkout', order: 'desc', page: '1') + # # => true + # + # current_page?(controller: 'shop', action: 'checkout', order: 'desc', page: '2') + # # => false + # + # current_page?('http://www.example.com/shop/checkout') + # # => true + # + # current_page?('http://www.example.com/shop/checkout', check_parameters: true) + # # => false + # + # current_page?('/shop/checkout') + # # => true + # + # current_page?('http://www.example.com/shop/checkout?order=desc&page=1') + # # => true + # + # Different actions may share the same URL path but have a different HTTP method. Let's say we + # sent a POST to http://www.example.com/products and rendered a validation error. + # + # current_page?(controller: 'product', action: 'index') + # # => false + # + # current_page?(controller: 'product', action: 'create') + # # => false + # + # current_page?(controller: 'product', action: 'create', method: :post) + # # => true + # + # current_page?(controller: 'product', action: 'index', method: [:get, :post]) + # # => true + # + # We can also pass in the symbol arguments instead of strings. + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:559 + def current_page?(options = T.unsafe(nil), check_parameters: T.unsafe(nil), method: T.unsafe(nil), **options_as_kwargs); end + + # Creates an anchor element of the given +name+ using a URL created by the set of +options+. + # See the valid options in the documentation for +url_for+. It's also possible to + # pass a \String instead of an options hash, which generates an anchor element that uses the + # value of the \String as the href for the link. Using a :back \Symbol instead + # of an options hash will generate a link to the referrer (a JavaScript back link + # will be used in place of a referrer if none exists). If +nil+ is passed as the name + # the value of the link itself will become the name. + # + # ==== Signatures + # + # link_to(body, url, html_options = {}) + # # url is a String; you can use URL helpers like + # # posts_path + # + # link_to(body, url_options = {}, html_options = {}) + # # url_options, except :method, is passed to url_for + # + # link_to(options = {}, html_options = {}) do + # # name + # end + # + # link_to(url, html_options = {}) do + # # name + # end + # + # link_to(active_record_model) + # + # ==== Options + # * :data - This option can be used to add custom data attributes. + # + # ==== Examples + # + # Because it relies on +url_for+, +link_to+ supports both older-style controller/action/id arguments + # and newer RESTful routes. Current \Rails style favors RESTful routes whenever possible, so base + # your application on resources and use + # + # link_to "Profile", profile_path(@profile) + # # => Profile + # + # or the even pithier + # + # link_to "Profile", @profile + # # => Profile + # + # in place of the older more verbose, non-resource-oriented + # + # link_to "Profile", controller: "profiles", action: "show", id: @profile + # # => Profile + # + # Similarly, + # + # link_to "Profiles", profiles_path + # # => Profiles + # + # is better than + # + # link_to "Profiles", controller: "profiles" + # # => Profiles + # + # When name is +nil+ the href is presented instead + # + # link_to nil, "http://example.com" + # # => http://www.example.com + # + # More concise yet, when +name+ is an Active Record model that defines a + # +to_s+ method returning a default value or a model instance attribute + # + # link_to @profile + # # => Eileen + # + # You can use a block as well if your link target is hard to fit into the name parameter. ERB example: + # + # <%= link_to(@profile) do %> + # <%= @profile.name %> -- Check it out! + # <% end %> + # # => + # David -- Check it out! + # + # + # Classes and ids for CSS are easy to produce: + # + # link_to "Articles", articles_path, id: "news", class: "article" + # # => Articles + # + # Be careful when using the older argument style, as an extra literal hash is needed: + # + # link_to "Articles", { controller: "articles" }, id: "news", class: "article" + # # => Articles + # + # Leaving the hash off gives the wrong link: + # + # link_to "WRONG!", controller: "articles", id: "news", class: "article" + # # => WRONG! + # + # +link_to+ can also produce links with anchors or query strings: + # + # link_to "Comment wall", profile_path(@profile, anchor: "wall") + # # => Comment wall + # + # link_to "Ruby on Rails search", controller: "searches", query: "ruby on rails" + # # => Ruby on Rails search + # + # link_to "Nonsense search", searches_path(foo: "bar", baz: "quux") + # # => Nonsense search + # + # You can set any link attributes such as target, rel, type: + # + # link_to "External link", "http://www.rubyonrails.org/", target: "_blank", rel: "nofollow" + # # => External link + # + # ==== Turbo + # + # Rails 7 ships with Turbo enabled by default. Turbo provides the following +:data+ options: + # + # * turbo_method: symbol of HTTP verb - Performs a Turbo link visit + # with the given HTTP verb. Forms are recommended when performing non-+GET+ requests. + # Only use data-turbo-method where a form is not possible. + # + # * turbo_confirm: "question?" - Adds a confirmation dialog to the link with the + # given value. + # + # {Consult the Turbo Handbook for more information on the options + # above.}[https://turbo.hotwired.dev/handbook/drive#performing-visits-with-a-different-method] + # + # ===== \Examples + # + # link_to "Delete profile", @profile, data: { turbo_method: :delete } + # # => Delete profile + # + # link_to "Visit Other Site", "https://rubyonrails.org/", data: { turbo_confirm: "Are you sure?" } + # # => Visit Other Site + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:198 + def link_to(name = T.unsafe(nil), options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Creates a link tag of the given +name+ using a URL created by the set of + # +options+ if +condition+ is true, otherwise only the name is + # returned. To specialize the default behavior, you can pass a block that + # accepts the name or the full argument list for +link_to_if+. + # + # ==== Examples + # <%= link_to_if(@current_user.nil?, "Login", { controller: "sessions", action: "new" }) %> + # # If the user isn't logged in... + # # => Login + # + # <%= + # link_to_if(@current_user.nil?, "Login", { controller: "sessions", action: "new" }) do + # link_to(@current_user.login, { controller: "accounts", action: "show", id: @current_user }) + # end + # %> + # # If the user isn't logged in... + # # => Login + # # If they are logged in... + # # => my_username + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:438 + def link_to_if(condition, name, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Creates a link tag of the given +name+ using a URL created by the set of + # +options+ unless +condition+ is true, in which case only the name is + # returned. To specialize the default behavior (i.e., show a login link rather + # than just the plaintext link text), you can pass a block that + # accepts the name or the full argument list for +link_to_unless+. + # + # ==== Examples + # <%= link_to_unless(@current_user.nil?, "Reply", { action: "reply" }) %> + # # If the user is logged in... + # # => Reply + # + # <%= + # link_to_unless(@current_user.nil?, "Reply", { action: "reply" }) do |name| + # link_to(name, { controller: "accounts", action: "signup" }) + # end + # %> + # # If the user is logged in... + # # => Reply + # # If not... + # # => Reply + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:415 + def link_to_unless(condition, name, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Creates a link tag of the given +name+ using a URL created by the set of + # +options+ unless the current request URI is the same as the links, in + # which case only the name is returned (or the given block is yielded, if + # one exists). You can give +link_to_unless_current+ a block which will + # specialize the default behavior (e.g., show a "Start Here" link rather + # than the link's text). + # + # ==== Examples + # Let's say you have a navigation menu... + # + # + # + # If in the "about" action, it will render... + # + # + # + # ...but if in the "index" action, it will render: + # + # + # + # The implicit block given to +link_to_unless_current+ is evaluated if the current + # action is the action given. So, if we had a comments page and wanted to render a + # "Go Back" link instead of a link to the comments page, we could do something like this... + # + # <%= + # link_to_unless_current("Comment", { controller: "comments", action: "new" }) do + # link_to("Go back", { controller: "posts", action: "index" }) + # end + # %> + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:391 + def link_to_unless_current(name, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Creates a mailto link tag to the specified +email_address+, which is + # also used as the name of the link unless +name+ is specified. Additional + # HTML attributes for the link can be passed in +html_options+. + # + # +mail_to+ has several methods for customizing the email itself by + # passing special keys to +html_options+. + # + # ==== Options + # * :subject - Preset the subject line of the email. + # * :body - Preset the body of the email. + # * :cc - Carbon Copy additional recipients on the email. + # * :bcc - Blind Carbon Copy additional recipients on the email. + # * :reply_to - Preset the +Reply-To+ field of the email. + # + # ==== Obfuscation + # Prior to \Rails 4.0, +mail_to+ provided options for encoding the address + # in order to hinder email harvesters. To take advantage of these options, + # install the +actionview-encoded_mail_to+ gem. + # + # ==== Examples + # mail_to "me@domain.com" + # # => me@domain.com + # + # mail_to "me@domain.com", "My email" + # # => My email + # + # mail_to "me@domain.com", cc: "ccaddress@domain.com", + # subject: "This is an example email" + # # => me@domain.com + # + # You can use a block as well if your link target is hard to fit into the name parameter. ERB example: + # + # <%= mail_to "me@domain.com" do %> + # Email me: me@domain.com + # <% end %> + # # => + # Email me: me@domain.com + # + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:488 + def mail_to(email_address, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Creates a TEL anchor link tag to the specified +phone_number+. When the + # link is clicked, the default app to make phone calls is opened and + # prepopulated with the phone number. + # + # If +name+ is not specified, +phone_number+ will be used as the name of + # the link. + # + # A +country_code+ option is supported, which prepends a plus sign and the + # given country code to the linked phone number. For example, + # country_code: "01" will prepend +01 to the linked + # phone number. + # + # Additional HTML attributes for the link can be passed via +html_options+. + # + # ==== Options + # * :country_code - Prepends the country code to the phone number + # + # ==== Examples + # phone_to "1234567890" + # # => 1234567890 + # + # phone_to "1234567890", "Phone me" + # # => Phone me + # + # phone_to "1234567890", country_code: "01" + # # => 1234567890 + # + # You can use a block as well if your link target is hard to fit into the name parameter. \ERB example: + # + # <%= phone_to "1234567890" do %> + # Phone me: + # <% end %> + # # => + # Phone me: + # + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:693 + def phone_to(phone_number, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Creates an SMS anchor link tag to the specified +phone_number+. When the + # link is clicked, the default SMS messaging app is opened ready to send a + # message to the linked phone number. If the +body+ option is specified, + # the contents of the message will be preset to +body+. + # + # If +name+ is not specified, +phone_number+ will be used as the name of + # the link. + # + # A +country_code+ option is supported, which prepends a plus sign and the + # given country code to the linked phone number. For example, + # country_code: "01" will prepend +01 to the linked + # phone number. + # + # Additional HTML attributes for the link can be passed via +html_options+. + # + # ==== Options + # * :country_code - Prepend the country code to the phone number. + # * :body - Preset the body of the message. + # + # ==== Examples + # sms_to "5155555785" + # # => 5155555785 + # + # sms_to "5155555785", country_code: "01" + # # => 5155555785 + # + # sms_to "5155555785", "Text me" + # # => Text me + # + # sms_to "5155555785", body: "I have a question about your product." + # # => 5155555785 + # + # You can use a block as well if your link target is hard to fit into the name parameter. \ERB example: + # + # <%= sms_to "5155555785" do %> + # Text me: + # <% end %> + # # => + # Text me: + # + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:642 + def sms_to(phone_number, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end + + # Basic implementation of url_for to allow use helpers without routes existence + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:38 + def url_for(options = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:50 + def _back_url; end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:55 + def _filtered_referrer; end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:736 + def add_method_to_attributes!(html_options, method); end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:707 + def convert_options_to_data_attributes(options, html_options); end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:730 + def link_to_remote_options?(options); end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:747 + def method_for_options(options); end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:765 + def method_not_get_method?(method); end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:786 + def method_tag(method); end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:834 + def remove_trailing_slash!(url_string); end + + # Returns an array of hashes each containing :name and :value keys + # suitable for use as the names and values of form input fields: + # + # to_form_params(name: 'David', nationality: 'Danish') + # # => [{name: 'name', value: 'David'}, {name: 'nationality', value: 'Danish'}] + # + # to_form_params(country: { name: 'Denmark' }) + # # => [{name: 'country[name]', value: 'Denmark'}] + # + # to_form_params(countries: ['Denmark', 'Sweden']}) + # # => [{name: 'countries[]', value: 'Denmark'}, {name: 'countries[]', value: 'Sweden'}] + # + # An optional namespace can be passed to enclose key names: + # + # to_form_params({ name: 'Denmark' }, 'country') + # # => [{name: 'country[name]', value: 'Denmark'}] + # + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:808 + def to_form_params(attribute, namespace = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:770 + def token_tag(token = T.unsafe(nil), form_options: T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:722 + def url_target(name, options); end + + class << self + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:35 + def button_to_generates_button_tag; end + + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:35 + def button_to_generates_button_tag=(val); end + end +end + +# This helper may be included in any class that includes the +# URL helpers of a routes (routes.url_helpers). Some methods +# provided here will only work in the context of a request +# (link_to_unless_current, for instance), which must be provided +# as a method called #request on the context. +# +# pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:23 +ActionView::Helpers::UrlHelper::BUTTON_TAG_METHOD_VERBS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:29 +module ActionView::Helpers::UrlHelper::ClassMethods + # pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:30 + def _url_for_modules; end +end + +# pkg:gem/actionview#lib/action_view/helpers/url_helper.rb:757 +ActionView::Helpers::UrlHelper::STRINGIFIED_COMMON_METHODS = T.let(T.unsafe(nil), Hash) + +# This is a class to fix I18n global state. Whenever you provide I18n.locale during a request, +# it will trigger the lookup_context and consequently expire the cache. +# +# pkg:gem/actionview#lib/action_view/rendering.rb:8 +class ActionView::I18nProxy < ::I18n::Config + # pkg:gem/actionview#lib/action_view/rendering.rb:11 + def initialize(original_config, lookup_context); end + + # pkg:gem/actionview#lib/action_view/rendering.rb:17 + def locale; end + + # pkg:gem/actionview#lib/action_view/rendering.rb:21 + def locale=(value); end + + # pkg:gem/actionview#lib/action_view/rendering.rb:9 + def lookup_context; end + + # pkg:gem/actionview#lib/action_view/rendering.rb:9 + def original_config; end +end + +# = Action View \Layouts +# +# Layouts reverse the common pattern of including shared headers and footers in many templates to isolate changes in +# repeated setups. The inclusion pattern has pages that look like this: +# +# <%= render "application/header" %> +# Hello World +# <%= render "application/footer" %> +# +# This approach is a decent way of keeping common structures isolated from the changing content, but it's verbose +# and if you ever want to change the structure of these two includes, you'll have to change all the templates. +# +# With layouts, you can flip it around and have the common structure know where to insert changing content. This means +# that the header and footer are only mentioned in one place, like this: +# +# // The header part of this layout +# <%= yield %> +# // The footer part of this layout +# +# And then you have content pages that look like this: +# +# hello world +# +# At rendering time, the content page is computed and then inserted in the layout, like this: +# +# // The header part of this layout +# hello world +# // The footer part of this layout +# +# == Accessing shared variables +# +# Layouts have access to variables specified in the content pages and vice versa. This allows you to have layouts with +# references that won't materialize before rendering time: +# +#

    <%= @page_title %>

    +# <%= yield %> +# +# ...and content pages that fulfill these references _at_ rendering time: +# +# <% @page_title = "Welcome" %> +# Off-world colonies offers you a chance to start a new life +# +# The result after rendering is: +# +#

    Welcome

    +# Off-world colonies offers you a chance to start a new life +# +# == Layout assignment +# +# You can either specify a layout declaratively (using the #layout class method) or give +# it the same name as your controller, and place it in app/views/layouts. +# If a subclass does not have a layout specified, it inherits its layout using normal Ruby inheritance. +# +# For instance, if you have PostsController and a template named app/views/layouts/posts.html.erb, +# that template will be used for all actions in PostsController and controllers inheriting +# from PostsController. +# +# If you use a module, for instance Weblog::PostsController, you will need a template named +# app/views/layouts/weblog/posts.html.erb. +# +# Since all your controllers inherit from ApplicationController, they will use +# app/views/layouts/application.html.erb if no other layout is specified +# or provided. +# +# == Inheritance Examples +# +# class BankController < ActionController::Base +# # bank.html.erb exists +# +# class ExchangeController < BankController +# # exchange.html.erb exists +# +# class CurrencyController < BankController +# +# class InformationController < BankController +# layout "information" +# +# class TellerController < InformationController +# # teller.html.erb exists +# +# class EmployeeController < InformationController +# # employee.html.erb exists +# layout nil +# +# class VaultController < BankController +# layout :access_level_layout +# +# class TillController < BankController +# layout false +# +# In these examples, we have three implicit lookup scenarios: +# * The +BankController+ uses the "bank" layout. +# * The +ExchangeController+ uses the "exchange" layout. +# * The +CurrencyController+ inherits the layout from BankController. +# +# However, when a layout is explicitly set, the explicitly set layout wins: +# * The +InformationController+ uses the "information" layout, explicitly set. +# * The +TellerController+ also uses the "information" layout, because the parent explicitly set it. +# * The +EmployeeController+ uses the "employee" layout, because it set the layout to +nil+, resetting the parent configuration. +# * The +VaultController+ chooses a layout dynamically by calling the access_level_layout method. +# * The +TillController+ does not use a layout at all. +# +# == Types of layouts +# +# Layouts are basically just regular templates, but the name of this template needs not be specified statically. Sometimes +# you want to alternate layouts depending on runtime information, such as whether someone is logged in or not. This can +# be done either by specifying a method reference as a symbol or using an inline method (as a proc). +# +# The method reference is the preferred approach to variable layouts and is used like this: +# +# class WeblogController < ActionController::Base +# layout :writers_and_readers +# +# def index +# # fetching posts +# end +# +# private +# def writers_and_readers +# logged_in? ? "writer_layout" : "reader_layout" +# end +# end +# +# Now when a new request for the index action is processed, the layout will vary depending on whether the person accessing +# is logged in or not. +# +# If you want to use an inline method, such as a proc, do something like this: +# +# class WeblogController < ActionController::Base +# layout proc { |controller| controller.logged_in? ? "writer_layout" : "reader_layout" } +# end +# +# If an argument isn't given to the proc, it's evaluated in the context of +# the current controller anyway. +# +# class WeblogController < ActionController::Base +# layout proc { logged_in? ? "writer_layout" : "reader_layout" } +# end +# +# Of course, the most common way of specifying a layout is still just as a plain template name: +# +# class WeblogController < ActionController::Base +# layout "weblog_standard" +# end +# +# The template will be looked always in app/views/layouts/ folder. But you can point +# layouts folder direct also. layout "layouts/demo" is the same as layout "demo". +# +# Setting the layout to +nil+ forces it to be looked up in the filesystem and falls back to the parent behavior if none exists. +# Setting it to +nil+ is useful to re-enable template lookup overriding a previous configuration set in the parent: +# +# class ApplicationController < ActionController::Base +# layout "application" +# end +# +# class PostsController < ApplicationController +# # Will use "application" layout +# end +# +# class CommentsController < ApplicationController +# # Will search for "comments" layout and fall back to "application" layout +# layout nil +# end +# +# == Conditional layouts +# +# If you have a layout that by default is applied to all the actions of a controller, you still have the option of rendering +# a given action or set of actions without a layout, or restricting a layout to only a single action or a set of actions. The +# :only and :except options can be passed to the layout call. For example: +# +# class WeblogController < ActionController::Base +# layout "weblog_standard", except: :rss +# +# # ... +# +# end +# +# This will assign "weblog_standard" as the WeblogController's layout for all actions except for the +rss+ action, which will +# be rendered directly, without wrapping a layout around the rendered view. +# +# Both the :only and :except condition can accept an arbitrary number of method references, so +# except: [ :rss, :text_only ] is valid, as is except: :rss. +# +# == Using a different layout in the action render call +# +# If most of your actions use the same layout, it makes perfect sense to define a controller-wide layout as described above. +# Sometimes you'll have exceptions where one action wants to use a different layout than the rest of the controller. +# You can do this by passing a :layout option to the render call. For example: +# +# class WeblogController < ActionController::Base +# layout "weblog_standard" +# +# def help +# render action: "help", layout: "help" +# end +# end +# +# This will override the controller-wide "weblog_standard" layout, and will render the help action with the "help" layout instead. +# +# pkg:gem/actionview#lib/action_view/layouts.rb:205 +module ActionView::Layouts + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActionView::ViewPaths + include ::ActionView::Rendering + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActionView::ViewPaths::ClassMethods + mixes_in_class_methods ::ActionView::Rendering::ClassMethods + mixes_in_class_methods ::ActionView::Layouts::ClassMethods + + # pkg:gem/actionview#lib/action_view/layouts.rb:361 + def initialize(*); end + + # pkg:gem/actionview#lib/action_view/layouts.rb:350 + def _process_render_template_options(options); end + + # pkg:gem/actionview#lib/action_view/layouts.rb:359 + def action_has_layout=(_arg0); end + + # Controls whether an action should be rendered using a layout. + # If you want to disable any layout settings for the + # current action so that it is rendered without a layout then + # either override this method in your controller to return false + # for that action or set the action_has_layout attribute + # to false before rendering. + # + # pkg:gem/actionview#lib/action_view/layouts.rb:372 + def action_has_layout?; end + + private + + # pkg:gem/actionview#lib/action_view/layouts.rb:377 + def _conditional_layout?; end + + # Returns the default layout for this controller. + # Optionally raises an exception if the layout could not be found. + # + # ==== Parameters + # * formats - The formats accepted to this layout + # * require_layout - If set to +true+ and layout is not found, + # an +ArgumentError+ exception is raised (defaults to +false+) + # + # ==== Returns + # * template - The template object for the default layout (or +nil+) + # + # pkg:gem/actionview#lib/action_view/layouts.rb:415 + def _default_layout(lookup_context, formats, keys, require_layout = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/layouts.rb:430 + def _include_layout?(options); end + + # This will be overwritten by _write_layout_method + # + # pkg:gem/actionview#lib/action_view/layouts.rb:382 + def _layout(*); end + + # Determine the layout for a given name, taking into account the name type. + # + # ==== Parameters + # * name - The name of the template + # + # pkg:gem/actionview#lib/action_view/layouts.rb:388 + def _layout_for_option(name); end + + # pkg:gem/actionview#lib/action_view/layouts.rb:401 + def _normalize_layout(value); end + + module GeneratedClassMethods + def _layout; end + def _layout=(value); end + def _layout?; end + def _layout_conditions; end + def _layout_conditions=(value); end + def _layout_conditions?; end + end + + module GeneratedInstanceMethods + def _layout_conditions; end + def _layout_conditions?; end + end +end + +# pkg:gem/actionview#lib/action_view/layouts.rb:217 +module ActionView::Layouts::ClassMethods + # Creates a _layout method to be called by _default_layout . + # + # If a layout is not explicitly mentioned then look for a layout with the controller's name. + # if nothing is found then try same procedure to find super class's layout. + # + # pkg:gem/actionview#lib/action_view/layouts.rb:283 + def _write_layout_method; end + + # pkg:gem/actionview#lib/action_view/layouts.rb:218 + def inherited(klass); end + + # Specify the layout to use for this class. + # + # If the specified layout is a: + # String:: the String is the template name + # Symbol:: call the method specified by the symbol + # Proc:: call the passed Proc + # false:: There is no layout + # true:: raise an ArgumentError + # nil:: Force default layout behavior with inheritance + # + # Return value of +Proc+ and +Symbol+ arguments should be +String+, +false+, +true+, or +nil+ + # with the same meaning as described above. + # + # ==== Parameters + # + # * layout - The layout to use. + # + # ==== Options (conditions) + # + # * +:only+ - A list of actions to apply this layout to. + # * +:except+ - Apply this layout to all actions but this one. + # + # pkg:gem/actionview#lib/action_view/layouts.rb:269 + def layout(layout, conditions = T.unsafe(nil)); end + + private + + # If no layout is supplied, look for a template named the return + # value of this method. + # + # ==== Returns + # * String - A template name + # + # pkg:gem/actionview#lib/action_view/layouts.rb:345 + def _implied_layout_name; end +end + +# This module is mixed in if layout conditions are provided. This means +# that if no layout conditions are used, this method is not used +# +# pkg:gem/actionview#lib/action_view/layouts.rb:225 +module ActionView::Layouts::ClassMethods::LayoutConditions + private + + # Determines whether the current action has a layout definition by + # checking the action name against the :only and :except conditions + # set by the layout method. + # + # ==== Returns + # * Boolean - True if the action has a layout definition, false otherwise. + # + # pkg:gem/actionview#lib/action_view/layouts.rb:233 + def _conditional_layout?; end +end + +# pkg:gem/actionview#lib/action_view/log_subscriber.rb:6 +class ActionView::LogSubscriber < ::ActiveSupport::LogSubscriber + include ::ActionView::LogSubscriber::Utils + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:9 + def initialize; end + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:42 + def render_collection(event); end + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:34 + def render_layout(event); end + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:23 + def render_partial(event); end + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:14 + def render_template(event); end + + private + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:118 + def cache_message(payload); end + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:110 + def render_count(payload); end + + class << self + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:102 + def attach_to(*); end + + private + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:21 + def __class_attr_log_levels; end + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:21 + def __class_attr_log_levels=(new_value); end + end +end + +# pkg:gem/actionview#lib/action_view/log_subscriber.rb:73 +class ActionView::LogSubscriber::Start + include ::ActionView::LogSubscriber::Utils + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:94 + def finish(name, id, payload); end + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:97 + def silenced?(_); end + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:76 + def start(name, id, payload); end +end + +# pkg:gem/actionview#lib/action_view/log_subscriber.rb:54 +module ActionView::LogSubscriber::Utils + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:55 + def logger; end + + private + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:60 + def from_rails_root(string); end + + # pkg:gem/actionview#lib/action_view/log_subscriber.rb:66 + def rails_root; end +end + +# pkg:gem/actionview#lib/action_view/log_subscriber.rb:7 +ActionView::LogSubscriber::VIEWS_PATTERN = T.let(T.unsafe(nil), Regexp) + +# = Action View Lookup Context +# +# LookupContext is the object responsible for holding all information +# required for looking up templates, i.e. view paths and details. +# LookupContext is also responsible for generating a key, given to +# view paths, used in the resolver cache lookup. Since this key is generated +# only once during the request, it speeds up all cache accesses. +# +# pkg:gem/actionview#lib/action_view/lookup_context.rb:15 +class ActionView::LookupContext + include ::ActionView::LookupContext::Accessors + include ::ActionView::LookupContext::DetailsCache + include ::ActionView::LookupContext::ViewPaths + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:232 + def initialize(view_paths, details = T.unsafe(nil), prefixes = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:242 + def digest_cache; end + + # Override formats= to expand ["*/*"] values and automatically + # add :html as fallback to :js. + # + # pkg:gem/actionview#lib/action_view/lookup_context.rb:263 + def formats=(values); end + + # Override locale to return a symbol instead of array. + # + # pkg:gem/actionview#lib/action_view/lookup_context.rb:283 + def locale; end + + # Overload locale= to also set the I18n.locale. If the current I18n.config object responds + # to original_config, it means that it has a copy of the original I18n configuration and it's + # acting as proxy, which we need to skip. + # + # pkg:gem/actionview#lib/action_view/lookup_context.rb:290 + def locale=(value); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:16 + def prefixes; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:16 + def prefixes=(_arg0); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:246 + def with_prepended_formats(formats); end + + private + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:253 + def initialize_details(target, details); end + + class << self + # pkg:gem/actionview#lib/action_view/lookup_context.rb:21 + def register_detail(name, &block); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:18 + def registered_details; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:18 + def registered_details=(_arg0); end + end +end + +# Holds accessors for the registered details. +# +# pkg:gem/actionview#lib/action_view/lookup_context.rb:39 +module ActionView::LookupContext::Accessors + # pkg:gem/actionview#lib/action_view/lookup_context.rb:25 + def default_formats; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:25 + def default_handlers; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:25 + def default_locale; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:25 + def default_variants; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:26 + def formats; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:26 + def formats=(value); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:26 + def handlers; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:26 + def handlers=(value); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:26 + def locale; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:26 + def locale=(value); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:26 + def variants; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:26 + def variants=(value); end +end + +# pkg:gem/actionview#lib/action_view/lookup_context.rb:40 +ActionView::LookupContext::Accessors::DEFAULT_PROCS = T.let(T.unsafe(nil), Hash) + +# Add caching behavior on top of Details. +# +# pkg:gem/actionview#lib/action_view/lookup_context.rb:98 +module ActionView::LookupContext::DetailsCache + # pkg:gem/actionview#lib/action_view/lookup_context.rb:99 + def cache; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:99 + def cache=(_arg0); end + + # Calculate the details key. Remove the handlers from calculation to improve performance + # since the user cannot modify it explicitly. + # + # pkg:gem/actionview#lib/action_view/lookup_context.rb:103 + def details_key; end + + # Temporary skip passing the details_key forward. + # + # pkg:gem/actionview#lib/action_view/lookup_context.rb:108 + def disable_cache; end + + private + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:116 + def _set_detail(key, value); end +end + +# pkg:gem/actionview#lib/action_view/lookup_context.rb:54 +class ActionView::LookupContext::DetailsKey + # pkg:gem/actionview#lib/action_view/lookup_context.rb:55 + def eql?(_arg0); end + + class << self + # pkg:gem/actionview#lib/action_view/lookup_context.rb:77 + def clear; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:65 + def details_cache_key(details); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:61 + def digest_cache(details); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:86 + def digest_caches; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:90 + def view_context_class; end + end +end + +# Helpers related to template lookup using the lookup context information. +# +# pkg:gem/actionview#lib/action_view/lookup_context.rb:125 +module ActionView::LookupContext::ViewPaths + # pkg:gem/actionview#lib/action_view/lookup_context.rb:148 + def any?(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:153 + def any_templates?(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:155 + def append_view_paths(paths); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:141 + def exists?(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), **options); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:128 + def find(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:135 + def find_all(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:133 + def find_template(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:126 + def html_fallback_for_js; end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:159 + def prepend_view_paths(paths); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:146 + def template_exists?(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), **options); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:126 + def view_paths; end + + private + + # Whenever setting view paths, makes a copy so that we can manipulate them in + # instance objects as we wish. + # + # pkg:gem/actionview#lib/action_view/lookup_context.rb:166 + def build_view_paths(paths); end + + # Compute details hash and key according to user options (e.g. passed from #render). + # + # pkg:gem/actionview#lib/action_view/lookup_context.rb:175 + def detail_args_for(options); end + + # pkg:gem/actionview#lib/action_view/lookup_context.rb:188 + def detail_args_for_any; end + + # Fix when prefix is specified as part of the template name + # + # pkg:gem/actionview#lib/action_view/lookup_context.rb:209 + def normalize_name(name, prefixes); end +end + +# pkg:gem/actionview#lib/action_view/template/error.rb:41 +class ActionView::MissingTemplate < ::ActionView::ActionViewError + include ::DidYouMean::Correctable + + # pkg:gem/actionview#lib/action_view/template/error.rb:44 + def initialize(paths, path, prefixes, partial, details, *); end + + # Apps may have thousands of candidate templates so we attempt to + # generate the suggestions as efficiently as possible. + # First we split templates into prefixes and basenames, so that those can + # be matched separately. + # + # pkg:gem/actionview#lib/action_view/template/error.rb:104 + def corrections; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:42 + def partial; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:42 + def path; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:42 + def paths; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:42 + def prefixes; end +end + +# pkg:gem/actionview#lib/action_view/template/error.rb:71 +class ActionView::MissingTemplate::Results + # pkg:gem/actionview#lib/action_view/template/error.rb:74 + def initialize(size); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:91 + def add(path, score); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:83 + def should_record?(score); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:79 + def to_a; end +end + +# pkg:gem/actionview#lib/action_view/template/error.rb:72 +class ActionView::MissingTemplate::Results::Result < ::Struct + # pkg:gem/actionview#lib/action_view/template/error.rb:72 + def path; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:72 + def path=(_); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:72 + def score; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:72 + def score=(_); end + + class << self + # pkg:gem/actionview#lib/action_view/template/error.rb:72 + def [](*_arg0); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:72 + def inspect; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:72 + def keyword_init?; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:72 + def members; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:72 + def new(*_arg0); end + end +end + +# pkg:gem/actionview#lib/action_view/model_naming.rb:4 +module ActionView::ModelNaming + # Converts the given object to an Active Model compliant one. + # + # pkg:gem/actionview#lib/action_view/model_naming.rb:6 + def convert_to_model(object); end + + # pkg:gem/actionview#lib/action_view/model_naming.rb:10 + def model_name_from_record_or_class(record_or_class); end +end + +# pkg:gem/actionview#lib/action_view/renderer/object_renderer.rb:4 +class ActionView::ObjectRenderer < ::ActionView::PartialRenderer + include ::ActionView::AbstractRenderer::ObjectRendering + + # pkg:gem/actionview#lib/action_view/renderer/object_renderer.rb:7 + def initialize(lookup_context, options); end + + # pkg:gem/actionview#lib/action_view/renderer/object_renderer.rb:19 + def render_object_derive_partial(object, context, block); end + + # pkg:gem/actionview#lib/action_view/renderer/object_renderer.rb:13 + def render_object_with_partial(object, partial, context, block); end + + private + + # pkg:gem/actionview#lib/action_view/renderer/object_renderer.rb:29 + def render_partial_template(view, locals, template, layout, block); end + + # pkg:gem/actionview#lib/action_view/renderer/object_renderer.rb:25 + def template_keys(path); end +end + +# Used as a buffer for views +# +# The main difference between this and ActiveSupport::SafeBuffer +# is for the methods `<<` and `safe_expr_append=` the inputs are +# checked for nil before they are assigned and `to_s` is called on +# the input. For example: +# +# obuf = ActionView::OutputBuffer.new "hello" +# obuf << 5 +# puts obuf # => "hello5" +# +# sbuf = ActiveSupport::SafeBuffer.new "hello" +# sbuf << 5 +# puts sbuf # => "hello\u0005" +# +# pkg:gem/actionview#lib/action_view/buffers.rb:21 +class ActionView::OutputBuffer + # pkg:gem/actionview#lib/action_view/buffers.rb:22 + def initialize(buffer = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:42 + def <<(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:81 + def ==(other); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:54 + def append=(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:27 + def blank?(*, **, &); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:72 + def capture(*args); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:53 + def concat(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:27 + def empty?(*, **, &); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:27 + def encode!(*, **, &); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:27 + def encoding(*, **, &); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:27 + def force_encoding(*, **, &); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:32 + def html_safe; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:38 + def html_safe?; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:27 + def length(*, **, &); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:85 + def raw; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:89 + def raw_buffer; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:60 + def safe_append=(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:56 + def safe_concat(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:62 + def safe_expr_append=(val); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:29 + def to_s; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:34 + def to_str; end + + private + + # pkg:gem/actionview#lib/action_view/buffers.rb:68 + def initialize_copy(other); end +end + +# pkg:gem/actionview#lib/action_view/flows.rb:6 +class ActionView::OutputFlow + # pkg:gem/actionview#lib/action_view/flows.rb:9 + def initialize; end + + # Called by content_for + # + # pkg:gem/actionview#lib/action_view/flows.rb:24 + def append(key, value); end + + # pkg:gem/actionview#lib/action_view/flows.rb:27 + def append!(key, value); end + + # pkg:gem/actionview#lib/action_view/flows.rb:7 + def content; end + + # Called by _layout_for to read stored values. + # + # pkg:gem/actionview#lib/action_view/flows.rb:14 + def get(key); end + + # Called by each renderer object to set the layout contents. + # + # pkg:gem/actionview#lib/action_view/flows.rb:19 + def set(key, value); end +end + +# pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:6 +class ActionView::PartialIteration + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:13 + def initialize(size); end + + # Check if this is the first iteration of the partial. + # + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:19 + def first?; end + + # The current iteration of the partial. + # + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:11 + def index; end + + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:28 + def iterate!; end + + # Check if this is the last iteration of the partial. + # + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:24 + def last?; end + + # The number of iterations that will be done by the partial. + # + # pkg:gem/actionview#lib/action_view/renderer/collection_renderer.rb:8 + def size; end +end + +# = Action View Partials +# +# There's also a convenience method for rendering sub templates within the current controller that depends on a +# single object (we call this kind of sub templates for partials). It relies on the fact that partials should +# follow the naming convention of being prefixed with an underscore -- as to separate them from regular +# templates that could be rendered on their own. +# +# In a template for Advertiser#account: +# +# <%= render partial: "account" %> +# +# This would render "advertiser/_account.html.erb". +# +# In another template for Advertiser#buy, we could have: +# +# <%= render partial: "account", locals: { account: @buyer } %> +# +# <% @advertisements.each do |ad| %> +# <%= render partial: "ad", locals: { ad: ad } %> +# <% end %> +# +# This would first render advertiser/_account.html.erb with @buyer passed in as the local variable +account+, then +# render advertiser/_ad.html.erb and pass the local variable +ad+ to the template for display. +# +# == The +:as+ and +:object+ options +# +# By default ActionView::PartialRenderer doesn't have any local variables. +# The :object option can be used to pass an object to the partial. For instance: +# +# <%= render partial: "account", object: @buyer %> +# +# would provide the @buyer object to the partial, available under the local variable +account+ and is +# equivalent to: +# +# <%= render partial: "account", locals: { account: @buyer } %> +# +# With the :as option we can specify a different name for said local variable. For example, if we +# wanted it to be +user+ instead of +account+ we'd do: +# +# <%= render partial: "account", object: @buyer, as: 'user' %> +# +# This is equivalent to +# +# <%= render partial: "account", locals: { user: @buyer } %> +# +# == \Rendering variants of a partial +# +# The :variants option can be used to render a different template variant of a partial. For instance: +# +# <%= render partial: "account", variants: :mobile %> +# +# This will render _account.html+mobile.erb. This option also accepts multiple variants +# like so: +# +# <%= render partial: "account", variants: [:desktop, :mobile] %> +# +# This will look for the following templates and render the first one that exists: +# * _account.html+desktop.erb +# * _account.html+mobile.erb +# * _account.html.erb +# +# == \Rendering a collection of partials +# +# The example of partial use describes a familiar pattern where a template needs to iterate over an array and +# render a sub template for each of the elements. This pattern has been implemented as a single method that +# accepts an array and renders a partial by the same name as the elements contained within. So the three-lined +# example in "Using partials" can be rewritten with a single line: +# +# <%= render partial: "ad", collection: @advertisements %> +# +# This will render advertiser/_ad.html.erb and pass the local variable +ad+ to the template for display. An +# iteration object will automatically be made available to the template with a name of the form +# +partial_name_iteration+. The iteration object has knowledge about which index the current object has in +# the collection and the total size of the collection. The iteration object also has two convenience methods, +# +first?+ and +last?+. In the case of the example above, the template would be fed +ad_iteration+. +# For backwards compatibility the +partial_name_counter+ is still present and is mapped to the iteration's +# +index+ method. +# +# The :as option may be used when rendering partials. +# +# You can specify a partial to be rendered between elements via the :spacer_template option. +# The following example will render advertiser/_ad_divider.html.erb between each ad partial: +# +# <%= render partial: "ad", collection: @advertisements, spacer_template: "ad_divider" %> +# +# If the given :collection is +nil+ or empty, render will return +nil+. This will allow you +# to specify a text which will be displayed instead by using this form: +# +# <%= render(partial: "ad", collection: @advertisements) || "There's no ad to be displayed" %> +# +# == \Rendering shared partials +# +# Two controllers can share a set of partials and render them like this: +# +# <%= render partial: "advertisement/ad", locals: { ad: @advertisement } %> +# +# This will render the partial advertisement/_ad.html.erb regardless of which controller this is being called from. +# +# == \Rendering objects that respond to +to_partial_path+ +# +# Instead of explicitly naming the location of a partial, you can also let PartialRenderer do the work +# and pick the proper path by checking +to_partial_path+ method. +# +# # @account.to_partial_path returns 'accounts/account', so it can be used to replace: +# # <%= render partial: "accounts/account", locals: { account: @account} %> +# <%= render partial: @account %> +# +# # @posts is an array of Post instances, so every post record returns 'posts/post' on #to_partial_path, +# # that's why we can replace: +# # <%= render partial: "posts/post", collection: @posts %> +# <%= render partial: @posts %> +# +# == \Rendering the default case +# +# If you're not going to be using any of the options like collections or layouts, you can also use the short-hand +# defaults of render to render partials. Examples: +# +# # Instead of <%= render partial: "account" %> +# <%= render "account" %> +# +# # Instead of <%= render partial: "account", locals: { account: @buyer } %> +# <%= render "account", account: @buyer %> +# +# # @account.to_partial_path returns 'accounts/account', so it can be used to replace: +# # <%= render partial: "accounts/account", locals: { account: @account} %> +# <%= render @account %> +# +# # @posts is an array of Post instances, so every post record returns 'posts/post' on #to_partial_path, +# # that's why we can replace: +# # <%= render partial: "posts/post", collection: @posts %> +# <%= render @posts %> +# +# == \Rendering partials with layouts +# +# Partials can have their own layouts applied to them. These layouts are different than the ones that are +# specified globally for the entire action, but they work in a similar fashion. Imagine a list with two types +# of users: +# +# <%# app/views/users/index.html.erb %> +# Here's the administrator: +# <%= render partial: "user", layout: "administrator", locals: { user: administrator } %> +# +# Here's the editor: +# <%= render partial: "user", layout: "editor", locals: { user: editor } %> +# +# <%# app/views/users/_user.html.erb %> +# Name: <%= user.name %> +# +# <%# app/views/users/_administrator.html.erb %> +#
    +# Budget: $<%= user.budget %> +# <%= yield %> +#
    +# +# <%# app/views/users/_editor.html.erb %> +#
    +# Deadline: <%= user.deadline %> +# <%= yield %> +#
    +# +# ...this will return: +# +# Here's the administrator: +#
    +# Budget: $<%= user.budget %> +# Name: <%= user.name %> +#
    +# +# Here's the editor: +#
    +# Deadline: <%= user.deadline %> +# Name: <%= user.name %> +#
    +# +# If a collection is given, the layout will be rendered once for each item in +# the collection. For example, these two snippets have the same output: +# +# <%# app/views/users/_user.html.erb %> +# Name: <%= user.name %> +# +# <%# app/views/users/index.html.erb %> +# <%# This does not use layouts %> +#
      +# <% users.each do |user| -%> +#
    • +# <%= render partial: "user", locals: { user: user } %> +#
    • +# <% end -%> +#
    +# +# <%# app/views/users/_li_layout.html.erb %> +#
  • +# <%= yield %> +#
  • +# +# <%# app/views/users/index.html.erb %> +#
      +# <%= render partial: "user", layout: "li_layout", collection: users %> +#
    +# +# Given two users whose names are Alice and Bob, these snippets return: +# +#
      +#
    • +# Name: Alice +#
    • +#
    • +# Name: Bob +#
    • +#
    +# +# The current object being rendered, as well as the object_counter, will be +# available as local variables inside the layout template under the same names +# as available in the partial. +# +# You can also apply a layout to a block within any template: +# +# <%# app/views/users/_chief.html.erb %> +# <%= render(layout: "administrator", locals: { user: chief }) do %> +# Title: <%= chief.title %> +# <% end %> +# +# ...this will return: +# +#
    +# Budget: $<%= user.budget %> +# Title: <%= chief.name %> +#
    +# +# As you can see, the :locals hash is shared between both the partial and its layout. +# +# pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:236 +class ActionView::PartialRenderer < ::ActionView::AbstractRenderer + include ::ActionView::CollectionCaching + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:239 + def initialize(lookup_context, options); end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:237 + def collection_cache; end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:237 + def collection_cache=(val); end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:246 + def render(partial, context, block); end + + private + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:278 + def find_template(path, locals); end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:261 + def render_partial_template(view, locals, template, layout, block); end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:257 + def template_keys(_); end + + class << self + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:237 + def collection_cache; end + + # pkg:gem/actionview#lib/action_view/renderer/partial_renderer.rb:237 + def collection_cache=(val); end + end +end + +# pkg:gem/actionview#lib/action_view/path_registry.rb:4 +module ActionView::PathRegistry + class << self + # pkg:gem/actionview#lib/action_view/path_registry.rb:53 + def all_file_system_resolvers; end + + # pkg:gem/actionview#lib/action_view/path_registry.rb:47 + def all_resolvers; end + + # pkg:gem/actionview#lib/action_view/path_registry.rb:22 + def cast_file_system_resolvers(paths); end + + # pkg:gem/actionview#lib/action_view/path_registry.rb:11 + def file_system_resolver_hooks; end + + # pkg:gem/actionview#lib/action_view/path_registry.rb:14 + def get_view_paths(klass); end + + # pkg:gem/actionview#lib/action_view/path_registry.rb:18 + def set_view_paths(klass, paths); end + end +end + +# = Action View PathSet +# +# This class is used to store and access paths in Action View. A number of +# operations are defined so that you can search among the paths in this +# set and also perform operations on other +PathSet+ objects. +# +# A +LookupContext+ will use a +PathSet+ to store the paths in its context. +# +# pkg:gem/actionview#lib/action_view/path_set.rb:11 +class ActionView::PathSet + include ::Enumerable + + # pkg:gem/actionview#lib/action_view/path_set.rb:18 + def initialize(paths = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:35 + def +(other); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:16 + def [](*, **, &); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:31 + def compact; end + + # pkg:gem/actionview#lib/action_view/path_set.rb:16 + def each(*, **, &); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:53 + def exists?(path, prefixes, partial, details, details_key, locals); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:40 + def find(path, prefixes, partial, details, details_key, locals); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:45 + def find_all(path, prefixes, partial, details, details_key, locals); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:16 + def include?(*, **, &); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:14 + def paths; end + + # pkg:gem/actionview#lib/action_view/path_set.rb:16 + def size(*, **, &); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:27 + def to_ary; end + + private + + # pkg:gem/actionview#lib/action_view/path_set.rb:22 + def initialize_copy(other); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:58 + def search_combinations(prefixes); end + + # pkg:gem/actionview#lib/action_view/path_set.rb:67 + def typecast(paths); end +end + +# = Action View Railtie +# +# pkg:gem/actionview#lib/action_view/railtie.rb:8 +class ActionView::Railtie < ::Rails::Engine; end + +# pkg:gem/actionview#lib/action_view/buffers.rb:92 +class ActionView::RawOutputBuffer + # pkg:gem/actionview#lib/action_view/buffers.rb:93 + def initialize(buffer); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:97 + def <<(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:103 + def raw; end +end + +# pkg:gem/actionview#lib/action_view/buffers.rb:150 +class ActionView::RawStreamingBuffer + # pkg:gem/actionview#lib/action_view/buffers.rb:151 + def initialize(buffer); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:155 + def <<(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:161 + def raw; end +end + +# = Action View \Record \Identifier +# +# RecordIdentifier encapsulates methods used by various ActionView helpers +# to associate records with DOM elements. +# +# Consider for example the following code that form of post: +# +# <%= form_with(model: post) do |f| %> +# <%= f.text_field :body %> +# <% end %> +# +# When +post+ is a new, unsaved ActiveRecord::Base instance, the resulting HTML +# is: +# +#
    +# +#
    +# +# When +post+ is a persisted ActiveRecord::Base instance, the resulting HTML +# is: +# +#
    +# +#
    +# +# In both cases, the +id+ and +class+ of the wrapping DOM element are +# automatically generated, following naming conventions encapsulated by the +# RecordIdentifier methods #dom_id and #dom_class: +# +# dom_id(Post) # => "new_post" +# dom_class(Post) # => "post" +# dom_id(Post.new) # => "new_post" +# dom_class(Post.new) # => "post" +# dom_id(Post.find 42) # => "post_42" +# dom_class(Post.find 42) # => "post" +# +# Note that these methods do not strictly require +Post+ to be a subclass of +# ActiveRecord::Base. +# Any +Post+ class will work as long as its instances respond to +to_key+ +# and +model_name+, given that +model_name+ responds to +param_key+. +# For instance: +# +# class Post +# attr_accessor :to_key +# +# def model_name +# OpenStruct.new param_key: 'post' +# end +# +# def self.find(id) +# new.tap { |post| post.to_key = [id] } +# end +# end +# +# pkg:gem/actionview#lib/action_view/record_identifier.rb:60 +module ActionView::RecordIdentifier + include ::ActionView::ModelNaming + extend ::ActionView::RecordIdentifier + extend ::ActionView::ModelNaming + + # The DOM class convention is to use the singular form of an object or class. + # + # dom_class(post) # => "post" + # dom_class(Person) # => "person" + # + # If you need to address multiple instances of the same class in the same view, you can prefix the dom_class: + # + # dom_class(post, :edit) # => "edit_post" + # dom_class(Person, :edit) # => "edit_person" + # + # pkg:gem/actionview#lib/action_view/record_identifier.rb:78 + def dom_class(record_or_class, prefix = T.unsafe(nil)); end + + # The DOM id convention is to use the singular form of an object or class with the id following an underscore. + # If no id is found, prefix with "new_" instead. + # + # dom_id(Post.find(45)) # => "post_45" + # dom_id(Post) # => "new_post" + # + # If you need to address multiple instances of the same class in the same view, you can prefix the dom_id: + # + # dom_id(Post.find(45), :edit) # => "edit_post_45" + # dom_id(Post, :custom) # => "custom_post" + # + # pkg:gem/actionview#lib/action_view/record_identifier.rb:93 + def dom_id(record_or_class, prefix = T.unsafe(nil)); end + + # The DOM target convention is to concatenate any number of parameters into a string. + # Records are passed through dom_id, while string and symbols are retained. + # + # dom_target(Post.find(45)) # => "post_45" + # dom_target(Post.find(45), :edit) # => "post_45_edit" + # dom_target(Post.find(45), :edit, :special) # => "post_45_edit_special" + # dom_target(Post.find(45), Comment.find(1)) # => "post_45_comment_1" + # + # pkg:gem/actionview#lib/action_view/record_identifier.rb:111 + def dom_target(*objects); end + + private + + # Returns a string representation of the key attribute(s) that is suitable for use in an HTML DOM id. + # This can be overwritten to customize the default generated string representation if desired. + # If you need to read back a key from a dom_id in order to query for the underlying database record, + # you should write a helper like 'person_record_from_dom_id' that will extract the key either based + # on the default implementation (which just joins all key attributes with '_') or on your own + # overwritten version of the method. By default, this implementation passes the key string through a + # method that replaces all characters that are invalid inside DOM ids, with valid ones. You need to + # make sure yourself that your dom ids are valid, in case you override this method. + # + # pkg:gem/actionview#lib/action_view/record_identifier.rb:134 + def record_key_for_dom_id(record); end +end + +# pkg:gem/actionview#lib/action_view/record_identifier.rb:66 +ActionView::RecordIdentifier::JOIN = T.let(T.unsafe(nil), String) + +# pkg:gem/actionview#lib/action_view/record_identifier.rb:67 +ActionView::RecordIdentifier::NEW = T.let(T.unsafe(nil), String) + +# pkg:gem/actionview#lib/action_view/render_parser.rb:4 +module ActionView::RenderParser; end + +# pkg:gem/actionview#lib/action_view/render_parser.rb:5 +ActionView::RenderParser::ALL_KNOWN_KEYS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionview#lib/action_view/render_parser.rb:8 +class ActionView::RenderParser::Base + # pkg:gem/actionview#lib/action_view/render_parser.rb:9 + def initialize(name, code); end + + private + + # pkg:gem/actionview#lib/action_view/render_parser.rb:15 + def directory; end + + # pkg:gem/actionview#lib/action_view/render_parser.rb:19 + def partial_to_virtual_path(render_type, partial_path); end +end + +# pkg:gem/actionview#lib/action_view/render_parser.rb:37 +ActionView::RenderParser::Default = ActionView::RenderParser::PrismRenderParser + +# pkg:gem/actionview#lib/action_view/render_parser/prism_render_parser.rb:5 +class ActionView::RenderParser::PrismRenderParser < ::ActionView::RenderParser::Base + # pkg:gem/actionview#lib/action_view/render_parser/prism_render_parser.rb:6 + def render_calls; end + + private + + # Accept a call node and return a hash of options for the render call. + # If it doesn't match the expected format, return nil. + # + # pkg:gem/actionview#lib/action_view/render_parser/prism_render_parser.rb:43 + def render_call_options(node); end + + # Accept the node that is being passed in the position of the template + # and return the template name and whether or not it is an object + # template. + # + # pkg:gem/actionview#lib/action_view/render_parser/prism_render_parser.rb:97 + def render_call_template(node); end +end + +# pkg:gem/actionview#lib/action_view/render_parser.rb:6 +ActionView::RenderParser::RENDER_TYPE_KEYS = T.let(T.unsafe(nil), Array) + +# = Action View \Renderer +# +# This is the main entry point for rendering. It basically delegates +# to other objects like TemplateRenderer and PartialRenderer which +# actually renders the template. +# +# The Renderer will parse the options from the +render+ or +render_body+ +# method and render a partial or a template based on the options. The +# +TemplateRenderer+ and +PartialRenderer+ objects are wrappers which do all +# the setup and logic necessary to render a view and a new object is created +# each time +render+ is called. +# +# pkg:gem/actionview#lib/action_view/renderer/renderer.rb:15 +class ActionView::Renderer + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:18 + def initialize(lookup_context); end + + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:52 + def cache_hits; end + + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:16 + def lookup_context; end + + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:16 + def lookup_context=(_arg0); end + + # Main render entry point shared by Action View and Action Controller. + # + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:23 + def render(context, options); end + + # Render but returns a valid Rack body. If fibers are defined, we return + # a streaming body that renders the template piece by piece. + # + # Note that partials are not supported to be rendered with streaming, + # so in such cases, we just wrap them in an array. + # + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:40 + def render_body(context, options); end + + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:48 + def render_partial(context, options, &block); end + + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:27 + def render_to_object(context, options); end + + private + + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:103 + def collection_from_object(object); end + + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:96 + def collection_from_options(options); end + + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:61 + def render_partial_to_object(context, options, &block); end + + # pkg:gem/actionview#lib/action_view/renderer/renderer.rb:57 + def render_template_to_object(context, options); end +end + +# pkg:gem/actionview#lib/action_view/rendering.rb:26 +module ActionView::Rendering + extend ::ActiveSupport::Concern + include ::ActionView::ViewPaths + + mixes_in_class_methods ::ActionView::ViewPaths::ClassMethods + mixes_in_class_methods ::ActionView::Rendering::ClassMethods + + # pkg:gem/actionview#lib/action_view/rendering.rb:32 + def initialize; end + + # Override process to set up I18n proxy. + # + # pkg:gem/actionview#lib/action_view/rendering.rb:38 + def process(*, **, &); end + + # pkg:gem/actionview#lib/action_view/rendering.rb:119 + def render_to_body(options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/rendering.rb:30 + def rendered_format; end + + # An instance of a view class. The default view class is ActionView::Base. + # + # The view class must have the following methods: + # + # * View.new(lookup_context, assigns, controller) — Create a new + # ActionView instance for a controller and we can also pass the arguments. + # + # * View#render(option) — Returns String with the rendered template. + # + # Override this method in a module to change the default behavior. + # + # pkg:gem/actionview#lib/action_view/rendering.rb:109 + def view_context; end + + # pkg:gem/actionview#lib/action_view/rendering.rb:95 + def view_context_class; end + + # Returns an object that is able to render templates. + # + # pkg:gem/actionview#lib/action_view/rendering.rb:114 + def view_renderer; end + + private + + # Normalize args by converting render "foo" to render action: "foo" and + # render "foo/bar" to render template: "foo/bar". + # + # pkg:gem/actionview#lib/action_view/rendering.rb:153 + def _normalize_args(action = T.unsafe(nil), options = T.unsafe(nil)); end + + # Assign the rendered format to look up context. + # + # pkg:gem/actionview#lib/action_view/rendering.rb:146 + def _process_format(format); end + + # Normalize options. + # + # pkg:gem/actionview#lib/action_view/rendering.rb:177 + def _process_render_template_options(options); end + + # Find and render a template based on the options given. + # + # pkg:gem/actionview#lib/action_view/rendering.rb:127 + def _render_template(options); end +end + +# pkg:gem/actionview#lib/action_view/rendering.rb:45 +module ActionView::Rendering::ClassMethods + # pkg:gem/actionview#lib/action_view/rendering.rb:49 + def _helpers; end + + # pkg:gem/actionview#lib/action_view/rendering.rb:46 + def _routes; end + + # pkg:gem/actionview#lib/action_view/rendering.rb:59 + def build_view_context_class(klass, supports_path, routes, helpers); end + + # pkg:gem/actionview#lib/action_view/rendering.rb:76 + def eager_load!; end + + # pkg:gem/actionview#lib/action_view/rendering.rb:52 + def inherit_view_context_class?; end + + # pkg:gem/actionview#lib/action_view/rendering.rb:82 + def view_context_class; end +end + +# = Action View Resolver +# +# pkg:gem/actionview#lib/action_view/template/resolver.rb:11 +class ActionView::Resolver + # pkg:gem/actionview#lib/action_view/template/resolver.rb:69 + def all_template_paths; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:64 + def built_templates; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:50 + def caching; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:50 + def caching=(val); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:79 + def caching?(&); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:56 + def clear_cache; end + + # Normalizes the arguments and passes it on to find_templates. + # + # pkg:gem/actionview#lib/action_view/template/resolver.rb:60 + def find_all(name, prefix = T.unsafe(nil), partial = T.unsafe(nil), details = T.unsafe(nil), key = T.unsafe(nil), locals = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:75 + def _find_all(name, prefix, partial, details, key, locals); end + + # This is what child classes implement. No defaults are needed + # because Resolver guarantees that the arguments are present and + # normalized. + # + # pkg:gem/actionview#lib/action_view/template/resolver.rb:84 + def find_templates(name, prefix, partial, details, locals = T.unsafe(nil)); end + + class << self + # pkg:gem/actionview#lib/action_view/template/resolver.rb:50 + def caching; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:50 + def caching=(val); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:53 + def caching?; end + end +end + +# pkg:gem/actionview#lib/action_view/template/resolver.rb:12 +class ActionView::Resolver::PathParser + # pkg:gem/actionview#lib/action_view/template/resolver.rb:15 + def build_path_regex; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:36 + def parse(path); end +end + +# pkg:gem/actionview#lib/action_view/template/resolver.rb:13 +class ActionView::Resolver::PathParser::ParsedPath < ::Struct + # pkg:gem/actionview#lib/action_view/template/resolver.rb:13 + def details; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:13 + def details=(_); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:13 + def path; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:13 + def path=(_); end + + class << self + # pkg:gem/actionview#lib/action_view/template/resolver.rb:13 + def [](*_arg0); end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:13 + def inspect; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:13 + def keyword_init?; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:13 + def members; end + + # pkg:gem/actionview#lib/action_view/template/resolver.rb:13 + def new(*_arg0); end + end +end + +# pkg:gem/actionview#lib/action_view/routing_url_for.rb:6 +module ActionView::RoutingUrlFor + include ::ActionDispatch::Routing::PolymorphicRoutes + + # Returns the URL for the set of +options+ provided. This takes the + # same options as +url_for+ in Action Controller (see the + # documentation for ActionDispatch::Routing::UrlFor#url_for). Note that by default + # :only_path is true so you'll get the relative "/controller/action" + # instead of the fully qualified URL like "http://example.com/controller/action". + # + # ==== Options + # * :anchor - Specifies the anchor name to be appended to the path. + # * :only_path - If true, returns the relative URL (omitting the protocol, host name, and port) (true by default unless :host is specified). + # * :trailing_slash - If true, adds a trailing slash, as in "/archive/2005/". Note that this + # is currently not recommended since it breaks caching. + # * :host - Overrides the default (current) host if provided. + # * :protocol - Overrides the default (current) protocol if provided. + # * :user - Inline HTTP authentication (only plucked out if :password is also present). + # * :password - Inline HTTP authentication (only plucked out if :user is also present). + # + # ==== Relying on named routes + # + # Passing a record (like an Active Record) instead of a hash as the options parameter will + # trigger the named route for that record. The lookup will happen on the name of the class. So passing a + # Workshop object will attempt to use the +workshop_path+ route. If you have a nested route, such as + # +admin_workshop_path+ you'll have to call that explicitly (it's impossible for +url_for+ to guess that route). + # + # ==== Implicit Controller Namespacing + # + # Controllers passed in using the +:controller+ option will retain their namespace unless it is an absolute one. + # + # ==== Examples + # <%= url_for(action: 'index') %> + # # => /blogs/ + # + # <%= url_for(action: 'find', controller: 'books') %> + # # => /books/find + # + # <%= url_for(action: 'login', controller: 'members', only_path: false, protocol: 'https') %> + # # => https://www.example.com/members/login/ + # + # <%= url_for(action: 'play', anchor: 'player') %> + # # => /messages/play/#player + # + # <%= url_for(action: 'jump', anchor: 'tax&ship') %> + # # => /testing/jump/#tax&ship + # + # <%= url_for(Workshop) %> + # # => /workshops + # + # <%= url_for(Workshop.new) %> + # # relies on Workshop answering a persisted? call (and in this case returning false) + # # => /workshops + # + # <%= url_for(@workshop) %> + # # calls @workshop.to_param which by default returns the id + # # => /workshops/5 + # + # # to_param can be re-defined in a model to provide different URL names: + # # => /workshops/1-workshop-name + # + # <%= url_for("http://www.example.com") %> + # # => http://www.example.com + # + # <%= url_for(:back) %> + # # if request.env["HTTP_REFERER"] is set to "http://www.example.com" + # # => http://www.example.com + # + # <%= url_for(:back) %> + # # if request.env["HTTP_REFERER"] is not set or is blank + # # => javascript:history.back() + # + # <%= url_for(action: 'index', controller: 'users') %> + # # Assuming an "admin" namespace + # # => /admin/users + # + # <%= url_for(action: 'index', controller: '/users') %> + # # Specify absolute path with beginning slash + # # => /users + # + # pkg:gem/actionview#lib/action_view/routing_url_for.rb:82 + def url_for(options = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/routing_url_for.rb:124 + def url_options; end + + private + + # pkg:gem/actionview#lib/action_view/routing_url_for.rb:139 + def _generate_paths_by_default; end + + # pkg:gem/actionview#lib/action_view/routing_url_for.rb:130 + def _routes_context; end + + # pkg:gem/actionview#lib/action_view/routing_url_for.rb:143 + def ensure_only_path_option(options); end + + # pkg:gem/actionview#lib/action_view/routing_url_for.rb:134 + def optimize_routes_generation?; end +end + +# pkg:gem/actionview#lib/action_view/buffers.rb:108 +class ActionView::StreamingBuffer + # pkg:gem/actionview#lib/action_view/buffers.rb:109 + def initialize(block); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:113 + def <<(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:119 + def append=(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:147 + def block; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:126 + def capture; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:118 + def concat(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:139 + def html_safe; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:135 + def html_safe?; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:143 + def raw; end + + # pkg:gem/actionview#lib/action_view/buffers.rb:124 + def safe_append=(value); end + + # pkg:gem/actionview#lib/action_view/buffers.rb:121 + def safe_concat(value); end +end + +# pkg:gem/actionview#lib/action_view/flows.rb:30 +class ActionView::StreamingFlow < ::ActionView::OutputFlow + # pkg:gem/actionview#lib/action_view/flows.rb:31 + def initialize(view, fiber); end + + # Appends the contents for the given key. This is called + # by providing and resuming back to the fiber, + # if that's the key it's waiting for. + # + # pkg:gem/actionview#lib/action_view/flows.rb:65 + def append!(key, value); end + + # Try to get stored content. If the content + # is not available and we're inside the layout fiber, + # then it will begin waiting for the given key and yield. + # + # pkg:gem/actionview#lib/action_view/flows.rb:43 + def get(key); end + + private + + # pkg:gem/actionview#lib/action_view/flows.rb:71 + def inside_fiber?; end +end + +# == TODO +# +# * Support streaming from child templates, partials and so on. +# * Rack::Cache needs to support streaming bodies +# +# pkg:gem/actionview#lib/action_view/renderer/streaming_template_renderer.rb:12 +class ActionView::StreamingTemplateRenderer < ::ActionView::TemplateRenderer + # For streaming, instead of rendering a given a template, we return a Body + # object that responds to each. This object is initialized with a block + # that knows how to render the template. + # + # pkg:gem/actionview#lib/action_view/renderer/streaming_template_renderer.rb:51 + def render_template(view, template, layout_name = T.unsafe(nil), locals = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/renderer/streaming_template_renderer.rb:63 + def delayed_render(buffer, template, layout, view, locals); end +end + +# A valid Rack::Body (i.e. it responds to each). +# It is initialized with a block that, when called, starts +# rendering the template. +# +# pkg:gem/actionview#lib/action_view/renderer/streaming_template_renderer.rb:13 +class ActionView::StreamingTemplateRenderer::Body + # pkg:gem/actionview#lib/action_view/renderer/streaming_template_renderer.rb:14 + def initialize(&start); end + + # Returns the complete body as a string. + # + # pkg:gem/actionview#lib/action_view/renderer/streaming_template_renderer.rb:29 + def body; end + + # pkg:gem/actionview#lib/action_view/renderer/streaming_template_renderer.rb:18 + def each(&block); end + + private + + # This is the same logging logic as in ShowExceptions middleware. + # + # pkg:gem/actionview#lib/action_view/renderer/streaming_template_renderer.rb:37 + def log_error(exception); end +end + +# pkg:gem/actionview#lib/action_view/template/error.rb:30 +class ActionView::StrictLocalsError < ::ArgumentError + # pkg:gem/actionview#lib/action_view/template/error.rb:31 + def initialize(argument_error, template); end +end + +# pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:6 +class ActionView::StructuredEventSubscriber < ::ActiveSupport::StructuredEventSubscriber + include ::ActionView::StructuredEventSubscriber::Utils + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:9 + def initialize; end + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:44 + def render_collection(event); end + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:35 + def render_layout(event); end + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:24 + def render_partial(event); end + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:14 + def render_template(event); end + + class << self + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:88 + def attach_to(*); end + + private + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:22 + def __class_attr_debug_methods; end + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:22 + def __class_attr_debug_methods=(new_value); end + end +end + +# pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:73 +class ActionView::StructuredEventSubscriber::Start + include ::ActionView::StructuredEventSubscriber::Utils + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:84 + def finish(name, id, payload); end + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:76 + def start(name, id, payload); end +end + +# pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:56 +module ActionView::StructuredEventSubscriber::Utils + private + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:58 + def from_rails_root(string); end + + # pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:66 + def rails_root; end +end + +# pkg:gem/actionview#lib/action_view/structured_event_subscriber.rb:7 +ActionView::StructuredEventSubscriber::VIEWS_PATTERN = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionview#lib/action_view/template/error.rb:256 +class ActionView::SyntaxErrorInTemplate < ::ActionView::Template::Error + # pkg:gem/actionview#lib/action_view/template/error.rb:257 + def initialize(template, offending_code_string); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:272 + def annotated_source_code; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:262 + def message; end +end + +# = Action View \Template +# +# pkg:gem/actionview#lib/action_view/template.rb:7 +class ActionView::Template + extend ::ActiveSupport::Autoload + extend ::ActionView::Template::Handlers + + # pkg:gem/actionview#lib/action_view/template.rb:199 + def initialize(source, identifier, handler, locals:, format: T.unsafe(nil), variant: T.unsafe(nil), virtual_path: T.unsafe(nil)); end + + # This method is responsible for properly setting the encoding of the + # source. Until this point, we assume that the source is BINARY data. + # If no additional information is supplied, we assume the encoding is + # the same as Encoding.default_external. + # + # The user can also specify the encoding via a comment on the first + # with any template engine, as we process out the encoding comment + # before passing the source on to the template engine, leaving a + # blank line in its stead. + # + # pkg:gem/actionview#lib/action_view/template.rb:321 + def encode!; end + + # pkg:gem/actionview#lib/action_view/template.rb:195 + def format; end + + # pkg:gem/actionview#lib/action_view/template.rb:194 + def handler; end + + # pkg:gem/actionview#lib/action_view/template.rb:194 + def identifier; end + + # pkg:gem/actionview#lib/action_view/template.rb:300 + def inspect; end + + # The locals this template has been or will be compiled for, or nil if this + # is a strict locals template. + # + # pkg:gem/actionview#lib/action_view/template.rb:223 + def locals; end + + # Exceptions are marshalled when using the parallel test runner with DRb, so we need + # to ensure that references to the template object can be marshalled as well. This means forgoing + # the marshalling of the compiler mutex and instantiating that again on unmarshalling. + # + # pkg:gem/actionview#lib/action_view/template.rb:393 + def marshal_dump; end + + # pkg:gem/actionview#lib/action_view/template.rb:397 + def marshal_load(array); end + + # pkg:gem/actionview#lib/action_view/template.rb:402 + def method_name; end + + # Render a template. If the template was not compiled yet, it is done + # exactly before rendering. + # + # This method is instrumented as "!render_template.action_view". Notice that + # we use a bang in this instrumentation because you don't want to + # consume this in production. This is only slow if it's being listened to. + # + # pkg:gem/actionview#lib/action_view/template.rb:271 + def render(view, locals, buffer = T.unsafe(nil), implicit_locals: T.unsafe(nil), add_to_stack: T.unsafe(nil), &block); end + + # pkg:gem/actionview#lib/action_view/template.rb:296 + def short_identifier; end + + # pkg:gem/actionview#lib/action_view/template.rb:304 + def source; end + + # pkg:gem/actionview#lib/action_view/template.rb:231 + def spot(location); end + + # This method is responsible for marking a template as having strict locals + # which means the template can only accept the locals defined in a magic + # comment. For example, if your template accepts the locals +title+ and + # +comment_count+, add the following to your template file: + # + # <%# locals: (title: "Default title", comment_count: 0) %> + # + # Strict locals are useful for validating template arguments and for + # specifying defaults. + # + # pkg:gem/actionview#lib/action_view/template.rb:366 + def strict_locals!; end + + # Returns whether a template is using strict locals. + # + # pkg:gem/actionview#lib/action_view/template.rb:386 + def strict_locals?; end + + # Returns whether the underlying handler supports streaming. If so, + # a streaming buffer *may* be passed when it starts rendering. + # + # pkg:gem/actionview#lib/action_view/template.rb:261 + def supports_streaming?; end + + # Translate an error location returned by ErrorHighlight to the correct + # source location inside the template. + # + # pkg:gem/actionview#lib/action_view/template.rb:251 + def translate_location(backtrace_location, spot); end + + # pkg:gem/actionview#lib/action_view/template.rb:292 + def type; end + + # pkg:gem/actionview#lib/action_view/template.rb:195 + def variable; end + + # pkg:gem/actionview#lib/action_view/template.rb:195 + def variant; end + + # pkg:gem/actionview#lib/action_view/template.rb:195 + def virtual_path; end + + private + + # Among other things, this method is responsible for properly setting + # the encoding of the compiled template. + # + # If the template engine handles encodings, we send the encoded + # String to the engine without further processing. This allows + # the template engine to support additional mechanisms for + # + # Otherwise, after we figure out the correct encoding, we then + # encode the source into Encoding.default_internal. + # In general, this means that templates will be UTF-8 inside of Rails, + # regardless of the original source encoding. + # + # pkg:gem/actionview#lib/action_view/template.rb:507 + def compile(mod); end + + # Compile a template. This method ensures a template is compiled + # just once and removes the source after it is compiled. + # + # pkg:gem/actionview#lib/action_view/template.rb:424 + def compile!(view); end + + # This method compiles the source of the template. The compilation of templates + # involves setting strict_locals! if applicable, encoding the template, and setting + # frozen string literal. + # + # pkg:gem/actionview#lib/action_view/template.rb:449 + def compiled_source; end + + # pkg:gem/actionview#lib/action_view/template.rb:411 + def find_node_by_id(node, node_id); end + + # pkg:gem/actionview#lib/action_view/template.rb:556 + def handle_render_error(view, e); end + + # pkg:gem/actionview#lib/action_view/template.rb:581 + def identifier_method_name; end + + # pkg:gem/actionview#lib/action_view/template.rb:585 + def instrument(action, &block); end + + # pkg:gem/actionview#lib/action_view/template.rb:593 + def instrument_payload; end + + # pkg:gem/actionview#lib/action_view/template.rb:589 + def instrument_render_template(&block); end + + # pkg:gem/actionview#lib/action_view/template.rb:568 + def locals_code; end + + # pkg:gem/actionview#lib/action_view/template.rb:548 + def offset; end + + class << self + # pkg:gem/actionview#lib/action_view/template.rb:180 + def frozen_string_literal; end + + # pkg:gem/actionview#lib/action_view/template.rb:180 + def frozen_string_literal=(_arg0); end + + # pkg:gem/actionview#lib/action_view/template.rb:184 + def mime_types_implementation=(implementation); end + end +end + +# The Template::Error exception is raised when the compilation or rendering of the template +# fails. This exception then gathers a bunch of intimate details and uses it to report a +# precise exception message. +# +# pkg:gem/actionview#lib/action_view/template/error.rb:165 +class ActionView::Template::Error < ::ActionView::ActionViewError + # pkg:gem/actionview#lib/action_view/template/error.rb:173 + def initialize(template); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:231 + def annotated_source_code; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:182 + def backtrace; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:186 + def backtrace_locations; end + + # Override to prevent #cause resetting during re-raise. + # + # pkg:gem/actionview#lib/action_view/template/error.rb:169 + def cause; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:190 + def file_name; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:223 + def line_number; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:203 + def source_extract(indentation = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:194 + def sub_template_message; end + + # pkg:gem/actionview#lib/action_view/template/error.rb:218 + def sub_template_of(template_path); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:171 + def template; end + + private + + # pkg:gem/actionview#lib/action_view/template/error.rb:244 + def formatted_code_for(source_code, line_counter, indent); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:236 + def source_location; end +end + +# pkg:gem/actionview#lib/action_view/template/error.rb:166 +ActionView::Template::Error::SOURCE_CODE_RADIUS = T.let(T.unsafe(nil), Integer) + +# = Action View HTML Template +# +# pkg:gem/actionview#lib/action_view/template/html.rb:6 +class ActionView::Template::HTML + # pkg:gem/actionview#lib/action_view/template/html.rb:9 + def initialize(string, type); end + + # pkg:gem/actionview#lib/action_view/template/html.rb:28 + def format; end + + # pkg:gem/actionview#lib/action_view/template/html.rb:14 + def identifier; end + + # pkg:gem/actionview#lib/action_view/template/html.rb:18 + def inspect; end + + # pkg:gem/actionview#lib/action_view/template/html.rb:24 + def render(*args); end + + # pkg:gem/actionview#lib/action_view/template/html.rb:20 + def to_str; end + + # pkg:gem/actionview#lib/action_view/template/html.rb:7 + def type; end +end + +# = Action View Template Handlers +# +# pkg:gem/actionview#lib/action_view/template/handlers.rb:6 +module ActionView::Template::Handlers + # pkg:gem/actionview#lib/action_view/template/handlers.rb:61 + def handler_for_extension(extension); end + + # pkg:gem/actionview#lib/action_view/template/handlers.rb:56 + def register_default_template_handler(extension, klass); end + + # Register an object that knows how to handle template files with the given + # extensions. This can be used to implement new template types. + # The handler must respond to +:call+, which will be passed the template + # and should return the rendered template as a String. + # + # pkg:gem/actionview#lib/action_view/template/handlers.rb:31 + def register_template_handler(*extensions, handler); end + + # pkg:gem/actionview#lib/action_view/template/handlers.rb:52 + def registered_template_handler(extension); end + + # pkg:gem/actionview#lib/action_view/template/handlers.rb:48 + def template_handler_extensions; end + + # Opposite to register_template_handler. + # + # pkg:gem/actionview#lib/action_view/template/handlers.rb:40 + def unregister_template_handler(*extensions); end + + class << self + # pkg:gem/actionview#lib/action_view/template/handlers.rb:12 + def extended(base); end + + # pkg:gem/actionview#lib/action_view/template/handlers.rb:23 + def extensions; end + end +end + +# pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:5 +class ActionView::Template::Handlers::Builder + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:8 + def call(template, source); end + + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:6 + def default_format; end + + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:6 + def default_format=(_arg0); end + + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:6 + def default_format?; end + + private + + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:17 + def require_engine; end + + class << self + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:6 + def default_format; end + + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:6 + def default_format=(value); end + + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:6 + def default_format?; end + + private + + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:6 + def __class_attr_default_format; end + + # pkg:gem/actionview#lib/action_view/template/handlers/builder.rb:6 + def __class_attr_default_format=(new_value); end + end +end + +# pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:9 +class ActionView::Template::Handlers::ERB + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:65 + def call(template, source); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:17 + def erb_implementation; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:17 + def erb_implementation=(_arg0); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:17 + def erb_implementation?; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:14 + def erb_trim_mode; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:14 + def erb_trim_mode=(_arg0); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:14 + def erb_trim_mode?; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:20 + def escape_ignore_list; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:20 + def escape_ignore_list=(_arg0); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:20 + def escape_ignore_list?; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:37 + def handles_encoding?; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:23 + def strip_trailing_newlines; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:23 + def strip_trailing_newlines=(_arg0); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:23 + def strip_trailing_newlines?; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:33 + def supports_streaming?; end + + # Translate an error location returned by ErrorHighlight to the correct + # source location inside the template. + # + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:43 + def translate_location(spot, _backtrace_location, source); end + + private + + # Return the offset between the error lineno and the source lineno. + # Searches in reverse from the backtrace lineno so we have a better + # chance of finding the correct line + # + # The compiled template is likely to be longer than the source. + # Use the difference between the compiled and source sizes to + # determine the earliest line that could contain the highlight. + # + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:119 + def find_lineno_offset(compiled, source_lines, highlight, error_lineno); end + + # Find which token in the source template spans the byte range that + # contains the error_column, then return the offset compared to the + # original source template. + # + # Iterate consecutive pairs of CODE or TEXT tokens, requiring + # a match of the first token before matching either token. + # + # For example, if we want to find tokens A, B, C, we do the following: + # 1. Find a match for A: test error_column or advance scanner. + # 2. Find a match for B or A: + # a. If B: start over with next token set (B, C). + # b. If A: test error_column or advance scanner. + # c. Otherwise: Advance 1 byte + # + # Prioritize matching the next token over the current token once + # a match for the current token has been found. This is to prevent + # the current token from looping past the next token if they both + # match (i.e. if the current token is a single space character). + # + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:152 + def find_offset(compiled, source_tokens, error_column); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:177 + def offset_source_tokens(source_tokens); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:97 + def valid_encoding(string, encoding); end + + class << self + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:29 + def call(template, source); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:17 + def erb_implementation; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:17 + def erb_implementation=(value); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:17 + def erb_implementation?; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:14 + def erb_trim_mode; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:14 + def erb_trim_mode=(value); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:14 + def erb_trim_mode?; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:20 + def escape_ignore_list; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:20 + def escape_ignore_list=(value); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:20 + def escape_ignore_list?; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:23 + def strip_trailing_newlines; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:23 + def strip_trailing_newlines=(value); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:23 + def strip_trailing_newlines?; end + + private + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:17 + def __class_attr_erb_implementation; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:17 + def __class_attr_erb_implementation=(new_value); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:14 + def __class_attr_erb_trim_mode; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:14 + def __class_attr_erb_trim_mode=(new_value); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:20 + def __class_attr_escape_ignore_list; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:20 + def __class_attr_escape_ignore_list=(new_value); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:23 + def __class_attr_strip_trailing_newlines; end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:23 + def __class_attr_strip_trailing_newlines=(new_value); end + end +end + +# pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:25 +ActionView::Template::Handlers::ERB::ENCODING_TAG = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionview#lib/action_view/template/handlers/erb/erubi.rb:9 +class ActionView::Template::Handlers::ERB::Erubi < ::Erubi::Engine + # pkg:gem/actionview#lib/action_view/template/handlers/erb/erubi.rb:11 + def initialize(input, properties = T.unsafe(nil)); end + + private + + # pkg:gem/actionview#lib/action_view/template/handlers/erb/erubi.rb:65 + def add_code(code); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb/erubi.rb:47 + def add_expression(indicator, code); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb/erubi.rb:70 + def add_postamble(_); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb/erubi.rb:30 + def add_text(text); end + + # pkg:gem/actionview#lib/action_view/template/handlers/erb/erubi.rb:75 + def flush_newline_if_pending(src); end +end + +# pkg:gem/actionview#lib/action_view/template/handlers/erb/erubi.rb:45 +ActionView::Template::Handlers::ERB::Erubi::BLOCK_EXPR = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionview#lib/action_view/template/handlers/erb.rb:27 +class ActionView::Template::Handlers::ERB::LocationParsingError < ::StandardError; end + +# pkg:gem/actionview#lib/action_view/template/handlers/html.rb:5 +class ActionView::Template::Handlers::Html < ::ActionView::Template::Handlers::Raw + # pkg:gem/actionview#lib/action_view/template/handlers/html.rb:6 + def call(template, source); end +end + +# pkg:gem/actionview#lib/action_view/template/handlers/raw.rb:5 +class ActionView::Template::Handlers::Raw + # pkg:gem/actionview#lib/action_view/template/handlers/raw.rb:6 + def call(template, source); end +end + +# pkg:gem/actionview#lib/action_view/template/inline.rb:7 +class ActionView::Template::Inline < ::ActionView::Template + # pkg:gem/actionview#lib/action_view/template/inline.rb:16 + def compile(mod); end +end + +# This finalizer is needed (and exactly with a proc inside another proc) +# otherwise templates leak in development. +# +# pkg:gem/actionview#lib/action_view/template/inline.rb:8 +ActionView::Template::Inline::Finalizer = T.let(T.unsafe(nil), Proc) + +# pkg:gem/actionview#lib/action_view/template.rb:308 +ActionView::Template::LEADING_ENCODING_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/actionview#lib/action_view/template.rb:197 +ActionView::Template::NONE = T.let(T.unsafe(nil), Object) + +# pkg:gem/actionview#lib/action_view/template.rb:565 +ActionView::Template::RUBY_RESERVED_KEYWORDS = T.let(T.unsafe(nil), Array) + +# = Action View RawFile Template +# +# pkg:gem/actionview#lib/action_view/template/raw_file.rb:6 +class ActionView::Template::RawFile + # pkg:gem/actionview#lib/action_view/template/raw_file.rb:9 + def initialize(filename); end + + # pkg:gem/actionview#lib/action_view/template/raw_file.rb:7 + def format; end + + # pkg:gem/actionview#lib/action_view/template/raw_file.rb:7 + def format=(_arg0); end + + # pkg:gem/actionview#lib/action_view/template/raw_file.rb:16 + def identifier; end + + # pkg:gem/actionview#lib/action_view/template/raw_file.rb:20 + def render(*args); end + + # pkg:gem/actionview#lib/action_view/template/raw_file.rb:24 + def supports_streaming?; end + + # pkg:gem/actionview#lib/action_view/template/raw_file.rb:7 + def type; end + + # pkg:gem/actionview#lib/action_view/template/raw_file.rb:7 + def type=(_arg0); end +end + +# = Action View Renderable Template for objects that respond to #render_in +# +# pkg:gem/actionview#lib/action_view/template/renderable.rb:6 +class ActionView::Template::Renderable + # pkg:gem/actionview#lib/action_view/template/renderable.rb:7 + def initialize(renderable); end + + # pkg:gem/actionview#lib/action_view/template/renderable.rb:25 + def format; end + + # pkg:gem/actionview#lib/action_view/template/renderable.rb:11 + def identifier; end + + # pkg:gem/actionview#lib/action_view/template/renderable.rb:15 + def render(context, *args); end +end + +# pkg:gem/actionview#lib/action_view/template.rb:10 +ActionView::Template::STRICT_LOCALS_REGEX = T.let(T.unsafe(nil), Regexp) + +# SimpleType is mostly just a stub implementation for when Action View +# is used without Action Dispatch. +# +# pkg:gem/actionview#lib/action_view/template/types.rb:9 +class ActionView::Template::SimpleType + # pkg:gem/actionview#lib/action_view/template/types.rb:29 + def initialize(symbol); end + + # pkg:gem/actionview#lib/action_view/template/types.rb:43 + def ==(type); end + + # pkg:gem/actionview#lib/action_view/template/types.rb:38 + def ref; end + + # pkg:gem/actionview#lib/action_view/template/types.rb:27 + def symbol; end + + # pkg:gem/actionview#lib/action_view/template/types.rb:33 + def to_s; end + + # pkg:gem/actionview#lib/action_view/template/types.rb:36 + def to_str; end + + # pkg:gem/actionview#lib/action_view/template/types.rb:41 + def to_sym; end + + class << self + # pkg:gem/actionview#lib/action_view/template/types.rb:14 + def [](type); end + + # pkg:gem/actionview#lib/action_view/template/types.rb:12 + def symbols; end + + # pkg:gem/actionview#lib/action_view/template/types.rb:22 + def valid_symbols?(symbols); end + end +end + +# pkg:gem/actionview#lib/action_view/template/sources.rb:5 +module ActionView::Template::Sources + extend ::ActiveSupport::Autoload +end + +# pkg:gem/actionview#lib/action_view/template/sources/file.rb:6 +class ActionView::Template::Sources::File + # pkg:gem/actionview#lib/action_view/template/sources/file.rb:7 + def initialize(filename); end + + # pkg:gem/actionview#lib/action_view/template/sources/file.rb:11 + def to_s; end +end + +# = Action View Text Template +# +# pkg:gem/actionview#lib/action_view/template/text.rb:6 +class ActionView::Template::Text + # pkg:gem/actionview#lib/action_view/template/text.rb:9 + def initialize(string); end + + # pkg:gem/actionview#lib/action_view/template/text.rb:27 + def format; end + + # pkg:gem/actionview#lib/action_view/template/text.rb:13 + def identifier; end + + # pkg:gem/actionview#lib/action_view/template/text.rb:17 + def inspect; end + + # pkg:gem/actionview#lib/action_view/template/text.rb:23 + def render(*args); end + + # pkg:gem/actionview#lib/action_view/template/text.rb:19 + def to_str; end + + # pkg:gem/actionview#lib/action_view/template/text.rb:7 + def type; end + + # pkg:gem/actionview#lib/action_view/template/text.rb:7 + def type=(_arg0); end +end + +# pkg:gem/actionview#lib/action_view/template.rb:189 +ActionView::Template::Types = Mime + +# pkg:gem/actionview#lib/action_view/template_details.rb:4 +class ActionView::TemplateDetails + # pkg:gem/actionview#lib/action_view/template_details.rb:35 + def initialize(locale, handler, format, variant); end + + # pkg:gem/actionview#lib/action_view/template_details.rb:33 + def format; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:62 + def format_or_default; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:33 + def handler; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:58 + def handler_class; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:33 + def locale; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:42 + def matches?(requested); end + + # pkg:gem/actionview#lib/action_view/template_details.rb:49 + def sort_key_for(requested); end + + # pkg:gem/actionview#lib/action_view/template_details.rb:33 + def variant; end +end + +# pkg:gem/actionview#lib/action_view/template_details.rb:5 +class ActionView::TemplateDetails::Requested + # pkg:gem/actionview#lib/action_view/template_details.rb:11 + def initialize(locale:, handlers:, formats:, variants:); end + + # pkg:gem/actionview#lib/action_view/template_details.rb:6 + def formats; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:7 + def formats_idx; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:6 + def handlers; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:7 + def handlers_idx; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:6 + def locale; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:7 + def locale_idx; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:6 + def variants; end + + # pkg:gem/actionview#lib/action_view/template_details.rb:7 + def variants_idx; end + + private + + # pkg:gem/actionview#lib/action_view/template_details.rb:28 + def build_idx_hash(arr); end +end + +# pkg:gem/actionview#lib/action_view/template_details.rb:9 +ActionView::TemplateDetails::Requested::ANY_HASH = T.let(T.unsafe(nil), Hash) + +# pkg:gem/actionview#lib/action_view/template/error.rb:254 +ActionView::TemplateError = ActionView::Template::Error + +# = Action View \TemplatePath +# +# Represents a template path within ActionView's lookup and rendering system, +# like "users/show" +# +# TemplatePath makes it convenient to convert between separate name, prefix, +# partial arguments and the virtual path. +# +# pkg:gem/actionview#lib/action_view/template_path.rb:11 +class ActionView::TemplatePath + # pkg:gem/actionview#lib/action_view/template_path.rb:47 + def initialize(name, prefix, partial, virtual); end + + # pkg:gem/actionview#lib/action_view/template_path.rb:64 + def ==(other); end + + # pkg:gem/actionview#lib/action_view/template_path.rb:61 + def eql?(other); end + + # pkg:gem/actionview#lib/action_view/template_path.rb:57 + def hash; end + + # pkg:gem/actionview#lib/action_view/template_path.rb:12 + def name; end + + # pkg:gem/actionview#lib/action_view/template_path.rb:12 + def partial; end + + # pkg:gem/actionview#lib/action_view/template_path.rb:13 + def partial?; end + + # pkg:gem/actionview#lib/action_view/template_path.rb:12 + def prefix; end + + # pkg:gem/actionview#lib/action_view/template_path.rb:55 + def to_s; end + + # pkg:gem/actionview#lib/action_view/template_path.rb:54 + def to_str; end + + # pkg:gem/actionview#lib/action_view/template_path.rb:12 + def virtual; end + + # pkg:gem/actionview#lib/action_view/template_path.rb:14 + def virtual_path; end + + class << self + # Convert name, prefix, and partial into a TemplatePath + # + # pkg:gem/actionview#lib/action_view/template_path.rb:43 + def build(name, prefix, partial); end + + # Build a TemplatePath form a virtual path + # + # pkg:gem/actionview#lib/action_view/template_path.rb:28 + def parse(virtual); end + + # Convert name, prefix, and partial into a virtual path string + # + # pkg:gem/actionview#lib/action_view/template_path.rb:17 + def virtual(name, prefix, partial); end + end +end + +# pkg:gem/actionview#lib/action_view/renderer/template_renderer.rb:4 +class ActionView::TemplateRenderer < ::ActionView::AbstractRenderer + # pkg:gem/actionview#lib/action_view/renderer/template_renderer.rb:5 + def render(context, options); end + + private + + # Determine the template to be rendered using the given options. + # + # pkg:gem/actionview#lib/action_view/renderer/template_renderer.rb:16 + def determine_template(options); end + + # This is the method which actually finds the layout using details in the lookup + # context object. If no layout is found, it checks if at least a layout with + # the given name exists across all details before raising the error. + # + # pkg:gem/actionview#lib/action_view/renderer/template_renderer.rb:88 + def find_layout(layout, keys, formats); end + + # Renders the given template. A string representing the layout can be + # supplied as well. + # + # pkg:gem/actionview#lib/action_view/renderer/template_renderer.rb:58 + def render_template(view, template, layout_name, locals); end + + # pkg:gem/actionview#lib/action_view/renderer/template_renderer.rb:71 + def render_with_layout(view, template, path, locals); end + + # pkg:gem/actionview#lib/action_view/renderer/template_renderer.rb:92 + def resolve_layout(layout, keys, formats); end +end + +# = Action View Test Case +# +# Read more about ActionView::TestCase in {Testing Rails Applications}[https://guides.rubyonrails.org/testing.html#testing-view-partials] +# in the guides. +# +# pkg:gem/actionview#lib/action_view/test_case.rb:15 +class ActionView::TestCase < ::ActiveSupport::TestCase + include ::ActionDispatch::Assertions::RoutingAssertions + include ::ActionDispatch::Assertions::ResponseAssertions + include ::ActionDispatch::TestProcess::FixtureFile + include ::ActionDispatch::TestProcess + include ::Rails::Dom::Testing::Assertions::DomAssertions + include ::Rails::Dom::Testing::Assertions::SelectorAssertions + include ::Rails::Dom::Testing::Assertions + include ::ActionDispatch::Assertions + include ::AbstractController::Helpers + include ::ActiveSupport::Benchmarkable + include ::ActionView::Helpers::ActiveModelHelper + include ::ActionView::Helpers::AssetUrlHelper + include ::ActionView::Helpers::CaptureHelper + include ::ActionView::Helpers::OutputSafetyHelper + include ::ActionView::Helpers::TagHelper + include ::ActionView::Helpers::AssetTagHelper + include ::ActionView::Helpers::AtomFeedHelper + include ::ActionView::Helpers::CacheHelper + include ::ActionView::Helpers::ContentExfiltrationPreventionHelper + include ::ActionView::Helpers::UrlHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::ControllerHelper + include ::ActionView::Helpers::CspHelper + include ::ActionView::Helpers::CsrfHelper + include ::ActionView::Helpers::DateHelper + include ::ActionView::Helpers::DebugHelper + include ::ActionView::Helpers::TextHelper + include ::ActionView::Helpers::FormTagHelper + include ::ActionController::TemplateAssertions + include ::ActionView::Context + include ::ActionDispatch::Routing::PolymorphicRoutes + include ::ActionView::ModelNaming + include ::ActionView::RecordIdentifier + include ::ActionView::Helpers::FormHelper + include ::ActionView::Helpers::TranslationHelper + include ::ActionView::Helpers::FormOptionsHelper + include ::ActionView::Helpers::JavaScriptHelper + include ::ActionView::Helpers::NumberHelper + include ::ActionView::Helpers::RenderingHelper + include ::ActionView::Helpers + include ::ActiveSupport::Testing::ConstantLookup + include ::ActionDispatch::Routing::UrlFor + include ::ActionView::RoutingUrlFor + include ::ActionView::TestCase::Behavior + extend ::ActionDispatch::Assertions::RoutingAssertions::ClassMethods + extend ::AbstractController::Helpers::Resolution + extend ::AbstractController::Helpers::ClassMethods + extend ::ActionView::Helpers::UrlHelper::ClassMethods + extend ::ActionView::Helpers::SanitizeHelper::ClassMethods + extend ::ActiveSupport::Testing::ConstantLookup::ClassMethods + extend ::ActionView::TestCase::Behavior::ClassMethods + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def _helper_methods; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def _helper_methods=(_arg0); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def _helper_methods?; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:251 + def _run_setup_callbacks(&block); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def debug_missing_translation; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def debug_missing_translation=(val); end + + class << self + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def _helper_methods; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def _helper_methods=(value); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def _helper_methods?; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def _helpers; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:249 + def content_class; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:249 + def content_class=(value); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:249 + def content_class?; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def debug_missing_translation; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def debug_missing_translation=(val); end + + private + + # pkg:gem/actionview#lib/action_view/test_case.rb:251 + def __class_attr___callbacks; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:251 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def __class_attr__helper_methods; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:459 + def __class_attr__helper_methods=(new_value); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:249 + def __class_attr_content_class; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:249 + def __class_attr_content_class=(new_value); end + end +end + +# pkg:gem/actionview#lib/action_view/test_case.rb:45 +module ActionView::TestCase::Behavior + include ::ActionDispatch::TestProcess::FixtureFile + include ::ActionDispatch::TestProcess + include ::Rails::Dom::Testing::Assertions::DomAssertions + include ::Rails::Dom::Testing::Assertions::SelectorAssertions + include ::Rails::Dom::Testing::Assertions + include ::ActionController::TemplateAssertions + include ::ActionView::Context + include ::ActionDispatch::Routing::PolymorphicRoutes + include ::ActionView::ModelNaming + include ::ActionView::RecordIdentifier + include ::ActionDispatch::Routing::UrlFor + include ::ActionView::RoutingUrlFor + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActionDispatch::Assertions::RoutingAssertions + include ::ActionDispatch::Assertions + include ::AbstractController::Helpers + include ::ActionView::Helpers::UrlHelper + include ::ActionView::Helpers::SanitizeHelper + include ::ActionView::Helpers::TextHelper + include ::ActionView::Helpers::FormTagHelper + include ::ActionView::Helpers::FormHelper + include ::ActionView::Helpers::TranslationHelper + include ::ActionView::Helpers + include ::ActiveSupport::Testing::ConstantLookup + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActionDispatch::Assertions::RoutingAssertions::ClassMethods + mixes_in_class_methods ::AbstractController::Helpers::ClassMethods + mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods + mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods + mixes_in_class_methods ::ActiveSupport::Testing::ConstantLookup::ClassMethods + mixes_in_class_methods ::ActionView::TestCase::Behavior::ClassMethods + + # pkg:gem/actionview#lib/action_view/test_case.rb:305 + def _routes; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:281 + def config; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:63 + def controller; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:63 + def controller=(_arg0); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:62 + def lookup_context(*, **, &); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:63 + def output_buffer; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:63 + def output_buffer=(_arg0); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:285 + def render(options = T.unsafe(nil), local_assigns = T.unsafe(nil), &block); end + + # Returns the content rendered by the last +render+ call. + # + # The returned object behaves like a string but also exposes a number of methods + # that allows you to parse the content string in formats registered using + # .register_parser. + # + # By default includes the following parsers: + # + # +.html+ + # + # Parse the rendered content String into HTML. By default, this means + # a Nokogiri::XML::Node. + # + # test "renders HTML" do + # article = Article.create!(title: "Hello, world") + # + # render partial: "articles/article", locals: { article: article } + # + # assert_pattern { rendered.html.at("main h1") => { content: "Hello, world" } } + # end + # + # To parse the rendered content into a Capybara::Simple::Node, + # re-register an :html parser with a call to + # Capybara.string: + # + # register_parser :html, -> rendered { Capybara.string(rendered) } + # + # test "renders HTML" do + # article = Article.create!(title: "Hello, world") + # + # render partial: article + # + # rendered.html.assert_css "h1", text: "Hello, world" + # end + # + # +.json+ + # + # Parse the rendered content String into JSON. By default, this means + # a ActiveSupport::HashWithIndifferentAccess. + # + # test "renders JSON" do + # article = Article.create!(title: "Hello, world") + # + # render formats: :json, partial: "articles/article", locals: { article: article } + # + # assert_pattern { rendered.json => { title: "Hello, world" } } + # end + # + # pkg:gem/actionview#lib/action_view/test_case.rb:112 + def rendered; end + + # Returns the content rendered by the last +render+ call. + # + # The returned object behaves like a string but also exposes a number of methods + # that allows you to parse the content string in formats registered using + # .register_parser. + # + # By default includes the following parsers: + # + # +.html+ + # + # Parse the rendered content String into HTML. By default, this means + # a Nokogiri::XML::Node. + # + # test "renders HTML" do + # article = Article.create!(title: "Hello, world") + # + # render partial: "articles/article", locals: { article: article } + # + # assert_pattern { rendered.html.at("main h1") => { content: "Hello, world" } } + # end + # + # To parse the rendered content into a Capybara::Simple::Node, + # re-register an :html parser with a call to + # Capybara.string: + # + # register_parser :html, -> rendered { Capybara.string(rendered) } + # + # test "renders HTML" do + # article = Article.create!(title: "Hello, world") + # + # render partial: article + # + # rendered.html.assert_css "h1", text: "Hello, world" + # end + # + # +.json+ + # + # Parse the rendered content String into JSON. By default, this means + # a ActiveSupport::HashWithIndifferentAccess. + # + # test "renders JSON" do + # article = Article.create!(title: "Hello, world") + # + # render formats: :json, partial: "articles/article", locals: { article: article } + # + # assert_pattern { rendered.json => { title: "Hello, world" } } + # end + # + # pkg:gem/actionview#lib/action_view/test_case.rb:112 + def rendered=(_arg0); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:301 + def rendered_views; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:63 + def request; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:63 + def request=(_arg0); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:269 + def setup_with_controller; end + + private + + # pkg:gem/actionview#lib/action_view/test_case.rb:426 + def _reset_rendered; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:412 + def _user_defined_ivars; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:374 + def _view; end + + # Need to experiment if this priority is the best one: rendered => output_buffer + # + # pkg:gem/actionview#lib/action_view/test_case.rb:339 + def document_root_element; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:430 + def method_missing(selector, *, **, &); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:446 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end + + # The instance of ActionView::Base that is used by +render+. + # + # pkg:gem/actionview#lib/action_view/test_case.rb:363 + def view; end + + # Returns a Hash of instance variables and their values, as defined by + # the user in the test case, which are then assigned to the view being + # rendered. This is generally intended for internal use and extension + # frameworks. + # + # pkg:gem/actionview#lib/action_view/test_case.rb:420 + def view_assigns; end + + module GeneratedClassMethods + def _helper_methods; end + def _helper_methods=(value); end + def _helper_methods?; end + def content_class; end + def content_class=(value); end + def content_class?; end + end + + module GeneratedInstanceMethods + def _helper_methods; end + def _helper_methods=(value); end + def _helper_methods?; end + end +end + +# pkg:gem/actionview#lib/action_view/test_case.rb:114 +module ActionView::TestCase::Behavior::ClassMethods + # pkg:gem/actionview#lib/action_view/test_case.rb:213 + def determine_default_helper_class(name); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:232 + def helper_class; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:230 + def helper_class=(_arg0); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:219 + def helper_method(*methods); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:115 + def inherited(descendant); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:236 + def new(*); end + + # Register a callable to parse rendered content for a given template + # format. + # + # Each registered parser will also define a +#rendered.[FORMAT]+ helper + # method, where +[FORMAT]+ corresponds to the value of the + # +format+ argument. + # + # By default, ActionView::TestCase defines parsers for: + # + # * +:html+ - returns an instance of +Nokogiri::XML::Node+ + # * +:json+ - returns an instance of ActiveSupport::HashWithIndifferentAccess + # + # These pre-registered parsers also define corresponding helpers: + # + # * +:html+ - defines +rendered.html+ + # * +:json+ - defines +rendered.json+ + # + # ==== Parameters + # + # [+format+] + # The name (as a +Symbol+) of the format used to render the content. + # + # [+callable+] + # The parser. A callable object that accepts the rendered string as + # its sole argument. Alternatively, the parser can be specified as a + # block. + # + # ==== Examples + # + # test "renders HTML" do + # article = Article.create!(title: "Hello, world") + # + # render partial: "articles/article", locals: { article: article } + # + # assert_pattern { rendered.html.at("main h1") => { content: "Hello, world" } } + # end + # + # test "renders JSON" do + # article = Article.create!(title: "Hello, world") + # + # render formats: :json, partial: "articles/article", locals: { article: article } + # + # assert_pattern { rendered.json => { title: "Hello, world" } } + # end + # + # To parse the rendered content into RSS, register a call to +RSS::Parser.parse+: + # + # register_parser :rss, -> rendered { RSS::Parser.parse(rendered) } + # + # test "renders RSS" do + # article = Article.create!(title: "Hello, world") + # + # render formats: :rss, partial: article + # + # assert_equal "Hello, world", rendered.rss.items.last.title + # end + # + # To parse the rendered content into a +Capybara::Simple::Node+, + # re-register an +:html+ parser with a call to +Capybara.string+: + # + # register_parser :html, -> rendered { Capybara.string(rendered) } + # + # test "renders HTML" do + # article = Article.create!(title: "Hello, world") + # + # render partial: article + # + # rendered.html.assert_css "h1", text: "Hello, world" + # end + # + # pkg:gem/actionview#lib/action_view/test_case.rb:197 + def register_parser(format, callable = T.unsafe(nil), &block); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:204 + def tests(helper_class); end + + private + + # pkg:gem/actionview#lib/action_view/test_case.rb:242 + def include_helper_modules!; end +end + +# pkg:gem/actionview#lib/action_view/test_case.rb:376 +ActionView::TestCase::Behavior::INTERNAL_IVARS = T.let(T.unsafe(nil), Array) + +# pkg:gem/actionview#lib/action_view/test_case.rb:343 +module ActionView::TestCase::Behavior::Locals + # pkg:gem/actionview#lib/action_view/test_case.rb:346 + def render(options = T.unsafe(nil), local_assigns = T.unsafe(nil)); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:344 + def rendered_views; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:344 + def rendered_views=(_arg0); end +end + +# pkg:gem/actionview#lib/action_view/test_case.rb:309 +class ActionView::TestCase::Behavior::RenderedViewContent < ::String + # pkg:gem/actionview#lib/action_view/test_case.rb:199 + def html; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:199 + def json; end +end + +# pkg:gem/actionview#lib/action_view/test_case.rb:312 +class ActionView::TestCase::Behavior::RenderedViewsCollection + # pkg:gem/actionview#lib/action_view/test_case.rb:313 + def initialize; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:317 + def add(view, locals); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:322 + def locals_for(view); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:326 + def rendered_views; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:330 + def view_rendered?(view, expected_locals); end +end + +# pkg:gem/actionview#lib/action_view/test_case.rb:459 +module ActionView::TestCase::HelperMethods + # pkg:gem/actionview#lib/action_view/test_case.rb:263 + def _test_case; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:259 + def protect_against_forgery?; end +end + +# pkg:gem/actionview#lib/action_view/test_case.rb:16 +class ActionView::TestCase::TestController < ::ActionController::Base + include ::ActionDispatch::TestProcess::FixtureFile + include ::ActionDispatch::TestProcess + + # pkg:gem/actionview#lib/action_view/test_case.rb:34 + def initialize; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:26 + def controller_path=(path); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:19 + def params; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:19 + def params=(_arg0); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:19 + def request; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:19 + def request=(_arg0); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:19 + def response; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:19 + def response=(_arg0); end + + private + + # pkg:gem/actionview#lib/action_view/test_case.rb:16 + def _layout(lookup_context, formats, keys); end + + class << self + # pkg:gem/actionview#lib/action_view/test_case.rb:30 + def controller_name; end + + # Overrides AbstractController::Base#controller_path + # + # pkg:gem/actionview#lib/action_view/test_case.rb:23 + def controller_path; end + + # Overrides AbstractController::Base#controller_path + # + # pkg:gem/actionview#lib/action_view/test_case.rb:23 + def controller_path=(_arg0); end + + private + + # pkg:gem/actionview#lib/action_view/test_case.rb:16 + def __class_attr_config; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:16 + def __class_attr_config=(new_value); end + + # pkg:gem/actionview#lib/action_view/test_case.rb:16 + def __class_attr_middleware_stack; end + + # pkg:gem/actionview#lib/action_view/test_case.rb:16 + def __class_attr_middleware_stack=(new_value); end + end +end + +# pkg:gem/actionview#lib/action_view/unbound_template.rb:6 +class ActionView::UnboundTemplate + # pkg:gem/actionview#lib/action_view/unbound_template.rb:10 + def initialize(source, identifier, details:, virtual_path:); end + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:20 + def bind_locals(locals); end + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:44 + def built_templates; end + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:7 + def details; end + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:8 + def format(*, **, &); end + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:8 + def handler(*, **, &); end + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:8 + def locale(*, **, &); end + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:8 + def variant(*, **, &); end + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:7 + def virtual_path; end + + private + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:49 + def build_template(locals); end + + # pkg:gem/actionview#lib/action_view/unbound_template.rb:63 + def normalize_locals(locals); end +end + +# pkg:gem/actionview#lib/action_view/gem_version.rb:9 +module ActionView::VERSION; end + +# pkg:gem/actionview#lib/action_view/gem_version.rb:10 +ActionView::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actionview#lib/action_view/gem_version.rb:11 +ActionView::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actionview#lib/action_view/gem_version.rb:13 +ActionView::VERSION::PRE = T.let(T.unsafe(nil), String) + +# pkg:gem/actionview#lib/action_view/gem_version.rb:15 +ActionView::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/actionview#lib/action_view/gem_version.rb:12 +ActionView::VERSION::TINY = T.let(T.unsafe(nil), Integer) + +# pkg:gem/actionview#lib/action_view/view_paths.rb:4 +module ActionView::ViewPaths + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActionView::ViewPaths::ClassMethods + + # The prefixes used in render "foo" shortcuts. + # + # pkg:gem/actionview#lib/action_view/view_paths.rb:81 + def _prefixes; end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:11 + def any_templates?(*, **, &); end + + # Append a path to the list of view paths for the current LookupContext. + # + # ==== Parameters + # * path - If a String is provided, it gets converted into + # the default view path. You may also provide a custom view path + # (see ActionView::PathSet for more information) + # + # pkg:gem/actionview#lib/action_view/view_paths.rb:103 + def append_view_path(path); end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:93 + def details_for_lookup; end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:11 + def formats(*, **, &); end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:11 + def formats=(arg); end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:11 + def locale(*, **, &); end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:11 + def locale=(arg); end + + # LookupContext is the object responsible for holding all + # information required for looking up templates, i.e. view paths and + # details. Check ActionView::LookupContext for more information. + # + # pkg:gem/actionview#lib/action_view/view_paths.rb:88 + def lookup_context; end + + # Prepend a path to the list of view paths for the current LookupContext. + # + # ==== Parameters + # * path - If a String is provided, it gets converted into + # the default view path. You may also provide a custom view path + # (see ActionView::PathSet for more information) + # + # pkg:gem/actionview#lib/action_view/view_paths.rb:113 + def prepend_view_path(path); end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:11 + def template_exists?(*, **, &); end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:11 + def view_paths(*, **, &); end +end + +# pkg:gem/actionview#lib/action_view/view_paths.rb:14 +module ActionView::ViewPaths::ClassMethods + # pkg:gem/actionview#lib/action_view/view_paths.rb:31 + def _build_view_paths(paths); end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:23 + def _prefixes; end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:15 + def _view_paths; end + + # pkg:gem/actionview#lib/action_view/view_paths.rb:19 + def _view_paths=(paths); end + + # Append a path to the list of view paths for this controller. + # + # ==== Parameters + # * path - If a String is provided, it gets converted into + # the default view path. You may also provide a custom view path + # (see ActionView::PathSet for more information) + # + # pkg:gem/actionview#lib/action_view/view_paths.rb:44 + def append_view_path(path); end + + # Prepend a path to the list of view paths for this controller. + # + # ==== Parameters + # * path - If a String is provided, it gets converted into + # the default view path. You may also provide a custom view path + # (see ActionView::PathSet for more information) + # + # pkg:gem/actionview#lib/action_view/view_paths.rb:54 + def prepend_view_path(path); end + + # A list of all of the default view paths for this controller. + # + # pkg:gem/actionview#lib/action_view/view_paths.rb:59 + def view_paths; end + + # Set the view paths. + # + # ==== Parameters + # * paths - If a PathSet is provided, use that; + # otherwise, process the parameter into a PathSet. + # + # pkg:gem/actionview#lib/action_view/view_paths.rb:68 + def view_paths=(paths); end + + private + + # Override this method in your controller if you want to change paths prefixes for finding views. + # Prefixes defined here will still be added to parents' ._prefixes. + # + # pkg:gem/actionview#lib/action_view/view_paths.rb:75 + def local_prefixes; end +end + +# pkg:gem/actionview#lib/action_view/template/error.rb:14 +class ActionView::WrongEncodingError < ::ActionView::EncodingError + # pkg:gem/actionview#lib/action_view/template/error.rb:15 + def initialize(string, encoding); end + + # pkg:gem/actionview#lib/action_view/template/error.rb:19 + def message; end +end diff --git a/sorbet/rbi/gems/activejob@8.1.4.1.rbi b/sorbet/rbi/gems/activejob@8.1.4.1.rbi new file mode 100644 index 000000000..2ab593478 --- /dev/null +++ b/sorbet/rbi/gems/activejob@8.1.4.1.rbi @@ -0,0 +1,3329 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `activejob` gem. +# Please instead update this file by running `bin/tapioca gem activejob`. + + +# :markup: markdown +# :include: ../README.md +# +# pkg:gem/activejob#lib/active_job/gem_version.rb:3 +module ActiveJob + extend ::ActiveSupport::Autoload + + class << self + # pkg:gem/activejob#lib/active_job/queue_adapter.rb:7 + def adapter_name(adapter); end + + # pkg:gem/activejob#lib/active_job/deprecator.rb:4 + def deprecator; end + + # Returns the currently loaded version of Active Job as a +Gem::Version+. + # + # pkg:gem/activejob#lib/active_job/gem_version.rb:5 + def gem_version; end + + # Push many jobs onto the queue at once without running enqueue callbacks. + # Queue adapters may communicate the enqueue status of each job by setting + # successfully_enqueued and/or enqueue_error on the passed-in job instances. + # + # pkg:gem/activejob#lib/active_job.rb:66 + def perform_all_later(*jobs); end + + # pkg:gem/activejob#lib/active_job.rb:60 + def verbose_enqueue_logs; end + + # pkg:gem/activejob#lib/active_job.rb:60 + def verbose_enqueue_logs=(_arg0); end + + # Returns the currently loaded version of Active Job as a +Gem::Version+. + # + # pkg:gem/activejob#lib/active_job/version.rb:7 + def version; end + + private + + # pkg:gem/activejob#lib/active_job/instrumentation.rb:6 + def instrument_enqueue_all(queue_adapter, jobs); end + end +end + +# pkg:gem/activejob#lib/active_job/arguments.rb:28 +module ActiveJob::Arguments + extend ::ActiveJob::Arguments + + # Deserializes a set of arguments. Intrinsic types that can safely be + # deserialized without mutation are returned as-is. Arrays/Hashes are + # deserialized element by element. All other types are deserialized using + # GlobalID. + # + # pkg:gem/activejob#lib/active_job/arguments.rb:82 + def deserialize(arguments); end + + # Serializes a set of arguments. Intrinsic types that can safely be + # serialized without mutation are returned as-is. Arrays/Hashes are + # serialized element by element. All other types are serialized using + # GlobalID. + # + # pkg:gem/activejob#lib/active_job/arguments.rb:34 + def serialize(arguments); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:38 + def serialize_argument(argument); end + + private + + # pkg:gem/activejob#lib/active_job/arguments.rb:191 + def convert_to_global_id_hash(argument); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:136 + def custom_serialized?(hash); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:109 + def deserialize_argument(argument); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:132 + def deserialize_global_id(hash); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:146 + def deserialize_hash(serialized_hash); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:140 + def serialize_hash(argument); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:159 + def serialize_hash_key(key); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:172 + def serialize_indifferent_hash(indifferent_hash); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:128 + def serialized_global_id?(hash); end + + # pkg:gem/activejob#lib/active_job/arguments.rb:178 + def transform_symbol_keys(hash, symbol_keys); end +end + +# pkg:gem/activejob#lib/active_job/arguments.rb:90 +ActiveJob::Arguments::GLOBALID_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/activejob#lib/active_job/arguments.rb:99 +ActiveJob::Arguments::RESERVED_KEYS = T.let(T.unsafe(nil), Set) + +# pkg:gem/activejob#lib/active_job/arguments.rb:94 +ActiveJob::Arguments::RUBY2_KEYWORDS_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/activejob#lib/active_job/arguments.rb:92 +ActiveJob::Arguments::SYMBOL_KEYS_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/activejob#lib/active_job/arguments.rb:96 +ActiveJob::Arguments::WITH_INDIFFERENT_ACCESS_KEY = T.let(T.unsafe(nil), String) + +# = Active Job \Base +# +# Active Job objects can be configured to work with different backend +# queuing frameworks. To specify a queue adapter to use: +# +# ActiveJob::Base.queue_adapter = :inline +# +# A list of supported adapters can be found in QueueAdapters. +# +# Active Job objects can be defined by creating a class that inherits +# from the ActiveJob::Base class. The only necessary method to +# implement is the "perform" method. +# +# To define an Active Job object: +# +# class ProcessPhotoJob < ActiveJob::Base +# def perform(photo) +# photo.watermark!('Rails') +# photo.rotate!(90.degrees) +# photo.resize_to_fit!(300, 300) +# photo.upload! +# end +# end +# +# Records that are passed in are serialized/deserialized using Global +# ID. More information can be found in ActiveJob::Arguments. +# +# To enqueue a job to be performed as soon as the queuing system is free: +# +# ProcessPhotoJob.perform_later(photo) +# +# To enqueue a job to be processed at some point in the future: +# +# ProcessPhotoJob.set(wait_until: Date.tomorrow.noon).perform_later(photo) +# +# More information can be found in ActiveJob::Core::ClassMethods#set. +# +# A job can also be processed immediately without sending to the queue: +# +# ProcessPhotoJob.perform_now(photo) +# +# == Exceptions +# +# * DeserializationError - Error class for deserialization errors. +# * SerializationError - Error class for serialization errors. +# +# pkg:gem/activejob#lib/active_job/base.rb:63 +class ActiveJob::Base + include ::ActiveJob::Core + include ::ActiveJob::QueueAdapter + include ::ActiveJob::QueueName + include ::ActiveJob::QueuePriority + include ::ActiveJob::Enqueuing + include ::ActiveSupport::Rescuable + include ::ActiveJob::Execution + include ::ActiveSupport::Callbacks + include ::ActiveJob::Callbacks + include ::ActiveJob::Exceptions + include ::ActiveJob::Instrumentation + include ::ActiveJob::Logging + include ::ActiveJob::ExecutionState + include ::ActiveJob::TestHelper::TestQueueAdapter + extend ::ActiveJob::Core::ClassMethods + extend ::ActiveJob::QueueAdapter::ClassMethods + extend ::ActiveJob::QueueName::ClassMethods + extend ::ActiveJob::QueuePriority::ClassMethods + extend ::ActiveJob::Enqueuing::ClassMethods + extend ::ActiveSupport::Rescuable::ClassMethods + extend ::ActiveJob::Execution::ClassMethods + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + extend ::ActiveJob::Callbacks::ClassMethods + extend ::ActiveJob::Exceptions::ClassMethods + extend ::ActiveJob::TestHelper::TestQueueAdapter::ClassMethods + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def __callbacks; end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _enqueue_callbacks; end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _perform_callbacks; end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _run_enqueue_callbacks(&block); end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _run_enqueue_callbacks!(&block); end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _run_perform_callbacks; end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _run_perform_callbacks!(&block); end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def after_discard_procs; end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def after_discard_procs=(_arg0); end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def after_discard_procs?; end + + # pkg:gem/activejob#lib/active_job/base.rb:73 + def logger; end + + # pkg:gem/activejob#lib/active_job/base.rb:73 + def logger=(val); end + + # pkg:gem/activejob#lib/active_job/base.rb:65 + def queue_adapter(&); end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name_prefix; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name_prefix=(_arg0); end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name_prefix?; end + + # pkg:gem/activejob#lib/active_job/base.rb:69 + def rescue_handlers; end + + # pkg:gem/activejob#lib/active_job/base.rb:69 + def rescue_handlers=(_arg0); end + + # pkg:gem/activejob#lib/active_job/base.rb:69 + def rescue_handlers?; end + + class << self + # pkg:gem/activejob#lib/active_job/base.rb:70 + def __callbacks; end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def __callbacks=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _enqueue_callbacks; end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _enqueue_callbacks=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _perform_callbacks; end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def _perform_callbacks=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:65 + def _queue_adapter; end + + # pkg:gem/activejob#lib/active_job/base.rb:65 + def _queue_adapter=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:65 + def _queue_adapter_name; end + + # pkg:gem/activejob#lib/active_job/base.rb:65 + def _queue_adapter_name=(value); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:19 + def _test_adapter; end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:19 + def _test_adapter=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def after_discard_procs; end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def after_discard_procs=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def after_discard_procs?; end + + # pkg:gem/activejob#lib/active_job/base.rb:68 + def enqueue_after_transaction_commit; end + + # pkg:gem/activejob#lib/active_job/base.rb:68 + def enqueue_after_transaction_commit=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:73 + def log_arguments; end + + # pkg:gem/activejob#lib/active_job/base.rb:73 + def log_arguments=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:73 + def log_arguments?; end + + # pkg:gem/activejob#lib/active_job/base.rb:73 + def logger; end + + # pkg:gem/activejob#lib/active_job/base.rb:73 + def logger=(val); end + + # pkg:gem/activejob#lib/active_job/base.rb:67 + def priority; end + + # pkg:gem/activejob#lib/active_job/base.rb:67 + def priority=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:67 + def priority?; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name?; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name_delimiter; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name_delimiter=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name_delimiter?; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name_prefix; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name_prefix=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def queue_name_prefix?; end + + # pkg:gem/activejob#lib/active_job/base.rb:69 + def rescue_handlers; end + + # pkg:gem/activejob#lib/active_job/base.rb:69 + def rescue_handlers=(value); end + + # pkg:gem/activejob#lib/active_job/base.rb:69 + def rescue_handlers?; end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def retry_jitter; end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def retry_jitter=(value); end + + private + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def __class_attr___callbacks; end + + # pkg:gem/activejob#lib/active_job/base.rb:70 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:65 + def __class_attr__queue_adapter; end + + # pkg:gem/activejob#lib/active_job/base.rb:65 + def __class_attr__queue_adapter=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:65 + def __class_attr__queue_adapter_name; end + + # pkg:gem/activejob#lib/active_job/base.rb:65 + def __class_attr__queue_adapter_name=(new_value); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:19 + def __class_attr__test_adapter; end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:19 + def __class_attr__test_adapter=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def __class_attr_after_discard_procs; end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def __class_attr_after_discard_procs=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:68 + def __class_attr_enqueue_after_transaction_commit; end + + # pkg:gem/activejob#lib/active_job/base.rb:68 + def __class_attr_enqueue_after_transaction_commit=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:73 + def __class_attr_log_arguments; end + + # pkg:gem/activejob#lib/active_job/base.rb:73 + def __class_attr_log_arguments=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:67 + def __class_attr_priority; end + + # pkg:gem/activejob#lib/active_job/base.rb:67 + def __class_attr_priority=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def __class_attr_queue_name; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def __class_attr_queue_name=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def __class_attr_queue_name_delimiter; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def __class_attr_queue_name_delimiter=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def __class_attr_queue_name_prefix; end + + # pkg:gem/activejob#lib/active_job/base.rb:66 + def __class_attr_queue_name_prefix=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:69 + def __class_attr_rescue_handlers; end + + # pkg:gem/activejob#lib/active_job/base.rb:69 + def __class_attr_rescue_handlers=(new_value); end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def __class_attr_retry_jitter; end + + # pkg:gem/activejob#lib/active_job/base.rb:71 + def __class_attr_retry_jitter=(new_value); end + end +end + +# = Active Job \Callbacks +# +# Active Job provides hooks during the life cycle of a job. Callbacks allow you +# to trigger logic during this cycle. Available callbacks are: +# +# * before_enqueue +# * around_enqueue +# * after_enqueue +# * before_perform +# * around_perform +# * after_perform +# +# pkg:gem/activejob#lib/active_job/callbacks.rb:18 +module ActiveJob::Callbacks + extend ::ActiveSupport::Concern + extend ::ActiveSupport::Callbacks + include GeneratedInstanceMethods + include ::ActiveSupport::Callbacks + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::DescendantsTracker + mixes_in_class_methods ::ActiveJob::Callbacks::ClassMethods + + class << self + # pkg:gem/activejob#lib/active_job/callbacks.rb:23 + def __callbacks; end + + # pkg:gem/activejob#lib/active_job/callbacks.rb:24 + def _execute_callbacks; end + + # pkg:gem/activejob#lib/active_job/callbacks.rb:24 + def _run_execute_callbacks; end + + # pkg:gem/activejob#lib/active_job/callbacks.rb:24 + def _run_execute_callbacks!(&block); end + + private + + # pkg:gem/activejob#lib/active_job/callbacks.rb:23 + def __class_attr___callbacks; end + end + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + end + + module GeneratedInstanceMethods + def __callbacks; end + end +end + +# These methods will be included into any Active Job object, adding +# callbacks for +perform+ and +enqueue+ methods. +# +# pkg:gem/activejob#lib/active_job/callbacks.rb:34 +module ActiveJob::Callbacks::ClassMethods + # Defines a callback that will get called right after the + # job is enqueued. + # + # class VideoProcessJob < ActiveJob::Base + # queue_as :default + # + # after_enqueue do |job| + # result = job.successfully_enqueued? ? "success" : "failure" + # $statsd.increment "enqueue-video-job.#{result}" + # end + # + # def perform(video_id) + # Video.find(video_id).process + # end + # end + # + # pkg:gem/activejob#lib/active_job/callbacks.rb:141 + def after_enqueue(*filters, &blk); end + + # Defines a callback that will get called right after the + # job's perform method has finished. + # + # class VideoProcessJob < ActiveJob::Base + # queue_as :default + # + # after_perform do |job| + # UserMailer.notify_video_processed(job.arguments.first) + # end + # + # def perform(video_id) + # Video.find(video_id).process + # end + # end + # + # pkg:gem/activejob#lib/active_job/callbacks.rb:69 + def after_perform(*filters, &blk); end + + # Defines a callback that will get called around the enqueuing + # of the job. + # + # class VideoProcessJob < ActiveJob::Base + # queue_as :default + # + # around_enqueue do |job, block| + # $statsd.time "video-job.process" do + # block.call + # end + # end + # + # def perform(video_id) + # Video.find(video_id).process + # end + # end + # + # pkg:gem/activejob#lib/active_job/callbacks.rb:162 + def around_enqueue(*filters, &blk); end + + # Defines a callback that will get called around the job's perform method. + # + # class VideoProcessJob < ActiveJob::Base + # queue_as :default + # + # around_perform do |job, block| + # UserMailer.notify_video_started_processing(job.arguments.first) + # block.call + # UserMailer.notify_video_processed(job.arguments.first) + # end + # + # def perform(video_id) + # Video.find(video_id).process + # end + # end + # + # You can access the return value of the job only if the execution wasn't halted. + # + # class VideoProcessJob < ActiveJob::Base + # around_perform do |job, block| + # value = block.call + # puts value # => "Hello World!" + # end + # + # def perform + # "Hello World!" + # end + # end + # + # pkg:gem/activejob#lib/active_job/callbacks.rb:102 + def around_perform(*filters, &blk); end + + # Defines a callback that will get called right before the + # job is enqueued. + # + # class VideoProcessJob < ActiveJob::Base + # queue_as :default + # + # before_enqueue do |job| + # $statsd.increment "enqueue-video-job.try" + # end + # + # def perform(video_id) + # Video.find(video_id).process + # end + # end + # + # pkg:gem/activejob#lib/active_job/callbacks.rb:121 + def before_enqueue(*filters, &blk); end + + # Defines a callback that will get called right before the + # job's perform method is executed. + # + # class VideoProcessJob < ActiveJob::Base + # queue_as :default + # + # before_perform do |job| + # UserMailer.notify_video_started_processing(job.arguments.first) + # end + # + # def perform(video_id) + # Video.find(video_id).process + # end + # end + # + # pkg:gem/activejob#lib/active_job/callbacks.rb:50 + def before_perform(*filters, &blk); end +end + +# pkg:gem/activejob#lib/active_job/configured_job.rb:4 +class ActiveJob::ConfiguredJob + # pkg:gem/activejob#lib/active_job/configured_job.rb:5 + def initialize(job_class, options = T.unsafe(nil)); end + + # pkg:gem/activejob#lib/active_job/configured_job.rb:14 + def perform_later(*, **, &); end + + # pkg:gem/activejob#lib/active_job/configured_job.rb:10 + def perform_now(*, **, &); end +end + +# = Active Job Continuable +# +# The Continuable module provides the ability to track the progress of your +# jobs, and continue from where they left off if interrupted. +# +# Mix ActiveJob::Continuable into your job to enable continuations. +# +# See {ActiveJob::Continuation}[rdoc-ref:ActiveJob::Continuation] for usage. +# +# pkg:gem/activejob#lib/active_job/continuable.rb:13 +module ActiveJob::Continuable + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + + # pkg:gem/activejob#lib/active_job/continuable.rb:62 + def checkpoint!; end + + # pkg:gem/activejob#lib/active_job/continuable.rb:33 + def continuation; end + + # pkg:gem/activejob#lib/active_job/continuable.rb:33 + def continuation=(_arg0); end + + # pkg:gem/activejob#lib/active_job/continuable.rb:56 + def deserialize(job_data); end + + # pkg:gem/activejob#lib/active_job/continuable.rb:66 + def interrupt!(reason:); end + + # The number of times the job has been resumed. + # + # pkg:gem/activejob#lib/active_job/continuable.rb:31 + def resumptions; end + + # The number of times the job has been resumed. + # + # pkg:gem/activejob#lib/active_job/continuable.rb:31 + def resumptions=(_arg0); end + + # pkg:gem/activejob#lib/active_job/continuable.rb:52 + def serialize; end + + # Start a new continuation step + # + # pkg:gem/activejob#lib/active_job/continuable.rb:36 + def step(step_name, start: T.unsafe(nil), isolated: T.unsafe(nil), &block); end + + private + + # pkg:gem/activejob#lib/active_job/continuable.rb:72 + def continue(&block); end + + # pkg:gem/activejob#lib/active_job/continuable.rb:91 + def resume_job(exception); end + + module GeneratedClassMethods + def max_resumptions; end + def max_resumptions=(value); end + def max_resumptions?; end + def resume_errors_after_advancing; end + def resume_errors_after_advancing=(value); end + def resume_errors_after_advancing?; end + def resume_options; end + def resume_options=(value); end + def resume_options?; end + end + + module GeneratedInstanceMethods + def max_resumptions; end + def max_resumptions?; end + def resume_errors_after_advancing; end + def resume_errors_after_advancing?; end + def resume_options; end + def resume_options?; end + end +end + +# = Active Job \Continuation +# +# Continuations provide a mechanism for interrupting and resuming jobs. This allows +# long-running jobs to make progress across application restarts. +# +# Jobs should include the ActiveJob::Continuable module to enable continuations. +# \Continuable jobs are automatically retried when interrupted. +# +# Use the +step+ method to define the steps in your job. Steps can use an optional +# cursor to track progress in the step. +# +# Steps are executed as soon as they are encountered. If a job is interrupted, previously +# completed steps will be skipped. If a step is in progress, it will be resumed +# with the last recorded cursor. +# +# Code that is not part of a step will be executed on each job run. +# +# You can pass a block or a method name to the step method. The block will be called with +# the step object as an argument. Methods can either take no arguments or a single argument +# for the step object. +# +# class ProcessImportJob < ApplicationJob +# include ActiveJob::Continuable +# +# def perform(import_id) +# # This always runs, even if the job is resumed. +# @import = Import.find(import_id) +# +# step :validate do +# @import.validate! +# end +# +# step(:process_records) do |step| +# @import.records.find_each(start: step.cursor) do |record| +# record.process +# step.advance! from: record.id +# end +# end +# +# step :reprocess_records +# step :finalize +# end +# +# def reprocess_records(step) +# @import.records.find_each(start: step.cursor) do |record| +# record.reprocess +# step.advance! from: record.id +# end +# end +# +# def finalize +# @import.finalize! +# end +# end +# +# === Cursors +# +# Cursors are used to track progress within a step. The cursor can be any object that is +# serializable as an argument to +ActiveJob::Base.serialize+. It defaults to +nil+. +# +# When a step is resumed, the last cursor value is restored. The code in the step is responsible +# for using the cursor to continue from the right point. +# +# +set!+ sets the cursor to a specific value. +# +# step :iterate_items do |step| +# items[step.cursor..].each do |item| +# process(item) +# step.set! (step.cursor || 0) + 1 +# end +# end +# +# An starting value for the cursor can be set when defining the step: +# +# step :iterate_items, start: 0 do |step| +# items[step.cursor..].each do |item| +# process(item) +# step.set! step.cursor + 1 +# end +# end +# +# The cursor can be advanced with +advance!+. This calls +succ+ on the current cursor value. +# It raises an ActiveJob::Continuation::UnadvanceableCursorError if the cursor does not implement +succ+. +# +# step :iterate_items, start: 0 do |step| +# items[step.cursor..].each do |item| +# process(item) +# step.advance! +# end +# end +# +# You can optionally pass a +from+ argument to +advance!+. This is useful when iterating +# over a collection of records where IDs may not be contiguous. +# +# step :process_records do |step| +# import.records.find_each(start: step.cursor) do |record| +# record.process +# step.advance! from: record.id +# end +# end +# +# You can use an array to iterate over nested records: +# +# step :process_nested_records, start: [ 0, 0 ] do |step| +# Account.find_each(start: step.cursor[0]) do |account| +# account.records.find_each(start: step.cursor[1]) do |record| +# record.process +# step.set! [ account.id, record.id + 1 ] +# end +# step.set! [ account.id + 1, 0 ] +# end +# end +# +# Setting or advancing the cursor creates a checkpoint. You can also create a checkpoint +# manually by calling the +checkpoint!+ method on the step. This is useful if you want to +# allow interruptions, but don't need to update the cursor. +# +# step :destroy_records do |step| +# import.records.find_each do |record| +# record.destroy! +# step.checkpoint! +# end +# end +# +# === Checkpoints +# +# A checkpoint is where a job can be interrupted. At a checkpoint the job will call +# +queue_adapter.stopping?+. If it returns true, the job will raise an +# ActiveJob::Continuation::Interrupt exception. +# +# There is an automatic checkpoint before the start of each step except for the first for +# each job execution. Within a step one is created when calling +set!+, +advance!+ or +checkpoint!+. +# +# Jobs are not automatically interrupted when the queue adapter is marked as stopping - they +# will continue to run either until the next checkpoint, or when the process is stopped. +# +# This is to allow jobs to be interrupted at a safe point, but it also means that the jobs +# should checkpoint more frequently than the shutdown timeout to ensure a graceful restart. +# +# When interrupted, the job will automatically retry with the progress serialized +# in the job data under the +continuation+ key. +# +# The serialized progress contains: +# - a list of the completed steps +# - the current step and its cursor value (if one is in progress) +# +# === Isolated Steps +# +# Steps run sequentially in a single job execution, unless the job is interrupted. +# +# You can specify that a step should always run in its own execution by passing the +isolated: true+ option. +# +# This is useful for long-running steps where it may not be possible to checkpoint within +# the job grace period - it ensures that progress is serialized back into the job data before +# the step starts. +# +# step :quick_step1 +# step :slow_step, isolated: true +# step :quick_step2 +# step :quick_step3 +# +# === Errors +# +# If a job raises an error and is not retried via Active Job, it will be passed back to the underlying +# queue backend and any progress in this execution will be lost. +# +# To mitigate this, the job will be automatically retried if it raises an error after it has made progress. +# Making progress is defined as having completed a step or advanced the cursor within the current step. +# +# === Configuration +# +# Continuable jobs have several configuration options: +# * :max_resumptions - The maximum number of times a job can be resumed. Defaults to +nil+ which means +# unlimited resumptions. +# * :resume_options - Options to pass to +retry_job+ when resuming the job. +# Defaults to { wait: 5.seconds }. +# See {ActiveJob::Exceptions#retry_job}[rdoc-ref:ActiveJob::Exceptions#retry_job] for available options. +# * :resume_errors_after_advancing - Whether to resume errors after advancing the continuation. +# Defaults to +true+. +# +# pkg:gem/activejob#lib/active_job/continuation.rb:186 +class ActiveJob::Continuation + include ::ActiveJob::Continuation::Validation + extend ::ActiveSupport::Autoload + + # pkg:gem/activejob#lib/active_job/continuation.rb:214 + def initialize(job, serialized_progress); end + + # pkg:gem/activejob#lib/active_job/continuation.rb:256 + def advanced?; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:242 + def description; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:260 + def instrumentation; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:252 + def started?; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:224 + def step(name, **options, &block); end + + # pkg:gem/activejob#lib/active_job/continuation.rb:235 + def to_h; end + + private + + # pkg:gem/activejob#lib/active_job/continuation.rb:267 + def completed; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:277 + def completed?(name); end + + # pkg:gem/activejob#lib/active_job/continuation.rb:267 + def current; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:267 + def encountered; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:326 + def instrument(*, **, &); end + + # pkg:gem/activejob#lib/active_job/continuation.rb:315 + def instrumenting_step(step, &block); end + + # pkg:gem/activejob#lib/active_job/continuation.rb:273 + def isolating?; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:267 + def job; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:281 + def new_step(*args, **options); end + + # pkg:gem/activejob#lib/active_job/continuation.rb:289 + def run_step(name, start:, isolated:, &block); end + + # pkg:gem/activejob#lib/active_job/continuation.rb:299 + def run_step_inline(name, start:, **options, &block); end + + # pkg:gem/activejob#lib/active_job/continuation.rb:269 + def running_step?; end + + # pkg:gem/activejob#lib/active_job/continuation.rb:285 + def skip_step(name); end +end + +# Raised when there is an error with a checkpoint, such as open database transactions. +# +# pkg:gem/activejob#lib/active_job/continuation.rb:203 +class ActiveJob::Continuation::CheckpointError < ::ActiveJob::Continuation::Error; end + +# Base class for all Continuation errors. +# +# pkg:gem/activejob#lib/active_job/continuation.rb:197 +class ActiveJob::Continuation::Error < ::StandardError; end + +# Raised when a job is interrupted, allowing Active Job to requeue it. +# This inherits from +Exception+ rather than +StandardError+, so it's not +# caught by normal exception handling. +# +# pkg:gem/activejob#lib/active_job/continuation.rb:194 +class ActiveJob::Continuation::Interrupt < ::Exception; end + +# Raised when a step is invalid. +# +# pkg:gem/activejob#lib/active_job/continuation.rb:200 +class ActiveJob::Continuation::InvalidStepError < ::ActiveJob::Continuation::Error; end + +# Raised when a job has reached its limit of the number of resumes. +# The limit is defined by the +max_resumptions+ class attribute. +# +# pkg:gem/activejob#lib/active_job/continuation.rb:210 +class ActiveJob::Continuation::ResumeLimitError < ::ActiveJob::Continuation::Error; end + +# = Active Job Continuation Step +# +# Represents a step within a continuable job. +# +# When a step is completed, it is recorded in the job's continuation state. +# If the job is interrupted, it will be resumed from after the last completed step. +# +# Steps also have an optional cursor that can be used to track progress within the step. +# If a job is interrupted during a step, the cursor will be saved and passed back when +# the job is resumed. +# +# It is the responsibility of the code in the step to use the cursor correctly to resume +# from where it left off. +# +# pkg:gem/activejob#lib/active_job/continuation/step.rb:18 +class ActiveJob::Continuation::Step + # pkg:gem/activejob#lib/active_job/continuation/step.rb:25 + def initialize(name, cursor, job:, resumed:); end + + # Advance the cursor from the current or supplied value + # + # The cursor will be advanced by calling the +succ+ method on the cursor. + # An UnadvanceableCursorError error will be raised if the cursor does not implement +succ+. + # + # pkg:gem/activejob#lib/active_job/continuation/step.rb:49 + def advance!(from: T.unsafe(nil)); end + + # Has the cursor been advanced during this job execution? + # + # pkg:gem/activejob#lib/active_job/continuation/step.rb:67 + def advanced?; end + + # Check if the job should be interrupted, and if so raise an Interrupt exception. + # The job will be requeued for retry. + # + # pkg:gem/activejob#lib/active_job/continuation/step.rb:35 + def checkpoint!; end + + # The cursor for the step. + # + # pkg:gem/activejob#lib/active_job/continuation/step.rb:23 + def cursor; end + + # pkg:gem/activejob#lib/active_job/continuation/step.rb:75 + def description; end + + # The name of the step. + # + # pkg:gem/activejob#lib/active_job/continuation/step.rb:20 + def name; end + + # Has this step been resumed from a previous job execution? + # + # pkg:gem/activejob#lib/active_job/continuation/step.rb:62 + def resumed?; end + + # Set the cursor and interrupt the job if necessary. + # + # pkg:gem/activejob#lib/active_job/continuation/step.rb:40 + def set!(cursor); end + + # pkg:gem/activejob#lib/active_job/continuation/step.rb:71 + def to_a; end + + private + + # pkg:gem/activejob#lib/active_job/continuation/step.rb:80 + def initial_cursor; end + + # pkg:gem/activejob#lib/active_job/continuation/step.rb:80 + def job; end +end + +# Raised when attempting to advance a cursor that doesn't implement `succ`. +# +# pkg:gem/activejob#lib/active_job/continuation.rb:206 +class ActiveJob::Continuation::UnadvanceableCursorError < ::ActiveJob::Continuation::Error; end + +# pkg:gem/activejob#lib/active_job/continuation/validation.rb:5 +module ActiveJob::Continuation::Validation + private + + # pkg:gem/activejob#lib/active_job/continuation/validation.rb:45 + def raise_step_error!(message); end + + # pkg:gem/activejob#lib/active_job/continuation/validation.rb:7 + def validate_step!(name); end + + # pkg:gem/activejob#lib/active_job/continuation/validation.rb:39 + def validate_step_expected_order!(name); end + + # pkg:gem/activejob#lib/active_job/continuation/validation.rb:21 + def validate_step_not_encountered!(name); end + + # pkg:gem/activejob#lib/active_job/continuation/validation.rb:27 + def validate_step_not_nested!(name); end + + # pkg:gem/activejob#lib/active_job/continuation/validation.rb:33 + def validate_step_resume_expected!(name); end + + # pkg:gem/activejob#lib/active_job/continuation/validation.rb:15 + def validate_step_symbol!(name); end +end + +# = Active Job \Core +# +# Provides general behavior that will be included into every Active Job +# object that inherits from ActiveJob::Base. +# +# pkg:gem/activejob#lib/active_job/core.rb:15 +module ActiveJob::Core + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveJob::Core::ClassMethods + + # Creates a new job instance. Takes the arguments that will be + # passed to the perform method. + # + # pkg:gem/activejob#lib/active_job/core.rb:103 + def initialize(*arguments, **); end + + # Job arguments + # + # pkg:gem/activejob#lib/active_job/core.rb:19 + def arguments; end + + # Job arguments + # + # pkg:gem/activejob#lib/active_job/core.rb:19 + def arguments=(_arg0); end + + # Attaches the stored job data to the current instance. Receives a hash + # returned from +serialize+ + # + # ==== Examples + # + # class DeliverWebhookJob < ActiveJob::Base + # attr_writer :attempt_number + # + # def attempt_number + # @attempt_number ||= 0 + # end + # + # def serialize + # super.merge('attempt_number' => attempt_number + 1) + # end + # + # def deserialize(job_data) + # super + # self.attempt_number = job_data['attempt_number'] + # end + # + # rescue_from(Timeout::Error) do |exception| + # raise exception if attempt_number > 5 + # retry_job(wait: 10) + # end + # end + # + # pkg:gem/activejob#lib/active_job/core.rb:160 + def deserialize(job_data); end + + # Track any exceptions raised by the backend so callers can inspect the errors. + # + # pkg:gem/activejob#lib/active_job/core.rb:63 + def enqueue_error; end + + # Track any exceptions raised by the backend so callers can inspect the errors. + # + # pkg:gem/activejob#lib/active_job/core.rb:63 + def enqueue_error=(_arg0); end + + # Track when a job was enqueued + # + # pkg:gem/activejob#lib/active_job/core.rb:53 + def enqueued_at; end + + # Track when a job was enqueued + # + # pkg:gem/activejob#lib/active_job/core.rb:53 + def enqueued_at=(_arg0); end + + # Hash that contains the number of times this job handled errors for each specific retry_on declaration. + # Keys are the string representation of the exceptions listed in the retry_on declaration, + # while its associated value holds the number of executions where the corresponding retry_on + # declaration handled one of its listed exceptions. + # + # pkg:gem/activejob#lib/active_job/core.rb:44 + def exception_executions; end + + # Hash that contains the number of times this job handled errors for each specific retry_on declaration. + # Keys are the string representation of the exceptions listed in the retry_on declaration, + # while its associated value holds the number of executions where the corresponding retry_on + # declaration handled one of its listed exceptions. + # + # pkg:gem/activejob#lib/active_job/core.rb:44 + def exception_executions=(_arg0); end + + # Number of times this job has been executed (which increments on every retry, like after an exception). + # + # pkg:gem/activejob#lib/active_job/core.rb:38 + def executions; end + + # Number of times this job has been executed (which increments on every retry, like after an exception). + # + # pkg:gem/activejob#lib/active_job/core.rb:38 + def executions=(_arg0); end + + # Job Identifier + # + # pkg:gem/activejob#lib/active_job/core.rb:26 + def job_id; end + + # Job Identifier + # + # pkg:gem/activejob#lib/active_job/core.rb:26 + def job_id=(_arg0); end + + # I18n.locale to be used during the job. + # + # pkg:gem/activejob#lib/active_job/core.rb:47 + def locale; end + + # I18n.locale to be used during the job. + # + # pkg:gem/activejob#lib/active_job/core.rb:47 + def locale=(_arg0); end + + # Priority that the job will have (lower is more priority). + # + # pkg:gem/activejob#lib/active_job/core.rb:32 + def priority=(_arg0); end + + # ID optionally provided by adapter + # + # pkg:gem/activejob#lib/active_job/core.rb:35 + def provider_job_id; end + + # ID optionally provided by adapter + # + # pkg:gem/activejob#lib/active_job/core.rb:35 + def provider_job_id=(_arg0); end + + # Queue in which the job will reside. + # + # pkg:gem/activejob#lib/active_job/core.rb:29 + def queue_name=(_arg0); end + + # Time when the job should be performed + # + # pkg:gem/activejob#lib/active_job/core.rb:23 + def scheduled_at; end + + # Time when the job should be performed + # + # pkg:gem/activejob#lib/active_job/core.rb:23 + def scheduled_at=(_arg0); end + + # Returns a hash with the job data that can safely be passed to the + # queuing adapter. + # + # pkg:gem/activejob#lib/active_job/core.rb:117 + def serialize; end + + # pkg:gem/activejob#lib/active_job/core.rb:20 + def serialized_arguments=(_arg0); end + + # Configures the job with the given options. + # + # pkg:gem/activejob#lib/active_job/core.rb:175 + def set(options = T.unsafe(nil)); end + + # Track whether the adapter received the job successfully. + # + # pkg:gem/activejob#lib/active_job/core.rb:56 + def successfully_enqueued=(_arg0); end + + # pkg:gem/activejob#lib/active_job/core.rb:58 + def successfully_enqueued?; end + + # Timezone to be used during the job. + # + # pkg:gem/activejob#lib/active_job/core.rb:50 + def timezone; end + + # Timezone to be used during the job. + # + # pkg:gem/activejob#lib/active_job/core.rb:50 + def timezone=(_arg0); end + + private + + # pkg:gem/activejob#lib/active_job/core.rb:208 + def arguments_serialized?; end + + # pkg:gem/activejob#lib/active_job/core.rb:204 + def deserialize_arguments(serialized_args); end + + # pkg:gem/activejob#lib/active_job/core.rb:193 + def deserialize_arguments_if_needed; end + + # pkg:gem/activejob#lib/active_job/core.rb:212 + def deserialize_time(time); end + + # pkg:gem/activejob#lib/active_job/core.rb:200 + def serialize_arguments(arguments); end + + # pkg:gem/activejob#lib/active_job/core.rb:185 + def serialize_arguments_if_needed(arguments); end +end + +# These methods will be included into any Active Job object, adding +# helpers for de/serialization and creation of job instances. +# +# pkg:gem/activejob#lib/active_job/core.rb:67 +module ActiveJob::Core::ClassMethods + # Creates a new job instance from a hash created with +serialize+ + # + # pkg:gem/activejob#lib/active_job/core.rb:69 + def deserialize(job_data); end + + # Creates a job preconfigured with the given options. You can call + # perform_later with the job arguments to enqueue the job with the + # preconfigured options + # + # ==== Options + # * :wait - Enqueues the job with the specified delay + # * :wait_until - Enqueues the job at the time specified + # * :queue - Enqueues the job on the specified queue + # * :priority - Enqueues the job with the specified priority + # + # ==== Examples + # + # VideoJob.set(queue: :some_queue).perform_later(Video.last) + # VideoJob.set(wait: 5.minutes).perform_later(Video.last) + # VideoJob.set(wait_until: Time.now.tomorrow).perform_later(Video.last) + # VideoJob.set(queue: :some_queue, wait: 5.minutes).perform_later(Video.last) + # VideoJob.set(queue: :some_queue, wait_until: Time.now.tomorrow).perform_later(Video.last) + # VideoJob.set(queue: :some_queue, wait: 5.minutes, priority: 10).perform_later(Video.last) + # + # pkg:gem/activejob#lib/active_job/core.rb:96 + def set(options = T.unsafe(nil)); end +end + +# Raised when an exception is raised during job arguments deserialization. +# +# Wraps the original exception raised as +cause+. +# +# pkg:gem/activejob#lib/active_job/arguments.rb:10 +class ActiveJob::DeserializationError < ::StandardError + # pkg:gem/activejob#lib/active_job/arguments.rb:11 + def initialize; end +end + +# pkg:gem/activejob#lib/active_job/enqueue_after_transaction_commit.rb:4 +module ActiveJob::EnqueueAfterTransactionCommit + private + + # pkg:gem/activejob#lib/active_job/enqueue_after_transaction_commit.rb:25 + def raw_enqueue; end + + class << self + # pkg:gem/activejob#lib/active_job/enqueue_after_transaction_commit.rb:6 + def included(base); end + end +end + +# pkg:gem/activejob#lib/active_job/enqueue_after_transaction_commit.rb:11 +module ActiveJob::EnqueueAfterTransactionCommit::ActiveJobMethods + # Ensures perform_all_later respects each job's enqueue_after_transaction_commit configuration. + # Jobs with enqueue_after_transaction_commit set to true are deferred and enqueued only after the transaction commits; + # other jobs are enqueued immediately. This ensures enqueuing timing matches the per-job setting. + # + # pkg:gem/activejob#lib/active_job/enqueue_after_transaction_commit.rb:15 + def perform_all_later(*jobs); end +end + +# Can be raised by adapters if they wish to communicate to the caller a reason +# why the adapter was unexpectedly unable to enqueue a job. +# +# pkg:gem/activejob#lib/active_job/enqueuing.rb:8 +class ActiveJob::EnqueueError < ::StandardError; end + +# pkg:gem/activejob#lib/active_job/enqueuing.rb:10 +module ActiveJob::Enqueuing + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveJob::Enqueuing::ClassMethods + + # Enqueues the job to be performed by the queue adapter. + # + # ==== Options + # * :wait - Enqueues the job with the specified delay + # * :wait_until - Enqueues the job at the time specified + # * :queue - Enqueues the job on the specified queue + # * :priority - Enqueues the job with the specified priority + # + # ==== Examples + # + # my_job_instance.enqueue + # my_job_instance.enqueue wait: 5.minutes + # my_job_instance.enqueue queue: :important + # my_job_instance.enqueue wait_until: Date.tomorrow.midnight + # my_job_instance.enqueue priority: 10 + # + # pkg:gem/activejob#lib/active_job/enqueuing.rb:82 + def enqueue(options = T.unsafe(nil)); end + + private + + # pkg:gem/activejob#lib/active_job/enqueuing.rb:103 + def _raw_enqueue; end + + # pkg:gem/activejob#lib/active_job/enqueuing.rb:97 + def raw_enqueue; end + + module GeneratedClassMethods + def enqueue_after_transaction_commit; end + def enqueue_after_transaction_commit=(value); end + end + + module GeneratedInstanceMethods; end +end + +# Includes the +perform_later+ method for job initialization. +# +# pkg:gem/activejob#lib/active_job/enqueuing.rb:27 +module ActiveJob::Enqueuing::ClassMethods + # Push a job onto the queue. By default the arguments must be either String, + # Integer, Float, NilClass, TrueClass, FalseClass, BigDecimal, Symbol, Date, + # Time, DateTime, ActiveSupport::TimeWithZone, ActiveSupport::Duration, + # Hash, ActiveSupport::HashWithIndifferentAccess, Array, Range, or + # GlobalID::Identification instances, although this can be extended by adding + # custom serializers. + # + # Returns an instance of the job class queued with arguments available in + # Job#arguments or +false+ if the enqueue did not succeed. + # + # After the attempted enqueue, the job will be yielded to an optional block. + # + # If Active Job is used conjointly with Active Record, and #perform_later is called + # inside an Active Record transaction, then the enqueue is implicitly deferred to after + # the transaction is committed, or dropped if it's rolled back. In such case #perform_later + # will return the job instance like if it was successfully enqueued, but will still return + # +false+ if a callback prevented the job from being enqueued. + # + # This behavior can be changed on a per job basis: + # + # class NotificationJob < ApplicationJob + # self.enqueue_after_transaction_commit = false + # end + # + # pkg:gem/activejob#lib/active_job/enqueuing.rb:51 + def perform_later(*, **, &); end + + private + + # pkg:gem/activejob#lib/active_job/enqueuing.rb:61 + def job_or_instantiate(*args, **, &); end +end + +# Provides behavior for retrying and discarding jobs on exceptions. +# +# pkg:gem/activejob#lib/active_job/exceptions.rb:7 +module ActiveJob::Exceptions + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveJob::Exceptions::ClassMethods + + # Reschedules the job to be re-executed. This is useful in combination with + # {rescue_from}[rdoc-ref:ActiveSupport::Rescuable::ClassMethods#rescue_from]. + # When you rescue an exception from your job you can ask Active Job to retry + # performing your job. + # + # ==== Options + # * :wait - Enqueues the job with the specified delay in seconds + # * :wait_until - Enqueues the job at the time specified + # * :queue - Enqueues the job on the specified queue + # * :priority - Enqueues the job with the specified priority + # + # ==== Examples + # + # class SiteScraperJob < ActiveJob::Base + # rescue_from(ErrorLoadingSite) do + # retry_job queue: :low_priority + # end + # + # def perform(*args) + # # raise ErrorLoadingSite if cannot scrape + # end + # end + # + # pkg:gem/activejob#lib/active_job/exceptions.rb:158 + def retry_job(options = T.unsafe(nil)); end + + private + + # pkg:gem/activejob#lib/active_job/exceptions.rb:171 + def determine_delay(seconds_or_duration_or_algorithm:, executions:, jitter: T.unsafe(nil)); end + + # pkg:gem/activejob#lib/active_job/exceptions.rb:192 + def determine_jitter_for_delay(delay, jitter); end + + # pkg:gem/activejob#lib/active_job/exceptions.rb:197 + def executions_for(exceptions); end + + # pkg:gem/activejob#lib/active_job/exceptions.rb:206 + def run_after_discard_procs(exception); end + + module GeneratedClassMethods + def after_discard_procs; end + def after_discard_procs=(value); end + def after_discard_procs?; end + def retry_jitter; end + def retry_jitter=(value); end + end + + module GeneratedInstanceMethods + def after_discard_procs; end + def after_discard_procs=(value); end + def after_discard_procs?; end + end +end + +# pkg:gem/activejob#lib/active_job/exceptions.rb:15 +module ActiveJob::Exceptions::ClassMethods + # A block to run when a job is about to be discarded for any reason. + # + # ==== Example + # + # class WorkJob < ActiveJob::Base + # after_discard do |job, exception| + # ExceptionNotifier.report(exception) + # end + # + # ... + # + # end + # + # pkg:gem/activejob#lib/active_job/exceptions.rb:131 + def after_discard(&blk); end + + # Discard the job with no attempts to retry, if the exception is raised. This is useful when the subject of the job, + # like an Active Record, is no longer available, and the job is thus no longer relevant. + # + # Passing the :report option reports the error through the error reporter before discarding the job. + # + # You can also pass a block that'll be invoked. This block is yielded with the job instance as the first and the error instance as the second parameter. + # + # +retry_on+ and +discard_on+ handlers are searched from bottom to top, and up the class hierarchy. The handler of the first class for + # which exception.is_a?(klass) holds true is the one invoked, if any. + # + # ==== Example + # + # class SearchIndexingJob < ActiveJob::Base + # discard_on ActiveJob::DeserializationError + # discard_on CustomAppException, report: true + # discard_on(AnotherCustomAppException) do |job, error| + # CustomErrorHandlingCode.handle(job, error) + # end + # + # def perform(record) + # # Will raise ActiveJob::DeserializationError if the record can't be deserialized + # # Might raise CustomAppException for something domain specific + # end + # end + # + # pkg:gem/activejob#lib/active_job/exceptions.rb:109 + def discard_on(*exceptions, report: T.unsafe(nil)); end + + # Catch the exception and reschedule job for re-execution after so many seconds, for a specific number of attempts. + # If the exception keeps getting raised beyond the specified number of attempts, the exception is allowed to + # bubble up to the underlying queuing system, which may have its own retry mechanism or place it in a + # holding queue for inspection. + # + # You can also pass a block that'll be invoked if the retry attempts fail for custom logic rather than letting + # the exception bubble up. This block is yielded with the job instance as the first and the error instance as the second parameter. + # + # +retry_on+ and +discard_on+ handlers are searched from bottom to top, and up the class hierarchy. The handler of the first class for + # which exception.is_a?(klass) holds true is the one invoked, if any. + # + # ==== Options + # * :wait - Re-enqueues the job with a delay specified either in seconds (default: 3 seconds), + # as a computing proc that takes the number of executions so far as an argument, or as a symbol reference of + # :polynomially_longer, which applies the wait algorithm of ((executions**4) + (Kernel.rand * (executions**4) * jitter)) + 2 + # (first wait ~3s, then ~18s, then ~83s, etc) + # * :attempts - Enqueues the job the specified number of times (default: 5 attempts) or a symbol reference of :unlimited + # to retry the job until it succeeds. The number of attempts includes the original job execution. + # * :queue - Re-enqueues the job on a different queue + # * :priority - Re-enqueues the job with a different priority + # * :jitter - A random delay of wait time used when calculating backoff. The default is 15% (0.15) which represents the upper bound of possible wait time (expressed as a percentage) + # * :report - Errors will be reported to the Rails.error reporter before being retried + # + # ==== Examples + # + # class RemoteServiceJob < ActiveJob::Base + # retry_on CustomAppException # defaults to ~3s wait, 5 attempts + # retry_on AnotherCustomAppException, wait: ->(executions) { executions * 2 } + # retry_on CustomInfrastructureException, wait: 5.minutes, attempts: :unlimited + # + # retry_on ActiveRecord::Deadlocked, wait: 5.seconds, attempts: 3 + # retry_on Net::OpenTimeout, Timeout::Error, wait: :polynomially_longer, attempts: 10 # retries at most 10 times for Net::OpenTimeout and Timeout::Error combined + # # To retry at most 10 times for each individual exception: + # # retry_on Net::OpenTimeout, wait: :polynomially_longer, attempts: 10 + # # retry_on Net::ReadTimeout, wait: 5.seconds, jitter: 0.30, attempts: 10 + # # retry_on Timeout::Error, wait: :polynomially_longer, attempts: 10 + # + # retry_on YetAnotherCustomAppException, report: true + # retry_on EvenWorseCustomAppException do |job, error| + # CustomErrorHandlingCode.handle(job, error) + # end + # + # def perform(*args) + # # Might raise CustomAppException, AnotherCustomAppException, or YetAnotherCustomAppException for something domain specific + # # Might raise ActiveRecord::Deadlocked when a local db deadlock is detected + # # Might raise Net::OpenTimeout or Timeout::Error when the remote service is down + # end + # end + # + # pkg:gem/activejob#lib/active_job/exceptions.rb:64 + def retry_on(*exceptions, wait: T.unsafe(nil), attempts: T.unsafe(nil), queue: T.unsafe(nil), priority: T.unsafe(nil), jitter: T.unsafe(nil), report: T.unsafe(nil)); end +end + +# pkg:gem/activejob#lib/active_job/exceptions.rb:168 +ActiveJob::Exceptions::JITTER_DEFAULT = T.let(T.unsafe(nil), Object) + +# = Active Job \Execution +# +# Provides methods to execute jobs immediately, and wraps job execution so +# that exceptions configured with +# {rescue_from}[rdoc-ref:ActiveSupport::Rescuable::ClassMethods#rescue_from] +# are handled. +# +# pkg:gem/activejob#lib/active_job/execution.rb:12 +module ActiveJob::Execution + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveSupport::Rescuable + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveSupport::Rescuable::ClassMethods + mixes_in_class_methods ::ActiveJob::Execution::ClassMethods + + # pkg:gem/activejob#lib/active_job/execution.rb:60 + def perform(*); end + + # Performs the job immediately. The job is not sent to the queuing adapter + # but directly executed by blocking the execution of others until it's finished. + # +perform_now+ returns the value of your job's +perform+ method. + # + # class MyJob < ActiveJob::Base + # def perform + # "Hello World!" + # end + # end + # + # puts MyJob.new(*args).perform_now # => "Hello World!" + # + # pkg:gem/activejob#lib/active_job/execution.rb:45 + def perform_now; end + + private + + # pkg:gem/activejob#lib/active_job/execution.rb:65 + def _perform_job; end + + module GeneratedClassMethods + def rescue_handlers; end + def rescue_handlers=(value); end + def rescue_handlers?; end + end + + module GeneratedInstanceMethods + def rescue_handlers; end + def rescue_handlers=(value); end + def rescue_handlers?; end + end +end + +# Includes methods for executing and performing jobs instantly. +# +# pkg:gem/activejob#lib/active_job/execution.rb:17 +module ActiveJob::Execution::ClassMethods + # pkg:gem/activejob#lib/active_job/execution.rb:26 + def execute(job_data); end + + # Performs the job immediately. + # + # MyJob.perform_now("mike") + # + # pkg:gem/activejob#lib/active_job/execution.rb:22 + def perform_now(*, **, &); end +end + +# pkg:gem/activejob#lib/active_job/execution_state.rb:4 +module ActiveJob::ExecutionState + # pkg:gem/activejob#lib/active_job/execution_state.rb:5 + def perform_now; end +end + +# pkg:gem/activejob#lib/active_job/instrumentation.rb:16 +module ActiveJob::Instrumentation + extend ::ActiveSupport::Concern + + # pkg:gem/activejob#lib/active_job/instrumentation.rb:29 + def instrument(operation, payload = T.unsafe(nil), &block); end + + # pkg:gem/activejob#lib/active_job/instrumentation.rb:25 + def perform_now; end + + private + + # pkg:gem/activejob#lib/active_job/instrumentation.rb:42 + def _perform_job; end + + # pkg:gem/activejob#lib/active_job/instrumentation.rb:47 + def halted_callback_hook(*); end +end + +# pkg:gem/activejob#lib/active_job/log_subscriber.rb:6 +class ActiveJob::LogSubscriber < ::ActiveSupport::LogSubscriber + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:7 + def backtrace_cleaner; end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:7 + def backtrace_cleaner=(_arg0); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:7 + def backtrace_cleaner?; end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:131 + def discard(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:9 + def enqueue(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:49 + def enqueue_all(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:29 + def enqueue_at(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:106 + def enqueue_retry(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:141 + def interrupt(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:86 + def perform(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:76 + def perform_start(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:149 + def resume(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:121 + def retry_stopped(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:178 + def step(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:157 + def step_skipped(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:165 + def step_started(event); end + + private + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:204 + def args_info(job); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:258 + def enqueue_source_location; end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:262 + def enqueued_jobs_message(adapter, enqueued_jobs); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:242 + def error(progname = T.unsafe(nil), &block); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:213 + def format(arg); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:234 + def info(progname = T.unsafe(nil), &block); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:250 + def log_enqueue_source; end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:230 + def logger; end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:200 + def queue_name(event); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:226 + def scheduled_at(event); end + + class << self + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:7 + def backtrace_cleaner; end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:7 + def backtrace_cleaner=(value); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:7 + def backtrace_cleaner?; end + + private + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:7 + def __class_attr_backtrace_cleaner; end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:7 + def __class_attr_backtrace_cleaner=(new_value); end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:27 + def __class_attr_log_levels; end + + # pkg:gem/activejob#lib/active_job/log_subscriber.rb:27 + def __class_attr_log_levels=(new_value); end + end +end + +# pkg:gem/activejob#lib/active_job/logging.rb:7 +module ActiveJob::Logging + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + + # pkg:gem/activejob#lib/active_job/logging.rb:31 + def perform_now; end + + private + + # pkg:gem/activejob#lib/active_job/logging.rb:45 + def logger_tagged_by_active_job?; end + + # pkg:gem/activejob#lib/active_job/logging.rb:36 + def tag_logger(*tags, &block); end + + module GeneratedClassMethods + def log_arguments; end + def log_arguments=(value); end + def log_arguments?; end + end + + module GeneratedInstanceMethods; end +end + +# = Active Job Queue adapter +# +# The +ActiveJob::QueueAdapter+ module is used to load the +# correct adapter. The default queue adapter is +:async+, +# which loads the ActiveJob::QueueAdapters::AsyncAdapter. +# +# pkg:gem/activejob#lib/active_job/queue_adapter.rb:20 +module ActiveJob::QueueAdapter + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveJob::QueueAdapter::ClassMethods + + module GeneratedClassMethods + def _queue_adapter; end + def _queue_adapter=(value); end + def _queue_adapter_name; end + def _queue_adapter_name=(value); end + end + + module GeneratedInstanceMethods; end +end + +# Includes the setter method for changing the active queue adapter. +# +# pkg:gem/activejob#lib/active_job/queue_adapter.rb:31 +module ActiveJob::QueueAdapter::ClassMethods + # Returns the backend queue provider. The default queue adapter + # is +:async+. See QueueAdapters for more information. + # + # pkg:gem/activejob#lib/active_job/queue_adapter.rb:34 + def queue_adapter; end + + # Specify the backend queue provider. The default queue adapter + # is the +:async+ queue. See QueueAdapters for more + # information. + # + # pkg:gem/activejob#lib/active_job/queue_adapter.rb:49 + def queue_adapter=(name_or_adapter); end + + # Returns string denoting the name of the configured queue adapter. + # By default returns "async". + # + # pkg:gem/activejob#lib/active_job/queue_adapter.rb:41 + def queue_adapter_name; end + + private + + # pkg:gem/activejob#lib/active_job/queue_adapter.rb:66 + def assign_adapter(adapter_name, queue_adapter); end + + # pkg:gem/activejob#lib/active_job/queue_adapter.rb:73 + def queue_adapter?(object); end +end + +# pkg:gem/activejob#lib/active_job/queue_adapter.rb:71 +ActiveJob::QueueAdapter::ClassMethods::QUEUE_ADAPTER_METHODS = T.let(T.unsafe(nil), Array) + +# = Active Job adapters +# +# Active Job has adapters for the following queuing backends: +# +# * {Backburner}[https://github.com/nesquena/backburner] +# * {Delayed Job}[https://github.com/collectiveidea/delayed_job] +# * {Que}[https://github.com/chanks/que] +# * {queue_classic}[https://github.com/QueueClassic/queue_classic] +# * {Resque}[https://github.com/resque/resque] +# * {Sidekiq}[https://sidekiq.org] +# * {Sneakers}[https://github.com/jondot/sneakers] +# * Please Note: We are not accepting pull requests for new adapters. See the {README}[link:files/activejob/README_md.html] for more details. +# +# For testing and development Active Job has three built-in adapters: +# +# * {Active Job Async}[https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/AsyncAdapter.html] +# * {Active Job Inline}[https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/InlineAdapter.html] +# * {Active Job Test}[https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/TestAdapter.html] +# +# === Backends Features +# +# | | Async | Queues | Delayed | Priorities | Timeout | Retries | +# |-------------------|-------|--------|------------|------------|---------|---------| +# | Backburner | Yes | Yes | Yes | Yes | Job | Global | +# | Delayed Job | Yes | Yes | Yes | Job | Global | Global | +# | Que | Yes | Yes | Yes | Job | No | Job | +# | queue_classic | Yes | Yes | Yes* | No | No | No | +# | Resque | Yes | Yes | Yes (Gem) | Queue | Global | Yes | +# | Sidekiq | Yes | Yes | Yes | Queue | No | Job | +# | Sneakers | Yes | Yes | No | Queue | Queue | No | +# | Active Job Async | Yes | Yes | Yes | No | No | No | +# | Active Job Inline | No | Yes | N/A | N/A | N/A | N/A | +# | Active Job Test | No | Yes | N/A | N/A | N/A | N/A | +# +# ==== Async +# +# Yes: The Queue Adapter has the ability to run the job in a non-blocking manner. +# It either runs on a separate or forked process, or on a different thread. +# +# No: The job is run in the same process. +# +# ==== Queues +# +# Yes: Jobs may set which queue they are run in with queue_as or by using the set +# method. +# +# ==== Delayed +# +# Yes: The adapter will run the job in the future through perform_later. +# +# (Gem): An additional gem is required to use perform_later with this adapter. +# +# No: The adapter will run jobs at the next opportunity and cannot use perform_later. +# +# N/A: The adapter does not support queuing. +# +# NOTE: +# queue_classic supports job scheduling since version 3.1. +# For older versions you can use the queue_classic-later gem. +# +# ==== Priorities +# +# The order in which jobs are processed can be configured differently depending +# on the adapter. +# +# Job: Any class inheriting from the adapter may set the priority on the job +# object relative to other jobs. +# +# Queue: The adapter can set the priority for job queues, when setting a queue +# with Active Job this will be respected. +# +# Yes: Allows the priority to be set on the job object, at the queue level or +# as default configuration option. +# +# No: The adapter does not allow the priority of jobs to be configured. +# +# N/A: The adapter does not support queuing, and therefore sorting them. +# +# ==== Timeout +# +# When a job will stop after the allotted time. +# +# Job: The timeout can be set for each instance of the job class. +# +# Queue: The timeout is set for all jobs on the queue. +# +# Global: The adapter is configured that all jobs have a maximum run time. +# +# No: The adapter does not allow the timeout of jobs to be configured. +# +# N/A: This adapter does not run in a separate process, and therefore timeout +# is unsupported. +# +# ==== Retries +# +# Job: The number of retries can be set per instance of the job class. +# +# Yes: The Number of retries can be configured globally, for each instance or +# on the queue. This adapter may also present failed instances of the job class +# that can be restarted. +# +# Global: The adapter has a global number of retries. +# +# No: The adapter does not allow the number of retries to be configured. +# +# N/A: The adapter does not run in a separate process, and therefore doesn't +# support retries. +# +# pkg:gem/activejob#lib/active_job/queue_adapters.rb:112 +module ActiveJob::QueueAdapters + extend ::ActiveSupport::Autoload + + class << self + # Returns adapter for specified name. + # + # ActiveJob::QueueAdapters.lookup(:sidekiq) + # # => ActiveJob::QueueAdapters::SidekiqAdapter + # + # pkg:gem/activejob#lib/active_job/queue_adapters.rb:134 + def lookup(name); end + end +end + +# pkg:gem/activejob#lib/active_job/queue_adapters.rb:126 +ActiveJob::QueueAdapters::ADAPTER = T.let(T.unsafe(nil), String) + +# = Active Job Abstract Adapter +# +# Active Job supports multiple job queue systems. ActiveJob::QueueAdapters::AbstractAdapter +# forms the abstraction layer which makes this possible. +# +# pkg:gem/activejob#lib/active_job/queue_adapters/abstract_adapter.rb:9 +class ActiveJob::QueueAdapters::AbstractAdapter + # pkg:gem/activejob#lib/active_job/queue_adapters/abstract_adapter.rb:12 + def enqueue(job); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/abstract_adapter.rb:16 + def enqueue_at(job, timestamp); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/abstract_adapter.rb:10 + def stopping; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/abstract_adapter.rb:10 + def stopping=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/abstract_adapter.rb:20 + def stopping?; end +end + +# = Active Job Async adapter +# +# The Async adapter runs jobs with an in-process thread pool. +# +# This is the default queue adapter. It's well-suited for dev/test since +# it doesn't need an external infrastructure, but it's a poor fit for +# production since it drops pending jobs on restart. +# +# To use this adapter, set queue adapter to +:async+: +# +# config.active_job.queue_adapter = :async +# +# To configure the adapter's thread pool, instantiate the adapter and +# pass your own config: +# +# config.active_job.queue_adapter = ActiveJob::QueueAdapters::AsyncAdapter.new \ +# min_threads: 1, +# max_threads: 2 * Concurrent.processor_count, +# idletime: 600.seconds +# +# The adapter uses a {Concurrent Ruby}[https://github.com/ruby-concurrency/concurrent-ruby] thread pool to schedule and execute +# jobs. Since jobs share a single thread pool, long-running jobs will block +# short-lived jobs. Fine for dev/test; bad for production. +# +# pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:33 +class ActiveJob::QueueAdapters::AsyncAdapter < ::ActiveJob::QueueAdapters::AbstractAdapter + # See {Concurrent::ThreadPoolExecutor}[https://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ThreadPoolExecutor.html] for executor options. + # + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:35 + def initialize(**executor_options); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:39 + def enqueue(job); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:43 + def enqueue_at(job, timestamp); end + + # Used for our test suite. + # + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:55 + def immediate=(immediate); end + + # Gracefully stop processing jobs. Finishes in-progress work and handles + # any new jobs following the executor's fallback policy (`caller_runs`). + # Waits for termination by default. Pass `wait: false` to continue. + # + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:50 + def shutdown(wait: T.unsafe(nil)); end +end + +# Note that we don't actually need to serialize the jobs since we're +# performing them in-process, but we do so anyway for parity with other +# adapters and deployment environments. Otherwise, serialization bugs +# may creep in undetected. +# +# pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:63 +class ActiveJob::QueueAdapters::AsyncAdapter::JobWrapper + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:64 + def initialize(job); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:69 + def perform; end +end + +# pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:74 +class ActiveJob::QueueAdapters::AsyncAdapter::Scheduler + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:86 + def initialize(**options); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:96 + def enqueue(job, queue_name:); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:100 + def enqueue_at(job, timestamp, queue_name:); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:114 + def executor; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:84 + def immediate; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:84 + def immediate=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:109 + def shutdown(wait: T.unsafe(nil)); end +end + +# pkg:gem/activejob#lib/active_job/queue_adapters/async_adapter.rb:75 +ActiveJob::QueueAdapters::AsyncAdapter::Scheduler::DEFAULT_EXECUTOR_OPTIONS = T.let(T.unsafe(nil), Hash) + +# = Active Job Inline adapter +# +# When enqueuing jobs with the Inline adapter the job will be executed +# immediately. +# +# To use the Inline set the queue_adapter config to +:inline+. +# +# Rails.application.config.active_job.queue_adapter = :inline +# +# pkg:gem/activejob#lib/active_job/queue_adapters/inline_adapter.rb:13 +class ActiveJob::QueueAdapters::InlineAdapter < ::ActiveJob::QueueAdapters::AbstractAdapter + # pkg:gem/activejob#lib/active_job/queue_adapters/inline_adapter.rb:14 + def enqueue(job); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/inline_adapter.rb:18 + def enqueue_at(*); end +end + +# = Test adapter for Active Job +# +# The test adapter should be used only in testing. Along with +# ActiveJob::TestCase and ActiveJob::TestHelper +# it makes a great tool to test your \Rails application. +# +# To use the test adapter set +queue_adapter+ config to +:test+. +# +# Rails.application.config.active_job.queue_adapter = :test +# +# pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:14 +class ActiveJob::QueueAdapters::TestAdapter < ::ActiveJob::QueueAdapters::AbstractAdapter + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def at; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def at=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:28 + def enqueue(job); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:33 + def enqueue_at(job, timestamp); end + + # Provides a store of all the enqueued jobs with the TestAdapter so you can check them. + # + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:19 + def enqueued_jobs; end + + # Provides a store of all the enqueued jobs with the TestAdapter so you can check them. + # + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:16 + def enqueued_jobs=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def filter; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def filter=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def perform_enqueued_at_jobs; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def perform_enqueued_at_jobs=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def perform_enqueued_jobs; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def perform_enqueued_jobs=(_arg0); end + + # Provides a store of all the performed jobs with the TestAdapter so you can check them. + # + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:24 + def performed_jobs; end + + # Provides a store of all the performed jobs with the TestAdapter so you can check them. + # + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:16 + def performed_jobs=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def queue; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def queue=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def reject; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def reject=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def stopping; end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:15 + def stopping=(_arg0); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:38 + def stopping?; end + + private + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:83 + def filter_as_proc(filter); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:61 + def filtered?(job); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:75 + def filtered_job_class?(job); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:69 + def filtered_queue?(job); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:65 + def filtered_time?(job); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:43 + def job_to_hash(job, extras = T.unsafe(nil)); end + + # pkg:gem/activejob#lib/active_job/queue_adapters/test_adapter.rb:52 + def perform_or_enqueue(perform, job, job_data); end +end + +# pkg:gem/activejob#lib/active_job/queue_name.rb:4 +module ActiveJob::QueueName + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveJob::QueueName::ClassMethods + + # Returns the name of the queue the job will be run on. + # + # pkg:gem/activejob#lib/active_job/queue_name.rb:61 + def queue_name; end + + module GeneratedClassMethods + def queue_name; end + def queue_name=(value); end + def queue_name?; end + def queue_name_delimiter; end + def queue_name_delimiter=(value); end + def queue_name_delimiter?; end + def queue_name_prefix; end + def queue_name_prefix=(value); end + def queue_name_prefix?; end + end + + module GeneratedInstanceMethods + def queue_name_prefix; end + def queue_name_prefix=(value); end + def queue_name_prefix?; end + end +end + +# Includes the ability to override the default queue name and prefix. +# +# pkg:gem/activejob#lib/active_job/queue_name.rb:8 +module ActiveJob::QueueName::ClassMethods + # pkg:gem/activejob#lib/active_job/queue_name.rb:9 + def default_queue_name; end + + # pkg:gem/activejob#lib/active_job/queue_name.rb:9 + def default_queue_name=(val); end + + # Specifies the name of the queue to process the job on. + # + # class PublishToFeedJob < ActiveJob::Base + # queue_as :feeds + # + # def perform(post) + # post.to_feed! + # end + # end + # + # Can be given a block that will evaluate in the context of the job + # so that a dynamic queue name can be applied: + # + # class PublishToFeedJob < ApplicationJob + # queue_as do + # post = self.arguments.first + # + # if post.paid? + # :paid_feeds + # else + # :feeds + # end + # end + # + # def perform(post) + # post.to_feed! + # end + # end + # + # pkg:gem/activejob#lib/active_job/queue_name.rb:39 + def queue_as(part_name = T.unsafe(nil), &block); end + + # pkg:gem/activejob#lib/active_job/queue_name.rb:47 + def queue_name_from_part(part_name); end + + class << self + # pkg:gem/activejob#lib/active_job/queue_name.rb:9 + def default_queue_name; end + + # pkg:gem/activejob#lib/active_job/queue_name.rb:9 + def default_queue_name=(val); end + end +end + +# pkg:gem/activejob#lib/active_job/queue_priority.rb:4 +module ActiveJob::QueuePriority + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveJob::QueuePriority::ClassMethods + + # Returns the priority that the job will be created with + # + # pkg:gem/activejob#lib/active_job/queue_priority.rb:53 + def priority; end + + module GeneratedClassMethods + def priority; end + def priority=(value); end + def priority?; end + end + + module GeneratedInstanceMethods; end +end + +# Includes the ability to override the default queue priority. +# +# pkg:gem/activejob#lib/active_job/queue_priority.rb:8 +module ActiveJob::QueuePriority::ClassMethods + # pkg:gem/activejob#lib/active_job/queue_priority.rb:9 + def default_priority; end + + # pkg:gem/activejob#lib/active_job/queue_priority.rb:9 + def default_priority=(val); end + + # Specifies the priority of the queue to create the job with. + # + # class PublishToFeedJob < ActiveJob::Base + # queue_with_priority 50 + # + # def perform(post) + # post.to_feed! + # end + # end + # + # Can be given a block that will evaluate in the context of the job + # so that a dynamic priority can be applied: + # + # class PublishToFeedJob < ApplicationJob + # queue_with_priority do + # post = self.arguments.first + # + # if post.paid? + # 10 + # else + # 50 + # end + # end + # + # def perform(post) + # post.to_feed! + # end + # end + # + # pkg:gem/activejob#lib/active_job/queue_priority.rb:39 + def queue_with_priority(priority = T.unsafe(nil), &block); end + + class << self + # pkg:gem/activejob#lib/active_job/queue_priority.rb:9 + def default_priority; end + + # pkg:gem/activejob#lib/active_job/queue_priority.rb:9 + def default_priority=(val); end + end +end + +# = Active Job Railtie +# +# pkg:gem/activejob#lib/active_job/railtie.rb:9 +class ActiveJob::Railtie < ::Rails::Railtie; end + +# Raised when an unsupported argument type is set as a job argument. We +# currently support String, Integer, Float, NilClass, TrueClass, FalseClass, +# BigDecimal, Symbol, Date, Time, DateTime, ActiveSupport::TimeWithZone, +# ActiveSupport::Duration, Hash, ActiveSupport::HashWithIndifferentAccess, +# Array, Range, or GlobalID::Identification instances, although this can be +# extended by adding custom serializers. +# Raised if you set the key for a Hash something else than a string or +# a symbol. Also raised when trying to serialize an object which can't be +# identified with a GlobalID - such as an unpersisted Active Record model. +# +# pkg:gem/activejob#lib/active_job/arguments.rb:26 +class ActiveJob::SerializationError < ::ArgumentError; end + +# = Active Job \Serializers +# +# The +ActiveJob::Serializers+ module is used to store a list of known serializers +# and to add new ones. It also has helpers to serialize/deserialize objects. +# +# pkg:gem/activejob#lib/active_job/serializers.rb:8 +module ActiveJob::Serializers + extend ::ActiveSupport::Autoload + + class << self + # Adds new serializers to a list of known serializers. + # + # pkg:gem/activejob#lib/active_job/serializers.rb:60 + def add_serializers(*new_serializers); end + + # Returns deserialized object. + # Will look up through all known serializers. + # If no serializer found will raise ArgumentError. + # + # pkg:gem/activejob#lib/active_job/serializers.rb:40 + def deserialize(argument); end + + # Returns serialized representative of the passed object. + # Will look up through all known serializers. + # Raises ActiveJob::SerializationError if it can't find a proper serializer. + # + # pkg:gem/activejob#lib/active_job/serializers.rb:31 + def serialize(argument); end + + # Returns list of known serializers. + # + # pkg:gem/activejob#lib/active_job/serializers.rb:51 + def serializers; end + + # pkg:gem/activejob#lib/active_job/serializers.rb:53 + def serializers=(serializers); end + + private + + # pkg:gem/activejob#lib/active_job/serializers.rb:66 + def add_new_serializers(new_serializers); end + + # pkg:gem/activejob#lib/active_job/serializers.rb:80 + def index_serializers(new_serializers); end + end +end + +# pkg:gem/activejob#lib/active_job/serializers/action_controller_parameters_serializer.rb:5 +class ActiveJob::Serializers::ActionControllerParametersSerializer < ::ActiveJob::Serializers::ObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/action_controller_parameters_serializer.rb:10 + def deserialize(hash); end + + # pkg:gem/activejob#lib/active_job/serializers/action_controller_parameters_serializer.rb:18 + def klass; end + + # pkg:gem/activejob#lib/active_job/serializers/action_controller_parameters_serializer.rb:6 + def serialize(argument); end + + # pkg:gem/activejob#lib/active_job/serializers/action_controller_parameters_serializer.rb:14 + def serialize?(argument); end +end + +# pkg:gem/activejob#lib/active_job/serializers/big_decimal_serializer.rb:7 +class ActiveJob::Serializers::BigDecimalSerializer < ::ActiveJob::Serializers::ObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/big_decimal_serializer.rb:12 + def deserialize(hash); end + + # pkg:gem/activejob#lib/active_job/serializers/big_decimal_serializer.rb:16 + def klass; end + + # pkg:gem/activejob#lib/active_job/serializers/big_decimal_serializer.rb:8 + def serialize(big_decimal); end +end + +# pkg:gem/activejob#lib/active_job/serializers/date_serializer.rb:5 +class ActiveJob::Serializers::DateSerializer < ::ActiveJob::Serializers::ObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/date_serializer.rb:10 + def deserialize(hash); end + + # pkg:gem/activejob#lib/active_job/serializers/date_serializer.rb:14 + def klass; end + + # pkg:gem/activejob#lib/active_job/serializers/date_serializer.rb:6 + def serialize(date); end +end + +# pkg:gem/activejob#lib/active_job/serializers/date_time_serializer.rb:5 +class ActiveJob::Serializers::DateTimeSerializer < ::ActiveJob::Serializers::TimeObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/date_time_serializer.rb:6 + def deserialize(hash); end + + # pkg:gem/activejob#lib/active_job/serializers/date_time_serializer.rb:10 + def klass; end +end + +# pkg:gem/activejob#lib/active_job/serializers/duration_serializer.rb:5 +class ActiveJob::Serializers::DurationSerializer < ::ActiveJob::Serializers::ObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/duration_serializer.rb:12 + def deserialize(hash); end + + # pkg:gem/activejob#lib/active_job/serializers/duration_serializer.rb:19 + def klass; end + + # pkg:gem/activejob#lib/active_job/serializers/duration_serializer.rb:6 + def serialize(duration); end +end + +# pkg:gem/activejob#lib/active_job/serializers/module_serializer.rb:5 +class ActiveJob::Serializers::ModuleSerializer < ::ActiveJob::Serializers::ObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/module_serializer.rb:11 + def deserialize(hash); end + + # pkg:gem/activejob#lib/active_job/serializers/module_serializer.rb:15 + def klass; end + + # pkg:gem/activejob#lib/active_job/serializers/module_serializer.rb:6 + def serialize(constant); end +end + +# pkg:gem/activejob#lib/active_job/serializers.rb:104 +ActiveJob::Serializers::OBJECT_SERIALIZER_KEY = T.let(T.unsafe(nil), String) + +# Base class for serializing and deserializing custom objects. +# +# Example: +# +# class MoneySerializer < ActiveJob::Serializers::ObjectSerializer +# def serialize(money) +# super("amount" => money.amount, "currency" => money.currency) +# end +# +# def deserialize(hash) +# Money.new(hash["amount"], hash["currency"]) +# end +# +# def klass +# Money +# end +# end +# +# pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:24 +class ActiveJob::Serializers::ObjectSerializer + include ::Singleton + extend ::Singleton::SingletonClassMethods + + # pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:31 + def initialize; end + + # Deserializes an argument from a JSON primitive type. + # + # pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:47 + def deserialize(hash); end + + # Serializes an argument to a JSON primitive type. + # + # pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:42 + def serialize(hash); end + + # Determines if an argument should be serialized by a serializer. + # + # pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:37 + def serialize?(argument); end + + class << self + # Deserializes an argument from a JSON primitive type. + # + # pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:28 + def deserialize(*, **, &); end + + # Serializes an argument to a JSON primitive type. + # + # pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:28 + def serialize(*, **, &); end + + # Determines if an argument should be serialized by a serializer. + # + # pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:28 + def serialize?(*, **, &); end + + private + + # pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:25 + def allocate; end + + # pkg:gem/activejob#lib/active_job/serializers/object_serializer.rb:25 + def new(*_arg0); end + end +end + +# pkg:gem/activejob#lib/active_job/serializers/range_serializer.rb:5 +class ActiveJob::Serializers::RangeSerializer < ::ActiveJob::Serializers::ObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/range_serializer.rb:14 + def deserialize(hash); end + + # pkg:gem/activejob#lib/active_job/serializers/range_serializer.rb:18 + def klass; end + + # pkg:gem/activejob#lib/active_job/serializers/range_serializer.rb:6 + def serialize(range); end +end + +# pkg:gem/activejob#lib/active_job/serializers/symbol_serializer.rb:5 +class ActiveJob::Serializers::SymbolSerializer < ::ActiveJob::Serializers::ObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/symbol_serializer.rb:10 + def deserialize(argument); end + + # pkg:gem/activejob#lib/active_job/serializers/symbol_serializer.rb:14 + def klass; end + + # pkg:gem/activejob#lib/active_job/serializers/symbol_serializer.rb:6 + def serialize(argument); end +end + +# pkg:gem/activejob#lib/active_job/serializers/time_object_serializer.rb:5 +class ActiveJob::Serializers::TimeObjectSerializer < ::ActiveJob::Serializers::ObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/time_object_serializer.rb:8 + def serialize(time); end +end + +# pkg:gem/activejob#lib/active_job/serializers/time_object_serializer.rb:6 +ActiveJob::Serializers::TimeObjectSerializer::NANO_PRECISION = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activejob#lib/active_job/serializers/time_serializer.rb:5 +class ActiveJob::Serializers::TimeSerializer < ::ActiveJob::Serializers::TimeObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/time_serializer.rb:6 + def deserialize(hash); end + + # pkg:gem/activejob#lib/active_job/serializers/time_serializer.rb:10 + def klass; end +end + +# pkg:gem/activejob#lib/active_job/serializers/time_with_zone_serializer.rb:5 +class ActiveJob::Serializers::TimeWithZoneSerializer < ::ActiveJob::Serializers::ObjectSerializer + # pkg:gem/activejob#lib/active_job/serializers/time_with_zone_serializer.rb:15 + def deserialize(hash); end + + # pkg:gem/activejob#lib/active_job/serializers/time_with_zone_serializer.rb:19 + def klass; end + + # pkg:gem/activejob#lib/active_job/serializers/time_with_zone_serializer.rb:8 + def serialize(time_with_zone); end +end + +# pkg:gem/activejob#lib/active_job/serializers/time_with_zone_serializer.rb:6 +ActiveJob::Serializers::TimeWithZoneSerializer::NANO_PRECISION = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:6 +class ActiveJob::StructuredEventSubscriber < ::ActiveSupport::StructuredEventSubscriber + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:137 + def discard(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:7 + def enqueue(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:56 + def enqueue_all(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:31 + def enqueue_at(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:109 + def enqueue_retry(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:149 + def interrupt(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:87 + def perform(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:73 + def perform_start(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:162 + def resume(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:124 + def retry_stopped(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:197 + def step(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:173 + def step_skipped(event); end + + # pkg:gem/activejob#lib/active_job/structured_event_subscriber.rb:184 + def step_started(event); end +end + +# pkg:gem/activejob#lib/active_job/test_case.rb:6 +class ActiveJob::TestCase < ::ActiveSupport::TestCase + include ::ActiveJob::TestHelper +end + +# Provides helper methods for testing Active Job +# +# pkg:gem/activejob#lib/active_job/test_helper.rb:8 +module ActiveJob::TestHelper + include ::ActiveSupport::Testing::Assertions + + # pkg:gem/activejob#lib/active_job/test_helper.rb:56 + def after_teardown; end + + # Asserts that the number of enqueued jobs matches the given number. + # + # def test_jobs + # assert_enqueued_jobs 0 + # HelloJob.perform_later('david') + # assert_enqueued_jobs 1 + # HelloJob.perform_later('abdelkader') + # assert_enqueued_jobs 2 + # end + # + # If a block is passed, asserts that the block will cause the specified number of + # jobs to be enqueued. + # + # def test_jobs_again + # assert_enqueued_jobs 1 do + # HelloJob.perform_later('cristian') + # end + # + # assert_enqueued_jobs 2 do + # HelloJob.perform_later('aaron') + # HelloJob.perform_later('rafael') + # end + # end + # + # Asserts the number of times a specific job was enqueued by passing +:only+ option. + # + # def test_logging_job + # assert_enqueued_jobs 1, only: LoggingJob do + # LoggingJob.perform_later + # HelloJob.perform_later('jeremy') + # end + # end + # + # Asserts the number of times a job except specific class was enqueued by passing +:except+ option. + # + # def test_logging_job + # assert_enqueued_jobs 1, except: HelloJob do + # LoggingJob.perform_later + # HelloJob.perform_later('jeremy') + # end + # end + # + # +:only+ and +:except+ options accept Class, Array of Class, or Proc. When passed a Proc, + # a hash containing the job's class and it's argument are passed as argument. + # + # Asserts the number of times a job is enqueued to a specific queue by passing +:queue+ option. + # + # def test_logging_job + # assert_enqueued_jobs 2, queue: 'default' do + # LoggingJob.perform_later + # HelloJob.perform_later('elfassy') + # end + # end + # + # pkg:gem/activejob#lib/active_job/test_helper.rb:122 + def assert_enqueued_jobs(number, only: T.unsafe(nil), except: T.unsafe(nil), queue: T.unsafe(nil), &block); end + + # Asserts that the job has been enqueued with the given arguments. + # + # def test_assert_enqueued_with + # MyJob.perform_later(1,2,3) + # assert_enqueued_with(job: MyJob, args: [1,2,3]) + # + # MyJob.set(wait_until: Date.tomorrow.noon, queue: "my_queue").perform_later + # assert_enqueued_with(at: Date.tomorrow.noon, queue: "my_queue") + # end + # + # For keyword arguments, specify them as a hash inside an array: + # + # def test_assert_enqueued_with_keyword_arguments + # MyJob.perform_later(arg1: 'value1', arg2: 'value2') + # assert_enqueued_with(job: MyJob, args: [{ arg1: 'value1', arg2: 'value2' }]) + # end + # + # The given arguments may also be specified as matcher procs that return a + # boolean value indicating whether a job's attribute meets certain criteria. + # + # For example, a proc can be used to match a range of times: + # + # def test_assert_enqueued_with + # at_matcher = ->(job_at) { (Date.yesterday..Date.tomorrow).cover?(job_at) } + # + # MyJob.set(wait_until: Date.today.noon).perform_later + # + # assert_enqueued_with(job: MyJob, at: at_matcher) + # end + # + # A proc can also be used to match a subset of a job's args: + # + # def test_assert_enqueued_with + # args_matcher = ->(job_args) { job_args[0].key?(:foo) } + # + # MyJob.perform_later(foo: "bar", other_arg: "No need to check in the test") + # + # assert_enqueued_with(job: MyJob, args: args_matcher) + # end + # + # If a block is passed, asserts that the block will cause the job to be + # enqueued with the given arguments. + # + # def test_assert_enqueued_with + # assert_enqueued_with(job: MyJob, args: [1,2,3]) do + # MyJob.perform_later(1,2,3) + # end + # + # assert_enqueued_with(job: MyJob, at: Date.tomorrow.noon) do + # MyJob.set(wait_until: Date.tomorrow.noon).perform_later + # end + # end + # + # pkg:gem/activejob#lib/active_job/test_helper.rb:406 + def assert_enqueued_with(job: T.unsafe(nil), args: T.unsafe(nil), at: T.unsafe(nil), queue: T.unsafe(nil), priority: T.unsafe(nil), &block); end + + # Asserts that no jobs have been enqueued. + # + # def test_jobs + # assert_no_enqueued_jobs + # HelloJob.perform_later('jeremy') + # assert_enqueued_jobs 1 + # end + # + # If a block is passed, asserts that the block will not cause any job to be enqueued. + # + # def test_jobs_again + # assert_no_enqueued_jobs do + # # No job should be enqueued from this block + # end + # end + # + # Asserts that no jobs of a specific kind are enqueued by passing +:only+ option. + # + # def test_no_logging + # assert_no_enqueued_jobs only: LoggingJob do + # HelloJob.perform_later('jeremy') + # end + # end + # + # Asserts that no jobs except specific class are enqueued by passing +:except+ option. + # + # def test_no_logging + # assert_no_enqueued_jobs except: HelloJob do + # HelloJob.perform_later('jeremy') + # end + # end + # + # +:only+ and +:except+ options accept Class, Array of Class, or Proc. When passed a Proc, + # a hash containing the job's class and it's argument are passed as argument. + # + # Asserts that no jobs are enqueued to a specific queue by passing +:queue+ option + # + # def test_no_logging + # assert_no_enqueued_jobs queue: 'default' do + # LoggingJob.set(queue: :some_queue).perform_later + # end + # end + # + # Note: This assertion is simply a shortcut for: + # + # assert_enqueued_jobs 0, &block + # + # pkg:gem/activejob#lib/active_job/test_helper.rb:186 + def assert_no_enqueued_jobs(only: T.unsafe(nil), except: T.unsafe(nil), queue: T.unsafe(nil), &block); end + + # Asserts that no jobs have been performed. + # + # def test_jobs + # assert_no_performed_jobs + # + # perform_enqueued_jobs do + # HelloJob.perform_later('matthew') + # assert_performed_jobs 1 + # end + # end + # + # If a block is passed, asserts that the block will not cause any job to be performed. + # + # def test_jobs_again + # assert_no_performed_jobs do + # # No job should be performed from this block + # end + # end + # + # The block form supports filtering. If the +:only+ option is specified, + # then only the listed job(s) will not be performed. + # + # def test_no_logging + # assert_no_performed_jobs only: LoggingJob do + # HelloJob.perform_later('jeremy') + # end + # end + # + # Also if the +:except+ option is specified, + # then the job(s) except specific class will not be performed. + # + # def test_no_logging + # assert_no_performed_jobs except: HelloJob do + # HelloJob.perform_later('jeremy') + # end + # end + # + # +:only+ and +:except+ options accept Class, Array of Class, or Proc. When passed a Proc, + # an instance of the job will be passed as argument. + # + # If the +:queue+ option is specified, + # then only the job(s) enqueued to a specific queue will not be performed. + # + # def test_assert_no_performed_jobs_with_queue_option + # assert_no_performed_jobs queue: :some_queue do + # HelloJob.set(queue: :other_queue).perform_later("jeremy") + # end + # end + # + # Note: This assertion is simply a shortcut for: + # + # assert_performed_jobs 0, &block + # + # pkg:gem/activejob#lib/active_job/test_helper.rb:348 + def assert_no_performed_jobs(only: T.unsafe(nil), except: T.unsafe(nil), queue: T.unsafe(nil), &block); end + + # Asserts that the number of performed jobs matches the given number. + # If no block is passed, perform_enqueued_jobs + # must be called around or after the job call. + # + # def test_jobs + # assert_performed_jobs 0 + # + # perform_enqueued_jobs do + # HelloJob.perform_later('xavier') + # end + # assert_performed_jobs 1 + # + # HelloJob.perform_later('yves') + # + # perform_enqueued_jobs + # + # assert_performed_jobs 2 + # end + # + # If a block is passed, asserts that the block will cause the specified number of + # jobs to be performed. + # + # def test_jobs_again + # assert_performed_jobs 1 do + # HelloJob.perform_later('robin') + # end + # + # assert_performed_jobs 2 do + # HelloJob.perform_later('carlos') + # HelloJob.perform_later('sean') + # end + # end + # + # This method also supports filtering. If the +:only+ option is specified, + # then only the listed job(s) will be performed. + # + # def test_hello_job + # assert_performed_jobs 1, only: HelloJob do + # HelloJob.perform_later('jeremy') + # LoggingJob.perform_later + # end + # end + # + # Also if the +:except+ option is specified, + # then the job(s) except specific class will be performed. + # + # def test_hello_job + # assert_performed_jobs 1, except: LoggingJob do + # HelloJob.perform_later('jeremy') + # LoggingJob.perform_later + # end + # end + # + # An array may also be specified, to support testing multiple jobs. + # + # def test_hello_and_logging_jobs + # assert_nothing_raised do + # assert_performed_jobs 2, only: [HelloJob, LoggingJob] do + # HelloJob.perform_later('jeremy') + # LoggingJob.perform_later('stewie') + # RescueJob.perform_later('david') + # end + # end + # end + # + # A proc may also be specified. When passed a Proc, the job's instance will be passed as argument. + # + # def test_hello_and_logging_jobs + # assert_nothing_raised do + # assert_performed_jobs(1, only: ->(job) { job.is_a?(HelloJob) }) do + # HelloJob.perform_later('jeremy') + # LoggingJob.perform_later('stewie') + # RescueJob.perform_later('david') + # end + # end + # end + # + # If the +:queue+ option is specified, + # then only the job(s) enqueued to a specific queue will be performed. + # + # def test_assert_performed_jobs_with_queue_option + # assert_performed_jobs 1, queue: :some_queue do + # HelloJob.set(queue: :some_queue).perform_later("jeremy") + # HelloJob.set(queue: :other_queue).perform_later("bogdan") + # end + # end + # + # pkg:gem/activejob#lib/active_job/test_helper.rb:278 + def assert_performed_jobs(number, only: T.unsafe(nil), except: T.unsafe(nil), queue: T.unsafe(nil), &block); end + + # Asserts that the job has been performed with the given arguments. + # + # def test_assert_performed_with + # MyJob.perform_later(1,2,3) + # + # perform_enqueued_jobs + # + # assert_performed_with(job: MyJob, args: [1,2,3]) + # + # MyJob.set(wait_until: Date.tomorrow.noon, queue: "my_queue").perform_later + # + # perform_enqueued_jobs + # + # assert_performed_with(at: Date.tomorrow.noon, queue: "my_queue") + # end + # + # The given arguments may also be specified as matcher procs that return a + # boolean value indicating whether a job's attribute meets certain criteria. + # + # For example, a proc can be used to match a range of times: + # + # def test_assert_performed_with + # at_matcher = ->(job_at) { (Date.yesterday..Date.tomorrow).cover?(job_at) } + # + # MyJob.set(wait_until: Date.today.noon).perform_later + # + # perform_enqueued_jobs + # + # assert_performed_with(job: MyJob, at: at_matcher) + # end + # + # A proc can also be used to match a subset of a job's args: + # + # def test_assert_performed_with + # args_matcher = ->(job_args) { job_args[0].key?(:foo) } + # + # MyJob.perform_later(foo: "bar", other_arg: "No need to check in the test") + # + # perform_enqueued_jobs + # + # assert_performed_with(job: MyJob, args: args_matcher) + # end + # + # If a block is passed, that block performs all of the jobs that were + # enqueued throughout the duration of the block and asserts that + # the job has been performed with the given arguments in the block. + # + # def test_assert_performed_with + # assert_performed_with(job: MyJob, args: [1,2,3]) do + # MyJob.perform_later(1,2,3) + # end + # + # assert_performed_with(job: MyJob, at: Date.tomorrow.noon) do + # MyJob.set(wait_until: Date.tomorrow.noon).perform_later + # end + # end + # + # pkg:gem/activejob#lib/active_job/test_helper.rb:510 + def assert_performed_with(job: T.unsafe(nil), args: T.unsafe(nil), at: T.unsafe(nil), queue: T.unsafe(nil), priority: T.unsafe(nil), &block); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:41 + def before_setup; end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:9 + def enqueued_jobs(*, **, &); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:9 + def enqueued_jobs=(arg); end + + # Performs all enqueued jobs. If a block is given, performs all of the jobs + # that were enqueued throughout the duration of the block. If a block is + # not given, performs all of the enqueued jobs up to this point in the test. + # + # def test_perform_enqueued_jobs + # perform_enqueued_jobs do + # MyJob.perform_later(1, 2, 3) + # end + # assert_performed_jobs 1 + # end + # + # def test_perform_enqueued_jobs_without_block + # MyJob.perform_later(1, 2, 3) + # + # perform_enqueued_jobs + # + # assert_performed_jobs 1 + # end + # + # This method also supports filtering. If the +:only+ option is specified, + # then only the listed job(s) will be performed. + # + # def test_perform_enqueued_jobs_with_only + # perform_enqueued_jobs(only: MyJob) do + # MyJob.perform_later(1, 2, 3) # will be performed + # HelloJob.perform_later(1, 2, 3) # will not be performed + # end + # assert_performed_jobs 1 + # end + # + # Also if the +:except+ option is specified, + # then the job(s) except specific class will be performed. + # + # def test_perform_enqueued_jobs_with_except + # perform_enqueued_jobs(except: HelloJob) do + # MyJob.perform_later(1, 2, 3) # will be performed + # HelloJob.perform_later(1, 2, 3) # will not be performed + # end + # assert_performed_jobs 1 + # end + # + # +:only+ and +:except+ options accept Class, Array of Class, or Proc. When passed a Proc, + # an instance of the job will be passed as argument. + # + # If the +:queue+ option is specified, + # then only the job(s) enqueued to a specific queue will be performed. + # + # def test_perform_enqueued_jobs_with_queue + # perform_enqueued_jobs queue: :some_queue do + # MyJob.set(queue: :some_queue).perform_later(1, 2, 3) # will be performed + # HelloJob.set(queue: :other_queue).perform_later(1, 2, 3) # will not be performed + # end + # assert_performed_jobs 1 + # end + # + # If the +:at+ option is specified, then only jobs that have been enqueued + # to run at or before the given time will be performed. This includes jobs + # that have been enqueued without a time. + # + # If queue_adapter_for_test is overridden to return a different adapter, + # +perform_enqueued_jobs+ will merely execute the block. + # + # pkg:gem/activejob#lib/active_job/test_helper.rb:620 + def perform_enqueued_jobs(only: T.unsafe(nil), except: T.unsafe(nil), queue: T.unsafe(nil), at: T.unsafe(nil), &block); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:9 + def performed_jobs(*, **, &); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:9 + def performed_jobs=(arg); end + + # Accesses the queue_adapter set by ActiveJob::Base. + # + # def test_assert_job_has_custom_queue_adapter_set + # assert_instance_of CustomQueueAdapter, HelloJob.queue_adapter + # end + # + # pkg:gem/activejob#lib/active_job/test_helper.rb:661 + def queue_adapter; end + + # Returns a queue adapter instance to use with all Active Job test helpers. + # By default, returns an instance of ActiveJob::QueueAdapters::TestAdapter. + # Override this method to specify a different adapter. The adapter must + # implement the same interface as ActiveJob::QueueAdapters::TestAdapter. + # + # pkg:gem/activejob#lib/active_job/test_helper.rb:66 + def queue_adapter_for_test; end + + private + + # pkg:gem/activejob#lib/active_job/test_helper.rb:676 + def clear_enqueued_jobs; end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:680 + def clear_performed_jobs; end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:745 + def deserialize_args_for_assertion(job); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:716 + def enqueued_jobs_with(only: T.unsafe(nil), except: T.unsafe(nil), queue: T.unsafe(nil), at: T.unsafe(nil), &block); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:710 + def filter_as_proc(filter); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:724 + def flush_enqueued_jobs(only: T.unsafe(nil), except: T.unsafe(nil), queue: T.unsafe(nil), at: T.unsafe(nil)); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:752 + def instantiate_job(payload, skip_deserialize_arguments: T.unsafe(nil)); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:684 + def jobs_with(jobs, only: T.unsafe(nil), except: T.unsafe(nil), queue: T.unsafe(nil), at: T.unsafe(nil)); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:720 + def performed_jobs_with(only: T.unsafe(nil), except: T.unsafe(nil), queue: T.unsafe(nil), &block); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:732 + def prepare_args_for_assertion(args); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:759 + def queue_adapter_changed_jobs; end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:666 + def require_active_job_test_adapter!(method); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:672 + def using_test_adapter?; end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:766 + def validate_option(only: T.unsafe(nil), except: T.unsafe(nil)); end +end + +# pkg:gem/activejob#lib/active_job/test_helper.rb:15 +module ActiveJob::TestHelper::TestQueueAdapter + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveJob::TestHelper::TestQueueAdapter::ClassMethods + + module GeneratedClassMethods + def _test_adapter; end + def _test_adapter=(value); end + end + + module GeneratedInstanceMethods; end +end + +# pkg:gem/activejob#lib/active_job/test_helper.rb:22 +module ActiveJob::TestHelper::TestQueueAdapter::ClassMethods + # pkg:gem/activejob#lib/active_job/test_helper.rb:27 + def disable_test_adapter; end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:31 + def enable_test_adapter(test_adapter); end + + # pkg:gem/activejob#lib/active_job/test_helper.rb:23 + def queue_adapter; end +end + +# Raised during job payload deserialization when it references an uninitialized job class. +# +# pkg:gem/activejob#lib/active_job/core.rb:5 +class ActiveJob::UnknownJobClassError < ::NameError + # pkg:gem/activejob#lib/active_job/core.rb:6 + def initialize(job_class_name); end +end + +# pkg:gem/activejob#lib/active_job/gem_version.rb:9 +module ActiveJob::VERSION; end + +# pkg:gem/activejob#lib/active_job/gem_version.rb:10 +ActiveJob::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activejob#lib/active_job/gem_version.rb:11 +ActiveJob::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activejob#lib/active_job/gem_version.rb:13 +ActiveJob::VERSION::PRE = T.let(T.unsafe(nil), String) + +# pkg:gem/activejob#lib/active_job/gem_version.rb:15 +ActiveJob::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/activejob#lib/active_job/gem_version.rb:12 +ActiveJob::VERSION::TINY = T.let(T.unsafe(nil), Integer) diff --git a/sorbet/rbi/gems/activemodel@8.1.4.1.rbi b/sorbet/rbi/gems/activemodel@8.1.4.1.rbi new file mode 100644 index 000000000..03b94149e --- /dev/null +++ b/sorbet/rbi/gems/activemodel@8.1.4.1.rbi @@ -0,0 +1,6593 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `activemodel` gem. +# Please instead update this file by running `bin/tapioca gem activemodel`. + + +# :include: ../README.rdoc +# +# pkg:gem/activemodel#lib/active_model/gem_version.rb:3 +module ActiveModel + extend ::ActiveSupport::Autoload + + class << self + # pkg:gem/activemodel#lib/active_model/deprecator.rb:4 + def deprecator; end + + # pkg:gem/activemodel#lib/active_model.rb:82 + def eager_load!; end + + # Returns the currently loaded version of \Active \Model as a +Gem::Version+. + # + # pkg:gem/activemodel#lib/active_model/gem_version.rb:5 + def gem_version; end + + # Returns the currently loaded version of \Active \Model as a +Gem::Version+. + # + # pkg:gem/activemodel#lib/active_model/version.rb:7 + def version; end + end +end + +# = Active \Model \API +# +# Includes the required interface for an object to interact with +# Action Pack and Action View, using different Active \Model modules. +# It includes model name introspections, conversions, translations, and +# validations. Besides that, it allows you to initialize the object with a +# hash of attributes, pretty much like Active Record does. +# +# A minimal implementation could be: +# +# class Person +# include ActiveModel::API +# attr_accessor :name, :age +# end +# +# person = Person.new(name: 'bob', age: '18') +# person.name # => "bob" +# person.age # => "18" +# +# Note that, by default, +ActiveModel::API+ implements #persisted? +# to return +false+, which is the most common case. You may want to override +# it in your class to simulate a different scenario: +# +# class Person +# include ActiveModel::API +# attr_accessor :id, :name +# +# def persisted? +# self.id.present? +# end +# end +# +# person = Person.new(id: 1, name: 'bob') +# person.persisted? # => true +# +# Also, if for some reason you need to run code on initialize ( ::new ), make +# sure you call +super+ if you want the attributes hash initialization to +# happen. +# +# class Person +# include ActiveModel::API +# attr_accessor :id, :name, :omg +# +# def initialize(attributes={}) +# super +# @omg ||= true +# end +# end +# +# person = Person.new(id: 1, name: 'bob') +# person.omg # => true +# +# For more detailed information on other functionalities available, please +# refer to the specific modules included in +ActiveModel::API+ +# (see below). +# +# pkg:gem/activemodel#lib/active_model/api.rb:59 +module ActiveModel::API + include ::ActiveModel::ForbiddenAttributesProtection + include ::ActiveModel::AttributeAssignment + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveSupport::Callbacks + include ::ActiveModel::Validations::HelperMethods + include ::ActiveModel::Validations + include ::ActiveModel::Conversion + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::Validations::ClassMethods + mixes_in_class_methods ::ActiveModel::Callbacks + mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::DescendantsTracker + mixes_in_class_methods ::ActiveModel::Translation + mixes_in_class_methods ::ActiveModel::Validations::HelperMethods + mixes_in_class_methods ::ActiveModel::Conversion::ClassMethods + + # Initializes a new model with the given +params+. + # + # class Person + # include ActiveModel::API + # attr_accessor :name, :age + # end + # + # person = Person.new(name: 'bob', age: '18') + # person.name # => "bob" + # person.age # => "18" + # + # pkg:gem/activemodel#lib/active_model/api.rb:80 + def initialize(attributes = T.unsafe(nil)); end + + # Indicates if the model is persisted. Default is +false+. + # + # class Person + # include ActiveModel::API + # attr_accessor :id, :name + # end + # + # person = Person.new(id: 1, name: 'bob') + # person.persisted? # => false + # + # pkg:gem/activemodel#lib/active_model/api.rb:95 + def persisted?; end + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + def _validators; end + def _validators=(value); end + def _validators?; end + def param_delimiter; end + def param_delimiter=(value); end + def param_delimiter?; end + end + + module GeneratedInstanceMethods + def __callbacks; end + def _validators; end + def _validators?; end + def param_delimiter=(value); end + end +end + +# pkg:gem/activemodel#lib/active_model/access.rb:7 +module ActiveModel::Access + # pkg:gem/activemodel#lib/active_model/access.rb:8 + def slice(*methods); end + + # pkg:gem/activemodel#lib/active_model/access.rb:12 + def values_at(*methods); end +end + +# pkg:gem/activemodel#lib/active_model/attribute.rb:6 +class ActiveModel::Attribute + # This method should not be called directly. + # Use #from_database or #from_user + # + # pkg:gem/activemodel#lib/active_model/attribute.rb:33 + def initialize(name, value_before_type_cast, type, original_attribute = T.unsafe(nil), value = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:123 + def ==(other); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:115 + def came_from_user?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:66 + def changed?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:70 + def changed_in_place?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:99 + def dup_or_share; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:143 + def encode_with(coder); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:129 + def eql?(other); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:74 + def forgetting_assignment; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:119 + def has_been_read?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:131 + def hash; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:135 + def init_with(coder); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:111 + def initialized?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:29 + def name; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:47 + def original_value; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:151 + def original_value_for_database; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:62 + def serializable?(&block); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:29 + def type; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:107 + def type_cast(*); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:41 + def value(&); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:29 + def value_before_type_cast; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:55 + def value_for_database; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:87 + def with_cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:91 + def with_type(type); end + + # pkg:gem/activemodel#lib/active_model/attribute/user_provided_default.rb:7 + def with_user_default(value); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:83 + def with_value_from_database(value); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:78 + def with_value_from_user(value); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute.rb:177 + def _original_value_for_database; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:173 + def _value_for_database; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:161 + def assigned?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:169 + def changed_from_assignment?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:163 + def initialize_dup(other); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:160 + def original_attribute; end + + class << self + # pkg:gem/activemodel#lib/active_model/attribute.rb:8 + def from_database(name, value_before_type_cast, type, value = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:12 + def from_user(name, value_before_type_cast, type, original_attribute = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:20 + def null(name); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:24 + def uninitialized(name, type); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:16 + def with_cast_value(name, value_before_type_cast, type); end + end +end + +# pkg:gem/activemodel#lib/active_model/attribute.rb:181 +class ActiveModel::Attribute::FromDatabase < ::ActiveModel::Attribute + # pkg:gem/activemodel#lib/active_model/attribute.rb:186 + def forgetting_assignment; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:182 + def type_cast(value); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute.rb:200 + def _original_value_for_database; end +end + +# pkg:gem/activemodel#lib/active_model/attribute.rb:205 +class ActiveModel::Attribute::FromUser < ::ActiveModel::Attribute + # pkg:gem/activemodel#lib/active_model/attribute.rb:210 + def came_from_user?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:206 + def type_cast(value); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute.rb:215 + def _value_for_database; end +end + +# pkg:gem/activemodel#lib/active_model/attribute.rb:230 +class ActiveModel::Attribute::Null < ::ActiveModel::Attribute + # pkg:gem/activemodel#lib/active_model/attribute.rb:231 + def initialize(name); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:235 + def type_cast(*); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:247 + def with_cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:239 + def with_type(type); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:243 + def with_value_from_database(value); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:246 + def with_value_from_user(value); end +end + +# pkg:gem/activemodel#lib/active_model/attribute.rb:250 +class ActiveModel::Attribute::Uninitialized < ::ActiveModel::Attribute + # pkg:gem/activemodel#lib/active_model/attribute.rb:253 + def initialize(name, type); end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:274 + def forgetting_assignment; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:270 + def initialized?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:263 + def original_value; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:257 + def value; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:267 + def value_for_database; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:278 + def with_type(type); end +end + +# pkg:gem/activemodel#lib/active_model/attribute.rb:251 +ActiveModel::Attribute::Uninitialized::UNINITIALIZED_ORIGINAL_VALUE = T.let(T.unsafe(nil), Object) + +# pkg:gem/activemodel#lib/active_model/attribute/user_provided_default.rb:11 +class ActiveModel::Attribute::UserProvidedDefault < ::ActiveModel::Attribute::FromUser + # pkg:gem/activemodel#lib/active_model/attribute/user_provided_default.rb:12 + def initialize(name, value, type, database_default); end + + # pkg:gem/activemodel#lib/active_model/attribute/user_provided_default.rb:29 + def dup_or_share; end + + # pkg:gem/activemodel#lib/active_model/attribute/user_provided_default.rb:39 + def marshal_dump; end + + # pkg:gem/activemodel#lib/active_model/attribute/user_provided_default.rb:50 + def marshal_load(values); end + + # pkg:gem/activemodel#lib/active_model/attribute/user_provided_default.rb:17 + def value_before_type_cast; end + + # pkg:gem/activemodel#lib/active_model/attribute/user_provided_default.rb:25 + def with_type(type); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute/user_provided_default.rb:62 + def user_provided_value; end +end + +# pkg:gem/activemodel#lib/active_model/attribute.rb:220 +class ActiveModel::Attribute::WithCastValue < ::ActiveModel::Attribute + # pkg:gem/activemodel#lib/active_model/attribute.rb:225 + def changed_in_place?; end + + # pkg:gem/activemodel#lib/active_model/attribute.rb:221 + def type_cast(value); end +end + +# pkg:gem/activemodel#lib/active_model/attribute_assignment.rb:6 +module ActiveModel::AttributeAssignment + include ::ActiveModel::ForbiddenAttributesProtection + + # Allows you to set all the attributes by passing in a hash of attributes with + # keys matching the attribute names. + # + # If the passed hash responds to permitted? method and the return value + # of this method is +false+ an ActiveModel::ForbiddenAttributesError + # exception is raised. + # + # class Cat + # include ActiveModel::AttributeAssignment + # attr_accessor :name, :status + # end + # + # cat = Cat.new + # cat.assign_attributes(name: "Gorby", status: "yawning") + # cat.name # => 'Gorby' + # cat.status # => 'yawning' + # cat.assign_attributes(status: "sleeping") + # cat.name # => 'Gorby' + # cat.status # => 'sleeping' + # + # pkg:gem/activemodel#lib/active_model/attribute_assignment.rb:28 + def assign_attributes(new_attributes); end + + # Like `BasicObject#method_missing`, `#attribute_writer_missing` is invoked + # when `#assign_attributes` is passed an unknown attribute name. + # + # By default, `#attribute_writer_missing` raises an UnknownAttributeError. + # + # class Rectangle + # include ActiveModel::AttributeAssignment + # + # attr_accessor :length, :width + # + # def attribute_writer_missing(name, value) + # Rails.logger.warn "Tried to assign to unknown attribute #{name}" + # end + # end + # + # rectangle = Rectangle.new + # rectangle.assign_attributes(height: 10) # => Logs "Tried to assign to unknown attribute 'height'" + # + # pkg:gem/activemodel#lib/active_model/attribute_assignment.rb:56 + def attribute_writer_missing(name, value); end + + # pkg:gem/activemodel#lib/active_model/attribute_assignment.rb:37 + def attributes=(new_attributes); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute_assignment.rb:67 + def _assign_attribute(k, v); end + + # pkg:gem/activemodel#lib/active_model/attribute_assignment.rb:61 + def _assign_attributes(attributes); end +end + +# = Active \Model \Attribute \Methods +# +# Provides a way to add prefixes and suffixes to your methods as +# well as handling the creation of ActiveRecord::Base - like +# class methods such as +table_name+. +# +# The requirements to implement +ActiveModel::AttributeMethods+ are to: +# +# * include ActiveModel::AttributeMethods in your class. +# * Call each of its methods you want to add, such as +attribute_method_suffix+ +# or +attribute_method_prefix+. +# * Call +define_attribute_methods+ after the other methods are called. +# * Define the various generic +_attribute+ methods that you have declared. +# * Define an +attributes+ method which returns a hash with each +# attribute name in your model as hash key and the attribute value as hash value. +# Hash keys must be strings. +# +# A minimal implementation could be: +# +# class Person +# include ActiveModel::AttributeMethods +# +# attribute_method_affix prefix: 'reset_', suffix: '_to_default!' +# attribute_method_suffix '_contrived?' +# attribute_method_prefix 'clear_' +# define_attribute_methods :name +# +# attr_accessor :name +# +# def attributes +# { 'name' => @name } +# end +# +# private +# def attribute_contrived?(attr) +# true +# end +# +# def clear_attribute(attr) +# send("#{attr}=", nil) +# end +# +# def reset_attribute_to_default!(attr) +# send("#{attr}=", 'Default Name') +# end +# end +# +# pkg:gem/activemodel#lib/active_model/attribute_methods.rb:64 +module ActiveModel::AttributeMethods + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::AttributeMethods::ClassMethods + + # +attribute_missing+ is like +method_missing+, but for attributes. When + # +method_missing+ is called we check to see if there is a matching + # attribute method. If so, we tell +attribute_missing+ to dispatch the + # attribute. This method can be overloaded to customize the behavior. + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:520 + def attribute_missing(match, *, **, &); end + + # Allows access to the object attributes, which are held in the hash + # returned by attributes, as though they were first-class + # methods. So a +Person+ class with a +name+ attribute can for example use + # Person#name and Person#name= and never directly use + # the attributes hash -- except for multiple assignments with + # ActiveRecord::Base#attributes=. + # + # It's also possible to instantiate related objects, so a Client + # class belonging to the +clients+ table with a +master_id+ foreign key + # can instantiate master through Client#master. + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:507 + def method_missing(method, *, **, &); end + + # A +Person+ instance with a +name+ attribute can ask + # person.respond_to?(:name), person.respond_to?(:name=), + # and person.respond_to?(:name?) which will all return +true+. + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:536 + def respond_to?(method, include_private_methods = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:531 + def respond_to_without_attributes?(*_arg0); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:564 + def _read_attribute(attr); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:549 + def attribute_method?(attr_name); end + + # Returns a struct representing the matching attribute method. + # The struct's attributes are prefix, base and suffix. + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:555 + def matched_attribute_method(method_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:560 + def missing_attribute(attr_name, stack); end + + module GeneratedClassMethods + def attribute_aliases; end + def attribute_aliases=(value); end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns=(value); end + def attribute_method_patterns?; end + end + + module GeneratedInstanceMethods + def attribute_aliases; end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns?; end + end +end + +# pkg:gem/activemodel#lib/active_model/attribute_methods.rb:568 +module ActiveModel::AttributeMethods::AttrNames + class << self + # We want to generate the methods via module_eval rather than + # define_method, because define_method is slower on dispatch. + # + # But sometimes the database might return columns with + # characters that are not allowed in normal method names (like + # 'my_column(omg)'. So to work around this we first define with + # the __temp__ identifier, and then use alias method to rename + # it to what we want. + # + # We are also defining a constant to hold the frozen string of + # the attribute name. Using a constant means that we do not have + # to allocate an object on each call to the attribute method. + # Making it frozen means that it doesn't get duped when used to + # key the @attributes in read_attribute. + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:585 + def define_attribute_accessor_method(owner, attr_name, writer: T.unsafe(nil)); end + end +end + +# pkg:gem/activemodel#lib/active_model/attribute_methods.rb:569 +ActiveModel::AttributeMethods::AttrNames::DEF_SAFE_NAME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activemodel#lib/active_model/attribute_methods.rb:68 +ActiveModel::AttributeMethods::CALL_COMPILABLE_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activemodel#lib/active_model/attribute_methods.rb:75 +module ActiveModel::AttributeMethods::ClassMethods + # Allows you to make aliases for attributes. + # + # class Person + # include ActiveModel::AttributeMethods + # + # attr_accessor :name + # attribute_method_suffix '_short?' + # define_attribute_methods :name + # + # alias_attribute :nickname, :name + # + # private + # def attribute_short?(attr) + # send(attr).length < 5 + # end + # end + # + # person = Person.new + # person.name = 'Bob' + # person.name # => "Bob" + # person.nickname # => "Bob" + # person.name_short? # => true + # person.nickname_short? # => true + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:203 + def alias_attribute(new_name, old_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:226 + def alias_attribute_method_definition(code_generator, pattern, new_name, old_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:382 + def aliases_by_attribute_name; end + + # Returns the original name for the alias +name+ + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:245 + def attribute_alias(name); end + + # Is +new_name+ an alias? + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:240 + def attribute_alias?(new_name); end + + # Declares a method available for all attributes with the given prefix + # and suffix. Uses +method_missing+ and respond_to? to rewrite + # the method. + # + # #{prefix}#{attr}#{suffix}(*args, &block) + # + # to + # + # #{prefix}attribute#{suffix}(#{attr}, *args, &block) + # + # An #{prefix}attribute#{suffix} instance method must exist and + # accept at least the +attr+ argument. + # + # class Person + # include ActiveModel::AttributeMethods + # + # attr_accessor :name + # attribute_method_affix prefix: 'reset_', suffix: '_to_default!' + # define_attribute_methods :name + # + # private + # def reset_attribute_to_default!(attr) + # send("#{attr}=", 'Default Name') + # end + # end + # + # person = Person.new + # person.name # => 'Gem' + # person.reset_name_to_default! + # person.name # => 'Default Name' + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:175 + def attribute_method_affix(*affixes); end + + # Declares a method available for all attributes with the given prefix. + # Uses +method_missing+ and respond_to? to rewrite the method. + # + # #{prefix}#{attr}(*args, &block) + # + # to + # + # #{prefix}attribute(#{attr}, *args, &block) + # + # An instance method #{prefix}attribute must exist and accept + # at least the +attr+ argument. + # + # class Person + # include ActiveModel::AttributeMethods + # + # attr_accessor :name + # attribute_method_prefix 'clear_' + # define_attribute_methods :name + # + # private + # def clear_attribute(attr) + # send("#{attr}=", nil) + # end + # end + # + # person = Person.new + # person.name = 'Bob' + # person.name # => "Bob" + # person.clear_name + # person.name # => nil + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:106 + def attribute_method_prefix(*prefixes, parameters: T.unsafe(nil)); end + + # Declares a method available for all attributes with the given suffix. + # Uses +method_missing+ and respond_to? to rewrite the method. + # + # #{attr}#{suffix}(*args, &block) + # + # to + # + # attribute#{suffix}(#{attr}, *args, &block) + # + # An attribute#{suffix} instance method must exist and accept at + # least the +attr+ argument. + # + # class Person + # include ActiveModel::AttributeMethods + # + # attr_accessor :name + # attribute_method_suffix '_short?' + # define_attribute_methods :name + # + # private + # def attribute_short?(attr) + # send(attr).length < 5 + # end + # end + # + # person = Person.new + # person.name = 'Bob' + # person.name # => "Bob" + # person.name_short? # => true + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:140 + def attribute_method_suffix(*suffixes, parameters: T.unsafe(nil)); end + + # Declares an attribute that should be prefixed and suffixed by + # +ActiveModel::AttributeMethods+. + # + # To use, pass an attribute name (as string or symbol). Be sure to declare + # +define_attribute_method+ after you define any prefix, suffix or affix + # method, or they will not hook in. + # + # class Person + # include ActiveModel::AttributeMethods + # + # attr_accessor :name + # attribute_method_suffix '_short?' + # + # # Call to define_attribute_method must appear after the + # # attribute_method_prefix, attribute_method_suffix or + # # attribute_method_affix declarations. + # define_attribute_method :name + # + # private + # def attribute_short?(attr) + # send(attr).length < 5 + # end + # end + # + # person = Person.new + # person.name = 'Bob' + # person.name # => "Bob" + # person.name_short? # => true + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:311 + def define_attribute_method(attr_name, _owner: T.unsafe(nil), as: T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:320 + def define_attribute_method_pattern(pattern, attr_name, owner:, as:, override: T.unsafe(nil)); end + + # Declares the attributes that should be prefixed and suffixed by + # +ActiveModel::AttributeMethods+. + # + # To use, pass attribute names (as strings or symbols). Be sure to declare + # +define_attribute_methods+ after you define any prefix, suffix, or affix + # methods, or they will not hook in. + # + # class Person + # include ActiveModel::AttributeMethods + # + # attr_accessor :name, :age, :address + # attribute_method_prefix 'clear_' + # + # # Call to define_attribute_methods must appear after the + # # attribute_method_prefix, attribute_method_suffix or + # # attribute_method_affix declarations. + # define_attribute_methods :name, :age, :address + # + # private + # def clear_attribute(attr) + # send("#{attr}=", nil) + # end + # end + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:272 + def define_attribute_methods(*attr_names); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:211 + def eagerly_generate_alias_attribute_methods(new_name, old_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:217 + def generate_alias_attribute_methods(code_generator, new_name, old_name); end + + # Removes all the previously dynamically defined methods from the class, including alias attribute methods. + # + # class Person + # include ActiveModel::AttributeMethods + # + # attr_accessor :name + # attribute_method_suffix '_short?' + # define_attribute_method :name + # alias_attribute :first_name, :name + # + # private + # def attribute_short?(attr) + # send(attr).length < 5 + # end + # end + # + # person = Person.new + # person.name = 'Bob' + # person.first_name # => "Bob" + # person.name_short? # => true + # + # Person.undefine_attribute_methods + # + # person.name_short? # => NoMethodError + # person.first_name # => NoMethodError + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:375 + def undefine_attribute_methods; end + + private + + # The methods +method_missing+ and +respond_to?+ of this module are + # invoked often in a typical rails, both of which invoke the method + # +matched_attribute_method+. The latter method iterates through an + # array doing regular expression matches, which results in a lot of + # object creations. Most of the time it returns a +nil+ match. As the + # match result is always the same given a +method_name+, this cache is + # used to alleviate the GC, which ultimately also speeds up the app + # significantly (in our case our test suite finishes 10% faster with + # this cache). + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:417 + def attribute_method_patterns_cache; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:421 + def attribute_method_patterns_matching(method_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:445 + def build_mangled_name(name); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:455 + def define_call(code_generator, name, target_name, mangled_name, parameters, call_args, namespace:, as:); end + + # Define a method `name` in `mod` that dispatches to `send` + # using the given `extra` args. This falls back on `send` + # if the called name cannot be compiled. + # + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:430 + def define_proxy_call(code_generator, name, proxy_target, parameters, *call_args, namespace:, as: T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:400 + def generated_attribute_methods; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:387 + def inherited(base); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:404 + def instance_method_already_implemented?(method_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:396 + def resolve_attribute_name(name); end +end + +# pkg:gem/activemodel#lib/active_model/attribute_methods.rb:471 +class ActiveModel::AttributeMethods::ClassMethods::AttributeMethodPattern + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:476 + def initialize(prefix: T.unsafe(nil), suffix: T.unsafe(nil), parameters: T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:485 + def match(method_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:491 + def method_name(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:472 + def parameters; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:472 + def prefix; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:472 + def proxy_target; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:472 + def suffix; end +end + +# pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 +class ActiveModel::AttributeMethods::ClassMethods::AttributeMethodPattern::AttributeMethod < ::Struct + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 + def attr_name; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 + def attr_name=(_); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 + def proxy_target; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 + def proxy_target=(_); end + + class << self + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 + def [](*_arg0); end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 + def inspect; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 + def keyword_init?; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 + def members; end + + # pkg:gem/activemodel#lib/active_model/attribute_methods.rb:474 + def new(*_arg0); end + end +end + +# pkg:gem/activemodel#lib/active_model/attribute_methods.rb:67 +ActiveModel::AttributeMethods::NAME_COMPILABLE_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:7 +class ActiveModel::AttributeMutationTracker + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:10 + def initialize(attributes); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:40 + def any_changes?; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:34 + def change_to_attribute(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:44 + def changed?(attr_name, from: T.unsafe(nil), to: T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:14 + def changed_attribute_names; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:50 + def changed_in_place?(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:18 + def changed_values; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:26 + def changes; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:63 + def force_change(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:54 + def forget_change(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:59 + def original_value(attr_name); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:74 + def attr_names; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:78 + def attribute_changed?(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:68 + def attributes; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:82 + def fetch_value(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:70 + def forced_changes; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:86 + def type_cast(attr_name, value); end +end + +# pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:8 +ActiveModel::AttributeMutationTracker::OPTION_NOT_GIVEN = T.let(T.unsafe(nil), Object) + +# pkg:gem/activemodel#lib/active_model/attribute_registration.rb:8 +module ActiveModel::AttributeRegistration + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveModel::AttributeRegistration::ClassMethods +end + +# pkg:gem/activemodel#lib/active_model/attribute_registration.rb:11 +module ActiveModel::AttributeRegistration::ClassMethods + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:31 + def _default_attributes; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:12 + def attribute(name, type = T.unsafe(nil), default: T.unsafe(nil), **options); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:37 + def attribute_types; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:23 + def decorate_attributes(names = T.unsafe(nil), &decorator); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:43 + def type_for_attribute(attribute_name, &block); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:81 + def apply_pending_attribute_modifications(attribute_set); end + + # Hook for other modules to override. The attribute type is passed + # through this method immediately after it is resolved, before any type + # decorations are applied. + # + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:112 + def hook_attribute_type(attribute, type); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:77 + def pending_attribute_modifications; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:91 + def reset_default_attributes; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:96 + def reset_default_attributes!; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:101 + def resolve_attribute_name(name); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:105 + def resolve_type_name(name, **options); end +end + +# pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 +class ActiveModel::AttributeRegistration::ClassMethods::PendingDecorator < ::Struct + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:68 + def apply_to(attribute_set); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 + def decorator; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 + def decorator=(_); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 + def names; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 + def names=(_); end + + class << self + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 + def [](*_arg0); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 + def inspect; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 + def keyword_init?; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 + def members; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:67 + def new(*_arg0); end + end +end + +# pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 +class ActiveModel::AttributeRegistration::ClassMethods::PendingDefault < ::Struct + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:62 + def apply_to(attribute_set); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 + def default; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 + def default=(_); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 + def name; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 + def name=(_); end + + class << self + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 + def [](*_arg0); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 + def inspect; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 + def keyword_init?; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 + def members; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:61 + def new(*_arg0); end + end +end + +# pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 +class ActiveModel::AttributeRegistration::ClassMethods::PendingType < ::Struct + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:55 + def apply_to(attribute_set); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 + def name; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 + def name=(_); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 + def type; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 + def type=(_); end + + class << self + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 + def [](*_arg0); end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 + def inspect; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 + def keyword_init?; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 + def members; end + + # pkg:gem/activemodel#lib/active_model/attribute_registration.rb:54 + def new(*_arg0); end + end +end + +# pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:6 +class ActiveModel::AttributeSet + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:12 + def initialize(attributes); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:106 + def ==(other); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:16 + def [](name); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:20 + def []=(name, value); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:93 + def accessed; end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:24 + def cast_types; end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:73 + def deep_dup; end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:10 + def each_value(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:10 + def except(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:10 + def fetch(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:50 + def fetch_value(name, &block); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:68 + def freeze; end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:44 + def include?(name); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:41 + def key?(name); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:46 + def keys; end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:97 + def map(&block); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:87 + def reset(key); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:102 + def reverse_merge!(target_attributes); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:39 + def to_h; end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:36 + def to_hash; end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:28 + def values_before_type_cast; end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:32 + def values_for_database; end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:64 + def write_cast_value(name, value); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:54 + def write_from_database(name, value); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:58 + def write_from_user(name, value); end + + protected + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:111 + def attributes; end + + private + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:114 + def default_attribute(name); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:82 + def initialize_clone(_); end + + # pkg:gem/activemodel#lib/active_model/attribute_set.rb:77 + def initialize_dup(_); end +end + +# pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:7 +class ActiveModel::AttributeSet::Builder + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:10 + def initialize(types, default_attributes = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:15 + def build_from_database(values = T.unsafe(nil), additional_types = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:8 + def default_attributes; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:8 + def types; end +end + +# Attempts to do more intelligent YAML dumping of an +# ActiveModel::AttributeSet to reduce the size of the resulting string +# +# pkg:gem/activemodel#lib/active_model/attribute_set/yaml_encoder.rb:7 +class ActiveModel::AttributeSet::YAMLEncoder + # pkg:gem/activemodel#lib/active_model/attribute_set/yaml_encoder.rb:8 + def initialize(default_types); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/yaml_encoder.rb:22 + def decode(coder); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/yaml_encoder.rb:12 + def encode(attribute_set, coder); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute_set/yaml_encoder.rb:37 + def default_types; end +end + +# = Active \Model \Attributes +# +# The Attributes module allows models to define attributes beyond simple Ruby +# readers and writers. Similar to Active Record attributes, which are +# typically inferred from the database schema, Active Model Attributes are +# aware of data types, can have default values, and can handle casting and +# serialization. +# +# To use Attributes, include the module in your model class and define your +# attributes using the +attribute+ macro. It accepts a name, a type, a default +# value, and any other options supported by the attribute type. +# +# ==== Examples +# +# class Person +# include ActiveModel::Attributes +# +# attribute :name, :string +# attribute :active, :boolean, default: true +# end +# +# person = Person.new +# person.name = "Volmer" +# +# person.name # => "Volmer" +# person.active # => true +# +# pkg:gem/activemodel#lib/active_model/attributes.rb:30 +module ActiveModel::Attributes + extend ::ActiveSupport::Concern + extend ::ActiveSupport::Autoload + include GeneratedInstanceMethods + include ::ActiveModel::AttributeRegistration + include ::ActiveModel::AttributeMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::AttributeRegistration::ClassMethods + mixes_in_class_methods ::ActiveModel::AttributeMethods::ClassMethods + mixes_in_class_methods ::ActiveModel::Attributes::ClassMethods + + # pkg:gem/activemodel#lib/active_model/attributes.rb:106 + def initialize(*); end + + # Returns an array of attribute names as strings. + # + # class Person + # include ActiveModel::Attributes + # + # attribute :name, :string + # attribute :age, :integer + # end + # + # person = Person.new + # person.attribute_names # => ["name", "age"] + # + # pkg:gem/activemodel#lib/active_model/attributes.rb:146 + def attribute_names; end + + # Returns a hash of all the attributes with their names as keys and the + # values of the attributes as values. + # + # class Person + # include ActiveModel::Attributes + # + # attribute :name, :string + # attribute :age, :integer + # end + # + # person = Person.new + # person.name = "Francesco" + # person.age = 22 + # + # person.attributes # => { "name" => "Francesco", "age" => 22} + # + # pkg:gem/activemodel#lib/active_model/attributes.rb:131 + def attributes; end + + # pkg:gem/activemodel#lib/active_model/attributes.rb:150 + def freeze; end + + private + + # pkg:gem/activemodel#lib/active_model/attributes.rb:156 + def _write_attribute(attr_name, value); end + + # pkg:gem/activemodel#lib/active_model/attributes.rb:161 + def attribute(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attributes.rb:159 + def attribute=(attr_name, value); end + + # pkg:gem/activemodel#lib/active_model/attributes.rb:111 + def initialize_dup(other); end + + module GeneratedClassMethods + def attribute_aliases; end + def attribute_aliases=(value); end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns=(value); end + def attribute_method_patterns?; end + end + + module GeneratedInstanceMethods + def attribute_aliases; end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns?; end + end +end + +# pkg:gem/activemodel#lib/active_model/attributes.rb:39 +module ActiveModel::Attributes::ClassMethods + # :call-seq: attribute(name, cast_type = nil, default: nil, **options) + # + # Defines a model attribute. In addition to the attribute name, a cast + # type and default value may be specified, as well as any options + # supported by the given cast type. + # + # class Person + # include ActiveModel::Attributes + # + # attribute :name, :string + # attribute :active, :boolean, default: true + # end + # + # person = Person.new + # person.name = "Volmer" + # + # person.name # => "Volmer" + # person.active # => true + # + # pkg:gem/activemodel#lib/active_model/attributes.rb:59 + def attribute(name, *, **, &); end + + # Returns an array of attribute names as strings. + # + # class Person + # include ActiveModel::Attributes + # + # attribute :name, :string + # attribute :age, :integer + # end + # + # Person.attribute_names # => ["name", "age"] + # + # pkg:gem/activemodel#lib/active_model/attributes.rb:74 + def attribute_names; end + + private + + # pkg:gem/activemodel#lib/active_model/attributes.rb:92 + def define_method_attribute=(canonical_name, owner:, as: T.unsafe(nil)); end +end + +# pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:5 +module ActiveModel::Attributes::Normalization + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveModel::AttributeMethods + include ::ActiveModel::Dirty + include ::ActiveSupport::Callbacks + include ::ActiveModel::Validations::Callbacks + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::Attributes::Normalization::ClassMethods + mixes_in_class_methods ::ActiveModel::AttributeMethods::ClassMethods + mixes_in_class_methods ::ActiveModel::Validations::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::DescendantsTracker + + # Normalizes a specified attribute using its declared normalizations. + # + # ==== Examples + # + # class User + # include ActiveModel::Attributes + # include ActiveModel::Attributes::Normalization + # + # attribute :email, :string + # + # normalizes :email, with: -> email { email.strip.downcase } + # end + # + # legacy_user = User.load_from_legacy_data(...) + # legacy_user.email # => " CRUISE-CONTROL@EXAMPLE.COM\n" + # legacy_user.normalize_attribute(:email) + # legacy_user.email # => "cruise-control@example.com" + # + # ==== Behavior with Active Record + # + # To prevent confusion, normalization will not be applied + # when the attribute is fetched from the database. This means that if a + # record was persisted before the normalization was declared, the record's + # attribute will not be normalized until either it is assigned a new + # value, or it is explicitly migrated via Normalization#normalize_attribute. + # + # Be aware that if your app was created before Rails 7.1, and your app + # marshals instances of the targeted model (for example, when caching), + # then you should set ActiveRecord.marshalling_format_version to +7.1+ or + # higher via either config.load_defaults 7.1 or + # config.active_record.marshalling_format_version = 7.1. + # Otherwise, +Marshal+ may attempt to serialize the normalization +Proc+ + # and raise +TypeError+. + # + # class User < ActiveRecord::Base + # normalizes :email, with: -> email { email.strip.downcase } + # normalizes :phone, with: -> phone { phone.delete("^0-9").delete_prefix("1") } + # end + # + # user = User.create(email: " CRUISE-CONTROL@EXAMPLE.COM\n") + # user.email # => "cruise-control@example.com" + # + # user = User.find_by(email: "\tCRUISE-CONTROL@EXAMPLE.COM ") + # user.email # => "cruise-control@example.com" + # user.email_before_type_cast # => "cruise-control@example.com" + # + # User.where(email: "\tCRUISE-CONTROL@EXAMPLE.COM ").count # => 1 + # User.where(["email = ?", "\tCRUISE-CONTROL@EXAMPLE.COM "]).count # => 0 + # + # User.exists?(email: "\tCRUISE-CONTROL@EXAMPLE.COM ") # => true + # User.exists?(["email = ?", "\tCRUISE-CONTROL@EXAMPLE.COM "]) # => false + # + # User.normalize_value_for(:phone, "+1 (555) 867-5309") # => "5558675309" + # + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:70 + def normalize_attribute(name); end + + private + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:140 + def normalize_changed_in_place_attributes; end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:147 + def normalized_attribute_changed_in_place?(attribute); end + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + def attribute_aliases; end + def attribute_aliases=(value); end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns=(value); end + def attribute_method_patterns?; end + def normalized_attributes; end + def normalized_attributes=(value); end + def normalized_attributes?; end + end + + module GeneratedInstanceMethods + def __callbacks; end + def attribute_aliases; end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns?; end + def normalized_attributes; end + def normalized_attributes=(value); end + def normalized_attributes?; end + end +end + +# pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:75 +module ActiveModel::Attributes::Normalization::ClassMethods + # Normalizes a given +value+ using normalizations declared for +name+. + # + # ==== Examples + # + # class User + # include ActiveModel::Attributes + # include ActiveModel::Attributes::Normalization + # + # attribute :email, :string + # + # normalizes :email, with: -> email { email.strip.downcase } + # end + # + # User.normalize_value_for(:email, " CRUISE-CONTROL@EXAMPLE.COM\n") + # # => "cruise-control@example.com" + # + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:134 + def normalize_value_for(name, value); end + + # Declares a normalization for one or more attributes. The normalization + # is applied when the attribute is assigned or validated. + # + # Because the normalization may be applied multiple times, it should be + # _idempotent_. In other words, applying the normalization more than once + # should have the same result as applying it only once. + # + # By default, the normalization will not be applied to +nil+ values. This + # behavior can be changed with the +:apply_to_nil+ option. + # + # ==== Options + # + # * +:with+ - Any callable object that accepts the attribute's value as + # its sole argument, and returns it normalized. + # * +:apply_to_nil+ - Whether to apply the normalization to +nil+ values. + # Defaults to +false+. + # + # ==== Examples + # + # class User + # include ActiveModel::Attributes + # include ActiveModel::Attributes::Normalization + # + # attribute :email, :string + # attribute :phone, :string + # + # normalizes :email, with: -> email { email.strip.downcase } + # normalizes :phone, with: -> phone { phone.delete("^0-9").delete_prefix("1") } + # end + # + # user = User.new + # user.email = " CRUISE-CONTROL@EXAMPLE.COM\n" + # user.email # => "cruise-control@example.com" + # + # User.normalize_value_for(:phone, "+1 (555) 867-5309") # => "5558675309" + # + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:111 + def normalizes(*names, with:, apply_to_nil: T.unsafe(nil)); end +end + +# pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:151 +class ActiveModel::Attributes::Normalization::NormalizedValueType + include ::ActiveModel::Type::SerializeCastValue + extend ::ActiveModel::Type::SerializeCastValue::ClassMethods + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:157 + def initialize(cast_type:, normalizer:, normalize_nil:); end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:176 + def ==(other); end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:164 + def cast(value); end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:154 + def cast_type; end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:182 + def eql?(other); end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:184 + def hash; end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:188 + def inspect; end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:154 + def normalize_nil; end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:155 + def normalize_nil?; end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:154 + def normalizer; end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:168 + def serialize(value); end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:172 + def serialize_cast_value(value); end + + private + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:194 + def instance_variables_to_inspect; end + + # pkg:gem/activemodel#lib/active_model/attributes/normalization.rb:196 + def normalize(value); end +end + +# +BlockValidator+ is a special +EachValidator+ which receives a block on initialization +# and call this block for each attribute being validated. +validates_each+ uses this validator. +# +# pkg:gem/activemodel#lib/active_model/validator.rb:179 +class ActiveModel::BlockValidator < ::ActiveModel::EachValidator + # pkg:gem/activemodel#lib/active_model/validator.rb:180 + def initialize(options, &block); end + + private + + # pkg:gem/activemodel#lib/active_model/validator.rb:186 + def validate_each(record, attribute, value); end +end + +# = Active \Model \Callbacks +# +# Provides an interface for any class to have Active Record like callbacks. +# +# Like the Active Record methods, the callback chain is aborted as soon as +# one of the methods throws +:abort+. +# +# First, extend +ActiveModel::Callbacks+ from the class you are creating: +# +# class MyModel +# extend ActiveModel::Callbacks +# end +# +# Then define a list of methods that you want callbacks attached to: +# +# define_model_callbacks :create, :update +# +# This will provide all three standard callbacks (before, around and after) +# for both the :create and :update methods. To implement, +# you need to wrap the methods you want callbacks on in a block so that the +# callbacks get a chance to fire: +# +# def create +# run_callbacks :create do +# # Your create action methods here +# end +# end +# +# Then in your class, you can use the +before_create+, +after_create+, and +# +around_create+ methods, just as you would in an Active Record model. +# +# before_create :action_before_create +# +# def action_before_create +# # Your code here +# end +# +# When defining an around callback remember to yield to the block, otherwise +# it won't be executed: +# +# around_create :log_status +# +# def log_status +# puts 'going to call the block...' +# yield +# puts 'block successfully called.' +# end +# +# You can choose to have only specific callbacks by passing a hash to the +# +define_model_callbacks+ method. +# +# define_model_callbacks :create, only: [:after, :before] +# +# Would only create the +after_create+ and +before_create+ callback methods in +# your class. +# +# NOTE: Defining the same callback multiple times will overwrite previous callback definitions. +# +# pkg:gem/activemodel#lib/active_model/callbacks.rb:65 +module ActiveModel::Callbacks + # +define_model_callbacks+ accepts the same options +define_callbacks+ does, + # in case you want to overwrite a default. Besides that, it also accepts an + # :only option, where you can choose if you want all types (before, + # around or after) or just some. + # + # define_model_callbacks :initialize, only: :after + # + # Note, the only: hash will apply to all callbacks defined + # on that method call. To get around this you can call the +define_model_callbacks+ + # method as many times as you need. + # + # define_model_callbacks :create, only: :after + # define_model_callbacks :update, only: :before + # define_model_callbacks :destroy, only: :around + # + # Would create +after_create+, +before_update+, and +around_destroy+ methods + # only. + # + # You can pass in a class to before_, after_ and around_, + # in which case the callback will call that class's _ method + # passing the object that the callback is being called on. + # + # class MyModel + # extend ActiveModel::Callbacks + # define_model_callbacks :create + # + # before_create AnotherClass + # end + # + # class AnotherClass + # def self.before_create( obj ) + # # obj is the MyModel instance that the callback is being called on + # end + # end + # + # NOTE: +method_name+ passed to +define_model_callbacks+ must not end with + # !, ? or =. + # + # pkg:gem/activemodel#lib/active_model/callbacks.rb:109 + def define_model_callbacks(*callbacks); end + + private + + # pkg:gem/activemodel#lib/active_model/callbacks.rb:143 + def _define_after_model_callback(klass, callback); end + + # pkg:gem/activemodel#lib/active_model/callbacks.rb:136 + def _define_around_model_callback(klass, callback); end + + # pkg:gem/activemodel#lib/active_model/callbacks.rb:129 + def _define_before_model_callback(klass, callback); end + + class << self + # pkg:gem/activemodel#lib/active_model/callbacks.rb:66 + def extended(base); end + end +end + +# = Active \Model \Conversion +# +# Handles default conversions: #to_model, #to_key, #to_param, and #to_partial_path. +# +# Let's take for example this non-persisted object. +# +# class ContactMessage +# include ActiveModel::Conversion +# +# # ContactMessage are never persisted in the DB +# def persisted? +# false +# end +# end +# +# cm = ContactMessage.new +# cm.to_model == cm # => true +# cm.to_key # => nil +# cm.to_param # => nil +# cm.to_partial_path # => "contact_messages/contact_message" +# +# pkg:gem/activemodel#lib/active_model/conversion.rb:24 +module ActiveModel::Conversion + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::Conversion::ClassMethods + + # Returns an Array of all key attributes if any of the attributes is set, whether or not + # the object is persisted. Returns +nil+ if there are no key attributes. + # + # class Person + # include ActiveModel::Conversion + # attr_accessor :id + # + # def initialize(id) + # @id = id + # end + # end + # + # person = Person.new(1) + # person.to_key # => [1] + # + # pkg:gem/activemodel#lib/active_model/conversion.rb:67 + def to_key; end + + # If your object is already designed to implement all of the \Active \Model + # you can use the default :to_model implementation, which simply + # returns +self+. + # + # class Person + # include ActiveModel::Conversion + # end + # + # person = Person.new + # person.to_model == person # => true + # + # If your model does not act like an \Active \Model object, then you should + # define :to_model yourself returning a proxy object that wraps + # your object with \Active \Model compliant methods. + # + # pkg:gem/activemodel#lib/active_model/conversion.rb:49 + def to_model; end + + # Returns a +string+ representing the object's key suitable for use in URLs, + # or +nil+ if persisted? is +false+. + # + # class Person + # include ActiveModel::Conversion + # attr_accessor :id + # + # def initialize(id) + # @id = id + # end + # + # def persisted? + # true + # end + # end + # + # person = Person.new(1) + # person.to_param # => "1" + # + # pkg:gem/activemodel#lib/active_model/conversion.rb:90 + def to_param; end + + # Returns a +string+ identifying the path associated with the object. + # ActionPack uses this to find a suitable partial to represent the object. + # + # class Person + # include ActiveModel::Conversion + # end + # + # person = Person.new + # person.to_partial_path # => "people/person" + # + # pkg:gem/activemodel#lib/active_model/conversion.rb:103 + def to_partial_path; end + + module GeneratedClassMethods + def param_delimiter; end + def param_delimiter=(value); end + def param_delimiter?; end + end + + module GeneratedInstanceMethods + def param_delimiter=(value); end + end +end + +# pkg:gem/activemodel#lib/active_model/conversion.rb:107 +module ActiveModel::Conversion::ClassMethods + # Provide a class level cache for #to_partial_path. This is an + # internal method and should not be accessed directly. + # + # pkg:gem/activemodel#lib/active_model/conversion.rb:110 + def _to_partial_path; end +end + +# = Active \Model \Dirty +# +# Provides a way to track changes in your object in the same way as +# Active Record does. +# +# The requirements for implementing ActiveModel::Dirty are: +# +# * include ActiveModel::Dirty in your object. +# * Call define_attribute_methods passing each method you want to +# track. +# * Call *_will_change! before each change to the tracked attribute. +# * Call changes_applied after the changes are persisted. +# * Call clear_changes_information when you want to reset the changes +# information. +# * Call restore_attributes when you want to restore previous data. +# +# A minimal implementation could be: +# +# class Person +# include ActiveModel::Dirty +# +# define_attribute_methods :name +# +# def initialize +# @name = nil +# end +# +# def name +# @name +# end +# +# def name=(val) +# name_will_change! unless val == @name +# @name = val +# end +# +# def save +# # do persistence work +# +# changes_applied +# end +# +# def reload! +# # get the values from the persistence layer +# +# clear_changes_information +# end +# +# def rollback! +# restore_attributes +# end +# end +# +# A newly instantiated +Person+ object is unchanged: +# +# person = Person.new +# person.changed? # => false +# +# Change the name: +# +# person.name = 'Bob' +# person.changed? # => true +# person.name_changed? # => true +# person.name_changed?(from: nil, to: "Bob") # => true +# person.name_was # => nil +# person.name_change # => [nil, "Bob"] +# person.name = 'Bill' +# person.name_change # => [nil, "Bill"] +# +# Save the changes: +# +# person.save +# person.changed? # => false +# person.name_changed? # => false +# +# Reset the changes: +# +# person.previous_changes # => {"name" => [nil, "Bill"]} +# person.name_previously_changed? # => true +# person.name_previously_changed?(from: nil, to: "Bill") # => true +# person.name_previous_change # => [nil, "Bill"] +# person.name_previously_was # => nil +# person.reload! +# person.previous_changes # => {} +# +# Rollback the changes: +# +# person.name = "Uncle Bob" +# person.rollback! +# person.name # => "Bill" +# person.name_changed? # => false +# +# Assigning the same value leaves the attribute unchanged: +# +# person.name = 'Bill' +# person.name_changed? # => false +# person.name_change # => nil +# +# Which attributes have changed? +# +# person.name = 'Bob' +# person.changed # => ["name"] +# person.changes # => {"name" => ["Bill", "Bob"]} +# +# If an attribute is modified in-place then make use of +# {*_will_change!}[rdoc-ref:#*_will_change!] to mark that the attribute is changing. +# Otherwise \Active \Model can't track changes to in-place attributes. Note +# that Active Record can detect in-place modifications automatically. You do +# not need to call *_will_change! on Active Record models. +# +# person.name_will_change! +# person.name_change # => ["Bill", "Bill"] +# person.name << 'y' +# person.name_change # => ["Bill", "Billy"] +# +# Methods can be invoked as +name_changed?+ or by passing an argument to the +# generic method attribute_changed?("name"). +# +# pkg:gem/activemodel#lib/active_model/dirty.rb:123 +module ActiveModel::Dirty + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveModel::AttributeMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::AttributeMethods::ClassMethods + + # pkg:gem/activemodel#lib/active_model/dirty.rb:264 + def as_json(options = T.unsafe(nil)); end + + # Dispatch target for {*_changed?}[rdoc-ref:#*_changed?] attribute methods. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:300 + def attribute_changed?(attr_name, **options); end + + # pkg:gem/activemodel#lib/active_model/dirty.rb:367 + def attribute_changed_in_place?(attr_name); end + + # Dispatch target for {*_previously_changed?}[rdoc-ref:#*_previously_changed?] attribute methods. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:310 + def attribute_previously_changed?(attr_name, **options); end + + # Dispatch target for {*_previously_was}[rdoc-ref:#*_previously_was] attribute methods. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:315 + def attribute_previously_was(attr_name); end + + # Dispatch target for {*_was}[rdoc-ref:#*_was] attribute methods. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:305 + def attribute_was(attr_name); end + + # Returns an array with the name of the attributes with unsaved changes. + # + # person.changed # => [] + # person.name = 'bob' + # person.changed # => ["name"] + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:295 + def changed; end + + # Returns +true+ if any of the attributes has unsaved changes, +false+ otherwise. + # + # person.changed? # => false + # person.name = 'bob' + # person.changed? # => true + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:286 + def changed?; end + + # Returns a hash of the attributes with unsaved changes indicating their original + # values like attr => original value. + # + # person.name # => "bob" + # person.name = 'robert' + # person.changed_attributes # => {"name" => "bob"} + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:343 + def changed_attributes; end + + # Returns a hash of changed attributes indicating their original + # and new values like attr => [original value, new value]. + # + # person.changes # => {} + # person.name = 'bob' + # person.changes # => { "name" => ["bill", "bob"] } + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:353 + def changes; end + + # Clears dirty data and moves +changes+ to +previous_changes+ and + # +mutations_from_database+ to +mutations_before_last_save+ respectively. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:272 + def changes_applied; end + + # pkg:gem/activemodel#lib/active_model/dirty.rb:331 + def clear_attribute_changes(attr_names); end + + # Clears all dirty data: current changes and previous changes. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:325 + def clear_changes_information; end + + # pkg:gem/activemodel#lib/active_model/dirty.rb:253 + def init_attributes(other); end + + # Returns a hash of attributes that were changed before the model was saved. + # + # person.name # => "bob" + # person.name = 'robert' + # person.save + # person.previous_changes # => {"name" => ["bob", "robert"]} + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:363 + def previous_changes; end + + # Restore all previous data of the provided attributes. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:320 + def restore_attributes(attr_names = T.unsafe(nil)); end + + private + + # Dispatch target for *_change attribute methods. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:399 + def attribute_change(attr_name); end + + # Dispatch target for *_previous_change attribute methods. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:404 + def attribute_previous_change(attr_name); end + + # Dispatch target for *_will_change! attribute methods. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:409 + def attribute_will_change!(attr_name); end + + # pkg:gem/activemodel#lib/active_model/dirty.rb:378 + def clear_attribute_change(attr_name); end + + # pkg:gem/activemodel#lib/active_model/dirty.rb:390 + def forget_attribute_assignments; end + + # pkg:gem/activemodel#lib/active_model/dirty.rb:372 + def init_internals; end + + # pkg:gem/activemodel#lib/active_model/dirty.rb:248 + def initialize_dup(other); end + + # pkg:gem/activemodel#lib/active_model/dirty.rb:394 + def mutations_before_last_save; end + + # pkg:gem/activemodel#lib/active_model/dirty.rb:382 + def mutations_from_database; end + + # Dispatch target for restore_*! attribute methods. + # + # pkg:gem/activemodel#lib/active_model/dirty.rb:414 + def restore_attribute!(attr_name); end + + module GeneratedClassMethods + def attribute_aliases; end + def attribute_aliases=(value); end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns=(value); end + def attribute_method_patterns?; end + end + + module GeneratedInstanceMethods + def attribute_aliases; end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns?; end + end +end + +# = Active \Model \EachValidator +# +# +EachValidator+ is a validator which iterates through the attributes given +# in the options hash invoking the validate_each method passing in the +# record, attribute, and value. +# +# All \Active \Model validations are built on top of this validator. +# +# pkg:gem/activemodel#lib/active_model/validator.rb:134 +class ActiveModel::EachValidator < ::ActiveModel::Validator + # Returns a new validator instance. All options will be available via the + # +options+ reader, however the :attributes option will be removed + # and instead be made available through the +attributes+ reader. + # + # pkg:gem/activemodel#lib/active_model/validator.rb:140 + def initialize(options); end + + # pkg:gem/activemodel#lib/active_model/validator.rb:135 + def attributes; end + + # Hook method that gets called by the initializer allowing verification + # that the arguments supplied are valid. You could for example raise an + # +ArgumentError+ when invalid options are supplied. + # + # pkg:gem/activemodel#lib/active_model/validator.rb:168 + def check_validity!; end + + # Performs validation on the supplied record. By default this will call + # +validate_each+ to determine validity therefore subclasses should + # override +validate_each+ with validation logic. + # + # pkg:gem/activemodel#lib/active_model/validator.rb:150 + def validate(record); end + + # Override this method in subclasses with the validation logic, adding + # errors to the records +errors+ array where necessary. + # + # pkg:gem/activemodel#lib/active_model/validator.rb:161 + def validate_each(record, attribute, value); end + + private + + # pkg:gem/activemodel#lib/active_model/validator.rb:172 + def prepare_value_for_validation(value, record, attr_name); end +end + +# = Active \Model \Error +# +# Represents one single error +# +# pkg:gem/activemodel#lib/active_model/error.rb:8 +class ActiveModel::Error + # pkg:gem/activemodel#lib/active_model/error.rb:102 + def initialize(base, attribute, type = T.unsafe(nil), **options); end + + # pkg:gem/activemodel#lib/active_model/error.rb:189 + def ==(other); end + + # The attribute of +base+ which the error belongs to + # + # pkg:gem/activemodel#lib/active_model/error.rb:120 + def attribute; end + + # The object which the error belongs to + # + # pkg:gem/activemodel#lib/active_model/error.rb:118 + def base; end + + # pkg:gem/activemodel#lib/active_model/error.rb:151 + def detail; end + + # Returns the error details. + # + # error = ActiveModel::Error.new(person, :name, :too_short, count: 5) + # error.details + # # => { error: :too_short, count: 5 } + # + # pkg:gem/activemodel#lib/active_model/error.rb:148 + def details; end + + # pkg:gem/activemodel#lib/active_model/error.rb:192 + def eql?(other); end + + # Returns the full error message. + # + # error = ActiveModel::Error.new(person, :name, :too_short, count: 5) + # error.full_message + # # => "Name is too short (minimum is 5 characters)" + # + # pkg:gem/activemodel#lib/active_model/error.rb:158 + def full_message; end + + # pkg:gem/activemodel#lib/active_model/error.rb:194 + def hash; end + + # pkg:gem/activemodel#lib/active_model/error.rb:12 + def i18n_customize_full_message; end + + # pkg:gem/activemodel#lib/active_model/error.rb:12 + def i18n_customize_full_message=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/error.rb:12 + def i18n_customize_full_message?; end + + # pkg:gem/activemodel#lib/active_model/error.rb:198 + def inspect; end + + # See if error matches provided +attribute+, +type+, and +options+. + # + # Omitted params are not checked for a match. + # + # pkg:gem/activemodel#lib/active_model/error.rb:165 + def match?(attribute, type = T.unsafe(nil), **options); end + + # Returns the error message. + # + # error = ActiveModel::Error.new(person, :name, :too_short, count: 5) + # error.message + # # => "is too short (minimum is 5 characters)" + # + # pkg:gem/activemodel#lib/active_model/error.rb:134 + def message; end + + # The options provided when calling errors#add + # + # pkg:gem/activemodel#lib/active_model/error.rb:127 + def options; end + + # The raw value provided as the second parameter when calling + # errors#add + # + # pkg:gem/activemodel#lib/active_model/error.rb:125 + def raw_type; end + + # See if error matches provided +attribute+, +type+, and +options+ exactly. + # + # All params must be equal to Error's own attributes to be considered a + # strict match. + # + # pkg:gem/activemodel#lib/active_model/error.rb:183 + def strict_match?(attribute, type, **options); end + + # The type of error, defaults to +:invalid+ unless specified + # + # pkg:gem/activemodel#lib/active_model/error.rb:122 + def type; end + + protected + + # pkg:gem/activemodel#lib/active_model/error.rb:203 + def attributes_for_hash; end + + private + + # pkg:gem/activemodel#lib/active_model/error.rb:110 + def initialize_dup(other); end + + class << self + # pkg:gem/activemodel#lib/active_model/error.rb:14 + def full_message(attribute, message, base); end + + # pkg:gem/activemodel#lib/active_model/error.rb:63 + def generate_message(attribute, type, base, options); end + + # pkg:gem/activemodel#lib/active_model/error.rb:12 + def i18n_customize_full_message; end + + # pkg:gem/activemodel#lib/active_model/error.rb:12 + def i18n_customize_full_message=(value); end + + # pkg:gem/activemodel#lib/active_model/error.rb:12 + def i18n_customize_full_message?; end + + private + + # pkg:gem/activemodel#lib/active_model/error.rb:12 + def __class_attr_i18n_customize_full_message; end + + # pkg:gem/activemodel#lib/active_model/error.rb:12 + def __class_attr_i18n_customize_full_message=(new_value); end + end +end + +# pkg:gem/activemodel#lib/active_model/error.rb:9 +ActiveModel::Error::CALLBACKS_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activemodel#lib/active_model/error.rb:10 +ActiveModel::Error::MESSAGE_OPTIONS = T.let(T.unsafe(nil), Array) + +# = Active \Model \Errors +# +# Provides error related functionalities you can include in your object +# for handling error messages and interacting with Action View helpers. +# +# A minimal implementation could be: +# +# class Person +# # Required dependency for ActiveModel::Errors +# extend ActiveModel::Naming +# +# def initialize +# @errors = ActiveModel::Errors.new(self) +# end +# +# attr_accessor :name +# attr_reader :errors +# +# def validate! +# errors.add(:name, :blank, message: "cannot be nil") if name.nil? +# end +# +# # The following methods are needed to be minimally implemented +# +# def read_attribute_for_validation(attr) +# send(attr) +# end +# +# def self.human_attribute_name(attr, options = {}) +# attr +# end +# +# def self.lookup_ancestors +# [self] +# end +# end +# +# The last three methods are required in your object for +Errors+ to be +# able to generate error messages correctly and also handle multiple +# languages. Of course, if you extend your object with ActiveModel::Translation +# you will not need to implement the last two. Likewise, using +# ActiveModel::Validations will handle the validation related methods +# for you. +# +# The above allows you to do: +# +# person = Person.new +# person.validate! # => ["cannot be nil"] +# person.errors.full_messages # => ["name cannot be nil"] +# # etc.. +# +# pkg:gem/activemodel#lib/active_model/errors.rb:60 +class ActiveModel::Errors + include ::Enumerable + + # Pass in the instance of the object that is using the errors object. + # + # class Person + # def initialize + # @errors = ActiveModel::Errors.new(self) + # end + # end + # + # pkg:gem/activemodel#lib/active_model/errors.rb:114 + def initialize(base); end + + # When passed a symbol or a name of a method, returns an array of errors + # for the method. + # + # person.errors[:name] # => ["cannot be nil"] + # person.errors['name'] # => ["cannot be nil"] + # + # pkg:gem/activemodel#lib/active_model/errors.rb:227 + def [](attribute); end + + # Adds a new error of +type+ on +attribute+. + # More than one error can be added to the same +attribute+. + # If no +type+ is supplied, :invalid is assumed. + # + # person.errors.add(:name) + # # Adds <#ActiveModel::Error attribute=name, type=invalid> + # person.errors.add(:name, :not_implemented, message: "must be implemented") + # # Adds <#ActiveModel::Error attribute=name, type=not_implemented, + # options={:message=>"must be implemented"}> + # + # person.errors.messages + # # => {:name=>["is invalid", "must be implemented"]} + # + # If +type+ is a string, it will be used as error message. + # + # If +type+ is a symbol, it will be translated using the appropriate + # scope (see +generate_message+). + # + # person.errors.add(:name, :blank) + # person.errors.messages + # # => {:name=>["can't be blank"]} + # + # person.errors.add(:name, :too_long, count: 25) + # person.errors.messages + # # => {:name=>["is too long (maximum is 25 characters)"]} + # + # If +type+ is a proc, it will be called, allowing for things like + # Time.now to be used within an error. + # + # If the :strict option is set to +true+, it will raise + # ActiveModel::StrictValidationFailed instead of adding the error. + # :strict option can also be set to any other exception. + # + # person.errors.add(:name, :invalid, strict: true) + # # => ActiveModel::StrictValidationFailed: Name is invalid + # person.errors.add(:name, :invalid, strict: NameIsInvalid) + # # => NameIsInvalid: Name is invalid + # + # person.errors.messages # => {} + # + # +attribute+ should be set to :base if the error is not + # directly associated with a single attribute. + # + # person.errors.add(:base, :name_or_email_blank, + # message: "either name or email must be present") + # person.errors.messages + # # => {:base=>["either name or email must be present"]} + # person.errors.details + # # => {:base=>[{error: :name_or_email_blank}]} + # + # pkg:gem/activemodel#lib/active_model/errors.rb:340 + def add(attribute, type = T.unsafe(nil), **options); end + + # Returns +true+ if an error matches provided +attribute+ and +type+, + # or +false+ otherwise. +type+ is treated the same as for +add+. + # + # person.errors.add :name, :blank + # person.errors.added? :name, :blank # => true + # person.errors.added? :name, "can't be blank" # => true + # + # If the error requires options, then it returns +true+ with + # the correct options, or +false+ with incorrect or missing options. + # + # person.errors.add :name, :too_long, count: 25 + # person.errors.added? :name, :too_long, count: 25 # => true + # person.errors.added? :name, "is too long (maximum is 25 characters)" # => true + # person.errors.added? :name, :too_long, count: 24 # => false + # person.errors.added? :name, :too_long # => false + # person.errors.added? :name, "is too long" # => false + # + # pkg:gem/activemodel#lib/active_model/errors.rb:370 + def added?(attribute, type = T.unsafe(nil), options = T.unsafe(nil)); end + + # Returns a Hash that can be used as the JSON representation for this + # object. You can pass the :full_messages option. This determines + # if the JSON object should contain full messages or not (false by default). + # + # person.errors.as_json # => {:name=>["cannot be nil"]} + # person.errors.as_json(full_messages: true) # => {:name=>["name cannot be nil"]} + # + # pkg:gem/activemodel#lib/active_model/errors.rb:245 + def as_json(options = T.unsafe(nil)); end + + # Returns all error attribute names + # + # person.errors.messages # => {:name=>["cannot be nil", "must be specified"]} + # person.errors.attribute_names # => [:name] + # + # pkg:gem/activemodel#lib/active_model/errors.rb:235 + def attribute_names; end + + # pkg:gem/activemodel#lib/active_model/errors.rb:100 + def clear(*, **, &); end + + # Copies the errors from other. + # For copying errors but keep @base as is. + # + # ==== Parameters + # + # * +other+ - The ActiveModel::Errors instance. + # + # ==== Examples + # + # person.errors.copy!(other) + # + # pkg:gem/activemodel#lib/active_model/errors.rb:135 + def copy!(other); end + + # Delete messages for +key+. Returns the deleted messages. + # + # person.errors[:name] # => ["cannot be nil"] + # person.errors.delete(:name) # => ["cannot be nil"] + # person.errors[:name] # => [] + # + # pkg:gem/activemodel#lib/active_model/errors.rb:213 + def delete(attribute, type = T.unsafe(nil), **options); end + + # Returns a Hash of attributes with an array of their error details. + # + # pkg:gem/activemodel#lib/active_model/errors.rb:274 + def details; end + + # pkg:gem/activemodel#lib/active_model/errors.rb:100 + def each(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/errors.rb:100 + def empty?(*, **, &); end + + # The actual array of +Error+ objects + # This method is aliased to objects. + # + # pkg:gem/activemodel#lib/active_model/errors.rb:104 + def errors; end + + # Returns a full message for a given attribute. + # + # person.errors.full_message(:name, 'is invalid') # => "Name is invalid" + # + # pkg:gem/activemodel#lib/active_model/errors.rb:449 + def full_message(attribute, message); end + + # Returns all the full error messages in an array. + # + # class Person + # validates_presence_of :name, :address, :email + # validates_length_of :name, in: 5..30 + # end + # + # person = Person.create(address: '123 First St.') + # person.errors.full_messages + # # => ["Name is too short (minimum is 5 characters)", "Name can't be blank", "Email can't be blank"] + # + # pkg:gem/activemodel#lib/active_model/errors.rb:413 + def full_messages; end + + # Returns all the full error messages for a given attribute in an array. + # + # class Person + # validates_presence_of :name, :email + # validates_length_of :name, in: 5..30 + # end + # + # person = Person.create() + # person.errors.full_messages_for(:name) + # # => ["Name is too short (minimum is 5 characters)", "Name can't be blank"] + # + # pkg:gem/activemodel#lib/active_model/errors.rb:428 + def full_messages_for(attribute); end + + # Translates an error message in its default scope + # (activemodel.errors.messages). + # + # Error messages are first looked up in activemodel.errors.models.MODEL.attributes.ATTRIBUTE.MESSAGE, + # if it's not there, it's looked up in activemodel.errors.models.MODEL.MESSAGE and if + # that is not there also, it returns the translation of the default message + # (e.g. activemodel.errors.messages.MESSAGE). The translated model + # name, translated attribute name, and the value are available for + # interpolation. + # + # When using inheritance in your models, it will check all the inherited + # models too, but only if the model itself hasn't been found. Say you have + # class Admin < User; end and you wanted the translation for + # the :blank error message for the title attribute, + # it looks for these translations: + # + # * activemodel.errors.models.admin.attributes.title.blank + # * activemodel.errors.models.admin.blank + # * activemodel.errors.models.user.attributes.title.blank + # * activemodel.errors.models.user.blank + # * any default you provided through the +options+ hash (in the activemodel.errors scope) + # * activemodel.errors.messages.blank + # * errors.attributes.title.blank + # * errors.messages.blank + # + # pkg:gem/activemodel#lib/active_model/errors.rb:477 + def generate_message(attribute, type = T.unsafe(nil), options = T.unsafe(nil)); end + + # Returns a Hash of attributes with an array of their Error objects. + # + # person.errors.group_by_attribute + # # => {:name=>[<#ActiveModel::Error>, <#ActiveModel::Error>]} + # + # pkg:gem/activemodel#lib/active_model/errors.rb:287 + def group_by_attribute; end + + # pkg:gem/activemodel#lib/active_model/errors.rb:205 + def has_key?(attribute); end + + # Imports one error. + # Imported errors are wrapped as a NestedError, + # providing access to original error object. + # If attribute or type needs to be overridden, use +override_options+. + # + # ==== Options + # + # * +:attribute+ - Override the attribute the error belongs to. + # * +:type+ - Override type of the error. + # + # pkg:gem/activemodel#lib/active_model/errors.rb:151 + def import(error, override_options = T.unsafe(nil)); end + + # Returns +true+ if the error messages include an error for the given key + # +attribute+, +false+ otherwise. + # + # person.errors.messages # => {:name=>["cannot be nil"]} + # person.errors.include?(:name) # => true + # person.errors.include?(:age) # => false + # + # pkg:gem/activemodel#lib/active_model/errors.rb:200 + def include?(attribute); end + + # pkg:gem/activemodel#lib/active_model/errors.rb:481 + def inspect; end + + # pkg:gem/activemodel#lib/active_model/errors.rb:206 + def key?(attribute); end + + # Merges the errors from other, + # each Error wrapped as NestedError. + # + # ==== Parameters + # + # * +other+ - The ActiveModel::Errors instance. + # + # ==== Examples + # + # person.errors.merge!(other) + # + # pkg:gem/activemodel#lib/active_model/errors.rb:172 + def merge!(other); end + + # Returns a Hash of attributes with an array of their error messages. + # + # pkg:gem/activemodel#lib/active_model/errors.rb:266 + def messages; end + + # Returns all the error messages for a given attribute in an array. + # + # class Person + # validates_presence_of :name, :email + # validates_length_of :name, in: 5..30 + # end + # + # person = Person.create() + # person.errors.messages_for(:name) + # # => ["is too short (minimum is 5 characters)", "can't be blank"] + # + # pkg:gem/activemodel#lib/active_model/errors.rb:442 + def messages_for(attribute); end + + # pkg:gem/activemodel#lib/active_model/errors.rb:105 + def objects; end + + # Returns +true+ if an error on the attribute with the given type is + # present, or +false+ otherwise. +type+ is treated the same as for +add+. + # + # person.errors.add :age + # person.errors.add :name, :too_long, count: 25 + # person.errors.of_kind? :age # => true + # person.errors.of_kind? :name # => false + # person.errors.of_kind? :name, :too_long # => true + # person.errors.of_kind? :name, "is too long (maximum is 25 characters)" # => true + # person.errors.of_kind? :name, :not_too_long # => false + # person.errors.of_kind? :name, "is too long" # => false + # + # pkg:gem/activemodel#lib/active_model/errors.rb:393 + def of_kind?(attribute, type = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/errors.rb:100 + def size(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/errors.rb:416 + def to_a; end + + # Returns a Hash of attributes with their error messages. If +full_messages+ + # is +true+, it will contain full messages (see +full_message+). + # + # person.errors.to_hash # => {:name=>["cannot be nil"]} + # person.errors.to_hash(true) # => {:name=>["name cannot be nil"]} + # + # pkg:gem/activemodel#lib/active_model/errors.rb:254 + def to_hash(full_messages = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/errors.rb:100 + def uniq!(*, **, &); end + + # Search for errors matching +attribute+, +type+, or +options+. + # + # Only supplied params will be matched. + # + # person.errors.where(:name) # => all name errors. + # person.errors.where(:name, :too_short) # => all name errors being too short + # person.errors.where(:name, :too_short, minimum: 2) # => all name errors being too short and minimum is 2 + # + # pkg:gem/activemodel#lib/active_model/errors.rb:187 + def where(attribute, type = T.unsafe(nil), **options); end + + private + + # pkg:gem/activemodel#lib/active_model/errors.rb:119 + def initialize_dup(other); end + + # pkg:gem/activemodel#lib/active_model/errors.rb:488 + def normalize_arguments(attribute, type, **options); end +end + +# pkg:gem/activemodel#lib/active_model/errors.rb:263 +ActiveModel::Errors::EMPTY_ARRAY = T.let(T.unsafe(nil), Array) + +# = Active \Model \ForbiddenAttributesError +# +# Raised when forbidden attributes are used for mass assignment. +# +# class Person < ActiveRecord::Base +# end +# +# params = ActionController::Parameters.new(name: 'Bob') +# Person.new(params) +# # => ActiveModel::ForbiddenAttributesError +# +# params.permit! +# Person.new(params) +# # => # +# +# pkg:gem/activemodel#lib/active_model/forbidden_attributes_protection.rb:18 +class ActiveModel::ForbiddenAttributesError < ::StandardError; end + +# pkg:gem/activemodel#lib/active_model/forbidden_attributes_protection.rb:21 +module ActiveModel::ForbiddenAttributesProtection + private + + # pkg:gem/activemodel#lib/active_model/forbidden_attributes_protection.rb:23 + def sanitize_for_mass_assignment(attributes); end + + # pkg:gem/activemodel#lib/active_model/forbidden_attributes_protection.rb:31 + def sanitize_forbidden_attributes(attributes); end +end + +# pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:91 +class ActiveModel::ForcedMutationTracker < ::ActiveModel::AttributeMutationTracker + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:92 + def initialize(attributes); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:101 + def change_to_attribute(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:97 + def changed_in_place?(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:125 + def finalize_changes; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:121 + def force_change(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:109 + def forget_change(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:113 + def original_value(attr_name); end + + private + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:132 + def attr_names; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:136 + def attribute_changed?(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:144 + def clone_value(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:140 + def fetch_value(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:130 + def finalized_changes; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:151 + def type_cast(attr_name, value); end +end + +# pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:94 +class ActiveModel::LazyAttributeHash + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:97 + def initialize(types, values, additional_types, default_attributes, delegate_hash = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:134 + def ==(other); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:110 + def [](key); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:114 + def []=(key, value); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:118 + def deep_dup; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:129 + def each_key(&block); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:95 + def each_value(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:95 + def except(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:95 + def fetch(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:106 + def key?(key); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:142 + def marshal_dump; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:146 + def marshal_load(values); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:95 + def transform_values(*, **, &); end + + protected + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:151 + def materialize; end + + private + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:163 + def additional_types; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:165 + def assign_default_value(name); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:163 + def default_attributes; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:163 + def delegate_hash; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:124 + def initialize_dup(_); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:163 + def types; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:163 + def values; end +end + +# pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:21 +class ActiveModel::LazyAttributeSet < ::ActiveModel::AttributeSet + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:22 + def initialize(values, types, additional_types, default_attributes, attributes = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:41 + def fetch_value(name, &block); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:32 + def key?(name); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:36 + def keys; end + + protected + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:61 + def attributes; end + + private + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:71 + def additional_types; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:73 + def default_attribute(name, value_present = T.unsafe(nil), value = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:71 + def default_attributes; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:71 + def types; end + + # pkg:gem/activemodel#lib/active_model/attribute_set/builder.rb:71 + def values; end +end + +# pkg:gem/activemodel#lib/active_model/lint.rb:4 +module ActiveModel::Lint; end + +# == Active \Model \Lint \Tests +# +# You can test whether an object is compliant with the Active \Model API by +# including +ActiveModel::Lint::Tests+ in your TestCase. It will +# include tests that tell you whether your object is fully compliant, +# or if not, which aspects of the API are not implemented. +# +# Note an object is not required to implement all APIs in order to work +# with Action Pack. This module only intends to provide guidance in case +# you want all features out of the box. +# +# These tests do not attempt to determine the semantic correctness of the +# returned values. For instance, you could implement valid? to +# always return +true+, and the tests would pass. It is up to you to ensure +# that the values are semantically meaningful. +# +# Objects you pass in are expected to return a compliant object from a call +# to to_model. It is perfectly fine for to_model to return +# +self+. +# +# pkg:gem/activemodel#lib/active_model/lint.rb:24 +module ActiveModel::Lint::Tests + # Passes if the object's model responds to errors and if calling + # [](attribute) on the result of this method returns an array. + # Fails otherwise. + # + # errors[attribute] is used to retrieve the errors of a model + # for a given attribute. If errors are present, the method should return + # an array of strings that are the errors for the attribute in question. + # If localization is used, the strings should be localized for the current + # locale. If no error is present, the method should return an empty array. + # + # pkg:gem/activemodel#lib/active_model/lint.rb:102 + def test_errors_aref; end + + # Passes if the object's model responds to model_name both as + # an instance method and as a class method, and if calling this method + # returns a string with some convenience methods: :human, + # :singular and :plural. + # + # Check ActiveModel::Naming for more information. + # + # pkg:gem/activemodel#lib/active_model/lint.rb:81 + def test_model_naming; end + + # Passes if the object's model responds to persisted? and if + # calling this method returns either +true+ or +false+. Fails otherwise. + # + # persisted? is used when calculating the URL for an object. + # If the object is not persisted, a form for that object, for instance, + # will route to the create action. If it is persisted, a form for the + # object will route to the update action. + # + # pkg:gem/activemodel#lib/active_model/lint.rb:70 + def test_persisted?; end + + # Passes if the object's model responds to to_key and if calling + # this method returns +nil+ when the object is not persisted. + # Fails otherwise. + # + # to_key returns an Enumerable of all (primary) key attributes + # of the model, and is used to a generate unique DOM id for the object. + # + # pkg:gem/activemodel#lib/active_model/lint.rb:31 + def test_to_key; end + + # Passes if the object's model responds to to_param and if + # calling this method returns +nil+ when the object is not persisted. + # Fails otherwise. + # + # to_param is used to represent the object's key in URLs. + # Implementers can decide to either raise an exception or provide a + # default in case the record uses a composite primary key. There are no + # tests for this behavior in lint because it doesn't make sense to force + # any of the possible implementation strategies on the implementer. + # + # pkg:gem/activemodel#lib/active_model/lint.rb:46 + def test_to_param; end + + # Passes if the object's model responds to to_partial_path and if + # calling this method returns a string. Fails otherwise. + # + # to_partial_path is used for looking up partials. For example, + # a BlogPost model might return "blog_posts/blog_post". + # + # pkg:gem/activemodel#lib/active_model/lint.rb:58 + def test_to_partial_path; end + + private + + # pkg:gem/activemodel#lib/active_model/lint.rb:117 + def assert_boolean(result, name); end + + # pkg:gem/activemodel#lib/active_model/lint.rb:108 + def def_method(receiver, name, &block); end + + # pkg:gem/activemodel#lib/active_model/lint.rb:112 + def model; end +end + +# Raised when an attribute is not defined. +# +# class User < ActiveRecord::Base +# has_many :pets +# end +# +# user = User.first +# user.pets.select(:id).first.user_id +# # => ActiveModel::MissingAttributeError: missing attribute 'user_id' for Pet +# +# pkg:gem/activemodel#lib/active_model/attribute_methods.rb:15 +class ActiveModel::MissingAttributeError < ::NoMethodError; end + +# = Active \Model \Basic \Model +# +# Allows implementing models similar to ActiveRecord::Base. +# Includes ActiveModel::API for the required interface for an +# object to interact with Action Pack and Action View, but can be +# extended with other functionalities. +# +# A minimal implementation could be: +# +# class Person +# include ActiveModel::Model +# attr_accessor :name, :age +# end +# +# person = Person.new(name: 'bob', age: '18') +# person.name # => "bob" +# person.age # => "18" +# +# If for some reason you need to run code on initialize, make +# sure you call +super+ if you want the attributes hash initialization to +# happen. +# +# class Person +# include ActiveModel::Model +# attr_accessor :id, :name, :omg +# +# def initialize(attributes={}) +# super +# @omg ||= true +# end +# end +# +# person = Person.new(id: 1, name: 'bob') +# person.omg # => true +# +# For more detailed information on other functionalities available, please +# refer to the specific modules included in +ActiveModel::Model+ +# (see below). +# +# pkg:gem/activemodel#lib/active_model/model.rb:42 +module ActiveModel::Model + include ::ActiveModel::Access + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveSupport::Callbacks + include ::ActiveModel::Validations::HelperMethods + include ::ActiveModel::Validations + include ::ActiveModel::Conversion + include ::ActiveModel::API + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::Validations::ClassMethods + mixes_in_class_methods ::ActiveModel::Callbacks + mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::DescendantsTracker + mixes_in_class_methods ::ActiveModel::Translation + mixes_in_class_methods ::ActiveModel::Validations::HelperMethods + mixes_in_class_methods ::ActiveModel::Conversion::ClassMethods + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + def _validators; end + def _validators=(value); end + def _validators?; end + def param_delimiter; end + def param_delimiter=(value); end + def param_delimiter?; end + end + + module GeneratedInstanceMethods + def __callbacks; end + def _validators; end + def _validators?; end + def param_delimiter=(value); end + end +end + +# pkg:gem/activemodel#lib/active_model/naming.rb:8 +class ActiveModel::Name + include ::Comparable + + # Returns a new ActiveModel::Name instance. By default, the +namespace+ + # and +name+ option will take the namespace and name of the given class + # respectively. + # Use +locale+ argument for singularize and pluralize model name. + # + # module Foo + # class Bar + # end + # end + # + # ActiveModel::Name.new(Foo::Bar).to_s + # # => "Foo::Bar" + # + # pkg:gem/activemodel#lib/active_model/naming.rb:165 + def initialize(klass, namespace = T.unsafe(nil), name = T.unsafe(nil), locale = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def !~(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def <=>(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def ==(arg); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def ===(arg); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def =~(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def as_json(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:15 + def cache_key; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def collection; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def collection=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def element; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def element=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def eql?(*, **, &); end + + # Transform the model name into a more human format, using I18n. By default, + # it will underscore then humanize the class name. + # + # class BlogPost + # extend ActiveModel::Naming + # end + # + # BlogPost.model_name.human # => "Blog post" + # + # Specify +options+ with additional translating options. + # + # pkg:gem/activemodel#lib/active_model/naming.rb:196 + def human(options = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def i18n_key; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def i18n_key=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def match?(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def name; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def name=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def param_key; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def param_key=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def plural; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def plural=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def route_key; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def route_key=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def singular; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def singular=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def singular_route_key; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:11 + def singular_route_key=(_arg0); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def to_s(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:150 + def to_str(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:208 + def uncountable?; end + + private + + # pkg:gem/activemodel#lib/active_model/naming.rb:215 + def _singularize(string); end + + # pkg:gem/activemodel#lib/active_model/naming.rb:219 + def i18n_keys; end + + # pkg:gem/activemodel#lib/active_model/naming.rb:227 + def i18n_scope; end +end + +# pkg:gem/activemodel#lib/active_model/naming.rb:213 +ActiveModel::Name::MISSING_TRANSLATION = T.let(T.unsafe(nil), Integer) + +# = Active \Model \Naming +# +# Creates a +model_name+ method on your object. +# +# To implement, just extend ActiveModel::Naming in your object: +# +# class BookCover +# extend ActiveModel::Naming +# end +# +# BookCover.model_name.name # => "BookCover" +# BookCover.model_name.human # => "Book cover" +# +# BookCover.model_name.i18n_key # => :book_cover +# BookModule::BookCover.model_name.i18n_key # => :"book_module/book_cover" +# +# Providing the functionality that ActiveModel::Naming provides in your object +# is required to pass the \Active \Model Lint test. So either extending the +# provided method below, or rolling your own is required. +# +# pkg:gem/activemodel#lib/active_model/naming.rb:251 +module ActiveModel::Naming + # Returns an ActiveModel::Name object for module. It can be + # used to retrieve all kinds of naming-related information + # (See ActiveModel::Name for more information). + # + # class Person + # extend ActiveModel::Naming + # end + # + # Person.model_name.name # => "Person" + # Person.model_name.class # => ActiveModel::Name + # Person.model_name.singular # => "person" + # Person.model_name.plural # => "people" + # + # pkg:gem/activemodel#lib/active_model/naming.rb:269 + def model_name; end + + private + + # pkg:gem/activemodel#lib/active_model/naming.rb:351 + def inherited(base); end + + class << self + # pkg:gem/activemodel#lib/active_model/naming.rb:252 + def extended(base); end + + # Returns string to use for params names. It differs for + # namespaced models regarding whether it's inside isolated engine. + # + # # For isolated engine: + # ActiveModel::Naming.param_key(Blog::Post) # => "post" + # + # # For shared engine: + # ActiveModel::Naming.param_key(Blog::Post) # => "blog_post" + # + # pkg:gem/activemodel#lib/active_model/naming.rb:337 + def param_key(record_or_class); end + + # Returns the plural class name of a record or class. + # + # ActiveModel::Naming.plural(post) # => "posts" + # ActiveModel::Naming.plural(Highrise::Person) # => "highrise_people" + # + # pkg:gem/activemodel#lib/active_model/naming.rb:282 + def plural(record_or_class); end + + # Returns string to use while generating route names. It differs for + # namespaced models regarding whether it's inside isolated engine. + # + # # For isolated engine: + # ActiveModel::Naming.route_key(Blog::Post) # => "posts" + # + # # For shared engine: + # ActiveModel::Naming.route_key(Blog::Post) # => "blog_posts" + # + # The route key also considers if the noun is uncountable and, in + # such cases, automatically appends _index. + # + # pkg:gem/activemodel#lib/active_model/naming.rb:325 + def route_key(record_or_class); end + + # Returns the singular class name of a record or class. + # + # ActiveModel::Naming.singular(post) # => "post" + # ActiveModel::Naming.singular(Highrise::Person) # => "highrise_person" + # + # pkg:gem/activemodel#lib/active_model/naming.rb:290 + def singular(record_or_class); end + + # Returns string to use while generating route names. It differs for + # namespaced models regarding whether it's inside isolated engine. + # + # # For isolated engine: + # ActiveModel::Naming.singular_route_key(Blog::Post) # => "post" + # + # # For shared engine: + # ActiveModel::Naming.singular_route_key(Blog::Post) # => "blog_post" + # + # pkg:gem/activemodel#lib/active_model/naming.rb:310 + def singular_route_key(record_or_class); end + + # Identifies whether the class name of a record or class is uncountable. + # + # ActiveModel::Naming.uncountable?(Sheep) # => true + # ActiveModel::Naming.uncountable?(Post) # => false + # + # pkg:gem/activemodel#lib/active_model/naming.rb:298 + def uncountable?(record_or_class); end + + private + + # pkg:gem/activemodel#lib/active_model/naming.rb:341 + def model_name_from_record_or_class(record_or_class); end + end +end + +# pkg:gem/activemodel#lib/active_model/nested_error.rb:6 +class ActiveModel::NestedError < ::ActiveModel::Error + # pkg:gem/activemodel#lib/active_model/nested_error.rb:7 + def initialize(base, inner_error, override_options = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/nested_error.rb:16 + def inner_error; end + + # pkg:gem/activemodel#lib/active_model/nested_error.rb:18 + def message(*, **, &); end +end + +# pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:156 +class ActiveModel::NullMutationTracker + include ::Singleton + extend ::Singleton::SingletonClassMethods + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:174 + def any_changes?; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:171 + def change_to_attribute(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:178 + def changed?(attr_name, **); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:159 + def changed_attribute_names; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:182 + def changed_in_place?(attr_name); end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:163 + def changed_values; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:167 + def changes; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:186 + def original_value(attr_name); end + + class << self + private + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:157 + def allocate; end + + # pkg:gem/activemodel#lib/active_model/attribute_mutation_tracker.rb:157 + def new(*_arg0); end + end +end + +# pkg:gem/activemodel#lib/active_model/railtie.rb:7 +class ActiveModel::Railtie < ::Rails::Railtie; end + +# = Active \Model \RangeError +# +# Raised when attribute values are out of range. +# +# pkg:gem/activemodel#lib/active_model/errors.rb:521 +class ActiveModel::RangeError < ::RangeError; end + +# pkg:gem/activemodel#lib/active_model/secure_password.rb:6 +module ActiveModel::SecurePassword + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveModel::SecurePassword::ClassMethods + + class << self + # pkg:gem/activemodel#lib/active_model/secure_password.rb:17 + def min_cost; end + + # pkg:gem/activemodel#lib/active_model/secure_password.rb:17 + def min_cost=(_arg0); end + end +end + +# pkg:gem/activemodel#lib/active_model/secure_password.rb:21 +module ActiveModel::SecurePassword::ClassMethods + # Adds methods to set and authenticate against a BCrypt password. + # This mechanism requires you to have a +XXX_digest+ attribute, + # where +XXX+ is the attribute name of your desired password. + # + # The following validations are added automatically: + # * Password must be present on creation + # * Password length should be less than or equal to 72 bytes + # * Confirmation of password (using a +XXX_confirmation+ attribute) + # + # If confirmation validation is not needed, simply leave out the + # value for +XXX_confirmation+ (i.e. don't provide a form field for + # it). When this attribute has a +nil+ value, the validation will not be + # triggered. + # + # Additionally, a +XXX_challenge+ attribute is created. When set to a + # value other than +nil+, it will validate against the currently persisted + # password. This validation relies on dirty tracking, as provided by + # ActiveModel::Dirty; if dirty tracking methods are not defined, this + # validation will fail. + # + # All of the above validations can be omitted by passing + # validations: false as an argument. This allows complete + # customizability of validation behavior. + # + # A password reset token (valid for 15 minutes by default) is automatically + # configured when +reset_token+ is set to true (which it is by default) + # and the object responds to +generates_token_for+ (which Active Records do). + # + # Finally, the reset token expiry can be customized by passing a hash to + # +has_secure_password+: + # + # has_secure_password reset_token: { expires_in: 1.hour } + # + # To use +has_secure_password+, add bcrypt (~> 3.1.7) to your Gemfile: + # + # gem "bcrypt", "~> 3.1.7" + # + # ==== Examples + # + # ===== Using Active Record (which automatically includes ActiveModel::SecurePassword) + # + # # Schema: User(name:string, password_digest:string, recovery_password_digest:string) + # class User < ActiveRecord::Base + # has_secure_password + # has_secure_password :recovery_password, validations: false + # end + # + # user = User.new(name: "david", password: "", password_confirmation: "nomatch") + # + # user.save # => false, password required + # user.password = "vr00m" + # user.save # => false, confirmation doesn't match + # user.password_confirmation = "vr00m" + # user.save # => true + # + # user.authenticate("notright") # => false + # user.authenticate("vr00m") # => user + # User.find_by(name: "david")&.authenticate("notright") # => false + # User.find_by(name: "david")&.authenticate("vr00m") # => user + # + # user.recovery_password = "42password" + # user.recovery_password_digest # => "$2a$04$iOfhwahFymCs5weB3BNH/uXkTG65HR.qpW.bNhEjFP3ftli3o5DQC" + # user.save # => true + # + # user.authenticate_recovery_password("42password") # => user + # + # user.update(password: "pwn3d", password_challenge: "") # => false, challenge doesn't authenticate + # user.update(password: "nohack4u", password_challenge: "vr00m") # => true + # + # user.authenticate("vr00m") # => false, old password + # user.authenticate("nohack4u") # => user + # + # ===== Conditionally requiring a password + # + # class Account + # include ActiveModel::SecurePassword + # + # attr_accessor :is_guest, :password_digest + # + # has_secure_password + # + # def errors + # super.tap { |errors| errors.delete(:password, :blank) if is_guest } + # end + # end + # + # account = Account.new + # account.valid? # => false, password required + # + # account.is_guest = true + # account.valid? # => true + # + # ===== Using the password reset token + # + # user = User.create!(name: "david", password: "123", password_confirmation: "123") + # token = user.password_reset_token + # User.find_by_password_reset_token(token) # returns user + # + # # 16 minutes later... + # User.find_by_password_reset_token(token) # returns nil + # + # # raises ActiveSupport::MessageVerifier::InvalidSignature since the token is expired + # User.find_by_password_reset_token!(token) + # + # pkg:gem/activemodel#lib/active_model/secure_password.rb:125 + def has_secure_password(attribute = T.unsafe(nil), validations: T.unsafe(nil), reset_token: T.unsafe(nil)); end +end + +# pkg:gem/activemodel#lib/active_model/secure_password.rb:14 +ActiveModel::SecurePassword::DEFAULT_RESET_TOKEN_EXPIRES_IN = T.let(T.unsafe(nil), ActiveSupport::Duration) + +# pkg:gem/activemodel#lib/active_model/secure_password.rb:196 +class ActiveModel::SecurePassword::InstanceMethodsOnActivation < ::Module + # pkg:gem/activemodel#lib/active_model/secure_password.rb:197 + def initialize(attribute, reset_token:); end +end + +# BCrypt hash function can handle maximum 72 bytes, and if we pass +# password of length more than 72 bytes it ignores extra characters. +# Hence need to put a restriction on password length. +# +# pkg:gem/activemodel#lib/active_model/secure_password.rb:12 +ActiveModel::SecurePassword::MAX_PASSWORD_LENGTH_ALLOWED = T.let(T.unsafe(nil), Integer) + +# = Active \Model \Serialization +# +# Provides a basic serialization to a serializable_hash for your objects. +# +# A minimal implementation could be: +# +# class Person +# include ActiveModel::Serialization +# +# attr_accessor :name +# +# def attributes +# {'name' => nil} +# end +# end +# +# Which would provide you with: +# +# person = Person.new +# person.serializable_hash # => {"name"=>nil} +# person.name = "Bob" +# person.serializable_hash # => {"name"=>"Bob"} +# +# An +attributes+ hash must be defined and should contain any attributes you +# need to be serialized. Attributes must be strings, not symbols. +# When called, serializable hash will use instance methods that match the name +# of the attributes hash's keys. In order to override this behavior, override +# the +read_attribute_for_serialization+ method. +# +# ActiveModel::Serializers::JSON module automatically includes +# the +ActiveModel::Serialization+ module, so there is no need to +# explicitly include +ActiveModel::Serialization+. +# +# A minimal implementation including JSON would be: +# +# class Person +# include ActiveModel::Serializers::JSON +# +# attr_accessor :name +# +# def attributes +# {'name' => nil} +# end +# end +# +# Which would provide you with: +# +# person = Person.new +# person.serializable_hash # => {"name"=>nil} +# person.as_json # => {"name"=>nil} +# person.to_json # => "{\"name\":null}" +# +# person.name = "Bob" +# person.serializable_hash # => {"name"=>"Bob"} +# person.as_json # => {"name"=>"Bob"} +# person.to_json # => "{\"name\":\"Bob\"}" +# +# Valid options are :only, :except, :methods and +# :include. The following are all valid examples: +# +# person.serializable_hash(only: 'name') +# person.serializable_hash(include: :address) +# person.serializable_hash(include: { address: { only: 'city' }}) +# +# pkg:gem/activemodel#lib/active_model/serialization.rb:69 +module ActiveModel::Serialization + # Hook method defining how an attribute value should be retrieved for + # serialization. By default this is assumed to be an instance named after + # the attribute. Override this method in subclasses should you need to + # retrieve the value for a given attribute differently: + # + # class MyClass + # include ActiveModel::Serialization + # + # def initialize(data = {}) + # @data = data + # end + # + # def read_attribute_for_serialization(key) + # @data[key] + # end + # end + # + # pkg:gem/activemodel#lib/active_model/serialization.rb:167 + def read_attribute_for_serialization(key); end + + # Returns a serialized hash of your object. + # + # class Person + # include ActiveModel::Serialization + # + # attr_accessor :name, :age + # + # def attributes + # {'name' => nil, 'age' => nil} + # end + # + # def capitalized_name + # name.capitalize + # end + # end + # + # person = Person.new + # person.name = 'bob' + # person.age = 22 + # person.serializable_hash # => {"name"=>"bob", "age"=>22} + # person.serializable_hash(only: :name) # => {"name"=>"bob"} + # person.serializable_hash(except: :name) # => {"age"=>22} + # person.serializable_hash(methods: :capitalized_name) + # # => {"name"=>"bob", "age"=>22, "capitalized_name"=>"Bob"} + # + # Example with :include option + # + # class User + # include ActiveModel::Serializers::JSON + # attr_accessor :name, :notes # Emulate has_many :notes + # def attributes + # {'name' => nil} + # end + # end + # + # class Note + # include ActiveModel::Serializers::JSON + # attr_accessor :title, :text + # def attributes + # {'title' => nil, 'text' => nil} + # end + # end + # + # note = Note.new + # note.title = 'Battle of Austerlitz' + # note.text = 'Some text here' + # + # user = User.new + # user.name = 'Napoleon' + # user.notes = [note] + # + # user.serializable_hash + # # => {"name" => "Napoleon"} + # user.serializable_hash(include: { notes: { only: 'title' }}) + # # => {"name" => "Napoleon", "notes" => [{"title"=>"Battle of Austerlitz"}]} + # + # pkg:gem/activemodel#lib/active_model/serialization.rb:125 + def serializable_hash(options = T.unsafe(nil)); end + + private + + # pkg:gem/activemodel#lib/active_model/serialization.rb:172 + def attribute_names_for_serialization; end + + # Add associations specified via the :include option. + # + # Expects a block that takes as arguments: + # +association+ - name of the association + # +records+ - the association record(s) to be serialized + # +opts+ - options for the association records + # + # pkg:gem/activemodel#lib/active_model/serialization.rb:186 + def serializable_add_includes(options = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/serialization.rb:176 + def serializable_attributes(attribute_names); end +end + +# pkg:gem/activemodel#lib/active_model.rb:74 +module ActiveModel::Serializers + extend ::ActiveSupport::Autoload +end + +# = Active \Model \JSON \Serializer +# +# pkg:gem/activemodel#lib/active_model/serializers/json.rb:8 +module ActiveModel::Serializers::JSON + include ::ActiveModel::Serialization + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::Naming + + # Returns a hash representing the model. Some configuration can be + # passed through +options+. + # + # The option include_root_in_json controls the top-level behavior + # of +as_json+. If +true+, +as_json+ will emit a single root node named + # after the object's type. The default value for include_root_in_json + # option is +false+. + # + # user = User.find(1) + # user.as_json + # # => { "id" => 1, "name" => "Konata Izumi", "age" => 16, + # # "created_at" => "2006-08-01T17:27:13.000Z", "awesome" => true} + # + # ActiveRecord::Base.include_root_in_json = true + # + # user.as_json + # # => { "user" => { "id" => 1, "name" => "Konata Izumi", "age" => 16, + # # "created_at" => "2006-08-01T17:27:13.000Z", "awesome" => true } } + # + # This behavior can also be achieved by setting the :root option + # to +true+ as in: + # + # user = User.find(1) + # user.as_json(root: true) + # # => { "user" => { "id" => 1, "name" => "Konata Izumi", "age" => 16, + # # "created_at" => "2006-08-01T17:27:13.000Z", "awesome" => true } } + # + # If you prefer, :root may also be set to a custom string key instead as in: + # + # user = User.find(1) + # user.as_json(root: "author") + # # => { "author" => { "id" => 1, "name" => "Konata Izumi", "age" => 16, + # # "created_at" => "2006-08-01T17:27:13.000Z", "awesome" => true } } + # + # Without any +options+, the returned Hash will include all the model's + # attributes. + # + # user = User.find(1) + # user.as_json + # # => { "id" => 1, "name" => "Konata Izumi", "age" => 16, + # # "created_at" => "2006-08-01T17:27:13.000Z", "awesome" => true} + # + # The :only and :except options can be used to limit + # the attributes included, and work similar to the +attributes+ method. + # + # user.as_json(only: [:id, :name]) + # # => { "id" => 1, "name" => "Konata Izumi" } + # + # user.as_json(except: [:id, :created_at, :age]) + # # => { "name" => "Konata Izumi", "awesome" => true } + # + # To include the result of some method calls on the model use :methods: + # + # user.as_json(methods: :permalink) + # # => { "id" => 1, "name" => "Konata Izumi", "age" => 16, + # # "created_at" => "2006-08-01T17:27:13.000Z", "awesome" => true, + # # "permalink" => "1-konata-izumi" } + # + # To include associations use :include: + # + # user.as_json(include: :posts) + # # => { "id" => 1, "name" => "Konata Izumi", "age" => 16, + # # "created_at" => "2006-08-01T17:27:13.000Z", "awesome" => true, + # # "posts" => [ { "id" => 1, "author_id" => 1, "title" => "Welcome to the weblog" }, + # # { "id" => 2, "author_id" => 1, "title" => "So I was thinking" } ] } + # + # Second level and higher order associations work as well: + # + # user.as_json(include: { posts: { + # include: { comments: { + # only: :body } }, + # only: :title } }) + # # => { "id" => 1, "name" => "Konata Izumi", "age" => 16, + # # "created_at" => "2006-08-01T17:27:13.000Z", "awesome" => true, + # # "posts" => [ { "comments" => [ { "body" => "1st post!" }, { "body" => "Second!" } ], + # # "title" => "Welcome to the weblog" }, + # # { "comments" => [ { "body" => "Don't think too hard" } ], + # # "title" => "So I was thinking" } ] } + # + # pkg:gem/activemodel#lib/active_model/serializers/json.rb:96 + def as_json(options = T.unsafe(nil)); end + + # Sets the model +attributes+ from a JSON string. Returns +self+. + # + # class Person + # include ActiveModel::Serializers::JSON + # + # attr_accessor :name, :age, :awesome + # + # def attributes=(hash) + # hash.each do |key, value| + # send("#{key}=", value) + # end + # end + # + # def attributes + # instance_values + # end + # end + # + # json = { name: 'bob', age: 22, awesome:true }.to_json + # person = Person.new + # person.from_json(json) # => # + # person.name # => "bob" + # person.age # => 22 + # person.awesome # => true + # + # The default value for +include_root+ is +false+. You can change it to + # +true+ if the given JSON string includes a single root node. + # + # json = { person: { name: 'bob', age: 22, awesome:true } }.to_json + # person = Person.new + # person.from_json(json, true) # => # + # person.name # => "bob" + # person.age # => 22 + # person.awesome # => true + # + # pkg:gem/activemodel#lib/active_model/serializers/json.rb:146 + def from_json(json, include_root = T.unsafe(nil)); end + + module GeneratedClassMethods + def include_root_in_json; end + def include_root_in_json=(value); end + def include_root_in_json?; end + end + + module GeneratedInstanceMethods + def include_root_in_json; end + def include_root_in_json?; end + end +end + +# = Active \Model \StrictValidationFailed +# +# Raised when a validation cannot be corrected by end users and are considered +# exceptional. +# +# class Person +# include ActiveModel::Validations +# +# attr_accessor :name +# +# validates_presence_of :name, strict: true +# end +# +# person = Person.new +# person.name = nil +# person.valid? +# # => ActiveModel::StrictValidationFailed: Name can't be blank +# +# pkg:gem/activemodel#lib/active_model/errors.rb:515 +class ActiveModel::StrictValidationFailed < ::StandardError; end + +# = Active \Model \Translation +# +# Provides integration between your object and the \Rails internationalization +# (i18n) framework. +# +# A minimal implementation could be: +# +# class TranslatedPerson +# extend ActiveModel::Translation +# end +# +# TranslatedPerson.human_attribute_name('my_attribute') +# # => "My attribute" +# +# This also provides the required class methods for hooking into the +# \Rails internationalization API, including being able to define a +# class-based +i18n_scope+ and +lookup_ancestors+ to find translations in +# parent classes. +# +# pkg:gem/activemodel#lib/active_model/translation.rb:22 +module ActiveModel::Translation + include ::ActiveModel::Naming + + # Transforms attribute names into a more human format, such as "First name" + # instead of "first_name". + # + # Person.human_attribute_name("first_name") # => "First name" + # + # Specify +options+ with additional translating options. + # + # pkg:gem/activemodel#lib/active_model/translation.rb:48 + def human_attribute_name(attribute, options = T.unsafe(nil)); end + + # Returns the +i18n_scope+ for the class. Override if you want custom lookup. + # + # pkg:gem/activemodel#lib/active_model/translation.rb:28 + def i18n_scope; end + + # When localizing a string, it goes through the lookup returned by this + # method, which is used in ActiveModel::Name#human, + # ActiveModel::Errors#full_messages and + # ActiveModel::Translation#human_attribute_name. + # + # pkg:gem/activemodel#lib/active_model/translation.rb:36 + def lookup_ancestors; end + + class << self + # pkg:gem/activemodel#lib/active_model/translation.rb:25 + def raise_on_missing_translations; end + + # pkg:gem/activemodel#lib/active_model/translation.rb:25 + def raise_on_missing_translations=(_arg0); end + end +end + +# pkg:gem/activemodel#lib/active_model/translation.rb:40 +ActiveModel::Translation::MISSING_TRANSLATION = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:4 +module ActiveModel::Type + class << self + # pkg:gem/activemodel#lib/active_model/type.rb:38 + def default_value; end + + # pkg:gem/activemodel#lib/active_model/type.rb:34 + def lookup(*, **, &); end + + # Add a new type to the registry, allowing it to be referenced as a + # symbol by {attribute}[rdoc-ref:Attributes::ClassMethods#attribute]. + # + # pkg:gem/activemodel#lib/active_model/type.rb:30 + def register(type_name, klass = T.unsafe(nil), &block); end + + # pkg:gem/activemodel#lib/active_model/type.rb:26 + def registry; end + + # pkg:gem/activemodel#lib/active_model/type.rb:26 + def registry=(_arg0); end + end +end + +# = Active Model \BigInteger \Type +# +# Attribute type for integers that can be serialized to an unlimited number +# of bytes. This type is registered under the +:big_integer+ key. +# +# class Person +# include ActiveModel::Attributes +# +# attribute :id, :big_integer +# end +# +# person = Person.new +# person.id = "18_000_000_000" +# +# person.id # => 18000000000 +# +# All casting and serialization are performed in the same way as the +# standard ActiveModel::Type::Integer type. +# +# pkg:gem/activemodel#lib/active_model/type/big_integer.rb:25 +class ActiveModel::Type::BigInteger < ::ActiveModel::Type::Integer + # pkg:gem/activemodel#lib/active_model/type/big_integer.rb:47 + def serializable?(value, &); end + + # pkg:gem/activemodel#lib/active_model/type/big_integer.rb:26 + def serialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/big_integer.rb:43 + def serialize_cast_value(value); end + + private + + # pkg:gem/activemodel#lib/active_model/type/big_integer.rb:52 + def max_value; end +end + +# = Active Model \Binary \Type +# +# Attribute type for representation of binary data. This type is registered +# under the +:binary+ key. +# +# Non-string values are coerced to strings using their +to_s+ method. +# +# pkg:gem/activemodel#lib/active_model/type/binary.rb:11 +class ActiveModel::Type::Binary < ::ActiveModel::Type::Value + # pkg:gem/activemodel#lib/active_model/type/binary.rb:16 + def binary?; end + + # pkg:gem/activemodel#lib/active_model/type/binary.rb:20 + def cast(value); end + + # pkg:gem/activemodel#lib/active_model/type/binary.rb:35 + def changed_in_place?(raw_old_value, value); end + + # pkg:gem/activemodel#lib/active_model/type/binary.rb:30 + def serialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/binary.rb:12 + def type; end +end + +# pkg:gem/activemodel#lib/active_model/type/binary.rb:40 +class ActiveModel::Type::Binary::Data + # pkg:gem/activemodel#lib/active_model/type/binary.rb:41 + def initialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/binary.rb:56 + def ==(other); end + + # pkg:gem/activemodel#lib/active_model/type/binary.rb:52 + def hex; end + + # pkg:gem/activemodel#lib/active_model/type/binary.rb:47 + def to_s; end + + # pkg:gem/activemodel#lib/active_model/type/binary.rb:50 + def to_str; end +end + +# = Active Model \Boolean \Type +# +# A class that behaves like a boolean type, including rules for coercion of +# user input. +# +# - "false", "f", "0", +0+ or any other value in +# +FALSE_VALUES+ will be coerced to +false+. +# - Empty strings are coerced to +nil+. +# - All other values will be coerced to +true+. +# +# pkg:gem/activemodel#lib/active_model/type/boolean.rb:14 +class ActiveModel::Type::Boolean < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Immutable + + # pkg:gem/activemodel#lib/active_model/type/boolean.rb:31 + def serialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/boolean.rb:35 + def serialize_cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/boolean.rb:27 + def type; end + + private + + # pkg:gem/activemodel#lib/active_model/type/boolean.rb:40 + def cast_value(value); end +end + +# pkg:gem/activemodel#lib/active_model/type/boolean.rb:16 +ActiveModel::Type::Boolean::FALSE_VALUES = T.let(T.unsafe(nil), Set) + +# = Active Model \Date \Type +# +# Attribute type for date representation. It is registered under the +# +:date+ key. +# +# class Person +# include ActiveModel::Attributes +# +# attribute :birthday, :date +# end +# +# person = Person.new +# person.birthday = "1989-07-13" +# +# person.birthday.class # => Date +# person.birthday.year # => 1989 +# person.birthday.month # => 7 +# person.birthday.day # => 13 +# +# String values are parsed using the ISO 8601 date format. Any other values +# are cast using their +to_date+ method, if it exists. +# +# pkg:gem/activemodel#lib/active_model/type/date.rb:26 +class ActiveModel::Type::Date < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Immutable + include ::ActiveModel::Type::Helpers::Timezone + include ::ActiveModel::Type::Helpers::AcceptsMultiparameterTime::InstanceMethods + + # pkg:gem/activemodel#lib/active_model/type/date.rb:31 + def type; end + + # pkg:gem/activemodel#lib/active_model/type/date.rb:35 + def type_cast_for_schema(value); end + + private + + # pkg:gem/activemodel#lib/active_model/type/date.rb:40 + def cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/date.rb:58 + def fallback_string_to_date(string); end + + # pkg:gem/activemodel#lib/active_model/type/date.rb:52 + def fast_string_to_date(string); end + + # pkg:gem/activemodel#lib/active_model/type/date.rb:67 + def new_date(year, mon, mday); end + + # pkg:gem/activemodel#lib/active_model/type/date.rb:73 + def value_from_multiparameter_assignment(*); end +end + +# pkg:gem/activemodel#lib/active_model/type/date.rb:51 +ActiveModel::Type::Date::ISO_DATE = T.let(T.unsafe(nil), Regexp) + +# = Active Model \DateTime \Type +# +# Attribute type to represent dates and times. It is registered under the +# +:datetime+ key. +# +# class Event +# include ActiveModel::Attributes +# +# attribute :start, :datetime +# end +# +# event = Event.new +# event.start = "Wed, 04 Sep 2013 03:00:00 EAT" +# +# event.start.class # => Time +# event.start.year # => 2013 +# event.start.month # => 9 +# event.start.day # => 4 +# event.start.hour # => 3 +# event.start.min # => 0 +# event.start.sec # => 0 +# event.start.zone # => "EAT" +# +# String values are parsed using the ISO 8601 datetime format. Use the +# +:time+ type instead to parse partial time-only values. +# +# The degree of sub-second precision can be customized when declaring an +# attribute: +# +# class Event +# include ActiveModel::Attributes +# +# attribute :start, :datetime, precision: 4 +# end +# +# pkg:gem/activemodel#lib/active_model/type/date_time.rb:39 +class ActiveModel::Type::DateTime < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Timezone + include ::ActiveModel::Type::Helpers::AcceptsMultiparameterTime::InstanceMethods + include ::ActiveModel::Type::Helpers::TimeValue + + # pkg:gem/activemodel#lib/active_model/type/date_time.rb:50 + def mutable?; end + + # pkg:gem/activemodel#lib/active_model/type/date_time.rb:46 + def type; end + + private + + # pkg:gem/activemodel#lib/active_model/type/date_time.rb:59 + def cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/date_time.rb:72 + def fallback_string_to_time(string); end + + # '0.123456' -> 123456 + # '1.123456' -> 123456 + # + # pkg:gem/activemodel#lib/active_model/type/date_time.rb:68 + def microseconds(time); end + + # pkg:gem/activemodel#lib/active_model/type/date_time.rb:84 + def value_from_multiparameter_assignment(values_hash); end +end + +# = Active Model \Decimal \Type +# +# Attribute type for decimal, high-precision floating point numeric +# representation. It is registered under the +:decimal+ key. +# +# class BagOfCoffee +# include ActiveModel::Attributes +# +# attribute :weight, :decimal +# end +# +# Numeric instances are converted to BigDecimal instances. Any other objects +# are cast using their +to_d+ method, except for blank strings, which are +# cast to +nil+. If a +to_d+ method is not defined, the object is converted +# to a string using +to_s+, which is then cast using +to_d+. +# +# bag = BagOfCoffee.new +# +# bag.weight = 0.01 +# bag.weight # => 0.1e-1 +# +# bag.weight = "0.01" +# bag.weight # => 0.1e-1 +# +# bag.weight = "" +# bag.weight # => nil +# +# bag.weight = :arbitrary +# bag.weight # => 0.0 (the result of `.to_s.to_d`) +# +# Decimal precision defaults to 18, and can be customized when declaring an +# attribute: +# +# class BagOfCoffee +# include ActiveModel::Attributes +# +# attribute :weight, :decimal, precision: 24 +# end +# +# pkg:gem/activemodel#lib/active_model/type/decimal.rb:45 +class ActiveModel::Type::Decimal < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Immutable + include ::ActiveModel::Type::Helpers::Numeric + + # pkg:gem/activemodel#lib/active_model/type/decimal.rb:50 + def type; end + + # pkg:gem/activemodel#lib/active_model/type/decimal.rb:54 + def type_cast_for_schema(value); end + + private + + # pkg:gem/activemodel#lib/active_model/type/decimal.rb:99 + def apply_scale(value); end + + # pkg:gem/activemodel#lib/active_model/type/decimal.rb:59 + def cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/decimal.rb:83 + def convert_float_to_big_decimal(value); end + + # pkg:gem/activemodel#lib/active_model/type/decimal.rb:91 + def float_precision; end +end + +# pkg:gem/activemodel#lib/active_model/type/decimal.rb:48 +ActiveModel::Type::Decimal::BIGDECIMAL_PRECISION = T.let(T.unsafe(nil), Integer) + +# = Active Model \Float \Type +# +# Attribute type for floating point numeric values. It is registered under +# the +:float+ key. +# +# class BagOfCoffee +# include ActiveModel::Attributes +# +# attribute :weight, :float +# end +# +# bag = BagOfCoffee.new +# +# bag.weight = "0.25" +# bag.weight # => 0.25 +# +# bag.weight = "" +# bag.weight # => nil +# +# bag.weight = "NaN" +# bag.weight # => Float::NAN +# +# Values are cast using their +to_f+ method, except for the following +# strings: +# +# - Blank strings are cast to +nil+. +# - "Infinity" is cast to +Float::INFINITY+. +# - "-Infinity" is cast to -Float::INFINITY. +# - "NaN" is cast to +Float::NAN+. +# +# pkg:gem/activemodel#lib/active_model/type/float.rb:36 +class ActiveModel::Type::Float < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Immutable + include ::ActiveModel::Type::Helpers::Numeric + + # pkg:gem/activemodel#lib/active_model/type/float.rb:40 + def type; end + + # pkg:gem/activemodel#lib/active_model/type/float.rb:44 + def type_cast_for_schema(value); end + + private + + # pkg:gem/activemodel#lib/active_model/type/float.rb:54 + def cast_value(value); end +end + +# pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:5 +module ActiveModel::Type::Helpers; end + +# pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:6 +class ActiveModel::Type::Helpers::AcceptsMultiparameterTime < ::Module + # pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:37 + def initialize(defaults: T.unsafe(nil)); end +end + +# pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:7 +module ActiveModel::Type::Helpers::AcceptsMultiparameterTime::InstanceMethods + # pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:24 + def assert_valid_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:16 + def cast(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:8 + def serialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:12 + def serialize_cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/accepts_multiparameter_time.rb:32 + def value_constructed_by_mass_assignment?(value); end +end + +# pkg:gem/activemodel#lib/active_model/type/helpers/immutable.rb:6 +module ActiveModel::Type::Helpers::Immutable + # pkg:gem/activemodel#lib/active_model/type/helpers/immutable.rb:7 + def mutable?; end +end + +# pkg:gem/activemodel#lib/active_model/type/helpers/mutable.rb:6 +module ActiveModel::Type::Helpers::Mutable + # pkg:gem/activemodel#lib/active_model/type/helpers/mutable.rb:7 + def cast(value); end + + # +raw_old_value+ will be the `_before_type_cast` version of the + # value (likely a string). +new_value+ will be the current, type + # cast value. + # + # pkg:gem/activemodel#lib/active_model/type/helpers/mutable.rb:14 + def changed_in_place?(raw_old_value, new_value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/mutable.rb:18 + def mutable?; end +end + +# pkg:gem/activemodel#lib/active_model/type/helpers/numeric.rb:6 +module ActiveModel::Type::Helpers::Numeric + # pkg:gem/activemodel#lib/active_model/type/helpers/numeric.rb:15 + def cast(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/numeric.rb:31 + def changed?(old_value, _new_value, new_value_before_type_cast); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/numeric.rb:7 + def serialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/numeric.rb:11 + def serialize_cast_value(value); end + + private + + # pkg:gem/activemodel#lib/active_model/type/helpers/numeric.rb:37 + def equal_nan?(old_value, new_value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/numeric.rb:49 + def non_numeric_string?(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/numeric.rb:44 + def number_to_non_number?(old_value, new_value_before_type_cast); end +end + +# pkg:gem/activemodel#lib/active_model/type/helpers/numeric.rb:56 +ActiveModel::Type::Helpers::Numeric::NUMERIC_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activemodel#lib/active_model/type/helpers/time_value.rb:9 +module ActiveModel::Type::Helpers::TimeValue + # pkg:gem/activemodel#lib/active_model/type/helpers/time_value.rb:24 + def apply_seconds_precision(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/time_value.rb:10 + def serialize_cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/time_value.rb:38 + def type_cast_for_schema(value); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/time_value.rb:42 + def user_input_in_time_zone(value); end + + private + + # Early 3.2.x had a bug + # BUG: Wrapping the Time object with Time.at because Time.new with `in:` in Ruby 3.2.0 + # used to return an invalid Time object + # see: https://bugs.ruby-lang.org/issues/19292 + # + # pkg:gem/activemodel#lib/active_model/type/helpers/time_value.rb:88 + def fast_string_to_time(string); end + + # pkg:gem/activemodel#lib/active_model/type/helpers/time_value.rb:47 + def new_time(year, mon, mday, hour, min, sec, microsec, offset = T.unsafe(nil)); end +end + +# pkg:gem/activemodel#lib/active_model/type/helpers/time_value.rb:64 +ActiveModel::Type::Helpers::TimeValue::ISO_DATETIME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activemodel#lib/active_model/type/helpers/timezone.rb:8 +module ActiveModel::Type::Helpers::Timezone + # pkg:gem/activemodel#lib/active_model/type/helpers/timezone.rb:17 + def default_timezone; end + + # pkg:gem/activemodel#lib/active_model/type/helpers/timezone.rb:9 + def is_utc?; end +end + +# = Active Model \ImmutableString \Type +# +# Attribute type to represent immutable strings. It casts incoming values to +# frozen strings. +# +# class Person +# include ActiveModel::Attributes +# +# attribute :name, :immutable_string +# end +# +# person = Person.new +# person.name = 1 +# +# person.name # => "1" +# person.name.frozen? # => true +# +# Values are coerced to strings using their +to_s+ method. Boolean values +# are treated differently, however: +true+ will be cast to "t" and +# +false+ will be cast to "f". These strings can be customized when +# declaring an attribute: +# +# class Person +# include ActiveModel::Attributes +# +# attribute :active, :immutable_string, true: "aye", false: "nay" +# end +# +# person = Person.new +# person.active = true +# +# person.active # => "aye" +# +# pkg:gem/activemodel#lib/active_model/type/immutable_string.rb:37 +class ActiveModel::Type::ImmutableString < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Immutable + + # pkg:gem/activemodel#lib/active_model/type/immutable_string.rb:40 + def initialize(**args); end + + # pkg:gem/activemodel#lib/active_model/type/immutable_string.rb:50 + def serialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/immutable_string.rb:59 + def serialize_cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/immutable_string.rb:46 + def type; end + + private + + # pkg:gem/activemodel#lib/active_model/type/immutable_string.rb:64 + def cast_value(value); end +end + +# = Active Model \Integer \Type +# +# Attribute type for integer representation. This type is registered under +# the +:integer+ key. +# +# class Person +# include ActiveModel::Attributes +# +# attribute :age, :integer +# end +# +# Values are cast using their +to_i+ method, except for blank strings, which +# are cast to +nil+. If a +to_i+ method is not defined or raises an error, +# the value will be cast to +nil+. +# +# person = Person.new +# +# person.age = "18" +# person.age # => 18 +# +# person.age = "" +# person.age # => nil +# +# person.age = :not_an_integer +# person.age # => nil (because Symbol does not define #to_i) +# +# Serialization also works under the same principle. Non-numeric strings are +# serialized as +nil+, for example. +# +# Serialization also validates that the integer can be stored using a +# limited number of bytes. If it cannot, an ActiveModel::RangeError will be +# raised. The default limit is 4 bytes, and can be customized when declaring +# an attribute: +# +# class Person +# include ActiveModel::Attributes +# +# attribute :age, :integer, limit: 6 +# end +# +# pkg:gem/activemodel#lib/active_model/type/integer.rb:44 +class ActiveModel::Type::Integer < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Immutable + include ::ActiveModel::Type::Helpers::Numeric + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:52 + def initialize(**); end + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:62 + def deserialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:96 + def serializable?(value); end + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:67 + def serialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:88 + def serialize_cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:58 + def type; end + + private + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:132 + def _limit; end + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:112 + def cast_value(value); end + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:124 + def max_value; end + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:128 + def min_value; end + + # pkg:gem/activemodel#lib/active_model/type/integer.rb:104 + def out_of_range?(value); end +end + +# Column storage size in bytes. +# 4 bytes means an integer as opposed to smallint etc. +# +# pkg:gem/activemodel#lib/active_model/type/integer.rb:50 +ActiveModel::Type::Integer::DEFAULT_LIMIT = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activemodel#lib/active_model/type/registry.rb:5 +class ActiveModel::Type::Registry + # pkg:gem/activemodel#lib/active_model/type/registry.rb:6 + def initialize; end + + # pkg:gem/activemodel#lib/active_model/type/registry.rb:23 + def lookup(symbol, *, **, &); end + + # pkg:gem/activemodel#lib/active_model/type/registry.rb:15 + def register(type_name, klass = T.unsafe(nil), &block); end + + private + + # pkg:gem/activemodel#lib/active_model/type/registry.rb:10 + def initialize_copy(other); end + + # pkg:gem/activemodel#lib/active_model/type/registry.rb:34 + def registrations; end +end + +# pkg:gem/activemodel#lib/active_model/type/serialize_cast_value.rb:5 +module ActiveModel::Type::SerializeCastValue + extend ::ActiveSupport::Concern + include ::ActiveModel::Type::SerializeCastValue::DefaultImplementation + + mixes_in_class_methods ::ActiveModel::Type::SerializeCastValue::ClassMethods + + # pkg:gem/activemodel#lib/active_model/type/serialize_cast_value.rb:41 + def initialize(*, **, &); end + + # pkg:gem/activemodel#lib/active_model/type/serialize_cast_value.rb:37 + def itself_if_serialize_cast_value_compatible; end + + class << self + # pkg:gem/activemodel#lib/active_model/type/serialize_cast_value.rb:21 + def included(klass); end + + # pkg:gem/activemodel#lib/active_model/type/serialize_cast_value.rb:25 + def serialize(type, value); end + end +end + +# pkg:gem/activemodel#lib/active_model/type/serialize_cast_value.rb:8 +module ActiveModel::Type::SerializeCastValue::ClassMethods + # pkg:gem/activemodel#lib/active_model/type/serialize_cast_value.rb:9 + def serialize_cast_value_compatible?; end +end + +# pkg:gem/activemodel#lib/active_model/type/serialize_cast_value.rb:15 +module ActiveModel::Type::SerializeCastValue::DefaultImplementation + # pkg:gem/activemodel#lib/active_model/type/serialize_cast_value.rb:16 + def serialize_cast_value(value); end +end + +# = Active Model \String \Type +# +# Attribute type for strings. It is registered under the +:string+ key. +# +# This class is a specialization of ActiveModel::Type::ImmutableString. It +# performs coercion in the same way, and can be configured in the same way. +# However, it accounts for mutable strings, so dirty tracking can properly +# check if a string has changed. +# +# pkg:gem/activemodel#lib/active_model/type/string.rb:15 +class ActiveModel::Type::String < ::ActiveModel::Type::ImmutableString + # pkg:gem/activemodel#lib/active_model/type/string.rb:16 + def changed_in_place?(raw_old_value, new_value); end + + # pkg:gem/activemodel#lib/active_model/type/string.rb:22 + def mutable?; end + + # pkg:gem/activemodel#lib/active_model/type/string.rb:26 + def to_immutable_string; end + + private + + # pkg:gem/activemodel#lib/active_model/type/string.rb:37 + def cast_value(value); end +end + +# = Active Model \Time \Type +# +# Attribute type for time of day representation. It is registered under the +# +:time+ key. +# +# class Event +# include ActiveModel::Attributes +# +# attribute :start, :time +# end +# +# String values are parsed using the ISO 8601 datetime format, but are +# normalized to have a date of 2000-01-01 and be in the UTC time zone. +# +# event = Event.new +# event.start = "2004-10-25T01:23:45-06:00" +# +# event.start.class # => Time +# event.start # => 2000-01-01 07:23:45 UTC +# +# Partial time-only formats are also accepted. +# +# event.start = "00:01:02+03:00" +# event.start # => 1999-12-31 21:01:02 UTC +# +# The degree of sub-second precision can be customized when declaring an +# attribute: +# +# class Event +# include ActiveModel::Attributes +# +# attribute :start, :time, precision: 4 +# end +# +# pkg:gem/activemodel#lib/active_model/type/time.rb:38 +class ActiveModel::Type::Time < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Timezone + include ::ActiveModel::Type::Helpers::AcceptsMultiparameterTime::InstanceMethods + include ::ActiveModel::Type::Helpers::TimeValue + + # pkg:gem/activemodel#lib/active_model/type/time.rb:45 + def type; end + + # pkg:gem/activemodel#lib/active_model/type/time.rb:49 + def user_input_in_time_zone(value); end + + private + + # pkg:gem/activemodel#lib/active_model/type/time.rb:69 + def cast_value(value); end +end + +# = Active Model \Value \Type +# +# The base class for all attribute types. This class also serves as the +# default type for attributes that do not specify a type. +# +# pkg:gem/activemodel#lib/active_model/type/value.rb:9 +class ActiveModel::Type::Value + include ::ActiveModel::Type::SerializeCastValue + include ::ActiveModel::Type::SerializeCastValue::DefaultImplementation + extend ::ActiveModel::Type::SerializeCastValue::ClassMethods + + # Initializes a type with three basic configuration settings: precision, + # limit, and scale. The Value base class does not define behavior for + # these settings. It uses them for equality comparison and hash key + # generation only. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:17 + def initialize(precision: T.unsafe(nil), limit: T.unsafe(nil), scale: T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:121 + def ==(other); end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:144 + def as_json(*); end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:133 + def assert_valid_value(_); end + + # These predicates are not documented, as I need to look further into + # their use, and see if they can be removed entirely. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:77 + def binary?; end + + # Type casts a value from user input (e.g. from a setter). This value may + # be a string from the form builder, or a ruby object passed to a setter. + # There is currently no way to differentiate between which source it came + # from. + # + # The return value of this method will be returned from + # ActiveRecord::AttributeMethods::Read#read_attribute. See also: + # Value#cast_value. + # + # +value+ The raw input, as provided to the attribute setter. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:57 + def cast(value); end + + # Determines whether a value has changed for dirty checking. +old_value+ + # and +new_value+ will always be type-cast. Types should not need to + # override this method. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:84 + def changed?(old_value, new_value, _new_value_before_type_cast); end + + # Determines whether the mutable value has been modified since it was + # read. Returns +false+ by default. If your type returns an object + # which could be mutated, you should override this method. You will need + # to either: + # + # - pass +new_value+ to Value#serialize and compare it to + # +raw_old_value+ + # + # or + # + # - pass +raw_old_value+ to Value#deserialize and compare it to + # +new_value+ + # + # +raw_old_value+ The original value, before being passed to + # +deserialize+. + # + # +new_value+ The current value, after type casting. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:105 + def changed_in_place?(raw_old_value, new_value); end + + # Converts a value from database input to the appropriate ruby type. The + # return value of this method will be returned from + # ActiveRecord::AttributeMethods::Read#read_attribute. The default + # implementation just calls Value#cast. + # + # +value+ The raw input, as provided from the database. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:43 + def deserialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:127 + def eql?(other); end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:113 + def force_equality?(_value); end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:129 + def hash; end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:11 + def limit; end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:117 + def map(value, &); end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:140 + def mutable?; end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:11 + def precision; end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:11 + def scale; end + + # Returns true if this type can convert +value+ to a type that is usable + # by the database. For example a boolean type can return +true+ if the + # value parameter is a Ruby boolean, but may return +false+ if the value + # parameter is some other object. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:28 + def serializable?(value, &); end + + # Casts a value from the ruby type to a type that the database knows how + # to understand. The returned value from this method should be a + # +String+, +Numeric+, +Date+, +Time+, +Symbol+, +true+, +false+, or + # +nil+. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:65 + def serialize(value); end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:136 + def serialized?; end + + # Returns the unique type name as a Symbol. Subclasses should override + # this method. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:34 + def type; end + + # Type casts a value for schema dumping. This method is private, as we are + # hoping to remove it entirely. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:71 + def type_cast_for_schema(value); end + + # pkg:gem/activemodel#lib/active_model/type/value.rb:109 + def value_constructed_by_mass_assignment?(_value); end + + private + + # Convenience method for types which do not need separate type casting + # behavior for user and database inputs. Called by Value#cast for + # values except +nil+. + # + # pkg:gem/activemodel#lib/active_model/type/value.rb:152 + def cast_value(value); end +end + +# = Active \Model \UnknownAttributeError +# +# Raised when unknown attributes are supplied via mass assignment. +# +# class Person +# include ActiveModel::AttributeAssignment +# include ActiveModel::Validations +# end +# +# person = Person.new +# person.assign_attributes(name: 'Gorby') +# # => ActiveModel::UnknownAttributeError: unknown attribute 'name' for Person. +# +# pkg:gem/activemodel#lib/active_model/errors.rb:536 +class ActiveModel::UnknownAttributeError < ::NoMethodError + # pkg:gem/activemodel#lib/active_model/errors.rb:539 + def initialize(record, attribute); end + + # pkg:gem/activemodel#lib/active_model/errors.rb:537 + def attribute; end + + # pkg:gem/activemodel#lib/active_model/errors.rb:537 + def record; end +end + +# pkg:gem/activemodel#lib/active_model/gem_version.rb:9 +module ActiveModel::VERSION; end + +# pkg:gem/activemodel#lib/active_model/gem_version.rb:10 +ActiveModel::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activemodel#lib/active_model/gem_version.rb:11 +ActiveModel::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activemodel#lib/active_model/gem_version.rb:13 +ActiveModel::VERSION::PRE = T.let(T.unsafe(nil), String) + +# pkg:gem/activemodel#lib/active_model/gem_version.rb:15 +ActiveModel::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/activemodel#lib/active_model/gem_version.rb:12 +ActiveModel::VERSION::TINY = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activemodel#lib/active_model/validations.rb:493 +class ActiveModel::ValidationContext + # pkg:gem/activemodel#lib/active_model/validations.rb:494 + def context; end + + # pkg:gem/activemodel#lib/active_model/validations.rb:494 + def context=(_arg0); end +end + +# = Active \Model \ValidationError +# +# Raised by validate! when the model is invalid. Use the +# +model+ method to retrieve the record which did not validate. +# +# begin +# complex_operation_that_internally_calls_validate! +# rescue ActiveModel::ValidationError => invalid +# puts invalid.model.errors +# end +# +# pkg:gem/activemodel#lib/active_model/validations.rb:483 +class ActiveModel::ValidationError < ::StandardError + # pkg:gem/activemodel#lib/active_model/validations.rb:486 + def initialize(model); end + + # pkg:gem/activemodel#lib/active_model/validations.rb:484 + def model; end +end + +# = Active \Model \Validations +# +# Provides a full validation framework to your objects. +# +# A minimal implementation could be: +# +# class Person +# include ActiveModel::Validations +# +# attr_accessor :first_name, :last_name +# +# validates_each :first_name, :last_name do |record, attr, value| +# record.errors.add attr, "starts with z." if value.start_with?("z") +# end +# end +# +# Which provides you with the full standard validation stack that you +# know from Active Record: +# +# person = Person.new +# person.valid? # => true +# person.invalid? # => false +# +# person.first_name = 'zoolander' +# person.valid? # => false +# person.invalid? # => true +# person.errors.messages # => {first_name:["starts with z."]} +# +# Note that +ActiveModel::Validations+ automatically adds an +errors+ +# method to your instances initialized with a new ActiveModel::Errors +# object, so there is no need for you to do this manually. +# +# pkg:gem/activemodel#lib/active_model/validations.rb:37 +module ActiveModel::Validations + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveSupport::Callbacks + include ::ActiveModel::Validations::HelperMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::Validations::ClassMethods + mixes_in_class_methods ::ActiveModel::Callbacks + mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::DescendantsTracker + mixes_in_class_methods ::ActiveModel::Translation + mixes_in_class_methods ::ActiveModel::Validations::HelperMethods + + # Returns the +Errors+ object that holds all information about attribute + # error messages. + # + # class Person + # include ActiveModel::Validations + # + # attr_accessor :name + # validates_presence_of :name + # end + # + # person = Person.new + # person.valid? # => false + # person.errors # => # + # + # pkg:gem/activemodel#lib/active_model/validations.rb:330 + def errors; end + + # pkg:gem/activemodel#lib/active_model/validations.rb:374 + def freeze; end + + # Performs the opposite of valid?. Returns +true+ if errors were + # added, +false+ otherwise. + # + # class Person + # include ActiveModel::Validations + # + # attr_accessor :name + # validates_presence_of :name + # end + # + # person = Person.new + # person.name = '' + # person.invalid? # => true + # person.name = 'david' + # person.invalid? # => false + # + # Context can optionally be supplied to define which callbacks to test + # against (the context is defined on the validations using :on). + # + # class Person + # include ActiveModel::Validations + # + # attr_accessor :name + # validates_presence_of :name, on: :new + # end + # + # person = Person.new + # person.invalid? # => false + # person.invalid?(:new) # => true + # + # pkg:gem/activemodel#lib/active_model/validations.rb:410 + def invalid?(context = T.unsafe(nil)); end + + # Hook method defining how an attribute value should be retrieved. By default + # this is assumed to be an instance named after the attribute. Override this + # method in subclasses should you need to retrieve the value for a given + # attribute differently: + # + # class MyClass + # include ActiveModel::Validations + # + # def initialize(data = {}) + # @data = data + # end + # + # def read_attribute_for_validation(key) + # @data[key] + # end + # end + # + # pkg:gem/activemodel#lib/active_model/validations.rb:439 + def read_attribute_for_validation(key); end + + # Runs all the specified validations and returns +true+ if no errors were + # added otherwise +false+. + # + # class Person + # include ActiveModel::Validations + # + # attr_accessor :name + # validates_presence_of :name + # end + # + # person = Person.new + # person.name = '' + # person.valid? # => false + # person.name = 'david' + # person.valid? # => true + # + # Context can optionally be supplied to define which callbacks to test + # against (the context is defined on the validations using :on). + # + # class Person + # include ActiveModel::Validations + # + # attr_accessor :name + # validates_presence_of :name, on: :new + # end + # + # person = Person.new + # person.valid? # => true + # person.valid?(:new) # => false + # + # pkg:gem/activemodel#lib/active_model/validations.rb:363 + def valid?(context = T.unsafe(nil)); end + + # pkg:gem/activemodel#lib/active_model/validations.rb:372 + def validate(context = T.unsafe(nil)); end + + # Runs all the validations within the specified context. Returns +true+ if + # no errors are found, raises +ValidationError+ otherwise. + # + # Validations with no :on option will run no matter the context. Validations with + # some :on option will only run in the specified context. + # + # pkg:gem/activemodel#lib/active_model/validations.rb:419 + def validate!(context = T.unsafe(nil)); end + + # Passes the record off to the class or classes specified and allows them + # to add errors based on more complex conditions. + # + # class Person + # include ActiveModel::Validations + # + # validate :instance_validations + # + # def instance_validations + # validates_with MyValidator + # end + # end + # + # Please consult the class method documentation for more information on + # creating your own validator. + # + # You may also pass it multiple classes, like so: + # + # class Person + # include ActiveModel::Validations + # + # validate :instance_validations, on: :create + # + # def instance_validations + # validates_with MyValidator, MyOtherValidator + # end + # end + # + # Standard configuration options (:on, :if and + # :unless), which are available on the class version of + # +validates_with+, should instead be placed on the +validates+ method + # as these are applied and tested in the callback. + # + # If you pass any additional configuration options, they will be passed + # to the class and available as +options+, please refer to the + # class version of this method for more information. + # + # pkg:gem/activemodel#lib/active_model/validations/with.rb:144 + def validates_with(*args, &block); end + + # Returns the context when running validations. + # + # pkg:gem/activemodel#lib/active_model/validations.rb:444 + def validation_context; end + + private + + # pkg:gem/activemodel#lib/active_model/validations.rb:453 + def context_for_validation; end + + # pkg:gem/activemodel#lib/active_model/validations.rb:457 + def init_internals; end + + # Clean the +Errors+ object if instance is duped. + # + # pkg:gem/activemodel#lib/active_model/validations.rb:312 + def initialize_dup(other); end + + # pkg:gem/activemodel#lib/active_model/validations.rb:468 + def raise_validation_error; end + + # pkg:gem/activemodel#lib/active_model/validations.rb:463 + def run_validations!; end + + # pkg:gem/activemodel#lib/active_model/validations.rb:449 + def validation_context=(context); end + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + def _validators; end + def _validators=(value); end + def _validators?; end + end + + module GeneratedInstanceMethods + def __callbacks; end + def _validators; end + def _validators?; end + end +end + +# == \Active \Model Absence Validator +# +# pkg:gem/activemodel#lib/active_model/validations/absence.rb:6 +class ActiveModel::Validations::AbsenceValidator < ::ActiveModel::EachValidator + # pkg:gem/activemodel#lib/active_model/validations/absence.rb:7 + def validate_each(record, attr_name, value); end +end + +# pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:5 +class ActiveModel::Validations::AcceptanceValidator < ::ActiveModel::EachValidator + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:6 + def initialize(options); end + + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:11 + def validate_each(record, attribute, value); end + + private + + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:23 + def acceptable_option?(value); end + + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:18 + def setup!(klass); end +end + +# pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:27 +class ActiveModel::Validations::AcceptanceValidator::LazilyDefineAttributes < ::Module + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:28 + def initialize(attributes); end + + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:73 + def ==(other); end + + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:56 + def define_on(klass); end + + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:32 + def included(klass); end + + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:51 + def matches?(method_name); end + + protected + + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:78 + def attributes; end +end + +# = Active \Model \Validation \Callbacks +# +# Provides an interface for any class to have ClassMethods#before_validation and +# ClassMethods#after_validation callbacks. +# +# First, include +ActiveModel::Validations::Callbacks+ from the class you are +# creating: +# +# class MyModel +# include ActiveModel::Validations::Callbacks +# +# before_validation :do_stuff_before_validation +# after_validation :do_stuff_after_validation +# end +# +# Like other before_* callbacks if +before_validation+ throws +# +:abort+ then valid? will not be called. +# +# pkg:gem/activemodel#lib/active_model/validations/callbacks.rb:22 +module ActiveModel::Validations::Callbacks + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveSupport::Callbacks + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::Validations::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::DescendantsTracker + + private + + # Override run_validations! to include callbacks. + # + # pkg:gem/activemodel#lib/active_model/validations/callbacks.rb:124 + def run_validations!; end + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + end + + module GeneratedInstanceMethods + def __callbacks; end + end +end + +# pkg:gem/activemodel#lib/active_model/validations/callbacks.rb:32 +module ActiveModel::Validations::Callbacks::ClassMethods + # Defines a callback that will get called right after validation. + # + # class Person + # include ActiveModel::Validations + # include ActiveModel::Validations::Callbacks + # + # attr_accessor :name, :status + # + # validates_presence_of :name + # + # after_validation :set_status + # + # private + # def set_status + # self.status = errors.empty? + # end + # end + # + # person = Person.new + # person.name = '' + # person.valid? # => false + # person.status # => false + # person.name = 'bob' + # person.valid? # => true + # person.status # => true + # + # pkg:gem/activemodel#lib/active_model/validations/callbacks.rb:88 + def after_validation(*args, &block); end + + # Defines a callback that will get called right before validation. + # + # class Person + # include ActiveModel::Validations + # include ActiveModel::Validations::Callbacks + # + # attr_accessor :name + # + # validates_length_of :name, maximum: 6 + # + # before_validation :remove_whitespaces + # + # private + # def remove_whitespaces + # name.strip! + # end + # end + # + # person = Person.new + # person.name = ' bob ' + # person.valid? # => true + # person.name # => "bob" + # + # pkg:gem/activemodel#lib/active_model/validations/callbacks.rb:55 + def before_validation(*args, &block); end + + private + + # pkg:gem/activemodel#lib/active_model/validations/callbacks.rb:99 + def set_options_for_callback(options); end +end + +# pkg:gem/activemodel#lib/active_model/validations.rb:53 +module ActiveModel::Validations::ClassMethods + # Returns +true+ if +attribute+ is an attribute method, +false+ otherwise. + # + # class Person + # include ActiveModel::Validations + # + # attr_accessor :name + # end + # + # User.attribute_method?(:name) # => true + # User.attribute_method?(:age) # => false + # + # pkg:gem/activemodel#lib/active_model/validations.rb:284 + def attribute_method?(attribute); end + + # Clears all of the validators and validations. + # + # Note that this will clear anything that is being used to validate + # the model for both the +validates_with+ and +validate+ methods. + # It clears the validators that are created with an invocation of + # +validates_with+ and the callbacks that are set by an invocation + # of +validate+. + # + # class Person + # include ActiveModel::Validations + # + # validates_with MyValidator + # validates_with OtherValidator, on: :create + # validates_with StrictValidator, strict: true + # validate :cannot_be_robot + # + # def cannot_be_robot + # errors.add(:base, 'A person cannot be a robot') if person_is_robot + # end + # end + # + # Person.validators + # # => [ + # # #, + # # #, + # # # + # # ] + # + # If one runs Person.clear_validators! and then checks to see what + # validators this class has, you would obtain: + # + # Person.validators # => [] + # + # Also, the callback set by validate :cannot_be_robot will be erased + # so that: + # + # Person._validate_callbacks.empty? # => true + # + # pkg:gem/activemodel#lib/active_model/validations.rb:248 + def clear_validators!; end + + # Copy validators on inheritance. + # + # pkg:gem/activemodel#lib/active_model/validations.rb:289 + def inherited(base); end + + # Adds a validation method or block to the class. This is useful when + # overriding the +validate+ instance method becomes too unwieldy and + # you're looking for more descriptive declaration of your validations. + # + # This can be done with a symbol pointing to a method: + # + # class Comment + # include ActiveModel::Validations + # + # validate :must_be_friends + # + # def must_be_friends + # errors.add(:base, 'Must be friends to leave a comment') unless commenter.friend_of?(commentee) + # end + # end + # + # With a block which is passed with the current record to be validated: + # + # class Comment + # include ActiveModel::Validations + # + # validate do |comment| + # comment.must_be_friends + # end + # + # def must_be_friends + # errors.add(:base, 'Must be friends to leave a comment') unless commenter.friend_of?(commentee) + # end + # end + # + # Or with a block where +self+ points to the current record to be validated: + # + # class Comment + # include ActiveModel::Validations + # + # validate do + # errors.add(:base, 'Must be friends to leave a comment') unless commenter.friend_of?(commentee) + # end + # end + # + # Note that the return value of validation methods is not relevant. + # It's not possible to halt the validate callback chain. + # + # ==== Options + # + # * :on - Specifies the contexts where this validation is active. + # Runs in all validation contexts by default +nil+. You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or + # on: [:create, :custom_validation_context]) + # * :except_on - Specifies the contexts where this validation is not active. + # Runs in all validation contexts by default +nil+. You can pass a symbol + # or an array of symbols. (e.g. except_on: :create or + # except_on: :custom_validation_context or + # except_on: [:create, :custom_validation_context]) + # * :if - Specifies a method or proc to call to determine + # if the validation should occur (e.g. if: :allow_validation, + # or if: Proc.new { |user| user.signup_step > 2 }). The method or + # proc should return or evaluate to a +true+ or +false+ value. + # * :unless - Specifies a method or proc to call to + # determine if the validation should not occur (e.g. unless: :skip_validation, + # or unless: Proc.new { |user| user.signup_step <= 2 }). The + # method or proc should return or evaluate to a +true+ or +false+ + # value. + # + # NOTE: Calling +validate+ multiple times on the same method will overwrite previous definitions. + # + # pkg:gem/activemodel#lib/active_model/validations.rb:162 + def validate(*args, &block); end + + # This method is a shortcut to all default validators and any custom + # validator classes ending in 'Validator'. Note that \Rails default + # validators can be overridden inside specific classes by creating + # custom validator classes in their place such as PresenceValidator. + # + # Examples of using the default Rails validators: + # + # validates :username, absence: true + # validates :terms, acceptance: true + # validates :password, confirmation: true + # validates :username, exclusion: { in: %w(admin superuser) } + # validates :email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create } + # validates :age, inclusion: { in: 0..9 } + # validates :first_name, length: { maximum: 30 } + # validates :age, numericality: true + # validates :username, presence: true + # + # The power of the +validates+ method comes when using custom validators + # and default validators in one call for a given attribute. + # + # class EmailValidator < ActiveModel::EachValidator + # def validate_each(record, attribute, value) + # record.errors.add attribute, (options[:message] || "is not an email") unless + # /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.match?(value) + # end + # end + # + # class Person + # include ActiveModel::Validations + # attr_accessor :name, :email + # + # validates :name, presence: true, length: { maximum: 100 } + # validates :email, presence: true, email: true + # end + # + # Validator classes may also exist within the class being validated + # allowing custom modules of validators to be included as needed. + # + # class Film + # include ActiveModel::Validations + # + # class TitleValidator < ActiveModel::EachValidator + # def validate_each(record, attribute, value) + # record.errors.add attribute, "must start with 'the'" unless /\Athe/i.match?(value) + # end + # end + # + # validates :name, title: true + # end + # + # Additionally validator classes may be in another namespace and still + # used within any class. + # + # validates :name, :'film/title' => true + # + # The validators hash can also handle regular expressions, ranges, arrays + # and strings in shortcut form. + # + # validates :email, format: /@/ + # validates :role, inclusion: %w(admin contributor) + # validates :password, length: 6..20 + # + # When using shortcut form, ranges and arrays are passed to your + # validator's initializer as options[:in] while other types + # including regular expressions and strings are passed as options[:with]. + # + # There is also a list of options that could be used along with validators: + # + # * :on - Specifies the contexts where this validation is active. + # Runs in all validation contexts by default +nil+. You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or + # on: [:create, :custom_validation_context]) + # * :except_on - Specifies the contexts where this validation is not active. + # Runs in all validation contexts by default +nil+. You can pass a symbol + # or an array of symbols. (e.g. except_on: :create or + # except_on: :custom_validation_context or + # except_on: [:create, :custom_validation_context]) + # * :if - Specifies a method, proc or string to call to determine + # if the validation should occur (e.g. if: :allow_validation, + # or if: Proc.new { |user| user.signup_step > 2 }). The method, + # proc or string should return or evaluate to a +true+ or +false+ value. + # * :unless - Specifies a method, proc, or string to call to determine + # if the validation should not occur (e.g. unless: :skip_validation, + # or unless: Proc.new { |user| user.signup_step <= 2 }). The + # method, proc, or string should return or evaluate to a +true+ or + # +false+ value. + # * :allow_nil - Skip validation if the attribute is +nil+. + # * :allow_blank - Skip validation if the attribute is blank. + # * :strict - If the :strict option is set to true + # will raise ActiveModel::StrictValidationFailed instead of adding the error. + # :strict option can also be set to any other exception. + # + # Example: + # + # validates :password, presence: true, confirmation: true, if: :password_required? + # validates :token, length: { is: 24 }, strict: TokenLengthException + # + # + # Finally, the options +:if+, +:unless+, +:on+, +:allow_blank+, +:allow_nil+, +:strict+ + # and +:message+ can be given to one specific validator, as a hash: + # + # validates :password, presence: { if: :password_required?, message: 'is forgotten.' }, confirmation: true + # + # pkg:gem/activemodel#lib/active_model/validations/validates.rb:111 + def validates(*attributes); end + + # This method is used to define validations that cannot be corrected by end + # users and are considered exceptional. So each validator defined with bang + # or :strict option set to true will always raise + # ActiveModel::StrictValidationFailed instead of adding error + # when validation fails. See validates for more information about + # the validation itself. + # + # class Person + # include ActiveModel::Validations + # + # attr_accessor :name + # validates! :name, presence: true + # end + # + # person = Person.new + # person.name = '' + # person.valid? + # # => ActiveModel::StrictValidationFailed: Name can't be blank + # + # pkg:gem/activemodel#lib/active_model/validations/validates.rb:153 + def validates!(*attributes); end + + # Validates each attribute against a block. + # + # class Person + # include ActiveModel::Validations + # + # attr_accessor :first_name, :last_name + # + # validates_each :first_name, :last_name, allow_blank: true do |record, attr, value| + # record.errors.add attr, "starts with z." if value.start_with?("z") + # end + # end + # + # ==== Options + # + # * :on - Specifies the contexts where this validation is active. + # Runs in all validation contexts by default +nil+. You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or + # on: [:create, :custom_validation_context]) + # * :except_on - Specifies the contexts where this validation is not active. + # Runs in all validation contexts by default +nil+. You can pass a symbol + # or an array of symbols. (e.g. except_on: :create or + # except_on: :custom_validation_context or + # except_on: [:create, :custom_validation_context]) + # * :allow_nil - Skip validation if attribute is +nil+. + # * :allow_blank - Skip validation if attribute is blank. + # * :if - Specifies a method, proc, or string to call to determine + # if the validation should occur (e.g. if: :allow_validation, + # or if: Proc.new { |user| user.signup_step > 2 }). The method, + # proc or string should return or evaluate to a +true+ or +false+ value. + # * :unless - Specifies a method, proc, or string to call to + # determine if the validation should not occur (e.g. unless: :skip_validation, + # or unless: Proc.new { |user| user.signup_step <= 2 }). The + # method, proc, or string should return or evaluate to a +true+ or +false+ + # value. + # + # pkg:gem/activemodel#lib/active_model/validations.rb:89 + def validates_each(*attr_names, &block); end + + # Passes the record off to the class or classes specified and allows them + # to add errors based on more complex conditions. + # + # class Person + # include ActiveModel::Validations + # validates_with MyValidator + # end + # + # class MyValidator < ActiveModel::Validator + # def validate(record) + # if some_complex_logic + # record.errors.add :base, 'This record is invalid' + # end + # end + # + # private + # def some_complex_logic + # # ... + # end + # end + # + # You may also pass it multiple classes, like so: + # + # class Person + # include ActiveModel::Validations + # validates_with MyValidator, MyOtherValidator, on: :create + # end + # + # There is no default error message for +validates_with+. You must + # manually add errors to the record's errors collection in the validator + # class. + # + # To implement the validate method, you must have a +record+ parameter + # defined, which is the record to be validated. + # + # Configuration options: + # * :on - Specifies the contexts where this validation is active. + # Runs in all validation contexts by default +nil+. You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or + # on: [:create, :custom_validation_context]) + # * :if - Specifies a method, proc, or string to call to determine + # if the validation should occur (e.g. if: :allow_validation, + # or if: Proc.new { |user| user.signup_step > 2 }). + # The method, proc, or string should return or evaluate to a +true+ or + # +false+ value. + # * :unless - Specifies a method, proc, or string to call to + # determine if the validation should not occur + # (e.g. unless: :skip_validation, or + # unless: Proc.new { |user| user.signup_step <= 2 }). + # The method, proc, or string should return or evaluate to a +true+ or + # +false+ value. + # * :strict - Specifies whether validation should be strict. + # See ActiveModel::Validations#validates! for more information. + # + # If you pass any additional configuration options, they will be passed + # to the class and available as +options+: + # + # class Person + # include ActiveModel::Validations + # validates_with MyValidator, my_custom_key: 'my custom value' + # end + # + # class MyValidator < ActiveModel::Validator + # def validate(record) + # options[:my_custom_key] # => "my custom value" + # end + # end + # + # pkg:gem/activemodel#lib/active_model/validations/with.rb:88 + def validates_with(*args, &block); end + + # List all validators that are being used to validate the model using + # +validates_with+ method. + # + # class Person + # include ActiveModel::Validations + # + # validates_with MyValidator + # validates_with OtherValidator, on: :create + # validates_with StrictValidator, strict: true + # end + # + # Person.validators + # # => [ + # # #, + # # #, + # # # + # # ] + # + # pkg:gem/activemodel#lib/active_model/validations.rb:206 + def validators; end + + # List all validators that are being used to validate a specific attribute. + # + # class Person + # include ActiveModel::Validations + # + # attr_accessor :name, :age + # + # validates_presence_of :name + # validates_inclusion_of :age, in: 0..99 + # end + # + # Person.validators_on(:name) + # # => [ + # # #, + # # ] + # + # pkg:gem/activemodel#lib/active_model/validations.rb:268 + def validators_on(*attributes); end + + private + + # pkg:gem/activemodel#lib/active_model/validations/validates.rb:166 + def _parse_validates_options(options); end + + # When creating custom validators, it might be useful to be able to specify + # additional default keys. This can be done by overwriting this method. + # + # pkg:gem/activemodel#lib/active_model/validations/validates.rb:162 + def _validates_default_keys; end + + # pkg:gem/activemodel#lib/active_model/validations.rb:298 + def predicate_for_validation_context(context); end +end + +# pkg:gem/activemodel#lib/active_model/validations.rb:93 +ActiveModel::Validations::ClassMethods::VALID_OPTIONS_FOR_VALIDATE = T.let(T.unsafe(nil), Array) + +# pkg:gem/activemodel#lib/active_model/validations/clusivity.rb:8 +module ActiveModel::Validations::Clusivity + include ::ActiveModel::Validations::ResolveValue + + # pkg:gem/activemodel#lib/active_model/validations/clusivity.rb:14 + def check_validity!; end + + private + + # pkg:gem/activemodel#lib/active_model/validations/clusivity.rb:31 + def delimiter; end + + # pkg:gem/activemodel#lib/active_model/validations/clusivity.rb:21 + def include?(record, value); end + + # After Ruby 2.2, Range#include? on non-number-or-time-ish ranges checks all + # possible values in the range for equality, which is slower but more accurate. + # Range#cover? uses the previous logic of comparing a value with the range + # endpoints, which is fast but is only accurate on Numeric, Time, Date, + # or DateTime ranges. + # + # pkg:gem/activemodel#lib/active_model/validations/clusivity.rb:40 + def inclusion_method(enumerable); end +end + +# pkg:gem/activemodel#lib/active_model/validations/clusivity.rb:11 +ActiveModel::Validations::Clusivity::ERROR_MESSAGE = T.let(T.unsafe(nil), String) + +# pkg:gem/activemodel#lib/active_model/validations/comparability.rb:5 +module ActiveModel::Validations::Comparability + # pkg:gem/activemodel#lib/active_model/validations/comparability.rb:10 + def error_options(value, option_value); end +end + +# pkg:gem/activemodel#lib/active_model/validations/comparability.rb:6 +ActiveModel::Validations::Comparability::COMPARE_CHECKS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activemodel#lib/active_model/validations/comparison.rb:8 +class ActiveModel::Validations::ComparisonValidator < ::ActiveModel::EachValidator + include ::ActiveModel::Validations::Comparability + include ::ActiveModel::Validations::ResolveValue + + # pkg:gem/activemodel#lib/active_model/validations/comparison.rb:12 + def check_validity!; end + + # pkg:gem/activemodel#lib/active_model/validations/comparison.rb:19 + def validate_each(record, attr_name, value); end +end + +# pkg:gem/activemodel#lib/active_model/validations/confirmation.rb:5 +class ActiveModel::Validations::ConfirmationValidator < ::ActiveModel::EachValidator + # pkg:gem/activemodel#lib/active_model/validations/confirmation.rb:6 + def initialize(options); end + + # pkg:gem/activemodel#lib/active_model/validations/confirmation.rb:11 + def validate_each(record, attribute, value); end + + private + + # pkg:gem/activemodel#lib/active_model/validations/confirmation.rb:31 + def confirmation_value_equal?(record, attribute, value, confirmed); end + + # pkg:gem/activemodel#lib/active_model/validations/confirmation.rb:21 + def setup!(klass); end +end + +# pkg:gem/activemodel#lib/active_model/validations/exclusion.rb:7 +class ActiveModel::Validations::ExclusionValidator < ::ActiveModel::EachValidator + include ::ActiveModel::Validations::ResolveValue + include ::ActiveModel::Validations::Clusivity + + # pkg:gem/activemodel#lib/active_model/validations/exclusion.rb:10 + def validate_each(record, attribute, value); end +end + +# pkg:gem/activemodel#lib/active_model/validations/format.rb:7 +class ActiveModel::Validations::FormatValidator < ::ActiveModel::EachValidator + include ::ActiveModel::Validations::ResolveValue + + # pkg:gem/activemodel#lib/active_model/validations/format.rb:20 + def check_validity!; end + + # pkg:gem/activemodel#lib/active_model/validations/format.rb:10 + def validate_each(record, attribute, value); end + + private + + # pkg:gem/activemodel#lib/active_model/validations/format.rb:34 + def check_options_validity(name); end + + # pkg:gem/activemodel#lib/active_model/validations/format.rb:30 + def record_error(record, attribute, name, value); end + + # pkg:gem/activemodel#lib/active_model/validations/format.rb:48 + def regexp_using_multiline_anchors?(regexp); end +end + +# pkg:gem/activemodel#lib/active_model/validations/absence.rb:12 +module ActiveModel::Validations::HelperMethods + # Validates that the specified attributes are blank (as defined by + # Object#present?). + # + # class Person < ActiveRecord::Base + # validates_absence_of :first_name + # end + # + # The first_name attribute must be in the object and it must be blank. + # + # Configuration options: + # * :message - A custom error message (default is: "must be blank"). + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+. + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # pkg:gem/activemodel#lib/active_model/validations/absence.rb:28 + def validates_absence_of(*attr_names); end + + # Encapsulates the pattern of wanting to validate the acceptance of a + # terms of service check box (or similar agreement). + # + # class Person < ActiveRecord::Base + # validates_acceptance_of :terms_of_service + # validates_acceptance_of :eula, message: 'must be abided' + # end + # + # If the database column does not exist, the +terms_of_service+ attribute + # is entirely virtual. This check is performed only if +terms_of_service+ + # is not +nil+. + # + # Configuration options: + # * :message - A custom error message (default is: "must be + # accepted"). + # * :accept - Specifies a value that is considered accepted. + # Also accepts an array of possible values. The default value is + # an array ["1", true], which makes it easy to relate to an HTML + # checkbox. This should be set to, or include, +true+ if you are validating + # a database column, since the attribute is typecast from "1" to +true+ + # before validation. + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+. + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # pkg:gem/activemodel#lib/active_model/validations/acceptance.rb:108 + def validates_acceptance_of(*attr_names); end + + # Validates the value of a specified attribute fulfills all + # defined comparisons with another value, proc, or attribute. + # + # class Person < ActiveRecord::Base + # validates_comparison_of :value, greater_than: 'the sum of its parts' + # end + # + # Configuration options: + # * :message - A custom error message (default is: "failed comparison"). + # * :greater_than - Specifies the value must be greater than the + # supplied value. The default error message for this option is _"must be + # greater than %{count}"_. + # * :greater_than_or_equal_to - Specifies the value must be + # greater than or equal to the supplied value. The default error message + # for this option is _"must be greater than or equal to %{count}"_. + # * :equal_to - Specifies the value must be equal to the supplied + # value. The default error message for this option is _"must be equal to + # %{count}"_. + # * :less_than - Specifies the value must be less than the + # supplied value. The default error message for this option is _"must be + # less than %{count}"_. + # * :less_than_or_equal_to - Specifies the value must be less + # than or equal to the supplied value. The default error message for + # this option is _"must be less than or equal to %{count}"_. + # * :other_than - Specifies the value must not be equal to the + # supplied value. The default error message for this option is _"must be + # other than %{count}"_. + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+ . + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # The validator requires at least one of the following checks to be supplied. + # Each will accept a proc, value, or a symbol which corresponds to a method: + # + # * :greater_than + # * :greater_than_or_equal_to + # * :equal_to + # * :less_than + # * :less_than_or_equal_to + # * :other_than + # + # For example: + # + # class Person < ActiveRecord::Base + # validates_comparison_of :birth_date, less_than_or_equal_to: -> { Date.today } + # validates_comparison_of :preferred_name, other_than: :given_name, allow_nil: true + # end + # + # pkg:gem/activemodel#lib/active_model/validations/comparison.rb:85 + def validates_comparison_of(*attr_names); end + + # Encapsulates the pattern of wanting to validate a password or email + # address field with a confirmation. + # + # Model: + # class Person < ActiveRecord::Base + # validates_confirmation_of :user_name, :password + # validates_confirmation_of :email_address, + # message: 'should match confirmation' + # end + # + # View: + # <%= password_field "person", "password" %> + # <%= password_field "person", "password_confirmation" %> + # + # The added +password_confirmation+ attribute is virtual; it exists only + # as an in-memory attribute for validating the password. To achieve this, + # the validation adds accessors to the model for the confirmation + # attribute. + # + # NOTE: This check is performed only if +password_confirmation+ is not + # +nil+. To require confirmation, make sure to add a presence check for + # the confirmation attribute: + # + # validates_presence_of :password_confirmation, if: :password_changed? + # + # Configuration options: + # * :message - A custom error message (default is: "doesn't match + # %{translated_attribute_name}"). + # * :case_sensitive - Looks for an exact match. Ignored by + # non-text columns (+true+ by default). + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+. + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # pkg:gem/activemodel#lib/active_model/validations/confirmation.rb:75 + def validates_confirmation_of(*attr_names); end + + # Validates that the value of the specified attribute is not in a + # particular enumerable object. + # + # class Person < ActiveRecord::Base + # validates_exclusion_of :username, in: %w( admin superuser ), message: "You don't belong here" + # validates_exclusion_of :age, in: 30..60, message: 'This site is only for under 30 and over 60' + # validates_exclusion_of :format, in: %w( mov avi ), message: "extension %{value} is not allowed" + # validates_exclusion_of :password, in: ->(person) { [person.username, person.first_name] }, + # message: 'should not be the same as your username or first name' + # validates_exclusion_of :karma, in: :reserved_karmas + # end + # + # Configuration options: + # * :in - An enumerable object of items that the value shouldn't + # be part of. This can be supplied as a proc, lambda, or symbol which returns an + # enumerable. If the enumerable is a numerical, time, or datetime range the test + # is performed with Range#cover?, otherwise with include?. When + # using a proc or lambda the instance under validation is passed as an argument. + # * :within - A synonym(or alias) for :in + # Range#cover?, otherwise with include?. + # * :message - Specifies a custom error message (default is: "is + # reserved"). + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+. + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # pkg:gem/activemodel#lib/active_model/validations/exclusion.rb:44 + def validates_exclusion_of(*attr_names); end + + # Validates whether the value of the specified attribute is of the correct + # form, going by the regular expression provided. You can require that the + # attribute matches the regular expression: + # + # class Person < ActiveRecord::Base + # validates_format_of :email, with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create + # end + # + # Alternatively, you can require that the specified attribute does _not_ + # match the regular expression: + # + # class Person < ActiveRecord::Base + # validates_format_of :email, without: /NOSPAM/ + # end + # + # You can also provide a proc or lambda which will determine the regular + # expression that will be used to validate the attribute. + # + # class Person < ActiveRecord::Base + # # Admin can have number as a first letter in their screen name + # validates_format_of :screen_name, + # with: ->(person) { person.admin? ? /\A[a-z0-9][a-z0-9_\-]*\z/i : /\A[a-z][a-z0-9_\-]*\z/i } + # end + # + # Note: use \A and \z to match the start and end of the + # string, ^ and $ match the start/end of a line. + # + # Due to frequent misuse of ^ and $, you need to pass + # the multiline: true option in case you use any of these two + # anchors in the provided regular expression. In most cases, you should be + # using \A and \z. + # + # You must pass either :with or :without as an option. + # In addition, both must be a regular expression or a proc or lambda, or + # else an exception will be raised. + # + # Configuration options: + # * :message - A custom error message (default is: "is invalid"). + # * :with - Regular expression that if the attribute matches will + # result in a successful validation. This can be provided as a proc or + # lambda returning regular expression which will be called at runtime. + # * :without - Regular expression that if the attribute does not + # match will result in a successful validation. This can be provided as + # a proc or lambda returning regular expression which will be called at + # runtime. + # * :multiline - Set to true if your regular expression contains + # anchors that match the beginning or end of lines as opposed to the + # beginning or end of the string. These anchors are ^ and $. + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+. + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # pkg:gem/activemodel#lib/active_model/validations/format.rb:107 + def validates_format_of(*attr_names); end + + # Validates whether the value of the specified attribute is available in a + # particular enumerable object. + # + # class Person < ActiveRecord::Base + # validates_inclusion_of :role, in: %w( admin contributor ) + # validates_inclusion_of :age, in: 0..99 + # validates_inclusion_of :format, in: %w( jpg gif png ), message: "extension %{value} is not included in the list" + # validates_inclusion_of :states, in: ->(person) { STATES[person.country] } + # validates_inclusion_of :karma, in: :available_karmas + # end + # + # Configuration options: + # * :in - An enumerable object of available items. This can be + # supplied as a proc, lambda, or symbol which returns an enumerable. If the + # enumerable is a numerical, time, or datetime range the test is performed + # with Range#cover?, otherwise with include?. When using + # a proc or lambda the instance under validation is passed as an argument. + # * :within - A synonym(or alias) for :in + # * :message - Specifies a custom error message (default is: "is + # not included in the list"). + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+. + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # pkg:gem/activemodel#lib/active_model/validations/inclusion.rb:42 + def validates_inclusion_of(*attr_names); end + + # Validates that the specified attributes match the length restrictions + # supplied. Only one constraint option can be used at a time apart from + # +:minimum+ and +:maximum+ that can be combined together: + # + # class Person < ActiveRecord::Base + # validates_length_of :first_name, maximum: 30 + # validates_length_of :last_name, maximum: 30, message: "less than 30 if you don't mind" + # validates_length_of :fax, in: 7..32, allow_nil: true + # validates_length_of :phone, in: 7..32, allow_blank: true + # validates_length_of :user_name, within: 6..20, too_long: 'pick a shorter name', too_short: 'pick a longer name' + # validates_length_of :zip_code, minimum: 5, too_short: 'please enter at least 5 characters' + # validates_length_of :smurf_leader, is: 4, message: "papa is spelled with 4 characters... don't play me." + # validates_length_of :words_in_essay, minimum: 100, too_short: 'Your essay must be at least 100 words.' + # + # private + # def words_in_essay + # essay.scan(/\w+/) + # end + # end + # + # Constraint options: + # + # * :minimum - The minimum size of the attribute. + # * :maximum - The maximum size of the attribute. Allows +nil+ by + # default if not used with +:minimum+. + # * :is - The exact size of the attribute. + # * :within - A range specifying the minimum and maximum size of + # the attribute. + # * :in - A synonym (or alias) for :within. + # + # Other options: + # + # * :allow_nil - Attribute may be +nil+; skip validation. + # * :allow_blank - Attribute may be blank; skip validation. + # * :too_long - The error message if the attribute goes over the + # maximum (default is: "is too long (maximum is %{count} characters)"). + # * :too_short - The error message if the attribute goes under the + # minimum (default is: "is too short (minimum is %{count} characters)"). + # * :wrong_length - The error message if using the :is + # method and the attribute is the wrong size (default is: "is the wrong + # length (should be %{count} characters)"). + # * :message - The error message to use for a :minimum, + # :maximum, or :is violation. An alias of the appropriate + # too_long/too_short/wrong_length message. + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, and +:strict+. + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # pkg:gem/activemodel#lib/active_model/validations/length.rb:123 + def validates_length_of(*attr_names); end + + # Validates whether the value of the specified attribute is numeric by + # trying to convert it to a float with +Kernel.Float+ (if + # only_integer is +false+) or applying it to the regular + # expression /\A[\+\-]?\d+\z/ (if only_integer is set to + # +true+). Precision of +Kernel.Float+ values are guaranteed up to 15 + # digits. + # + # class Person < ActiveRecord::Base + # validates_numericality_of :value, on: :create + # end + # + # Configuration options: + # * :message - A custom error message (default is: "is not a number"). + # * :only_integer - Specifies whether the value has to be an + # integer (default is +false+). + # * :only_numeric - Specifies whether the value has to be an + # instance of Numeric (default is +false+). The default behavior is to + # attempt parsing the value if it is a String. + # * :allow_nil - Skip validation if attribute is +nil+ (default is + # +false+). Notice that for Integer and Float columns empty strings are + # converted to +nil+. + # * :greater_than - Specifies the value must be greater than the + # supplied value. The default error message for this option is _"must be + # greater than %{count}"_. + # * :greater_than_or_equal_to - Specifies the value must be + # greater than or equal the supplied value. The default error message + # for this option is _"must be greater than or equal to %{count}"_. + # * :equal_to - Specifies the value must be equal to the supplied + # value. The default error message for this option is _"must be equal to + # %{count}"_. + # * :less_than - Specifies the value must be less than the + # supplied value. The default error message for this option is _"must be + # less than %{count}"_. + # * :less_than_or_equal_to - Specifies the value must be less + # than or equal the supplied value. The default error message for this + # option is _"must be less than or equal to %{count}"_. + # * :other_than - Specifies the value must be other than the + # supplied value. The default error message for this option is _"must be + # other than %{count}"_. + # * :odd - Specifies the value must be an odd number. The default + # error message for this option is _"must be odd"_. + # * :even - Specifies the value must be an even number. The + # default error message for this option is _"must be even"_. + # * :in - Check that the value is within a range. The default + # error message for this option is _"must be in %{count}"_. + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+ . + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # The following checks can also be supplied with a proc or a symbol which + # corresponds to a method: + # + # * :greater_than + # * :greater_than_or_equal_to + # * :equal_to + # * :less_than + # * :less_than_or_equal_to + # * :only_integer + # * :other_than + # + # For example: + # + # class Person < ActiveRecord::Base + # validates_numericality_of :width, less_than: ->(person) { person.height } + # validates_numericality_of :width, greater_than: :minimum_weight + # end + # + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:217 + def validates_numericality_of(*attr_names); end + + # Validates that the specified attributes are not blank (as defined by + # Object#blank?). + # + # class Person < ActiveRecord::Base + # validates_presence_of :first_name + # end + # + # The first_name attribute must be in the object and it cannot be blank. + # + # If you want to validate the presence of a boolean field (where the real + # values are +true+ and +false+), you will want to use + # validates_inclusion_of :field_name, in: [true, false]. + # + # This is due to the way Object#blank? handles boolean values: + # false.blank? # => true. + # + # Configuration options: + # * :message - A custom error message (default is: "can't be blank"). + # + # There is also a list of default options supported by every validator: + # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+. + # See ActiveModel::Validations::ClassMethods#validates for more information. + # + # pkg:gem/activemodel#lib/active_model/validations/presence.rb:34 + def validates_presence_of(*attr_names); end + + # pkg:gem/activemodel#lib/active_model/validations/length.rb:127 + def validates_size_of(*attr_names); end + + private + + # pkg:gem/activemodel#lib/active_model/validations/helper_methods.rb:7 + def _merge_attributes(attr_names); end +end + +# pkg:gem/activemodel#lib/active_model/validations/inclusion.rb:7 +class ActiveModel::Validations::InclusionValidator < ::ActiveModel::EachValidator + include ::ActiveModel::Validations::ResolveValue + include ::ActiveModel::Validations::Clusivity + + # pkg:gem/activemodel#lib/active_model/validations/inclusion.rb:10 + def validate_each(record, attribute, value); end +end + +# pkg:gem/activemodel#lib/active_model/validations/length.rb:7 +class ActiveModel::Validations::LengthValidator < ::ActiveModel::EachValidator + include ::ActiveModel::Validations::ResolveValue + + # pkg:gem/activemodel#lib/active_model/validations/length.rb:15 + def initialize(options); end + + # pkg:gem/activemodel#lib/active_model/validations/length.rb:29 + def check_validity!; end + + # pkg:gem/activemodel#lib/active_model/validations/length.rb:47 + def validate_each(record, attribute, value); end + + private + + # pkg:gem/activemodel#lib/active_model/validations/length.rb:69 + def skip_nil_check?(key); end +end + +# pkg:gem/activemodel#lib/active_model/validations/length.rb:11 +ActiveModel::Validations::LengthValidator::CHECKS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activemodel#lib/active_model/validations/length.rb:10 +ActiveModel::Validations::LengthValidator::MESSAGES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activemodel#lib/active_model/validations/length.rb:13 +ActiveModel::Validations::LengthValidator::RESERVED_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activemodel#lib/active_model/validations/numericality.rb:9 +class ActiveModel::Validations::NumericalityValidator < ::ActiveModel::EachValidator + include ::ActiveModel::Validations::Comparability + include ::ActiveModel::Validations::ResolveValue + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:22 + def check_validity!; end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:36 + def validate_each(record, attr_name, value, precision: T.unsafe(nil), scale: T.unsafe(nil)); end + + private + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:118 + def allow_only_integer?(record); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:112 + def filtered_options(value); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:108 + def is_hexadecimal_literal?(raw_value); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:104 + def is_integer?(raw_value); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:94 + def is_number?(raw_value, precision, scale); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:68 + def option_as_number(record, option_value, precision, scale); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:72 + def parse_as_number(raw_value, precision, scale); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:86 + def parse_float(raw_value, precision, scale); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:122 + def prepare_value_for_validation(value, record, attr_name); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:143 + def record_attribute_changed_in_place?(record, attr_name); end + + # pkg:gem/activemodel#lib/active_model/validations/numericality.rb:90 + def round(raw_value, scale); end +end + +# pkg:gem/activemodel#lib/active_model/validations/numericality.rb:20 +ActiveModel::Validations::NumericalityValidator::HEXADECIMAL_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activemodel#lib/active_model/validations/numericality.rb:18 +ActiveModel::Validations::NumericalityValidator::INTEGER_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activemodel#lib/active_model/validations/numericality.rb:14 +ActiveModel::Validations::NumericalityValidator::NUMBER_CHECKS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activemodel#lib/active_model/validations/numericality.rb:13 +ActiveModel::Validations::NumericalityValidator::RANGE_CHECKS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activemodel#lib/active_model/validations/numericality.rb:16 +ActiveModel::Validations::NumericalityValidator::RESERVED_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activemodel#lib/active_model/validations/presence.rb:5 +class ActiveModel::Validations::PresenceValidator < ::ActiveModel::EachValidator + # pkg:gem/activemodel#lib/active_model/validations/presence.rb:6 + def validate_each(record, attr_name, value); end +end + +# pkg:gem/activemodel#lib/active_model/validations/resolve_value.rb:5 +module ActiveModel::Validations::ResolveValue + # pkg:gem/activemodel#lib/active_model/validations/resolve_value.rb:6 + def resolve_value(record, value); end +end + +# pkg:gem/activemodel#lib/active_model/validations/with.rb:7 +class ActiveModel::Validations::WithValidator < ::ActiveModel::EachValidator + # pkg:gem/activemodel#lib/active_model/validations/with.rb:8 + def validate_each(record, attr, val); end +end + +# = Active \Model \Validator +# +# A simple base class that can be used along with +# ActiveModel::Validations::ClassMethods.validates_with +# +# class Person +# include ActiveModel::Validations +# validates_with MyValidator +# end +# +# class MyValidator < ActiveModel::Validator +# def validate(record) +# if some_complex_logic +# record.errors.add(:base, "This record is invalid") +# end +# end +# +# private +# def some_complex_logic +# # ... +# end +# end +# +# Any class that inherits from \ActiveModel::Validator must implement a method +# called +validate+ which accepts a +record+. +# +# class Person +# include ActiveModel::Validations +# validates_with MyValidator +# end +# +# class MyValidator < ActiveModel::Validator +# def validate(record) +# record # => The person instance being validated +# options # => Any non-standard options passed to validates_with +# end +# end +# +# To cause a validation error, you must add to the +record+'s errors directly +# from within the validators message. +# +# class MyValidator < ActiveModel::Validator +# def validate(record) +# record.errors.add :base, "This is some custom error message" +# record.errors.add :first_name, "This is some complex validation" +# # etc... +# end +# end +# +# To add behavior to the initialize method, use the following signature: +# +# class MyValidator < ActiveModel::Validator +# def initialize(options) +# super +# @my_custom_field = options[:field_name] || :first_name +# end +# end +# +# Note that the validator is initialized only once for the whole application +# life cycle, and not on each validation run. +# +# The easiest way to add custom validators for validating individual attributes +# is with the convenient ActiveModel::EachValidator class. +# +# class TitleValidator < ActiveModel::EachValidator +# def validate_each(record, attribute, value) +# record.errors.add attribute, 'must be Mr., Mrs., or Dr.' unless %w(Mr. Mrs. Dr.).include?(value) +# end +# end +# +# This can now be used in combination with the +validates+ method. +# See ActiveModel::Validations::ClassMethods#validates for more on this. +# +# class Person +# include ActiveModel::Validations +# attr_accessor :title +# +# validates :title, presence: true, title: true +# end +# +# It can be useful to access the class that is using that validator when there are prerequisites such +# as an +attr_accessor+ being present. This class is accessible via options[:class] in the constructor. +# To set up your validator override the constructor. +# +# class MyValidator < ActiveModel::Validator +# def initialize(options={}) +# super +# options[:class].attr_accessor :custom_attribute +# end +# end +# +# pkg:gem/activemodel#lib/active_model/validator.rb:96 +class ActiveModel::Validator + # Accepts options that will be made available through the +options+ reader. + # + # pkg:gem/activemodel#lib/active_model/validator.rb:108 + def initialize(options = T.unsafe(nil)); end + + # Returns the kind for this validator. + # + # PresenceValidator.new(attributes: [:username]).kind # => :presence + # AcceptanceValidator.new(attributes: [:terms]).kind # => :acceptance + # + # pkg:gem/activemodel#lib/active_model/validator.rb:116 + def kind; end + + # pkg:gem/activemodel#lib/active_model/validator.rb:97 + def options; end + + # Override this method in subclasses with validation logic, adding errors + # to the records +errors+ array where necessary. + # + # pkg:gem/activemodel#lib/active_model/validator.rb:122 + def validate(record); end + + class << self + # Returns the kind of the validator. + # + # PresenceValidator.kind # => :presence + # AcceptanceValidator.kind # => :acceptance + # + # pkg:gem/activemodel#lib/active_model/validator.rb:103 + def kind; end + end +end diff --git a/sorbet/rbi/gems/activerecord-import@3.0.1.rbi b/sorbet/rbi/gems/activerecord-import@3.0.1.rbi new file mode 100644 index 000000000..393327171 --- /dev/null +++ b/sorbet/rbi/gems/activerecord-import@3.0.1.rbi @@ -0,0 +1,899 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `activerecord-import` gem. +# Please instead update this file by running `bin/tapioca gem activerecord-import`. + + +class ActiveModel::Validations::PresenceValidator < ::ActiveModel::EachValidator + include ::ActiveRecord::Import::ForeignKeyPresenceValidation +end + +# pkg:gem/activerecord-import#lib/activerecord-import/active_record/adapters/abstract_adapter.rb:5 +module ActiveRecord; end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:106 +class ActiveRecord::Associations::CollectionAssociation < ::ActiveRecord::Associations::Association + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:107 + def bulk_import(*args, &block); end + + # pkg:gem/activerecord-import#lib/activerecord-import/base.rb:5 + def import(*args, &block); end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:100 +class ActiveRecord::Associations::CollectionProxy < ::ActiveRecord::Relation + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:101 + def bulk_import(*args, &block); end + + # pkg:gem/activerecord-import#lib/activerecord-import/base.rb:5 + def import(*args, &block); end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:247 +class ActiveRecord::Base + include ::ActiveModel::ForbiddenAttributesProtection + include ::ActiveModel::AttributeAssignment + include ::ActiveModel::Access + include ::ActiveModel::Serialization + extend ::ActiveRecord::SignedId::DeprecateSignedIdVerifierSecret + + # See ActiveRecord::ConnectionAdapters::AbstractAdapter.synchronize + # + # pkg:gem/activerecord-import#lib/activerecord-import/synchronize.rb:77 + def synchronize(instances, key = T.unsafe(nil)); end + + class << self + # Imports a collection of values to the database. + # + # This is more efficient than using ActiveRecord::Base#create or + # ActiveRecord::Base#save multiple times. This method works well if + # you want to create more than one record at a time and do not care + # about having ActiveRecord objects returned for each record + # inserted. + # + # This can be used with or without validations. It does not utilize + # the ActiveRecord::Callbacks during creation/modification while + # performing the import. + # + # == Usage + # Model.import array_of_models + # Model.import column_names, array_of_models + # Model.import array_of_hash_objects + # Model.import column_names, array_of_hash_objects + # Model.import column_names, array_of_values + # Model.import column_names, array_of_values, options + # + # ==== Model.import array_of_models + # + # With this form you can call _import_ passing in an array of model + # objects that you want updated. + # + # ==== Model.import column_names, array_of_values + # + # The first parameter +column_names+ is an array of symbols or + # strings which specify the columns that you want to update. + # + # The second parameter, +array_of_values+, is an array of + # arrays. Each subarray is a single set of values for a new + # record. The order of values in each subarray should match up to + # the order of the +column_names+. + # + # ==== Model.import column_names, array_of_values, options + # + # The first two parameters are the same as the above form. The third + # parameter, +options+, is a hash. This is optional. Please see + # below for what +options+ are available. + # + # == Options + # * +validate+ - true|false, tells import whether or not to use + # ActiveRecord validations. Validations are enforced by default. + # It skips the uniqueness validation for performance reasons. + # You can find more details here: + # https://github.com/zdennis/activerecord-import/issues/228 + # * +ignore+ - true|false, an alias for on_duplicate_key_ignore. + # * +on_duplicate_key_ignore+ - true|false, tells import to discard + # records that contain duplicate keys. For Postgres 9.5+ it adds + # ON CONFLICT DO NOTHING, for MySQL it uses INSERT IGNORE, and for + # SQLite it uses INSERT OR IGNORE. Cannot be enabled on a + # recursive import. For database adapters that normally support + # setting primary keys on imported objects, this option prevents + # that from occurring. + # * +on_duplicate_key_update+ - :all, an Array, or Hash, tells import to + # use MySQL's ON DUPLICATE KEY UPDATE or Postgres/SQLite ON CONFLICT + # DO UPDATE ability. See On Duplicate Key Update below. + # * +synchronize+ - an array of ActiveRecord instances for the model + # that you are currently importing data into. This synchronizes + # existing model instances in memory with updates from the import. + # * +timestamps+ - true|false, tells import to not add timestamps + # (if false) even if record timestamps is disabled in ActiveRecord::Base + # * +recursive+ - true|false, tells import to import all has_many/has_one + # associations if the adapter supports setting the primary keys of the + # newly imported objects. PostgreSQL and MariaDB 10.5+ only. + # * +batch_size+ - an integer value to specify the max number of records to + # include per insert. Defaults to the total number of records to import. + # + # == Examples + # class BlogPost < ActiveRecord::Base ; end + # + # # Example using array of model objects + # posts = [ BlogPost.new author_name: 'Zach Dennis', title: 'AREXT', + # BlogPost.new author_name: 'Zach Dennis', title: 'AREXT2', + # BlogPost.new author_name: 'Zach Dennis', title: 'AREXT3' ] + # BlogPost.import posts + # + # # Example using array_of_hash_objects + # # NOTE: column_names will be determined by using the keys of the first hash in the array. If later hashes in the + # # array have different keys an exception will be raised. If you have hashes to import with different sets of keys + # # we recommend grouping these into batches before importing. + # values = [ {author_name: 'zdennis', title: 'test post'} ], [ {author_name: 'jdoe', title: 'another test post'} ] ] + # BlogPost.import values + # + # # Example using column_names and array_of_hash_objects + # columns = [ :author_name, :title ] + # values = [ {author_name: 'zdennis', title: 'test post'} ], [ {author_name: 'jdoe', title: 'another test post'} ] ] + # BlogPost.import columns, values + # + # # Example using column_names and array_of_values + # columns = [ :author_name, :title ] + # values = [ [ 'zdennis', 'test post' ], [ 'jdoe', 'another test post' ] ] + # BlogPost.import columns, values + # + # # Example using column_names, array_of_value and options + # columns = [ :author_name, :title ] + # values = [ [ 'zdennis', 'test post' ], [ 'jdoe', 'another test post' ] ] + # BlogPost.import( columns, values, validate: false ) + # + # # Example synchronizing existing instances in memory + # post = BlogPost.where(author_name: 'zdennis').first + # puts post.author_name # => 'zdennis' + # columns = [ :author_name, :title ] + # values = [ [ 'yoda', 'test post' ] ] + # BlogPost.import posts, synchronize: [ post ] + # puts post.author_name # => 'yoda' + # + # # Example synchronizing unsaved/new instances in memory by using a uniqued imported field + # posts = [BlogPost.new(title: "Foo"), BlogPost.new(title: "Bar")] + # BlogPost.import posts, synchronize: posts, synchronize_keys: [:title] + # puts posts.first.persisted? # => true + # + # == On Duplicate Key Update (MySQL) + # + # The :on_duplicate_key_update option can be either :all, an Array, or a Hash. + # + # ==== Using :all + # + # The :on_duplicate_key_update option can be set to :all. All columns + # other than the primary key are updated, except for timestamps recorded + # on create, such as created_at. If a list of column names is + # supplied, only those columns will be updated. Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: :all + # + # ==== Using an Array + # + # The :on_duplicate_key_update option can be an array of column + # names. The column names are the only fields that are updated if + # a duplicate record is found. Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: [ :date_modified, :content, :author ] + # + # ==== Using A Hash + # + # The :on_duplicate_key_update option can be a hash of column names + # to model attribute name mappings. This gives you finer grained + # control over what fields are updated with what attributes on your + # model. Below is an example: + # + # BlogPost.import columns, attributes, on_duplicate_key_update: { title: :title } + # + # == On Duplicate Key Update (Postgres 9.5+ and SQLite 3.24+) + # + # The :on_duplicate_key_update option can be :all, an Array, or a Hash with up to + # three attributes, :conflict_target (and optionally :index_predicate) or + # :constraint_name (Postgres), and :columns. + # + # ==== Using :all + # + # The :on_duplicate_key_update option can be set to :all. All columns + # other than the primary key are updated, except for timestamps recorded + # on create, such as created_at. If a list of column names is + # supplied, only those columns will be updated. Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: :all + # + # ==== Using an Array + # + # The :on_duplicate_key_update option can be an array of column + # names. This option only handles inserts that conflict with the + # primary key. If a table does not have a primary key, this will + # not work. The column names are the only fields that are updated + # if a duplicate record is found. Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: [ :date_modified, :content, :author ] + # + # ==== Using a Hash + # + # The :on_duplicate_key_update option can be a hash with up to three + # attributes, :conflict_target (and optionally :index_predicate) or + # :constraint_name, and :columns. Unlike MySQL, Postgres requires the + # conflicting constraint to be explicitly specified. Using this option + # allows you to specify a constraint other than the primary key. + # + # ===== :conflict_target + # + # The :conflict_target attribute specifies the columns that make up the + # conflicting unique constraint and can be a single column or an array of + # column names. This attribute is ignored if :constraint_name is included, + # but it is the preferred method of identifying a constraint. It will + # default to the primary key. Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: { conflict_target: [ :author_id, :slug ], columns: [ :date_modified ] } + # + # ===== :index_predicate + # + # The :index_predicate attribute optionally specifies a WHERE condition + # on :conflict_target, which is required for matching against partial + # indexes. This attribute is ignored if :constraint_name is included. + # Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: { conflict_target: [ :author_id, :slug ], index_predicate: 'status <> 0', columns: [ :date_modified ] } + # + # ===== :constraint_name + # + # The :constraint_name attribute explicitly identifies the conflicting + # unique index by name. Postgres documentation discourages using this method + # of identifying an index unless absolutely necessary. Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: { constraint_name: :blog_posts_pkey, columns: [ :date_modified ] } + # + # ===== :condition + # + # The :condition attribute optionally specifies a WHERE condition + # on :conflict_action. Only rows for which this expression returns true will be updated. + # Note that it's evaluated last, after a conflict has been identified as a candidate to update. + # Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: { conflict_target: [ :author_id ], condition: "blog_posts.title NOT LIKE '%sample%'", columns: [ :author_name ] } + # + # ===== :columns + # + # The :columns attribute can be either :all, an Array, or a Hash. + # + # ===== Using :all + # + # The :columns attribute can be :all. All columns other than the primary key will be updated, + # except for timestamps recorded on create, such as created_at. + # If a list of column names is supplied, only those columns will be updated. + # Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: { conflict_target: :slug, columns: :all } + # + # ===== Using an Array + # + # The :columns attribute can be an array of column names. The column names + # are the only fields that are updated if a duplicate record is found. + # Below is an example: + # + # BlogPost.import columns, values, on_duplicate_key_update: { conflict_target: :slug, columns: [ :date_modified, :content, :author ] } + # + # ===== Using a Hash + # + # The :columns option can be a hash of column names to model attribute name + # mappings. This gives you finer grained control over what fields are updated + # with what attributes on your model. Below is an example: + # + # BlogPost.import columns, attributes, on_duplicate_key_update: { conflict_target: :slug, columns: { title: :title } } + # + # = Returns + # This returns an object which responds to +failed_instances+ and +num_inserts+. + # * failed_instances - an array of objects that fails validation and were not committed to the database. An empty array if no validation is performed. + # * num_inserts - the number of insert statements it took to import the data + # * ids - the primary keys of the imported ids if the adapter supports it, otherwise an empty array. + # * results - import results if the adapter supports it, otherwise an empty array. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:534 + def bulk_import(*args); end + + # Imports a collection of values if all values are valid. Import fails at the + # first encountered validation error and raises ActiveRecord::RecordInvalid + # with the failed instance. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:549 + def bulk_import!(*args); end + + # Returns the column for +name+, following an attribute alias unless +name+ is + # itself a column, so a column that's also an alias isn't replaced by the + # column it aliases. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:559 + def column_name_for_import(name); end + + # pkg:gem/activerecord-import#lib/activerecord-import/base.rb:5 + def import(*args); end + + # pkg:gem/activerecord-import#lib/activerecord-import/base.rb:5 + def import!(*args); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:564 + def import_helper(*args); end + + # Imports the passed in +column_names+ and +array_of_attributes+ + # given the passed in +options+ Hash with validations. Returns an + # object with the methods +failed_instances+ and +num_inserts+. + # +failed_instances+ is an array of instances that failed validations. + # +num_inserts+ is the number of inserts it took to import the data. See + # ActiveRecord::Base.import for more information on + # +column_names+, +array_of_attributes+ and +options+. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:649 + def import_with_validations(conn, column_names, array_of_attributes, options = T.unsafe(nil)); end + + # Imports the passed in +column_names+ and +array_of_attributes+ + # given the passed in +options+ Hash. This will return the number + # of insert operations it took to create these records without + # validations or callbacks. See ActiveRecord::Base.import for more + # information on +column_names+, +array_of_attributes_ and + # +options+. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:668 + def import_without_validations_or_callbacks(conn, column_names, array_of_attributes, options = T.unsafe(nil)); end + + # Returns true if the current database connection adapter + # supports import functionality, otherwise returns false. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:251 + def supports_import?(conn = T.unsafe(nil)); end + + # Returns true if the current database connection adapter + # supports on duplicate key update functionality, otherwise + # returns false. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:264 + def supports_on_duplicate_key_update?(conn = T.unsafe(nil)); end + + # returns true if the current database connection adapter + # supports setting the primary key of bulk imported models, otherwise + # returns false + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:277 + def supports_setting_primary_key_of_imported_objects?(conn = T.unsafe(nil)); end + + # Synchronizes the passed in ActiveRecord instances with data + # from the database. This is like calling reload on an individual + # ActiveRecord instance but it is intended for use on multiple instances. + # + # This uses one query for all instance updates and then updates existing + # instances rather sending one query for each instance + # + # == Examples + # # Synchronizing existing models by matching on the primary key field + # posts = Post.where(author: "Zach").first + # <.. out of system changes occur to change author name from Zach to Zachary..> + # Post.synchronize posts + # posts.first.author # => "Zachary" instead of Zach + # + # # Synchronizing using custom key fields + # posts = Post.where(author: "Zach").first + # <.. out of system changes occur to change the address of author 'Zach' to 1245 Foo Ln ..> + # Post.synchronize posts, [:name] # queries on the :name column and not the :id column + # posts.first.address # => "1245 Foo Ln" instead of whatever it was + # + # pkg:gem/activerecord-import#lib/activerecord-import/synchronize.rb:25 + def synchronize(instances, keys = T.unsafe(nil)); end + + private + + # Adds the models that failed validation, when their rows were read, to +failed_instances+. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:925 + def add_failed_models(failed_instances, models, options); end + + # Force the primary key col into the insert if it's not + # on the list and we are using a sequence and stuff a nil + # value for it into each row so the sequencer will fire later + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:911 + def add_primary_key_for_sequence(conn, column_names, array_of_attributes); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1307 + def add_special_rails_stamps(conn, column_names, array_of_attributes, options); end + + # Converts array-like arguments, such as a Relation or a Set, to arrays. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1346 + def arrays_from_array_like_import_arguments(args); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:987 + def associated_options(options, association); end + + # Returns the values of +model+ that the foreign key of +association_reflection+ + # refers to: the columns named by the association's :primary_key option when + # one is given (e.g. has_many :reviews, primary_key: :identifier), + # and the model's id otherwise. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1254 + def association_foreign_key_values(model, association_reflection); end + + # Returns the names of the columns that a belongs_to association's foreign key refers to. + # For a composite key, ActiveRecord 7.1+ returns an Array, while older versions return + # its string form, e.g. "[:account_id, :id]". + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1127 + def association_primary_key_names(association_reflection); end + + # Returns the values of +column_names+ for each of +models+, the rows to import. Models + # that +validator+ finds invalid are left out, or raise ActiveRecord::RecordInvalid with + # the :raise_error option. Without a +validator+, the models aren't validated. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:798 + def attributes_from_models(conn, models, column_names, validator, options); end + + # Returns the column names and the rows to import from +args+, which are either an + # array of hashes, optionally after column names, or column names and an array of values. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:834 + def column_names_and_attributes_for_import(args); end + + # Returns the columns the database populates itself, such as with a default + # function, when importing new +models+. Like ActiveRecord's own inserts, the + # database populates these for models that don't assign a value, instead of + # inserting NULL. The primary key is handled separately. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1163 + def database_populated_column_names(conn, column_names, models); end + + # Returns the primary key columns the database populates itself, such as a uuid + # or a key with a default function, rather than from the model's sequence. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1179 + def database_populated_primary_keys(conn); end + + # We are eventually going to call Class.import so we build up a hash + # of class => objects to import. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1206 + def find_associated_objects_for_import(associated_objects_by_class, model); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1134 + def import_associations(models, options); end + + # Imports the new and changed associations of the +models+ that were imported, with the + # :on_duplicate_key_update option that was passed in rather than the copy used for +models+. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:966 + def import_associations_of_imported_models(models, import_result, on_duplicate_key_update, options); end + + # Returns the models that weren't rejected by validations. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:996 + def imported_models(models, import_result, options); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1350 + def invalid_import_arguments_message(args); end + + # Sync belongs_to association ids with foreign key field + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1102 + def load_association_ids(model); end + + # Returns the models to import from +args+, the column names to import them with, + # and the columns the database populates for the models that don't assign them, + # which is nil when +args+ give the column names. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:771 + def models_and_column_names_for_import(conn, args); end + + # Returns a copy of the +on_duplicate_key_update+ option to import with, so it can be + # changed, such as when adding timestamp columns, without modifying the option that was + # passed in. :all is replaced by the columns other than the primary key and the + # timestamps recorded on create. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:879 + def on_duplicate_key_update_for_import(on_duplicate_key_update, column_names, options); end + + # Takes the options Hash, if any, off the end of +args+ and returns the options + # for the import, with their defaults, along with the arguments to import. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:756 + def options_and_arguments_for_import(args); end + + # Returns true if +child+, an existing record of a has_one or has_many association, + # doesn't refer to the parent yet, such as when it was assigned to a new parent. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1264 + def reassigned_to_parent?(child, foreign_key_columns, foreign_key_values, type_column, type_name); end + + # Returns true if +database_value+, reloaded from the database, is the +value+ an instance + # already has. Databases store times to the microsecond, so a time with more precision, + # which ActiveRecord < 7.0 keeps in memory, comes back rounded or truncated. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1034 + def same_database_value?(value, database_value); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1196 + def schema_columns_hash(conn); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1041 + def set_attributes_and_mark_clean(conn, models, import_result, timestamps, options); end + + # Returns SQL comments for the annotations on the current scope, as + # ActiveRecord adds them to its queries, or nil if there are none. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:980 + def sql_comment_for_annotations(conn); end + + # Synchronizes +instances+ with the database like ActiveRecord::Base.synchronize, + # but rather than discarding their changes, it assigns the database values + # on top of them. Once the instances are marked clean, previous_changes then + # reflects what the import changed, as it does without synchronizing. + # Instances left without changes are marked clean right away. Returns the + # instances that were synchronized. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1008 + def synchronize_imported_instances(instances, keys); end + + # Finds the records matching the passed in +instances+ on +keys+ and + # yields each instance that has one together with the attributes of + # its record, for the block to update the instance with. Returns the + # instances that had a matching record. + # + # pkg:gem/activerecord-import#lib/activerecord-import/synchronize.rb:39 + def synchronize_instances(instances, keys); end + + # Validates each row of +array_of_attributes+ as a new model, adding the models that + # fail to +failed_instances+ and removing their rows from +array_of_attributes+. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:935 + def validate_attributes_for_import(failed_instances, column_names, array_of_attributes, validator, options); end + + # Checks that the imported hash has the required_keys, optionally also checks that the hash has + # no keys beyond those required when `allow_extra_keys` is false. + # returns `nil` if validation passes, or an error message if it fails + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1364 + def validate_hash_import(hash, required_keys, allow_extra_keys); end + + # Returns an Array of Hashes for the passed in +column_names+ and +array_of_attributes+. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1357 + def validations_array_for_column_names_and_attributes(column_names, array_of_attributes); end + + # A model of another class, such as an STI subclass with its own enum, can give + # a column a different type than this class, which serializes the imported values. + # Convert the model's value to this class's type through its database value. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1189 + def value_from_model_type(model, name, value); end + + # Returns SQL the VALUES for an INSERT statement given the passed in +columns+ + # and +array_of_attributes+. Nil values for +default_column_names+ use the + # database's default. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:1275 + def values_sql_for_columns_and_attributes(conn, columns, array_of_attributes, default_column_names = T.unsafe(nil)); end + + # ActiveRecord treats "id" as the primary key when writing attributes + # through id= or []=. When the primary key is composite or is another + # column, an "id" column has to be written directly instead. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:974 + def write_id_column_directly?(column); end + end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/active_record/adapters/abstract_adapter.rb:6 +module ActiveRecord::ConnectionAdapters; end + +# pkg:gem/activerecord-import#lib/activerecord-import/active_record/adapters/abstract_adapter.rb:7 +class ActiveRecord::ConnectionAdapters::AbstractAdapter + include ::ActiveRecord::Migration::JoinTable + include ::ActiveRecord::Import::AbstractAdapter::InstanceMethods +end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:243 +class ActiveRecord::ConnectionAdapters::ConnectionHandler + include ::ActiveRecord::Import::ConnectionHandler +end + +# pkg:gem/activerecord-import#lib/activerecord-import/core.rb:8 +module ActiveRecord::Import + class << self + # pkg:gem/activerecord-import#lib/activerecord-import/core.rb:12 + def base_adapter(adapter); end + + # Aliases +import+ and +import!+ to +bulk_import+ and +bulk_import!+, unless + # they are already defined or aliases have been skipped. + # + # pkg:gem/activerecord-import#lib/activerecord-import/aliases.rb:14 + def define_aliases; end + + # Loads the import functionality for the passed in ActiveRecord connection + # + # pkg:gem/activerecord-import#lib/activerecord-import/core.rb:35 + def load_from_connection_pool(connection_pool); end + + # Loads the import functionality for the passed in ActiveRecord connection, + # unless it's been tried for the connection's adapter already. Import uses + # this when activerecord-import was required after the connection was + # established. Each adapter is only tried once, so an unsupported adapter + # doesn't search the load path on every import. + # + # pkg:gem/activerecord-import#lib/activerecord-import/core.rb:44 + def load_from_connection_pool_once(connection_pool); end + + # Loads the import functionality for a specific database adapter + # + # pkg:gem/activerecord-import#lib/activerecord-import/core.rb:28 + def require_adapter(adapter); end + + # Prevents the +import+ and +import!+ aliases from being defined, and removes + # them if they already have been. Used by "activerecord-import/without_aliases". + # + # pkg:gem/activerecord-import#lib/activerecord-import/aliases.rb:26 + def skip_aliases!; end + + # pkg:gem/activerecord-import#lib/activerecord-import/aliases.rb:39 + def skip_aliases?; end + + private + + # pkg:gem/activerecord-import#lib/activerecord-import/core.rb:52 + def adapter_for(connection_pool); end + end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/core.rb:9 +ActiveRecord::Import::ADAPTER_PATH = T.let(T.unsafe(nil), String) + +# Methods aliased to +bulk_import+ and +bulk_import!+, keyed by the class +# they're defined on. +# +# pkg:gem/activerecord-import#lib/activerecord-import/aliases.rb:6 +ActiveRecord::Import::ALIASES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activerecord-import#lib/activerecord-import/core.rb:10 +ActiveRecord::Import::ATTEMPTED_ADAPTERS = T.let(T.unsafe(nil), Concurrent::Map) + +# pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:3 +module ActiveRecord::Import::AbstractAdapter; end + +# pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:4 +module ActiveRecord::Import::AbstractAdapter::InstanceMethods + # Synchronizes the passed in ActiveRecord instances with the records in + # the database by calling +reload+ on each instance. + # + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:42 + def after_import_synchronize(instances); end + + # Splits the values returned by an INSERT ... RETURNING into the ids and the + # +:returning+ results. +returned_values+ is a Hash with the returned + # +:values+, and the +:columns+ when more than one column was returned. + # + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:83 + def ids_and_results_from_returned_values(returned_values, options); end + + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:118 + def increment_locking_column!(table_name, results, locking_column); end + + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:9 + def insert_many(sql, values, _options = T.unsafe(nil), *args); end + + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:5 + def next_value_for_sequence(sequence_name); end + + # Returns an array of post SQL statements given the passed in options. + # + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:47 + def post_sql_statements(table_name, options); end + + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:25 + def pre_sql_statements(options); end + + # Returns the selections for an INSERT ... RETURNING clause: the primary key + # and any +:returning+ columns. Known columns are quoted, anything else (such + # as raw SQL) is returned unchanged. + # + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:68 + def returning_selections(options); end + + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:96 + def split_ids_and_results(selections, options); end + + # Whether a value in an INSERT's VALUES can be DEFAULT, to use the column's default + # + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:129 + def supports_default_keyword_in_values?; end + + # pkg:gem/activerecord-import#lib/activerecord-import/adapters/abstract_adapter.rb:124 + def supports_on_duplicate_key_update?; end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:3 +module ActiveRecord::Import::ConnectionAdapters; end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:235 +module ActiveRecord::Import::ConnectionHandler + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:236 + def establish_connection(*args, **kwargs, &block); end +end + +# Validates the presence of a belongs_to association on a model being +# validated for an import by checking its foreign key, so the associated +# record isn't loaded for every model. +# +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:38 +module ActiveRecord::Import::ForeignKeyPresenceValidation + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:39 + def validate(record); end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:8 +module ActiveRecord::Import::ImportSupport + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:9 + def supports_import?; end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:20 +class ActiveRecord::Import::MissingColumnError < ::StandardError + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:21 + def initialize(name, index); end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:14 +module ActiveRecord::Import::OnDuplicateKeyUpdateSupport + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:15 + def supports_on_duplicate_key_update?; end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 +class ActiveRecord::Import::Result < ::Struct + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def affected_rows; end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def affected_rows=(_); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def failed_instances; end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def failed_instances=(_); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def ids; end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def ids=(_); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def num_inserts; end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def num_inserts=(_); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def results; end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def results=(_); end + + class << self + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def [](*_arg0); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def inspect; end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def keyword_init?; end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def members; end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:6 + def new(*_arg0); end + end +end + +# Skips uniqueness validations while a model is being validated for an import +# that doesn't validate uniqueness, including the validations Rails runs on +# the model's associated records. +# +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:29 +module ActiveRecord::Import::SkipUniquenessValidation + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:30 + def validate_each(record, attribute, value); end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:47 +class ActiveRecord::Import::Validator + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:63 + def initialize(options = T.unsafe(nil)); end + + # Returns a copy of +presence_validator+ that validates the foreign keys of + # any belongs_to associations it validates, or nil if there are none. + # + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:78 + def foreign_key_presence_validator(presence_validator, klass); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:51 + def options; end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:68 + def valid_model?(model); end + + class << self + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:58 + def foreign_key_presence_validator(presence_validator, record); end + + # pkg:gem/activerecord-import#lib/activerecord-import/import.rb:53 + def skip_uniqueness?; end + end +end + +# Holds [validator, model] for the current thread while valid_model? runs. +# +# pkg:gem/activerecord-import#lib/activerecord-import/import.rb:49 +ActiveRecord::Import::Validator::CURRENT = T.let(T.unsafe(nil), Symbol) + +# pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:6 +class ActiveRecord::Import::ValueSetTooLargeError < ::StandardError + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:9 + def initialize(msg = T.unsafe(nil), size = T.unsafe(nil)); end + + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:7 + def size; end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:15 +class ActiveRecord::Import::ValueSetsBytesParser + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:22 + def initialize(values, options); end + + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:16 + def max_bytes; end + + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:28 + def parse; end + + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:16 + def reserved_bytes; end + + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:16 + def values; end + + private + + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:59 + def default_max_bytes; end + + class << self + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:18 + def parse(values, options); end + end +end + +# pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:66 +class ActiveRecord::Import::ValueSetsRecordsParser + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:73 + def initialize(values, options); end + + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:67 + def max_records; end + + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:78 + def parse; end + + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:67 + def values; end + + class << self + # pkg:gem/activerecord-import#lib/activerecord-import/value_sets_parser.rb:69 + def parse(values, options); end + end +end + +class ActiveRecord::Validations::UniquenessValidator < ::ActiveModel::EachValidator + include ::ActiveRecord::Import::SkipUniquenessValidation +end diff --git a/sorbet/rbi/gems/activerecord-session_store@2.3.0.rbi b/sorbet/rbi/gems/activerecord-session_store@2.3.0.rbi new file mode 100644 index 000000000..dc7d7e84d --- /dev/null +++ b/sorbet/rbi/gems/activerecord-session_store@2.3.0.rbi @@ -0,0 +1,504 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `activerecord-session_store` gem. +# Please instead update this file by running `bin/tapioca gem activerecord-session_store`. + + +# pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:4 +module ActionDispatch; end + +# pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:5 +module ActionDispatch::Session; end + +# = Active Record Session Store +# +# A session store backed by an Active Record class. A default class is +# provided, but any object duck-typing to an Active Record Session class +# with text +session_id+ and +data+ attributes is sufficient. +# +# The default assumes a +sessions+ tables with columns: +# +id+ (numeric primary key), +# +session_id+ (string, usually varchar; maximum length is 255), and +# +data+ (text or longtext; careful if your session data exceeds 65KB). +# +# The +session_id+ column should always be indexed for speedy lookups. +# Session data is marshaled to the +data+ column in Base64 format. +# If the data you write is larger than the column's size limit, +# ActionController::SessionOverflowError will be raised. +# +# You may configure the table name, primary key, and data column. +# For example, at the end of config/application.rb: +# +# ActiveRecord::SessionStore::Session.table_name = 'legacy_session_table' +# ActiveRecord::SessionStore::Session.primary_key = 'session_id' +# ActiveRecord::SessionStore::Session.data_column_name = 'legacy_session_data' +# +# Note that setting the primary key to the +session_id+ frees you from +# having a separate +id+ column if you don't want it. However, you must +# set session.model.id = session.session_id by hand! A before filter +# on ApplicationController is a good place. +# +# Since the default class is a simple Active Record, you get timestamps +# for free if you add +created_at+ and +updated_at+ datetime columns to +# the +sessions+ table, making periodic session expiration a snap. +# +# You may provide your own session class implementation, whether a +# feature-packed Active Record or a bare-metal high-performance SQL +# store, by setting +# +# ActionDispatch::Session::ActiveRecordStore.session_class = MySessionClass +# +# You must implement these methods: +# +# self.find_by_session_id(session_id) +# initialize(hash_of_session_id_and_data, options_hash = {}) +# attr_reader :session_id +# attr_accessor :data +# save +# destroy +# +# The example SqlBypass class is a generic SQL session store. You may +# use it as a basis for high-performance database-specific stores. +# +# pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:55 +class ActionDispatch::Session::ActiveRecordStore < ::ActionDispatch::Session::AbstractSecureStore + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:65 + def initialize(app, options = T.unsafe(nil)); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:58 + def session_class; end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:58 + def session_class=(_arg0); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:58 + def session_class?; end + + private + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:158 + def can_reuse_session_record?(request, id); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:103 + def delete_session(request, session_id, options); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:176 + def find_session(request, id); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:72 + def get_session(request, sid); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:127 + def get_session_model(request, id); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:165 + def get_session_with_fallback(sid); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:187 + def logger; end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:85 + def write_session(request, sid, session_data, options); end + + class << self + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:191 + def private_session_id?(session_id); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:58 + def session_class; end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:58 + def session_class=(value); end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:58 + def session_class?; end + + private + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:58 + def __class_attr_session_class; end + + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:58 + def __class_attr_session_class=(new_value); end + end +end + +# pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:60 +ActionDispatch::Session::ActiveRecordStore::DEFAULT_SAME_SITE = T.let(T.unsafe(nil), Proc) + +# pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:61 +ActionDispatch::Session::ActiveRecordStore::ENV_SESSION_OPTIONS_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:181 +module ActionDispatch::Session::ActiveRecordStore::NilLogger + class << self + # pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:182 + def silence; end + end +end + +# pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:63 +ActionDispatch::Session::ActiveRecordStore::SESSION_RECORD_CREATED_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord-session_store#lib/action_dispatch/session/active_record_store.rb:62 +ActionDispatch::Session::ActiveRecordStore::SESSION_RECORD_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord-session_store#lib/active_record/session_store/version.rb:1 +module ActiveRecord; end + +# pkg:gem/activerecord-session_store#lib/active_record/session_store/version.rb:2 +module ActiveRecord::SessionStore + class << self + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:13 + def deprecator; end + end +end + +# pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:18 +module ActiveRecord::SessionStore::ClassMethods + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:34 + def create_table!; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:25 + def deserialize(data); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:29 + def drop_table!; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:21 + def serialize(data); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:19 + def serializer; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:19 + def serializer=(val); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:43 + def serializer_class; end + + class << self + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:19 + def serializer; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:19 + def serializer=(val); end + end +end + +# Transparently migrates existing session values from Marshal to JSON +# +# pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:82 +class ActiveRecord::SessionStore::ClassMethods::HybridSerializer < ::ActiveRecord::SessionStore::ClassMethods::JsonSerializer + class << self + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:85 + def load(value); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:93 + def needs_migration?(value); end + end +end + +# pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:83 +ActiveRecord::SessionStore::ClassMethods::HybridSerializer::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# Uses built-in JSON library to encode/decode session +# +# pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:70 +class ActiveRecord::SessionStore::ClassMethods::JsonSerializer + class << self + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:76 + def dump(value); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:71 + def load(value); end + end +end + +# Use Marshal with Base64 encoding +# +# pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:59 +class ActiveRecord::SessionStore::ClassMethods::MarshalSerializer + class << self + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:64 + def dump(value); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:60 + def load(value); end + end +end + +# Defer serialization to the ActiveRecord database adapter +# +# pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:99 +class ActiveRecord::SessionStore::ClassMethods::NullSerializer + class << self + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:104 + def dump(value); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store.rb:100 + def load(value); end + end +end + +# pkg:gem/activerecord-session_store#lib/active_record/session_store/railtie.rb:5 +class ActiveRecord::SessionStore::Railtie < ::Rails::Railtie; end + +# The default Active Record class. +# +# pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:7 +class ActiveRecord::SessionStore::Session < ::ActiveRecord::Base + include ::ActiveRecord::SessionStore::Session::GeneratedAttributeMethods + include ::ActiveRecord::SessionStore::Session::GeneratedAssociationMethods + extend ::ActiveRecord::SessionStore::ClassMethods + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:61 + def initialize(*); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:17 + def _run_save_callbacks(&block); end + + # Lazy-deserialize session state. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:67 + def data; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:71 + def data=(data); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:14 + def data_column_name; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:14 + def data_column_name=(val); end + + # Has the session been loaded yet? + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:77 + def loaded?; end + + # This method was introduced when addressing CVE-2019-16782 + # (see https://github.com/rack/rack/security/advisories/GHSA-hrqr-hxpp-chr3). + # Sessions created on version <= 1.1.3 were guessable via a timing attack. + # To secure sessions created on those old versions, this method can be called + # on all existing sessions in the database. Users will not lose their session + # when this is done. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:87 + def secure!; end + + private + + # Ensures that the data about to be stored in the database is not + # larger than the data storage column. Raises + # ActionController::SessionOverflowError. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:113 + def raise_on_session_data_overflow!; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:103 + def serialize_data!; end + + class << self + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:14 + def data_column_name; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:14 + def data_column_name=(val); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:21 + def data_column_size_limit; end + + # Hook to set up sessid compatibility. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:26 + def find_by_session_id(session_id); end + + private + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:17 + def __class_attr___callbacks; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:17 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:7 + def __class_attr__validators; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:7 + def __class_attr__validators=(new_value); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:7 + def __class_attr_defined_enums; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:7 + def __class_attr_defined_enums=(new_value); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:32 + def session_id_column; end + + # Compatibility with tables using sessid instead of session_id. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:37 + def setup_sessid_compatibility!; end + end +end + +# pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:7 +module ActiveRecord::SessionStore::Session::GeneratedAssociationMethods; end + +# pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:7 +module ActiveRecord::SessionStore::Session::GeneratedAttributeMethods; end + +# pkg:gem/activerecord-session_store#lib/active_record/session_store/session.rb:9 +ActiveRecord::SessionStore::Session::SEMAPHORE = T.let(T.unsafe(nil), Thread::Mutex) + +# A barebones session store which duck-types with the default session +# store but bypasses Active Record and issues SQL directly. This is +# an example session model class meant as a basis for your own classes. +# +# The database connection, table name, and session id and data columns +# are configurable class attributes. Serializing and deserializeing +# are implemented as class methods that you may override. By default, +# serializing data is +# +# ::Base64.encode64(Marshal.dump(data)) +# +# and deserializing data is +# +# Marshal.load(::Base64.decode64(data)) +# +# This serializing behavior is intended to store the widest range of +# binary session data in a +text+ column. For higher performance, +# store in a +blob+ column instead and forgo the Base64 encoding. +# +# pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:23 +class ActiveRecord::SessionStore::SqlBypass + extend ::ActiveRecord::SessionStore::ClassMethods + + # Look for normal and serialized data, self.find_by_session_id's way of + # telling us to postpone deserializing until the data is requested. + # We need to handle a normal data attribute in case of a new record. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:78 + def initialize(attributes); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:113 + def changed?; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:69 + def connection(&); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:69 + def connection=(arg); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:69 + def connection_pool(&); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:69 + def connection_pool=(arg); end + + # Lazy-deserialize session state. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:93 + def data; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:108 + def data=(data); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:41 + def data_column; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:41 + def data_column=(val); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:147 + def destroy; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:104 + def loaded?; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:71 + def new_record; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:73 + def new_record?; end + + # Returns true if the record is persisted, i.e. it's not a new record + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:88 + def persisted?; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:117 + def save; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:72 + def session_id; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:72 + def session_id=(_arg0); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:35 + def session_id_column; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:35 + def session_id_column=(val); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:29 + def table_name; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:29 + def table_name=(val); end + + class << self + # Use the ActiveRecord::Base.connection by default. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:53 + def connection; end + + # Use the ActiveRecord::Base.connection by default. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:48 + def connection=(_arg0); end + + # Use the ActiveRecord::Base.connection_pool by default. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:57 + def connection_pool; end + + # Use the ActiveRecord::Base.connection_pool by default. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:51 + def connection_pool=(_arg0); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:41 + def data_column; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:41 + def data_column=(val); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:45 + def data_column_name; end + + # Look up a session by id and deserialize its data if found. + # + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:62 + def find_by_session_id(session_id); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:35 + def session_id_column; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:35 + def session_id_column=(val); end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:29 + def table_name; end + + # pkg:gem/activerecord-session_store#lib/active_record/session_store/sql_bypass.rb:29 + def table_name=(val); end + end +end + +# pkg:gem/activerecord-session_store#lib/active_record/session_store/version.rb:3 +ActiveRecord::SessionStore::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/activerecord@8.1.4.1.rbi b/sorbet/rbi/gems/activerecord@8.1.4.1.rbi new file mode 100644 index 000000000..6b53bb49b --- /dev/null +++ b/sorbet/rbi/gems/activerecord@8.1.4.1.rbi @@ -0,0 +1,40622 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `activerecord` gem. +# Please instead update this file by running `bin/tapioca gem activerecord`. + + +# pkg:gem/activerecord#lib/active_record/type.rb:59 +class ActiveModel::Type::BigInteger < ::ActiveModel::Type::Integer; end + +# pkg:gem/activerecord#lib/active_record/type.rb:65 +class ActiveModel::Type::ImmutableString < ::ActiveModel::Type::Value; end + +# pkg:gem/activerecord#lib/active_record/type.rb:64 +class ActiveModel::Type::Integer < ::ActiveModel::Type::Value; end + +# pkg:gem/activerecord#lib/active_record/type.rb:66 +class ActiveModel::Type::String < ::ActiveModel::Type::ImmutableString; end + +# pkg:gem/activerecord#lib/active_record/type.rb:67 +class ActiveModel::Type::Value; end + +# :include: ../README.rdoc +# Validation error class to wrap association records' errors, +# with index_errors support. +# :enddoc: +# :markup: markdown +# +# pkg:gem/activerecord#lib/active_record/gem_version.rb:3 +module ActiveRecord + include ::ActiveSupport::Deprecation::DeprecatedConstantAccessor + extend ::ActiveSupport::Autoload + + class << self + # pkg:gem/activerecord#lib/active_record.rb:370 + def action_on_strict_loading_violation; end + + # pkg:gem/activerecord#lib/active_record.rb:370 + def action_on_strict_loading_violation=(_arg0); end + + # Registers a block to be called after all the current transactions have been + # committed. + # + # If there is no currently open transaction, the block is called immediately. + # + # If there are multiple nested transactions, the block is called after the outermost one + # has been committed, + # + # If any of the currently open transactions is rolled back, the block is never called. + # + # If multiple transactions are open across multiple databases, the block will be invoked + # if and once all of them have been committed. But note that nesting transactions across + # two distinct databases is a sharding anti-pattern that comes with a world of hurts. + # + # pkg:gem/activerecord#lib/active_record.rb:573 + def after_all_transactions_commit(&block); end + + # pkg:gem/activerecord#lib/active_record.rb:593 + def all_open_transactions; end + + # pkg:gem/activerecord#lib/active_record.rb:363 + def application_record_class; end + + # pkg:gem/activerecord#lib/active_record.rb:363 + def application_record_class=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:288 + def async_query_executor; end + + # pkg:gem/activerecord#lib/active_record.rb:288 + def async_query_executor=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:354 + def before_committed_on_all_records; end + + # pkg:gem/activerecord#lib/active_record.rb:354 + def before_committed_on_all_records=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:351 + def belongs_to_required_validates_foreign_key; end + + # pkg:gem/activerecord#lib/active_record.rb:351 + def belongs_to_required_validates_foreign_key=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:213 + def database_cli; end + + # pkg:gem/activerecord#lib/active_record.rb:213 + def database_cli=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:235 + def db_warnings_action; end + + # pkg:gem/activerecord#lib/active_record.rb:237 + def db_warnings_action=(action); end + + # pkg:gem/activerecord#lib/active_record.rb:267 + def db_warnings_ignore; end + + # pkg:gem/activerecord#lib/active_record.rb:267 + def db_warnings_ignore=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:216 + def default_timezone; end + + # Determines whether to use Time.utc (using :utc) or Time.local (using :local) when pulling + # dates and times from the database. This is set to :utc by default. + # + # pkg:gem/activerecord#lib/active_record.rb:220 + def default_timezone=(default_timezone); end + + # pkg:gem/activerecord#lib/active_record.rb:611 + def default_transaction_isolation_level; end + + # pkg:gem/activerecord#lib/active_record.rb:607 + def default_transaction_isolation_level=(isolation_level); end + + # pkg:gem/activerecord#lib/active_record.rb:495 + def deprecated_associations_options; end + + # pkg:gem/activerecord#lib/active_record.rb:479 + def deprecated_associations_options=(options); end + + # pkg:gem/activerecord#lib/active_record/deprecator.rb:4 + def deprecator; end + + # pkg:gem/activerecord#lib/active_record.rb:184 + def disable_prepared_statements; end + + # pkg:gem/activerecord#lib/active_record.rb:184 + def disable_prepared_statements=(_arg0); end + + # Explicitly closes all database connections in all pools. + # + # pkg:gem/activerecord#lib/active_record.rb:556 + def disconnect_all!; end + + # pkg:gem/activerecord#lib/active_record.rb:425 + def dump_schema_after_migration; end + + # pkg:gem/activerecord#lib/active_record.rb:425 + def dump_schema_after_migration=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:435 + def dump_schemas; end + + # pkg:gem/activerecord#lib/active_record.rb:435 + def dump_schemas=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:545 + def eager_load!; end + + # pkg:gem/activerecord#lib/active_record.rb:390 + def error_on_ignored_order; end + + # pkg:gem/activerecord#lib/active_record.rb:390 + def error_on_ignored_order=(_arg0); end + + # Returns the currently loaded version of Active Record as a +Gem::Version+. + # + # pkg:gem/activerecord#lib/active_record/gem_version.rb:5 + def gem_version; end + + # pkg:gem/activerecord#lib/active_record.rb:476 + def generate_secure_token_on; end + + # pkg:gem/activerecord#lib/active_record.rb:476 + def generate_secure_token_on=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:312 + def global_executor_concurrency; end + + # Set the +global_executor_concurrency+. This configuration value can only be used + # with the global thread pool async query executor. + # + # pkg:gem/activerecord#lib/active_record.rb:304 + def global_executor_concurrency=(global_executor_concurrency); end + + # pkg:gem/activerecord#lib/active_record.rb:291 + def global_thread_pool_async_query_executor; end + + # pkg:gem/activerecord#lib/active_record.rb:327 + def index_nested_attribute_errors; end + + # pkg:gem/activerecord#lib/active_record.rb:327 + def index_nested_attribute_errors=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:191 + def lazily_load_schema_cache; end + + # pkg:gem/activerecord#lib/active_record.rb:191 + def lazily_load_schema_cache=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:345 + def maintain_test_schema; end + + # pkg:gem/activerecord#lib/active_record.rb:345 + def maintain_test_schema=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:502 + def marshalling_format_version; end + + # pkg:gem/activerecord#lib/active_record.rb:506 + def marshalling_format_version=(value); end + + # pkg:gem/activerecord#lib/active_record.rb:543 + def message_verifiers; end + + # pkg:gem/activerecord#lib/active_record.rb:543 + def message_verifiers=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:410 + def migration_strategy; end + + # pkg:gem/activerecord#lib/active_record.rb:410 + def migration_strategy=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:317 + def permanent_connection_checkout; end + + # Defines whether +ActiveRecord::Base.connection+ is allowed, deprecated, or entirely disallowed. + # + # pkg:gem/activerecord#lib/active_record.rb:320 + def permanent_connection_checkout=(value); end + + # pkg:gem/activerecord#lib/active_record.rb:529 + def protocol_adapters; end + + # pkg:gem/activerecord#lib/active_record.rb:529 + def protocol_adapters=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:447 + def query_transformers; end + + # pkg:gem/activerecord#lib/active_record.rb:447 + def query_transformers=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:342 + def queues; end + + # pkg:gem/activerecord#lib/active_record.rb:342 + def queues=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:462 + def raise_int_wider_than_64bit; end + + # pkg:gem/activerecord#lib/active_record.rb:462 + def raise_int_wider_than_64bit=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:348 + def raise_on_assign_to_attr_readonly; end + + # pkg:gem/activerecord#lib/active_record.rb:348 + def raise_on_assign_to_attr_readonly=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:360 + def raise_on_missing_required_finder_order_columns; end + + # pkg:gem/activerecord#lib/active_record.rb:360 + def raise_on_missing_required_finder_order_columns=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:273 + def reading_role; end + + # pkg:gem/activerecord#lib/active_record.rb:273 + def reading_role=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:357 + def run_after_transaction_callbacks_in_order_defined; end + + # pkg:gem/activerecord#lib/active_record.rb:357 + def run_after_transaction_callbacks_in_order_defined=(_arg0); end + + # Checks to see if the +table_name+ is ignored by checking + # against the +schema_cache_ignored_tables+ option. + # + # ActiveRecord.schema_cache_ignored_table?(:developers) + # + # pkg:gem/activerecord#lib/active_record.rb:207 + def schema_cache_ignored_table?(table_name); end + + # pkg:gem/activerecord#lib/active_record.rb:199 + def schema_cache_ignored_tables; end + + # pkg:gem/activerecord#lib/active_record.rb:199 + def schema_cache_ignored_tables=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:382 + def schema_format; end + + # pkg:gem/activerecord#lib/active_record.rb:382 + def schema_format=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:416 + def schema_versions_formatter; end + + # pkg:gem/activerecord#lib/active_record.rb:416 + def schema_versions_formatter=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:396 + def timestamped_migrations; end + + # pkg:gem/activerecord#lib/active_record.rb:396 + def timestamped_migrations=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:454 + def use_yaml_unsafe_load; end + + # pkg:gem/activerecord#lib/active_record.rb:454 + def use_yaml_unsafe_load=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:404 + def validate_migration_timestamps; end + + # pkg:gem/activerecord#lib/active_record.rb:404 + def validate_migration_timestamps=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:335 + def verbose_query_logs; end + + # pkg:gem/activerecord#lib/active_record.rb:335 + def verbose_query_logs=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:444 + def verify_foreign_keys_for_fixtures; end + + # pkg:gem/activerecord#lib/active_record.rb:444 + def verify_foreign_keys_for_fixtures=(_arg0); end + + # Returns the currently loaded version of Active Record as a +Gem::Version+. + # + # pkg:gem/activerecord#lib/active_record/version.rb:7 + def version; end + + # Sets a transaction isolation level for all connection pools within the block. + # + # pkg:gem/activerecord#lib/active_record.rb:616 + def with_transaction_isolation_level(isolation_level, &block); end + + # pkg:gem/activerecord#lib/active_record.rb:270 + def writing_role; end + + # pkg:gem/activerecord#lib/active_record.rb:270 + def writing_role=(_arg0); end + + # pkg:gem/activerecord#lib/active_record.rb:469 + def yaml_column_permitted_classes; end + + # pkg:gem/activerecord#lib/active_record.rb:469 + def yaml_column_permitted_classes=(_arg0); end + end +end + +# = Active Record Errors +# +# Generic Active Record exception class. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:10 +class ActiveRecord::ActiveRecordError < ::StandardError; end + +# Superclass for all errors raised from an Active Record adapter. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:54 +class ActiveRecord::AdapterError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/errors.rb:55 + def initialize(message = T.unsafe(nil), connection_pool: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:60 + def connection_pool; end +end + +# Raised when Active Record cannot find database adapter specified in +# +config/database.yml+ or programmatically. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:50 +class ActiveRecord::AdapterNotFound < ::ActiveRecord::ActiveRecordError; end + +# Raised when adapter not specified on connection (or configuration file +# +config/database.yml+ misses adapter field). +# +# pkg:gem/activerecord#lib/active_record/errors.rb:41 +class ActiveRecord::AdapterNotSpecified < ::ActiveRecord::ActiveRecordError; end + +# AdapterTimeout will be raised when database clients times out while waiting from the server. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:590 +class ActiveRecord::AdapterTimeout < ::ActiveRecord::QueryAborted; end + +# See ActiveRecord::Aggregations::ClassMethods for documentation +# +# pkg:gem/activerecord#lib/active_record/aggregations.rb:5 +module ActiveRecord::Aggregations + # pkg:gem/activerecord#lib/active_record/aggregations.rb:11 + def reload(*); end + + private + + # pkg:gem/activerecord#lib/active_record/aggregations.rb:17 + def clear_aggregation_cache; end + + # pkg:gem/activerecord#lib/active_record/aggregations.rb:21 + def init_internals; end + + # pkg:gem/activerecord#lib/active_record/aggregations.rb:6 + def initialize_dup(*); end +end + +# = Active Record \Aggregations +# +# Active Record implements aggregation through a macro-like class method called #composed_of +# for representing attributes as value objects. It expresses relationships like "Account [is] +# composed of Money [among other things]" or "Person [is] composed of [an] address". Each call +# to the macro adds a description of how the value objects are created from the attributes of +# the entity object (when the entity is initialized either as a new object or from finding an +# existing object) and how it can be turned back into attributes (when the entity is saved to +# the database). +# +# class Customer < ActiveRecord::Base +# composed_of :balance, class_name: "Money", mapping: { balance: :amount } +# composed_of :address, mapping: { address_street: :street, address_city: :city } +# end +# +# The customer class now has the following methods to manipulate the value objects: +# * Customer#balance, Customer#balance=(money) +# * Customer#address, Customer#address=(address) +# +# These methods will operate with value objects like the ones described below: +# +# class Money +# include Comparable +# attr_reader :amount, :currency +# EXCHANGE_RATES = { "USD_TO_DKK" => 6 } +# +# def initialize(amount, currency = "USD") +# @amount, @currency = amount, currency +# end +# +# def exchange_to(other_currency) +# exchanged_amount = (amount * EXCHANGE_RATES["#{currency}_TO_#{other_currency}"]).floor +# Money.new(exchanged_amount, other_currency) +# end +# +# def ==(other_money) +# amount == other_money.amount && currency == other_money.currency +# end +# +# def <=>(other_money) +# if currency == other_money.currency +# amount <=> other_money.amount +# else +# amount <=> other_money.exchange_to(currency).amount +# end +# end +# end +# +# class Address +# attr_reader :street, :city +# def initialize(street, city) +# @street, @city = street, city +# end +# +# def close_to?(other_address) +# city == other_address.city +# end +# +# def ==(other_address) +# city == other_address.city && street == other_address.street +# end +# end +# +# Now it's possible to access attributes from the database through the value objects instead. If +# you choose to name the composition the same as the attribute's name, it will be the only way to +# access that attribute. That's the case with our +balance+ attribute. You interact with the value +# objects just like you would with any other attribute: +# +# customer.balance = Money.new(20) # sets the Money value object and the attribute +# customer.balance # => Money value object +# customer.balance.exchange_to("DKK") # => Money.new(120, "DKK") +# customer.balance > Money.new(10) # => true +# customer.balance == Money.new(20) # => true +# customer.balance < Money.new(5) # => false +# +# Value objects can also be composed of multiple attributes, such as the case of Address. The order +# of the mappings will determine the order of the parameters. +# +# customer.address_street = "Hyancintvej" +# customer.address_city = "Copenhagen" +# customer.address # => Address.new("Hyancintvej", "Copenhagen") +# +# customer.address = Address.new("May Street", "Chicago") +# customer.address_street # => "May Street" +# customer.address_city # => "Chicago" +# +# == Writing value objects +# +# Value objects are immutable and interchangeable objects that represent a given value, such as +# a Money object representing $5. Two Money objects both representing $5 should be equal (through +# methods such as == and <=> from Comparable if ranking makes sense). This is +# unlike entity objects where equality is determined by identity. An entity class such as Customer can +# easily have two different objects that both have an address on Hyancintvej. Entity identity is +# determined by object or relational unique identifiers (such as primary keys). Normal +# ActiveRecord::Base classes are entity objects. +# +# It's also important to treat the value objects as immutable. Don't allow the Money object to have +# its amount changed after creation. Create a new Money object with the new value instead. The +# Money#exchange_to method is an example of this. It returns a new value object instead of changing +# its own values. Active Record won't persist value objects that have been changed through means +# other than the writer method. +# +# The immutable requirement is enforced by Active Record by freezing any object assigned as a value +# object. Attempting to change it afterwards will result in a +RuntimeError+. +# +# Read more about value objects on http://c2.com/cgi/wiki?ValueObject and on the dangers of not +# keeping value objects immutable on http://c2.com/cgi/wiki?ValueObjectsShouldBeImmutable +# +# == Custom constructors and converters +# +# By default value objects are initialized by calling the new constructor of the value +# class passing each of the mapped attributes, in the order specified by the :mapping +# option, as arguments. If the value class doesn't support this convention then #composed_of allows +# a custom constructor to be specified. +# +# When a new value is assigned to the value object, the default assumption is that the new value +# is an instance of the value class. Specifying a custom converter allows the new value to be automatically +# converted to an instance of value class if necessary. +# +# For example, the +NetworkResource+ model has +network_address+ and +cidr_range+ attributes that should be +# aggregated using the +NetAddr::CIDR+ value class (https://www.rubydoc.info/gems/netaddr/1.5.0/NetAddr/CIDR). +# The constructor for the value class is called +create+ and it expects a CIDR address string as a parameter. +# New values can be assigned to the value object using either another +NetAddr::CIDR+ object, a string +# or an array. The :constructor and :converter options can be used to meet +# these requirements: +# +# class NetworkResource < ActiveRecord::Base +# composed_of :cidr, +# class_name: 'NetAddr::CIDR', +# mapping: { network_address: :network, cidr_range: :bits }, +# allow_nil: true, +# constructor: Proc.new { |network_address, cidr_range| NetAddr::CIDR.create("#{network_address}/#{cidr_range}") }, +# converter: Proc.new { |value| NetAddr::CIDR.create(value.is_a?(Array) ? value.join('/') : value) } +# end +# +# # This calls the :constructor +# network_resource = NetworkResource.new(network_address: '192.168.0.1', cidr_range: 24) +# +# # These assignments will both use the :converter +# network_resource.cidr = [ '192.168.2.1', 8 ] +# network_resource.cidr = '192.168.0.1/24' +# +# # This assignment won't use the :converter as the value is already an instance of the value class +# network_resource.cidr = NetAddr::CIDR.create('192.168.2.1/8') +# +# # Saving and then reloading will use the :constructor on reload +# network_resource.save +# network_resource.reload +# +# == Finding records by a value object +# +# Once a #composed_of relationship is specified for a model, records can be loaded from the database +# by specifying an instance of the value object in the conditions hash. The following example +# finds all customers with +address_street+ equal to "May Street" and +address_city+ equal to "Chicago": +# +# Customer.where(address: Address.new("May Street", "Chicago")) +# +# pkg:gem/activerecord#lib/active_record/aggregations.rb:183 +module ActiveRecord::Aggregations::ClassMethods + # Adds reader and writer methods for manipulating a value object: + # composed_of :address adds address and address=(new_address) methods. + # + # Options are: + # * :class_name - Specifies the class name of the association. Use it only if that name + # can't be inferred from the part id. So composed_of :address will by default be linked + # to the Address class, but if the real class name is +CompanyAddress+, you'll have to specify it + # with this option. + # * :mapping - Specifies the mapping of entity attributes to attributes of the value + # object. Each mapping is represented as a key-value pair where the key is the name of the + # entity attribute and the value is the name of the attribute in the value object. The + # order in which mappings are defined determines the order in which attributes are sent to the + # value class constructor. The mapping can be written as a hash or as an array of pairs. + # * :allow_nil - Specifies that the value object will not be instantiated when all mapped + # attributes are +nil+. Setting the value object to +nil+ has the effect of writing +nil+ to all + # mapped attributes. + # This defaults to +false+. + # * :constructor - A symbol specifying the name of the constructor method or a Proc that + # is called to initialize the value object. The constructor is passed all of the mapped attributes, + # in the order that they are defined in the :mapping option, as arguments and uses them + # to instantiate a :class_name object. + # The default is :new. + # * :converter - A symbol specifying the name of a class method of :class_name + # or a Proc that is called when a new value is assigned to the value object. The converter is + # passed the single value that is used in the assignment and is only called if the new value is + # not an instance of :class_name. If :allow_nil is set to true, the converter + # can return +nil+ to skip the assignment. + # + # Option examples: + # composed_of :temperature, mapping: { reading: :celsius } + # composed_of :balance, class_name: "Money", mapping: { balance: :amount } + # composed_of :address, mapping: { address_street: :street, address_city: :city } + # composed_of :address, mapping: [ %w(address_street street), %w(address_city city) ] + # composed_of :gps_location + # composed_of :gps_location, allow_nil: true + # composed_of :ip_address, + # class_name: 'IPAddr', + # mapping: { ip: :to_i }, + # constructor: Proc.new { |ip| IPAddr.new(ip, Socket::AF_INET) }, + # converter: Proc.new { |ip| ip.is_a?(Integer) ? IPAddr.new(ip, Socket::AF_INET) : IPAddr.new(ip.to_s) } + # + # pkg:gem/activerecord#lib/active_record/aggregations.rb:225 + def composed_of(part_id, options = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/aggregations.rb:248 + def reader_method(name, class_name, mapping, allow_nil, constructor); end + + # pkg:gem/activerecord#lib/active_record/aggregations.rb:261 + def writer_method(name, class_name, mapping, allow_nil, converter); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:203 +class ActiveRecord::AmbiguousSourceReflectionForThroughAssociation < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:204 + def initialize(klass, macro, association_name, options, possible_sources); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:4 +class ActiveRecord::AssociationNotFoundError < ::ActiveRecord::ConfigurationError + include ::DidYouMean::Correctable + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:7 + def initialize(record = T.unsafe(nil), association_name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:5 + def association_name; end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:20 + def corrections; end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:5 + def record; end +end + +# pkg:gem/activerecord#lib/active_record/association_relation.rb:4 +class ActiveRecord::AssociationRelation < ::ActiveRecord::Relation + # pkg:gem/activerecord#lib/active_record/association_relation.rb:5 + def initialize(klass, association, **); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:14 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:19 + def insert(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:19 + def insert!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:19 + def insert_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:19 + def insert_all!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:10 + def proxy_association; end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:19 + def upsert(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:19 + def upsert_all(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:35 + def _create(attributes, &block); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:39 + def _create!(attributes, &block); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:31 + def _new(attributes, &block); end + + # pkg:gem/activerecord#lib/active_record/association_relation.rb:43 + def exec_queries; end +end + +# Raised when an object assigned to an association has an incorrect type. +# +# class Ticket < ActiveRecord::Base +# has_many :patches +# end +# +# class Patch < ActiveRecord::Base +# belongs_to :ticket +# end +# +# # Comments are not patches, this assignment raises AssociationTypeMismatch. +# @ticket.patches << Comment.new(content: "Please attach tests to your patch.") +# +# pkg:gem/activerecord#lib/active_record/errors.rb:32 +class ActiveRecord::AssociationTypeMismatch < ::ActiveRecord::ActiveRecordError; end + +# See ActiveRecord::Associations::ClassMethods for documentation. +# +# pkg:gem/activerecord#lib/active_record/associations.rb:5 +module ActiveRecord::Associations + extend ::ActiveSupport::Autoload + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Associations::ClassMethods + + # Returns the association instance for the given name, instantiating it if it doesn't already exist + # + # pkg:gem/activerecord#lib/active_record/associations.rb:53 + def association(name); end + + # pkg:gem/activerecord#lib/active_record/associations.rb:67 + def association_cached?(name); end + + private + + # Returns the specified association instance if it exists, +nil+ otherwise. + # + # pkg:gem/activerecord#lib/active_record/associations.rb:83 + def association_instance_get(name); end + + # Set the specified association instance. + # + # pkg:gem/activerecord#lib/active_record/associations.rb:88 + def association_instance_set(name, association); end + + # pkg:gem/activerecord#lib/active_record/associations.rb:92 + def deprecated_associations_api_guard(association, method_name); end + + # pkg:gem/activerecord#lib/active_record/associations.rb:77 + def init_internals; end + + # pkg:gem/activerecord#lib/active_record/associations.rb:71 + def initialize_dup(*); end + + # pkg:gem/activerecord#lib/active_record/associations.rb:96 + def report_deprecated_association(reflection, context:); end + + class << self + # pkg:gem/activerecord#lib/active_record/associations.rb:46 + def eager_load!; end + end +end + +# Keeps track of table aliases for ActiveRecord::Associations::JoinDependency +# +# pkg:gem/activerecord#lib/active_record/associations/alias_tracker.rb:8 +class ActiveRecord::Associations::AliasTracker + # table_joins is an array of arel joins which might conflict with the aliases we assign here + # + # pkg:gem/activerecord#lib/active_record/associations/alias_tracker.rb:53 + def initialize(table_alias_length, aliases); end + + # pkg:gem/activerecord#lib/active_record/associations/alias_tracker.rb:58 + def aliased_table_for(arel_table, table_name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/alias_tracker.rb:80 + def aliases; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/alias_tracker.rb:83 + def table_alias_for(table_name); end + + # pkg:gem/activerecord#lib/active_record/associations/alias_tracker.rb:87 + def truncate(name); end + + class << self + # pkg:gem/activerecord#lib/active_record/associations/alias_tracker.rb:9 + def create(pool, initial_table, joins, aliases = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/alias_tracker.rb:28 + def initial_count_for(connection, name, table_joins); end + end +end + +# = Active Record Associations +# +# This is the root class of all associations ('+ Foo' signifies an included module Foo): +# +# Association +# SingularAssociation +# HasOneAssociation + ForeignAssociation +# HasOneThroughAssociation + ThroughAssociation +# BelongsToAssociation +# BelongsToPolymorphicAssociation +# CollectionAssociation +# HasManyAssociation + ForeignAssociation +# HasManyThroughAssociation + ThroughAssociation +# +# Associations in Active Record are middlemen between the object that +# holds the association, known as the owner, and the associated +# result set, known as the target. Association metadata is available in +# reflection, which is an instance of +ActiveRecord::Reflection::AssociationReflection+. +# +# For example, given +# +# class Blog < ActiveRecord::Base +# has_many :posts +# end +# +# blog = Blog.first +# +# The association of blog.posts has the object +blog+ as its +# owner, the collection of its posts as target, and +# the reflection object represents a :has_many macro. +# +# pkg:gem/activerecord#lib/active_record/associations/association.rb:35 +class ActiveRecord::Associations::Association + # pkg:gem/activerecord#lib/active_record/associations/association.rb:41 + def initialize(owner, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:198 + def async_load_target; end + + # Whether the association represents a single record + # or a collection of records. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:249 + def collection?; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:227 + def create(attributes = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:231 + def create!(attributes = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:37 + def disable_joins; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:169 + def extensions; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:217 + def initialize_attributes(record, except_from_scope_attributes = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:153 + def inversed_from(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:157 + def inversed_from_queries(record); end + + # Returns the class of the target. belongs_to polymorphic overrides this to look at the + # polymorphic_type field on the owner. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:165 + def klass; end + + # Loads the \target if needed and returns it. + # + # This method is abstract in the sense that it relies on +find_target+, + # which is expected to be provided by descendants. + # + # If the \target is already \loaded it is just returned. Thus, you can call + # +load_target+ unconditionally to get the \target. + # + # ActiveRecord::RecordNotFound is rescued within the method, and it is + # not reraised. The proxy is \reset and +nil+ is the return value. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:189 + def load_target; end + + # Asserts the \target has been loaded setting the \loaded flag to +true+. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:86 + def loaded!; end + + # Has the \target been already \loaded? + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:81 + def loaded?; end + + # We can't dump @reflection and @through_reflection since it contains the scope proc + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:206 + def marshal_dump; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:211 + def marshal_load(data); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:39 + def options(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:36 + def owner; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:36 + def owner=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:37 + def reflection; end + + # Reloads the \target and returns +self+ on success. + # The QueryCache is cleared if +force+ is true. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:72 + def reload(force = T.unsafe(nil)); end + + # Remove the inverse association, if possible + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:147 + def remove_inverse_instance(record); end + + # Resets the \loaded flag to +false+ and sets the \target to +nil+. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:61 + def reset; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:66 + def reset_negative_cache; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:119 + def reset_scope; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:107 + def scope; end + + # Set the inverse association, if possible + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:132 + def set_inverse_instance(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:139 + def set_inverse_instance_from_queries(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:123 + def set_strict_loading(record); end + + # The target is stale if the target no longer points to the record(s) that the + # relevant foreign_key(s) refers to. If stale, the association accessor method + # on the owner will reload the target. It's up to subclasses to implement the + # stale_state method if relevant. + # + # Note that if the target has not been loaded, it is not considered stale. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:97 + def stale_target?; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:53 + def target; end + + # Sets the target of this association to \target, and the \loaded flag to +true+. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:102 + def target=(target); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:235 + def violates_strict_loading?; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:430 + def active_record_primary_key_values(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:434 + def association_primary_key_values(record); end + + # The scope for this association. + # + # Note that the association_scope is merged into the target_scope only when the + # scope method is called. This is because at that point the call may be surrounded + # by scope.scoping { ... } or unscoped { ... } etc, which affects the scope which + # actually gets built. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:302 + def association_scope; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:385 + def build_record(attributes); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:400 + def enqueue_destroy_association(options); end + + # Reader and writer methods call this so that consistent errors are presented + # when the association target class does not exist. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:256 + def ensure_klass_exists!; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:260 + def find_target(async: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:322 + def find_target?; end + + # Returns true if record contains the foreign_key + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:372 + def foreign_key_for?(record); end + + # Returns true if there is a foreign key present on the owner which + # references the target. This is used to determine whether we can load + # the target if the owner is currently a new record (and therefore + # without a key). If the owner is a new record then foreign_key must + # be present in order to load target. + # + # Currently implemented by belongs_to (vanilla and polymorphic) and + # has_one/has_many :through associations which go through a belongs_to. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:334 + def foreign_key_present?; end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:426 + def foreign_key_values(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:408 + def inversable?(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:352 + def inverse_association_for(record); end + + # Can be redefined by subclasses, notably polymorphic belongs_to + # The record parameter is necessary to support polymorphic inverses as we must check for + # the association in the specific class of the record. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:361 + def inverse_reflection_for(record); end + + # Returns true if inverse association on the given record needs to be set. + # This method is redefined by subclasses. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:367 + def invertible_for?(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:413 + def matches_foreign_key?(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:422 + def owner_foreign_key_matches_record?(record); end + + # Raises ActiveRecord::AssociationTypeMismatch unless +record+ is of + # the kind of the class of the associated objects. Meant to be used as + # a safety check when you are about to assign an associated record. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:341 + def raise_on_type_mismatch!(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:418 + def record_foreign_key_matches_owner?(record); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:318 + def scope_for_create; end + + # Returns true if statement cache should be skipped on the association reader. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:393 + def skip_statement_cache?(scope); end + + # pkg:gem/activerecord#lib/active_record/associations/association.rb:288 + def skip_strict_loading(&block); end + + # This should be implemented to return the values of the relevant key(s) on the owner, + # so that when stale_state is different from the value stored on the last find_target, + # the target is stale. + # + # This is only relevant to certain associations, which is why it returns +nil+ by default. + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:382 + def stale_state; end + + # Can be overridden (i.e. in ThroughAssociation) to merge in other scopes (i.e. the + # through association's scope) + # + # pkg:gem/activerecord#lib/active_record/associations/association.rb:314 + def target_scope; end +end + +# pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:5 +class ActiveRecord::Associations::AssociationScope + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:15 + def initialize(value_transformation); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:21 + def scope(association); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:124 + def add_constraints(scope, owner, chain); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:161 + def apply_scope(scope, table, key, value); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:169 + def eval_scope(reflection, scope, owner); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:112 + def get_chain(reflection, association, tracker); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:54 + def join(table, constraint); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:58 + def last_chain_scope(scope, reflection, owner); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:81 + def next_chain_scope(scope, reflection, next_reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:77 + def transform_value(value); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:52 + def value_transformation; end + + class << self + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:10 + def create(&block); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:34 + def get_bind_values(owner, chain); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:6 + def scope(association); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:19 +ActiveRecord::Associations::AssociationScope::INSTANCE = T.let(T.unsafe(nil), ActiveRecord::Associations::AssociationScope) + +# pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:101 +class ActiveRecord::Associations::AssociationScope::ReflectionProxy < ::SimpleDelegator + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:104 + def initialize(reflection, aliased_table); end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:102 + def aliased_table; end + + # pkg:gem/activerecord#lib/active_record/associations/association_scope.rb:109 + def all_includes; end +end + +# = Active Record Belongs To Association +# +# pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:6 +class ActiveRecord::Associations::BelongsToAssociation < ::ActiveRecord::Associations::SingularAssociation + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:59 + def decrement_counters; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:67 + def decrement_counters_before_last_save; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:46 + def default(&block); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:7 + def handle_dependency; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:63 + def increment_counters; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:41 + def inversed_from(record); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:50 + def reset; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:90 + def saved_change_to_target?; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:82 + def target_changed?; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:86 + def target_previously_changed?; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:55 + def updated?; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:124 + def find_target?; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:157 + def foreign_key_present?; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:161 + def invertible_for?(record); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:153 + def primary_key(klass); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:95 + def replace(record); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:132 + def replace_keys(record, force: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:128 + def require_counter_update?; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:166 + def stale_state; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:109 + def update_counters(by); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_association.rb:119 + def update_counters_via_scope(klass, foreign_key, by); end +end + +# = Active Record Belongs To Polymorphic Association +# +# pkg:gem/activerecord#lib/active_record/associations/belongs_to_polymorphic_association.rb:6 +class ActiveRecord::Associations::BelongsToPolymorphicAssociation < ::ActiveRecord::Associations::BelongsToAssociation + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_polymorphic_association.rb:7 + def klass; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_polymorphic_association.rb:20 + def saved_change_to_target?; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_polymorphic_association.rb:12 + def target_changed?; end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_polymorphic_association.rb:16 + def target_previously_changed?; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_polymorphic_association.rb:35 + def inverse_reflection_for(record); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_polymorphic_association.rb:39 + def raise_on_type_mismatch!(record); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_polymorphic_association.rb:25 + def replace_keys(record, force: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/belongs_to_polymorphic_association.rb:43 + def stale_state; end +end + +# This is the parent Association class which defines the variables +# used by all associations. +# +# The hierarchy is defined as follows: +# Association +# - SingularAssociation +# - BelongsToAssociation +# - HasOneAssociation +# - CollectionAssociation +# - HasManyAssociation +# This class is inherited by the has_one and belongs_to association classes +# +# pkg:gem/activerecord#lib/active_record/associations.rb:18 +module ActiveRecord::Associations::Builder; end + +# pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:15 +class ActiveRecord::Associations::Builder::Association + class << self + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:25 + def build(model, name, scope, options, &block); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:40 + def create_reflection(model, name, scope, options, &block); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:17 + def extensions; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:17 + def extensions=(_arg0); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:156 + def add_after_commit_jobs_callback(model, dependent); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:144 + def add_destroy_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:53 + def build_scope(scope); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:134 + def check_dependent_options(dependent, model); end + + # Defines the setter and getter methods for the association + # class Post < ActiveRecord::Base + # has_many :comments + # end + # + # Post.first.comments and Post.first.comments= methods are defined by this method... + # + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:95 + def define_accessors(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:77 + def define_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:126 + def define_change_tracking_methods(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:73 + def define_extensions(model, name); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:102 + def define_readers(mixin, name); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:122 + def define_validations(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:112 + def define_writers(mixin, name); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:61 + def macro; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:130 + def valid_dependent_options; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:65 + def valid_options(options); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:69 + def validate_options(options); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/builder/association.rb:21 +ActiveRecord::Associations::Builder::Association::VALID_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:4 +class ActiveRecord::Associations::Builder::BelongsTo < ::ActiveRecord::Associations::Builder::SingularAssociation + class << self + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:45 + def touch_record(o, changes, foreign_key, name, touch); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:28 + def add_counter_cache_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:113 + def add_default_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:119 + def add_destroy_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:89 + def add_touch_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:21 + def define_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:168 + def define_change_tracking_methods(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:131 + def define_validations(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:5 + def macro; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:17 + def valid_dependent_options; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/belongs_to.rb:9 + def valid_options(options); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/builder/collection_association.rb:6 +class ActiveRecord::Associations::Builder::CollectionAssociation < ::ActiveRecord::Associations::Builder::Association + class << self + # pkg:gem/activerecord#lib/active_record/associations/builder/collection_association.rb:13 + def define_callbacks(model, reflection); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/builder/collection_association.rb:30 + def define_callback(model, callback_name, name, options); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/collection_association.rb:22 + def define_extensions(model, name, &block); end + + # Defines the setter and getter methods for the collection_singular_ids. + # + # pkg:gem/activerecord#lib/active_record/associations/builder/collection_association.rb:58 + def define_readers(mixin, name); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/collection_association.rb:70 + def define_writers(mixin, name); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/collection_association.rb:9 + def valid_options(options); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/builder/collection_association.rb:7 +ActiveRecord::Associations::Builder::CollectionAssociation::CALLBACKS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:4 +class ActiveRecord::Associations::Builder::HasAndBelongsToMany + # pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:7 + def initialize(association_name, lhs_model, options); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:5 + def association_name; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:5 + def lhs_model; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:59 + def middle_reflection(join_model); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:5 + def options; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:13 + def through_model; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:92 + def belongs_to_options(options); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:71 + def middle_options(join_model); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_and_belongs_to_many.rb:80 + def table_name; end +end + +# pkg:gem/activerecord#lib/active_record/associations/builder/has_many.rb:4 +class ActiveRecord::Associations::Builder::HasMany < ::ActiveRecord::Associations::Builder::CollectionAssociation + class << self + private + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_many.rb:5 + def macro; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_many.rb:17 + def valid_dependent_options; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_many.rb:9 + def valid_options(options); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/builder/has_one.rb:4 +class ActiveRecord::Associations::Builder::HasOne < ::ActiveRecord::Associations::Builder::SingularAssociation + class << self + # pkg:gem/activerecord#lib/active_record/associations/builder/has_one.rb:37 + def touch_record(record, name, touch); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_one.rb:26 + def add_destroy_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_one.rb:46 + def add_touch_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_one.rb:21 + def define_callbacks(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_one.rb:30 + def define_validations(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_one.rb:5 + def macro; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_one.rb:17 + def valid_dependent_options; end + + # pkg:gem/activerecord#lib/active_record/associations/builder/has_one.rb:9 + def valid_options(options); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/builder/singular_association.rb:6 +class ActiveRecord::Associations::Builder::SingularAssociation < ::ActiveRecord::Associations::Builder::Association + class << self + # pkg:gem/activerecord#lib/active_record/associations/builder/singular_association.rb:56 + def define_callbacks(model, reflection); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/builder/singular_association.rb:11 + def define_accessors(model, reflection); end + + # Defines the (build|create)_association methods for belongs_to or has_one association + # + # pkg:gem/activerecord#lib/active_record/associations/builder/singular_association.rb:34 + def define_constructors(mixin, name); end + + # pkg:gem/activerecord#lib/active_record/associations/builder/singular_association.rb:7 + def valid_options(options); end + end +end + +# = Active Record \Associations +# +# \Associations are a set of macro-like class methods for tying objects together through +# foreign keys. They express relationships like "Project has one Project Manager" +# or "Project belongs to a Portfolio". Each macro adds a number of methods to the +# class which are specialized according to the collection or association symbol and the +# options hash. It works much the same way as Ruby's own attr* +# methods. +# +# class Project < ActiveRecord::Base +# belongs_to :portfolio +# has_one :project_manager +# has_many :milestones +# has_and_belongs_to_many :categories +# end +# +# The project class now has the following methods (and more) to ease the traversal and +# manipulation of its relationships: +# +# project = Project.first +# project.portfolio +# project.portfolio = Portfolio.first +# project.reload_portfolio +# +# project.project_manager +# project.project_manager = ProjectManager.first +# project.reload_project_manager +# +# project.milestones.empty? +# project.milestones.size +# project.milestones +# project.milestones << Milestone.first +# project.milestones.delete(Milestone.first) +# project.milestones.destroy(Milestone.first) +# project.milestones.find(Milestone.first.id) +# project.milestones.build +# project.milestones.create +# +# project.categories.empty? +# project.categories.size +# project.categories +# project.categories << Category.first +# project.categories.delete(category1) +# project.categories.destroy(category1) +# +# === A word of warning +# +# Don't create associations that have the same name as {instance methods}[rdoc-ref:ActiveRecord::Core] of +# +ActiveRecord::Base+. Since the association adds a method with that name to +# its model, using an association with the same name as one provided by +ActiveRecord::Base+ will override the method inherited through +ActiveRecord::Base+ and will break things. +# For instance, +attributes+ and +connection+ would be bad choices for association names, because those names already exist in the list of +ActiveRecord::Base+ instance methods. +# +# == Auto-generated methods +# See also "Instance Public methods" below ( from #belongs_to ) for more details. +# +# === Singular associations (one-to-one) +# | | belongs_to | +# generated methods | belongs_to | :polymorphic | has_one +# ----------------------------------+------------+--------------+--------- +# other | X | X | X +# other=(other) | X | X | X +# build_other(attributes={}) | X | | X +# create_other(attributes={}) | X | | X +# create_other!(attributes={}) | X | | X +# reload_other | X | X | X +# other_changed? | X | X | +# other_previously_changed? | X | X | +# +# === Collection associations (one-to-many / many-to-many) +# | | | has_many +# generated methods | habtm | has_many | :through +# ----------------------------------+-------+----------+---------- +# others | X | X | X +# others=(other,other,...) | X | X | X +# other_ids | X | X | X +# other_ids=(id,id,...) | X | X | X +# others<< | X | X | X +# others.push | X | X | X +# others.concat | X | X | X +# others.build(attributes={}) | X | X | X +# others.create(attributes={}) | X | X | X +# others.create!(attributes={}) | X | X | X +# others.size | X | X | X +# others.length | X | X | X +# others.count | X | X | X +# others.sum(*args) | X | X | X +# others.empty? | X | X | X +# others.clear | X | X | X +# others.delete(other,other,...) | X | X | X +# others.delete_all | X | X | X +# others.destroy(other,other,...) | X | X | X +# others.destroy_all | X | X | X +# others.find(*args) | X | X | X +# others.exists? | X | X | X +# others.distinct | X | X | X +# others.reset | X | X | X +# others.reload | X | X | X +# +# === Overriding generated methods +# +# Association methods are generated in a module included into the model +# class, making overrides easy. The original generated method can thus be +# called with +super+: +# +# class Car < ActiveRecord::Base +# belongs_to :owner +# belongs_to :old_owner +# +# def owner=(new_owner) +# self.old_owner = self.owner +# super +# end +# end +# +# The association methods module is included immediately after the +# generated attributes methods module, meaning an association will +# override the methods for an attribute with the same name. +# +# == Cardinality and associations +# +# Active Record associations can be used to describe one-to-one, one-to-many, and many-to-many +# relationships between models. Each model uses an association to describe its role in +# the relation. The #belongs_to association is always used in the model that has +# the foreign key. +# +# === One-to-one +# +# Use #has_one in the base, and #belongs_to in the associated model. +# +# class Employee < ActiveRecord::Base +# has_one :office +# end +# class Office < ActiveRecord::Base +# belongs_to :employee # foreign key - employee_id +# end +# +# === One-to-many +# +# Use #has_many in the base, and #belongs_to in the associated model. +# +# class Manager < ActiveRecord::Base +# has_many :employees +# end +# class Employee < ActiveRecord::Base +# belongs_to :manager # foreign key - manager_id +# end +# +# === Many-to-many +# +# There are two ways to build a many-to-many relationship. +# +# The first way uses a #has_many association with the :through option and a join model, so +# there are two stages of associations. +# +# class Assignment < ActiveRecord::Base +# belongs_to :programmer # foreign key - programmer_id +# belongs_to :project # foreign key - project_id +# end +# class Programmer < ActiveRecord::Base +# has_many :assignments +# has_many :projects, through: :assignments +# end +# class Project < ActiveRecord::Base +# has_many :assignments +# has_many :programmers, through: :assignments +# end +# +# For the second way, use #has_and_belongs_to_many in both models. This requires a join table +# that has no corresponding model or primary key. +# +# class Programmer < ActiveRecord::Base +# has_and_belongs_to_many :projects # foreign keys in the join table +# end +# class Project < ActiveRecord::Base +# has_and_belongs_to_many :programmers # foreign keys in the join table +# end +# +# Choosing which way to build a many-to-many relationship is not always simple. +# If you need to work with the relationship model as its own entity, +# use #has_many :through. Use #has_and_belongs_to_many when working with legacy schemas or when +# you never work directly with the relationship itself. +# +# == Is it a #belongs_to or #has_one association? +# +# Both express a 1-1 relationship. The difference is mostly where to place the foreign +# key, which goes on the table for the class declaring the #belongs_to relationship. +# +# class User < ActiveRecord::Base +# # I reference an account. +# belongs_to :account +# end +# +# class Account < ActiveRecord::Base +# # One user references me. +# has_one :user +# end +# +# The tables for these classes could look something like: +# +# CREATE TABLE users ( +# id bigint NOT NULL auto_increment, +# account_id bigint default NULL, +# name varchar default NULL, +# PRIMARY KEY (id) +# ) +# +# CREATE TABLE accounts ( +# id bigint NOT NULL auto_increment, +# name varchar default NULL, +# PRIMARY KEY (id) +# ) +# +# == Unsaved objects and associations +# +# You can manipulate objects and associations before they are saved to the database, but +# there is some special behavior you should be aware of, mostly involving the saving of +# associated objects. +# +# You can set the :autosave option on a #has_one, #belongs_to, +# #has_many, or #has_and_belongs_to_many association. Setting it +# to +true+ will _always_ save the members, whereas setting it to +false+ will +# _never_ save the members. More details about :autosave option is available at +# AutosaveAssociation. +# +# === One-to-one associations +# +# * Assigning an object to a #has_one association automatically saves that object and +# the object being replaced (if there is one), in order to update their foreign +# keys - except if the parent object is unsaved (new_record? == true). +# * If either of these saves fail (due to one of the objects being invalid), an +# ActiveRecord::RecordNotSaved exception is raised and the assignment is +# cancelled. +# * If you wish to assign an object to a #has_one association without saving it, +# use the #build_association method (documented below). The object being +# replaced will still be saved to update its foreign key. +# * Assigning an object to a #belongs_to association does not save the object, since +# the foreign key field belongs on the parent. It does not save the parent either. +# +# === Collections +# +# * Adding an object to a collection (#has_many or #has_and_belongs_to_many) automatically +# saves that object, except if the parent object (the owner of the collection) is not yet +# stored in the database. +# * If saving any of the objects being added to a collection (via push or similar) +# fails, then push returns +false+. +# * If saving fails while replacing the collection (via association=), an +# ActiveRecord::RecordNotSaved exception is raised and the assignment is +# cancelled. +# * You can add an object to a collection without automatically saving it by using the +# collection.build method (documented below). +# * All unsaved (new_record? == true) members of the collection are automatically +# saved when the parent is saved. +# +# == Customizing the query +# +# \Associations are built from Relation objects, and you can use the Relation syntax +# to customize them. For example, to add a condition: +# +# class Blog < ActiveRecord::Base +# has_many :published_posts, -> { where(published: true) }, class_name: 'Post' +# end +# +# Inside the -> { ... } block you can use all of the usual Relation methods. +# +# === Accessing the owner object +# +# Sometimes it is useful to have access to the owner object when building the query. The owner +# is passed as a parameter to the block. For example, the following association would find all +# events that occur on the user's birthday: +# +# class User < ActiveRecord::Base +# has_many :birthday_events, ->(user) { where(starts_on: user.birthday) }, class_name: 'Event' +# end +# +# Note: Joining or eager loading such associations is not possible because +# those operations happen before instance creation. Such associations +# _can_ be preloaded, but doing so will perform N+1 queries because there +# will be a different scope for each record (similar to preloading +# polymorphic scopes). +# +# == Association callbacks +# +# Similar to the normal callbacks that hook into the life cycle of an Active Record object, +# you can also define callbacks that get triggered when you add an object to or remove an +# object from an association collection. +# +# class Firm < ActiveRecord::Base +# has_many :clients, +# dependent: :destroy, +# after_add: :congratulate_client, +# after_remove: :log_after_remove +# +# def congratulate_client(client) +# # ... +# end +# +# def log_after_remove(client) +# # ... +# end +# end +# +# Callbacks can be defined in three ways: +# +# 1. A symbol that references a method defined on the class with the +# associated collection. For example, after_add: :congratulate_client +# invokes Firm#congratulate_client(client). +# 2. A callable with a signature that accepts both the record with the +# associated collection and the record being added or removed. For +# example, after_add: ->(firm, client) { ... }. +# 3. An object that responds to the callback name. For example, passing +# after_add: CallbackObject.new invokes CallbackObject#after_add(firm, +# client). +# +# It's possible to stack callbacks by passing them as an array. Example: +# +# class CallbackObject +# def after_add(firm, client) +# firm.log << "after_adding #{client.id}" +# end +# end +# +# class Firm < ActiveRecord::Base +# has_many :clients, +# dependent: :destroy, +# after_add: [ +# :congratulate_client, +# -> (firm, client) { firm.log << "after_adding #{client.id}" }, +# CallbackObject.new +# ], +# after_remove: :log_after_remove +# end +# +# Possible callbacks are: +before_add+, +after_add+, +before_remove+, and +after_remove+. +# +# If any of the +before_add+ callbacks throw an exception, the object will not be +# added to the collection. +# +# Similarly, if any of the +before_remove+ callbacks throw an exception, the object +# will not be removed from the collection. +# +# Note: To trigger remove callbacks, you must use +destroy+ / +destroy_all+ methods. For example: +# +# * firm.clients.destroy(client) +# * firm.clients.destroy(*clients) +# * firm.clients.destroy_all +# +# +delete+ / +delete_all+ methods like the following do *not* trigger remove callbacks: +# +# * firm.clients.delete(client) +# * firm.clients.delete(*clients) +# * firm.clients.delete_all +# +# == Association extensions +# +# The proxy objects that control the access to associations can be extended through anonymous +# modules. This is especially beneficial for adding new finders, creators, and other +# factory-type methods that are only used as part of this association. +# +# class Account < ActiveRecord::Base +# has_many :people do +# def find_or_create_by_name(name) +# first_name, last_name = name.split(" ", 2) +# find_or_create_by(first_name: first_name, last_name: last_name) +# end +# end +# end +# +# person = Account.first.people.find_or_create_by_name("David Heinemeier Hansson") +# person.first_name # => "David" +# person.last_name # => "Heinemeier Hansson" +# +# If you need to share the same extensions between many associations, you can use a named +# extension module. +# +# module FindOrCreateByNameExtension +# def find_or_create_by_name(name) +# first_name, last_name = name.split(" ", 2) +# find_or_create_by(first_name: first_name, last_name: last_name) +# end +# end +# +# class Account < ActiveRecord::Base +# has_many :people, -> { extending FindOrCreateByNameExtension } +# end +# +# class Company < ActiveRecord::Base +# has_many :people, -> { extending FindOrCreateByNameExtension } +# end +# +# Some extensions can only be made to work with knowledge of the association's internals. +# Extensions can access relevant state using the following methods (where +items+ is the +# name of the association): +# +# * record.association(:items).owner - Returns the object the association is part of. +# * record.association(:items).reflection - Returns the reflection object that describes the association. +# * record.association(:items).target - Returns the associated object for #belongs_to and #has_one, or +# the collection of associated objects for #has_many and #has_and_belongs_to_many. +# +# However, inside the actual extension code, you will not have access to the record as +# above. In this case, you can access proxy_association. For example, +# record.association(:items) and record.items.proxy_association will return +# the same object, allowing you to make calls like proxy_association.owner inside +# association extensions. +# +# == Association Join Models +# +# Has Many associations can be configured with the :through option to use an +# explicit join model to retrieve the data. This operates similarly to a +# #has_and_belongs_to_many association. The advantage is that you're able to add validations, +# callbacks, and extra attributes on the join model. Consider the following schema: +# +# class Author < ActiveRecord::Base +# has_many :authorships +# has_many :books, through: :authorships +# end +# +# class Authorship < ActiveRecord::Base +# belongs_to :author +# belongs_to :book +# end +# +# @author = Author.first +# @author.authorships.collect { |a| a.book } # selects all books that the author's authorships belong to +# @author.books # selects all books by using the Authorship join model +# +# You can also go through a #has_many association on the join model: +# +# class Firm < ActiveRecord::Base +# has_many :clients +# has_many :invoices, through: :clients +# end +# +# class Client < ActiveRecord::Base +# belongs_to :firm +# has_many :invoices +# end +# +# class Invoice < ActiveRecord::Base +# belongs_to :client +# end +# +# @firm = Firm.first +# @firm.clients.flat_map { |c| c.invoices } # select all invoices for all clients of the firm +# @firm.invoices # selects all invoices by going through the Client join model +# +# Similarly you can go through a #has_one association on the join model: +# +# class Group < ActiveRecord::Base +# has_many :users +# has_many :avatars, through: :users +# end +# +# class User < ActiveRecord::Base +# belongs_to :group +# has_one :avatar +# end +# +# class Avatar < ActiveRecord::Base +# belongs_to :user +# end +# +# @group = Group.first +# @group.users.collect { |u| u.avatar }.compact # select all avatars for all users in the group +# @group.avatars # selects all avatars by going through the User join model. +# +# An important caveat with going through #has_one or #has_many associations on the +# join model is that these associations are *read-only*. For example, the following +# would not work following the previous example: +# +# @group.avatars << Avatar.new # this would work if User belonged_to Avatar rather than the other way around +# @group.avatars.delete(@group.avatars.last) # so would this +# +# === Setting Inverses +# +# If you are using a #belongs_to on the join model, it is a good idea to set the +# :inverse_of option on the #belongs_to, which will mean that the following example +# works correctly (where tags is a #has_many :through association): +# +# @post = Post.first +# @tag = @post.tags.build name: "ruby" +# @tag.save +# +# The last line ought to save the through record (a Tagging). This will only work if the +# :inverse_of is set: +# +# class Tagging < ActiveRecord::Base +# belongs_to :post +# belongs_to :tag, inverse_of: :taggings +# end +# +# If you do not set the :inverse_of record, the association will +# do its best to match itself up with the correct inverse. Automatic +# inverse detection only works on #has_many, #has_one, and +# #belongs_to associations. +# +# :foreign_key and :through options on the associations +# will also prevent the association's inverse from being found automatically, +# as will a custom scopes in some cases. See further details in the +# {Active Record Associations guide}[https://guides.rubyonrails.org/association_basics.html#bi-directional-associations]. +# +# The automatic guessing of the inverse association uses a heuristic based +# on the name of the class, so it may not work for all associations, +# especially the ones with non-standard names. +# +# You can turn off the automatic detection of inverse associations by setting +# the :inverse_of option to false like so: +# +# class Tagging < ActiveRecord::Base +# belongs_to :tag, inverse_of: false +# end +# +# == Nested \Associations +# +# You can actually specify *any* association with the :through option, including an +# association which has a :through option itself. For example: +# +# class Author < ActiveRecord::Base +# has_many :posts +# has_many :comments, through: :posts +# has_many :commenters, through: :comments +# end +# +# class Post < ActiveRecord::Base +# has_many :comments +# end +# +# class Comment < ActiveRecord::Base +# belongs_to :commenter +# end +# +# @author = Author.first +# @author.commenters # => People who commented on posts written by the author +# +# An equivalent way of setting up this association this would be: +# +# class Author < ActiveRecord::Base +# has_many :posts +# has_many :commenters, through: :posts +# end +# +# class Post < ActiveRecord::Base +# has_many :comments +# has_many :commenters, through: :comments +# end +# +# class Comment < ActiveRecord::Base +# belongs_to :commenter +# end +# +# When using a nested association, you will not be able to modify the association because there +# is not enough information to know what modification to make. For example, if you tried to +# add a Commenter in the example above, there would be no way to tell how to set up the +# intermediate Post and Comment objects. +# +# == Polymorphic \Associations +# +# Polymorphic associations on models are not restricted on what types of models they +# can be associated with. Rather, they specify an interface that a #has_many association +# must adhere to. +# +# class Asset < ActiveRecord::Base +# belongs_to :attachable, polymorphic: true +# end +# +# class Post < ActiveRecord::Base +# has_many :assets, as: :attachable # The :as option specifies the polymorphic interface to use. +# end +# +# @asset.attachable = @post +# +# This works by using a type column in addition to a foreign key to specify the associated +# record. In the Asset example, you'd need an +attachable_id+ integer column and an +# +attachable_type+ string column. +# +# Using polymorphic associations in combination with single table inheritance (STI) is +# a little tricky. In order for the associations to work as expected, ensure that you +# store the base model for the STI models in the type column of the polymorphic +# association. To continue with the asset example above, suppose there are guest posts +# and member posts that use the posts table for STI. In this case, there must be a +type+ +# column in the posts table. +# +# Note: The attachable_type= method is being called when assigning an +attachable+. +# The +class_name+ of the +attachable+ is passed as a String. +# +# class Asset < ActiveRecord::Base +# belongs_to :attachable, polymorphic: true +# +# def attachable_type=(class_name) +# super(class_name.constantize.base_class.to_s) +# end +# end +# +# class Post < ActiveRecord::Base +# # because we store "Post" in attachable_type now dependent: :destroy will work +# has_many :assets, as: :attachable, dependent: :destroy +# end +# +# class GuestPost < Post +# end +# +# class MemberPost < Post +# end +# +# == Caching +# +# All of the methods are built on a simple caching principle that will keep the result +# of the last query around unless specifically instructed not to. The cache is even +# shared across methods to make it even cheaper to use the macro-added methods without +# worrying too much about performance at the first go. +# +# project.milestones # fetches milestones from the database +# project.milestones.size # uses the milestone cache +# project.milestones.empty? # uses the milestone cache +# project.milestones.reload.size # fetches milestones from the database +# project.milestones # uses the milestone cache +# +# == Eager loading of associations +# +# Eager loading is a way to find objects of a certain class and a number of named associations. +# It is one of the easiest ways to prevent the dreaded N+1 problem in which fetching 100 +# posts that each need to display their author triggers 101 database queries. Through the +# use of eager loading, the number of queries will be reduced from 101 to 2. +# +# class Post < ActiveRecord::Base +# belongs_to :author +# has_many :comments +# end +# +# Consider the following loop using the class above: +# +# Post.all.each do |post| +# puts "Post: " + post.title +# puts "Written by: " + post.author.name +# puts "Last comment on: " + post.comments.first.created_on +# end +# +# To iterate over these one hundred posts, we'll generate 201 database queries. Let's +# first just optimize it for retrieving the author: +# +# Post.includes(:author).each do |post| +# +# This references the name of the #belongs_to association that also used the :author +# symbol. After loading the posts, +find+ will collect the +author_id+ from each one and load +# all of the referenced authors with one query. Doing so will cut down the number of queries +# from 201 to 102. +# +# We can improve upon the situation further by referencing both associations in the finder with: +# +# Post.includes(:author, :comments).each do |post| +# +# This will load all comments with a single query. This reduces the total number of queries +# to 3. In general, the number of queries will be 1 plus the number of associations +# named (except if some of the associations are polymorphic #belongs_to - see below). +# +# To include a deep hierarchy of associations, use a hash: +# +# Post.includes(:author, { comments: { author: :gravatar } }).each do |post| +# +# The above code will load all the comments and all of their associated +# authors and gravatars. You can mix and match any combination of symbols, +# arrays, and hashes to retrieve the associations you want to load. +# +# All of this power shouldn't fool you into thinking that you can pull out huge amounts +# of data with no performance penalty just because you've reduced the number of queries. +# The database still needs to send all the data to Active Record and it still needs to +# be processed. So it's no catch-all for performance problems, but it's a great way to +# cut down on the number of queries in a situation as the one described above. +# +# Since only one table is loaded at a time, conditions or orders cannot reference tables +# other than the main one. If this is the case, Active Record falls back to the previously +# used LEFT OUTER JOIN based strategy. For example: +# +# Post.includes([:author, :comments]).where(['comments.approved = ?', true]) +# +# This will result in a single SQL query with joins along the lines of: +# LEFT OUTER JOIN comments ON comments.post_id = posts.id and +# LEFT OUTER JOIN authors ON authors.id = posts.author_id. Note that using conditions +# like this can have unintended consequences. +# In the above example, posts with no approved comments are not returned at all because +# the conditions apply to the SQL statement as a whole and not just to the association. +# +# You must disambiguate column references for this fallback to happen, for example +# order: "author.name DESC" will work but order: "name DESC" will not. +# +# If you want to load all posts (including posts with no approved comments), then write +# your own LEFT OUTER JOIN query using ON: +# +# Post.joins("LEFT OUTER JOIN comments ON comments.post_id = posts.id AND comments.approved = '1'") +# +# In this case, it is usually more natural to include an association which has conditions defined on it: +# +# class Post < ActiveRecord::Base +# has_many :approved_comments, -> { where(approved: true) }, class_name: 'Comment' +# end +# +# Post.includes(:approved_comments) +# +# This will load posts and eager load the +approved_comments+ association, which contains +# only those comments that have been approved. +# +# If you eager load an association with a specified :limit option, it will be ignored, +# returning all the associated objects: +# +# class Picture < ActiveRecord::Base +# has_many :most_recent_comments, -> { order('id DESC').limit(10) }, class_name: 'Comment' +# end +# +# Picture.includes(:most_recent_comments).first.most_recent_comments # => returns all associated comments. +# +# Eager loading is supported with polymorphic associations. +# +# class Address < ActiveRecord::Base +# belongs_to :addressable, polymorphic: true +# end +# +# A call that tries to eager load the addressable model +# +# Address.includes(:addressable) +# +# This will execute one query to load the addresses and load the addressables with one +# query per addressable type. +# For example, if all the addressables are either of class Person or Company, then a total +# of 3 queries will be executed. The list of addressable types to load is determined on +# the back of the addresses loaded. This is not supported if Active Record has to fall back +# to the previous implementation of eager loading and will raise ActiveRecord::EagerLoadPolymorphicError. +# The reason is that the parent model's type is a column value so its corresponding table +# name cannot be put in the +FROM+/+JOIN+ clauses of that query. +# +# == Table Aliasing +# +# Active Record uses table aliasing in the case that a table is referenced multiple times +# in a join. If a table is referenced only once, the standard table name is used. The +# second time, the table is aliased as #{reflection_name}_#{parent_table_name}. +# Indexes are appended for any more successive uses of the table name. +# +# Post.joins(:comments) +# # SELECT ... FROM posts INNER JOIN comments ON ... +# Post.joins(:special_comments) # STI +# # SELECT ... FROM posts INNER JOIN comments ON ... AND comments.type = 'SpecialComment' +# Post.joins(:comments, :special_comments) # special_comments is the reflection name, posts is the parent table name +# # SELECT ... FROM posts INNER JOIN comments ON ... INNER JOIN comments special_comments_posts +# +# Acts as tree example: +# +# TreeMixin.joins(:children) +# # SELECT ... FROM mixins INNER JOIN mixins childrens_mixins ... +# TreeMixin.joins(children: :parent) +# # SELECT ... FROM mixins INNER JOIN mixins childrens_mixins ... +# # INNER JOIN parents_mixins ... +# TreeMixin.joins(children: {parent: :children}) +# # SELECT ... FROM mixins INNER JOIN mixins childrens_mixins ... +# # INNER JOIN parents_mixins ... +# # INNER JOIN mixins childrens_mixins_2 +# +# Has and Belongs to Many join tables use the same idea, but add a _join suffix: +# +# Post.joins(:categories) +# # SELECT ... FROM posts INNER JOIN categories_posts ... INNER JOIN categories ... +# Post.joins(categories: :posts) +# # SELECT ... FROM posts INNER JOIN categories_posts ... INNER JOIN categories ... +# # INNER JOIN categories_posts posts_categories_join INNER JOIN posts posts_categories +# Post.joins(categories: {posts: :categories}) +# # SELECT ... FROM posts INNER JOIN categories_posts ... INNER JOIN categories ... +# # INNER JOIN categories_posts posts_categories_join INNER JOIN posts posts_categories +# # INNER JOIN categories_posts categories_posts_join INNER JOIN categories categories_posts_2 +# +# If you wish to specify your own custom joins using ActiveRecord::QueryMethods#joins method, those table +# names will take precedence over the eager associations: +# +# Post.joins(:comments).joins("inner join comments ...") +# # SELECT ... FROM posts INNER JOIN comments_posts ON ... INNER JOIN comments ... +# Post.joins(:comments, :special_comments).joins("inner join comments ...") +# # SELECT ... FROM posts INNER JOIN comments comments_posts ON ... +# # INNER JOIN comments special_comments_posts ... +# # INNER JOIN comments ... +# +# Table aliases are automatically truncated according to the maximum length of table identifiers +# according to the specific database. +# +# == Modules +# +# By default, associations will look for objects within the current module scope. Consider: +# +# module MyApplication +# module Business +# class Firm < ActiveRecord::Base +# has_many :clients +# end +# +# class Client < ActiveRecord::Base; end +# end +# end +# +# When Firm#clients is called, it will in turn call +# MyApplication::Business::Client.find_all_by_firm_id(firm.id). +# If you want to associate with a class in another module scope, this can be done by +# specifying the complete class name. +# +# module MyApplication +# module Business +# class Firm < ActiveRecord::Base; end +# end +# +# module Billing +# class Account < ActiveRecord::Base +# belongs_to :firm, class_name: "MyApplication::Business::Firm" +# end +# end +# end +# +# == Bi-directional associations +# +# When you specify an association, there is usually an association on the associated model +# that specifies the same relationship in reverse. For example, with the following models: +# +# class Dungeon < ActiveRecord::Base +# has_many :traps +# has_one :evil_wizard +# end +# +# class Trap < ActiveRecord::Base +# belongs_to :dungeon +# end +# +# class EvilWizard < ActiveRecord::Base +# belongs_to :dungeon +# end +# +# The +traps+ association on +Dungeon+ and the +dungeon+ association on +Trap+ are +# the inverse of each other, and the inverse of the +dungeon+ association on +EvilWizard+ +# is the +evil_wizard+ association on +Dungeon+ (and vice-versa). By default, +# Active Record can guess the inverse of the association based on the name +# of the class. The result is the following: +# +# d = Dungeon.first +# t = d.traps.first +# d.object_id == t.dungeon.object_id # => true +# +# The +Dungeon+ instances +d+ and t.dungeon in the above example refer to +# the same in-memory instance since the association matches the name of the class. +# The result would be the same if we added +:inverse_of+ to our model definitions: +# +# class Dungeon < ActiveRecord::Base +# has_many :traps, inverse_of: :dungeon +# has_one :evil_wizard, inverse_of: :dungeon +# end +# +# class Trap < ActiveRecord::Base +# belongs_to :dungeon, inverse_of: :traps +# end +# +# class EvilWizard < ActiveRecord::Base +# belongs_to :dungeon, inverse_of: :evil_wizard +# end +# +# For more information, see the documentation for the +:inverse_of+ option and the +# {Active Record Associations guide}[https://guides.rubyonrails.org/association_basics.html#bi-directional-associations]. +# +# == Deleting from associations +# +# === Dependent associations +# +# #has_many, #has_one, and #belongs_to associations support the :dependent option. +# This allows you to specify that associated records should be deleted when the owner is +# deleted. +# +# For example: +# +# class Author +# has_many :posts, dependent: :destroy +# end +# Author.find(1).destroy # => Will destroy all of the author's posts, too +# +# The :dependent option can have different values which specify how the deletion +# is done. For more information, see the documentation for this option on the different +# specific association types. When no option is given, the behavior is to do nothing +# with the associated records when destroying a record. +# +# Note that :dependent is implemented using \Rails' callback +# system, which works by processing callbacks in order. Therefore, other +# callbacks declared either before or after the :dependent option +# can affect what it does. +# +# Note that :dependent option is ignored for #has_one :through associations. +# +# === Delete or destroy? +# +# #has_many and #has_and_belongs_to_many associations have the methods destroy, +# delete, destroy_all and delete_all. +# +# For #has_and_belongs_to_many, delete and destroy are the same: they +# cause the records in the join table to be removed. +# +# For #has_many, destroy and destroy_all will always call the destroy method of the +# record(s) being removed so that callbacks are run. However delete and delete_all will either +# do the deletion according to the strategy specified by the :dependent option, or +# if no :dependent option is given, then it will follow the default strategy. +# The default strategy is to do nothing (leave the foreign keys with the parent ids set), except for +# #has_many :through, where the default strategy is delete_all (delete +# the join records, without running their callbacks). +# +# There is also a clear method which is the same as delete_all, except that +# it returns the association rather than the records which have been deleted. +# +# === What gets deleted? +# +# There is a potential pitfall here: #has_and_belongs_to_many and #has_many :through +# associations have records in join tables, as well as the associated records. So when we +# call one of these deletion methods, what exactly should be deleted? +# +# The answer is that it is assumed that deletion on an association is about removing the +# link between the owner and the associated object(s), rather than necessarily the +# associated objects themselves. So with #has_and_belongs_to_many and #has_many +# :through, the join records will be deleted, but the associated records won't. +# +# This makes sense if you think about it: if you were to call post.tags.delete(Tag.find_by(name: 'food')) +# you would want the 'food' tag to be unlinked from the post, rather than for the tag itself +# to be removed from the database. +# +# However, there are examples where this strategy doesn't make sense. For example, suppose +# a person has many projects, and each project has many tasks. If we deleted one of a person's +# tasks, we would probably not want the project to be deleted. In this scenario, the delete method +# won't actually work: it can only be used if the association on the join model is a +# #belongs_to. In other situations you are expected to perform operations directly on +# either the associated records or the :through association. +# +# With a regular #has_many there is no distinction between the "associated records" +# and the "link", so there is only one choice for what gets deleted. +# +# With #has_and_belongs_to_many and #has_many :through, if you want to delete the +# associated records themselves, you can always do something along the lines of +# person.tasks.each(&:destroy). +# +# == Deprecated \Associations +# +# \Associations can be marked as deprecated by passing deprecated: true: +# +# has_many :posts, deprecated: true +# +# When a deprecated association is used, a warning is issued using the +# Active Record logger, though more options are available via +# configuration. +# +# The message includes some context that helps understand the deprecated +# usage: +# +# The association Author#posts is deprecated, the method post_ids was invoked (...) +# The association Author#posts is deprecated, referenced in query to preload records (...) +# +# The dots in the examples above would have the application-level spot +# where usage occurred, to help locate what triggered the warning. That +# location is computed using the Active Record backtrace cleaner. +# +# === What is considered to be usage? +# +# * Invocation of any association methods like +posts+, posts=, +# etc. +# +# * If the association accepts nested attributes, assignment to those +# attributes. +# +# * If the association is a through association and some of its nested +# associations are deprecated, you'll get warnings for them whenever the +# top-level through is used. This is so regardless of whether the +# through itself is deprecated. +# +# * Execution of queries that refer to the association. Think execution of +# eager_load(:posts), joins(author: :posts), etc. +# +# * If the association has a +:dependent+ option, destroying the +# associated record issues warnings (because that has a side-effect that +# would not happen if the association was removed). +# +# * If the association has a +:touch+ option, saving or destroying the +# record issues a warning (because that has a side-effect that would not +# happen if the association was removed). +# +# === Things that do NOT issue warnings +# +# The rationale behind most of the following edge cases is that Active +# Record accesses associations lazily, when used. Before that, the +# reference to the association is basically just a Ruby symbol. +# +# * If +posts+ is deprecated, has_many :comments, through: :posts +# does not warn. Usage of the +comments+ association reports usage of +# +posts+, as we explained above, but the definition of the +has_many+ +# itself does not. +# +# * Similarly, accepts_nested_attributes_for :posts does not +# warn. Assignment to the posts attributes warns, as explained above, +# but the +accepts_nested_attributes_for+ call itself does not. +# +# * Same if an association declares to be inverse of a deprecated one, the +# macro itself does not warn. +# +# * In the same line, the declaration validates_associated :posts +# does not warn by itself, though access is reported when the validation +# runs. +# +# * Relation query methods like Author.includes(:posts) do not +# warn by themselves. At that point, that is a relation that internally +# stores a symbol for later use. As explained in the previous section, +# you get a warning when/if the query is executed. +# +# * Access to the reflection object of the association as in +# Author.reflect_on_association(:posts) or +# Author.reflect_on_all_associations does not warn. +# +# === Configuration +# +# Reporting deprecated usage can be configured: +# +# config.active_record.deprecated_associations_options = { ... } +# +# If present, this has to be a hash with keys +:mode+ and/or +:backtrace+. +# +# ==== Mode +# +# * In +:warn+ mode, usage issues a warning that includes the +# application-level place where the access happened, if any. This is the +# default mode. +# +# * In +:raise+ mode, usage raises an +# ActiveRecord::DeprecatedAssociationError with a similar message and a +# clean backtrace in the exception object. +# +# * In +:notify+ mode, a deprecated_association.active_record +# Active Support notification is published. The event payload has the +# association reflection (+:reflection+), the application-level location +# (+:location+) where the access happened (a Thread::Backtrace::Location +# object, or +nil+), and a deprecation message (+:message+). +# +# ==== Backtrace +# +# If +:backtrace+ is true, warnings include a clean backtrace in the message +# and notifications have a +:backtrace+ key in the payload with an array +# of clean Thread::Backtrace::Location objects. Exceptions always get a +# clean stack trace set. +# +# Clean backtraces are computed using the Active Record backtrace cleaner. +# In Rails applications, that is by the default the same as +# Rails.backtrace_cleaner. +# +# == Type safety with ActiveRecord::AssociationTypeMismatch +# +# If you attempt to assign an object to an association that doesn't match the inferred +# or specified :class_name, you'll get an ActiveRecord::AssociationTypeMismatch. +# +# == Options +# +# All of the association macros can be specialized through options. This makes cases +# more complex than the simple and guessable ones possible. +# +# pkg:gem/activerecord#lib/active_record/associations.rb:1152 +module ActiveRecord::Associations::ClassMethods + # Specifies a one-to-one association with another class. This method + # should only be used if this class contains the foreign key. If the + # other class contains the foreign key, then you should use #has_one + # instead. See {Is it a belongs_to or has_one + # association?}[rdoc-ref:Associations::ClassMethods@Is+it+a+-23belongs_to+or+-23has_one+association-3F] + # for more detail on when to use #has_one and when to use #belongs_to. + # + # Methods will be added for retrieval and query for a single associated object, for which + # this object holds an id: + # + # +association+ is a placeholder for the symbol passed as the +name+ argument, so + # belongs_to :author would add among others author.nil?. + # + # [association] + # Returns the associated object. +nil+ is returned if none is found. + # [association=(associate)] + # Assigns the associate object, extracts the primary key, and sets it as the foreign key. + # No modification or deletion of existing records takes place. + # [build_association(attributes = {})] + # Returns a new object of the associated type that has been instantiated + # with +attributes+ and linked to this object through a foreign key, but has not yet been saved. + # [create_association(attributes = {})] + # Returns a new object of the associated type that has been instantiated + # with +attributes+, linked to this object through a foreign key, and that + # has already been saved (if it passed the validation). + # [create_association!(attributes = {})] + # Does the same as create_association, but raises ActiveRecord::RecordInvalid + # if the record is invalid. + # [reload_association] + # Returns the associated object, forcing a database read. + # [reset_association] + # Unloads the associated object. The next access will query it from the database. + # [association_changed?] + # Returns true if a new associate object has been assigned and the next save will update the foreign key. + # [association_previously_changed?] + # Returns true if the previous save updated the association to reference a new associate object. + # + # ==== Example + # + # class Post < ActiveRecord::Base + # belongs_to :author + # end + # + # Declaring belongs_to :author adds the following methods (and more): + # + # post = Post.find(7) + # author = Author.find(19) + # + # post.author # similar to Author.find(post.author_id) + # post.author = author # similar to post.author_id = author.id + # post.build_author # similar to post.author = Author.new + # post.create_author # similar to post.author = Author.new; post.author.save; post.author + # post.create_author! # similar to post.author = Author.new; post.author.save!; post.author + # post.reload_author + # post.reset_author + # post.author_changed? + # post.author_previously_changed? + # + # ==== Scopes + # + # You can pass a second argument +scope+ as a callable (i.e. proc or + # lambda) to retrieve a specific record or customize the generated query + # when you access the associated object. + # + # Scope examples: + # belongs_to :firm, -> { where(id: 2) } + # belongs_to :user, -> { joins(:friends) } + # belongs_to :level, ->(game) { where("game_level > ?", game.current_level) } + # + # ==== Options + # + # The declaration can also include an +options+ hash to specialize the behavior of the association. + # + # [+:class_name+] + # Specify the class name of the association. Use it only if that name can't be inferred + # from the association name. So belongs_to :author will by default be linked to the Author class, but + # if the real class name is Person, you'll have to specify it with this option. +:class_name+ + # is not supported in polymorphic associations, since in that case the class name of the + # associated record is stored in the type column. + # [+:foreign_key+] + # Specify the foreign key used for the association. By default this is guessed to be the name + # of the association with an "_id" suffix. So a class that defines a belongs_to :person + # association will use "person_id" as the default :foreign_key. Similarly, + # belongs_to :favorite_person, class_name: "Person" will use a foreign key + # of "favorite_person_id". + # + # Setting the :foreign_key option prevents automatic detection of the association's + # inverse, so it is generally a good idea to set the :inverse_of option as well. + # [+:foreign_type+] + # Specify the column used to store the associated object's type, if this is a polymorphic + # association. By default this is guessed to be the name of the association with a "_type" + # suffix. So a class that defines a belongs_to :taggable, polymorphic: true + # association will use "taggable_type" as the default :foreign_type. + # [+:primary_key+] + # Specify the method that returns the primary key of associated object used for the association. + # By default this is +id+. + # [+:dependent+] + # If set to :destroy, the associated object is destroyed when this object is. If set to + # :delete, the associated object is deleted *without* calling its destroy method. If set to + # :destroy_async, the associated object is scheduled to be destroyed in a background job. + # This option should not be specified when #belongs_to is used in conjunction with + # a #has_many relationship on another class because of the potential to leave + # orphaned records behind. + # [+:counter_cache+] + # Caches the number of belonging objects on the associate class through the use of CounterCache::ClassMethods#increment_counter + # and CounterCache::ClassMethods#decrement_counter. The counter cache is incremented when an object of this + # class is created and decremented when it's destroyed. This requires that a column + # named #{table_name}_count (such as +comments_count+ for a belonging Comment class) + # is used on the associate class (such as a Post class) - that is the migration for + # #{table_name}_count is created on the associate class (such that Post.comments_count will + # return the count cached). You can also specify a custom counter + # cache column by providing a column name instead of a +true+/+false+ value to this + # option (e.g., counter_cache: :my_custom_counter.) + # + # Starting to use counter caches on existing large tables can be troublesome, because the column + # values must be backfilled separately of the column addition (to not lock the table for too long) + # and before the use of +:counter_cache+ (otherwise methods like +size+/+any?+/etc, which use + # counter caches internally, can produce incorrect results). To safely backfill the values while keeping + # counter cache columns updated with the child records creation/removal and to avoid the mentioned methods + # use the possibly incorrect counter cache column values and always get the results from the database, + # use counter_cache: { active: false }. + # If you also need to specify a custom column name, use counter_cache: { active: false, column: :my_custom_counter }. + # + # Note: If you've enabled the counter cache, then you may want to add the counter cache attribute + # to the +attr_readonly+ list in the associated classes (e.g. class Post; attr_readonly :comments_count; end). + # [+:polymorphic+] + # Specify this association is a polymorphic association by passing +true+. + # Note: Since polymorphic associations rely on storing class names in the database, make sure to update the class names in the + # *_type polymorphic type column of the corresponding rows. + # [+:validate+] + # When set to +true+, validates new objects added to association when saving the parent object. +false+ by default. + # If you want to ensure associated objects are revalidated on every update, use +validates_associated+. + # [+:autosave+] + # If true, always save the associated object or destroy it if marked for destruction, when + # saving the parent object. + # If false, never save or destroy the associated object. + # By default, only save the associated object if it's a new record. + # + # Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for + # sets :autosave to true. + # [+:touch+] + # If true, the associated object will be touched (the +updated_at+ / +updated_on+ attributes set to current time) + # when this record is either saved or destroyed. If you specify a symbol, that attribute + # will be updated with the current time in addition to the +updated_at+ / +updated_on+ attribute. + # Please note that no validation will be performed when touching, and only the +after_touch+, + # +after_commit+, and +after_rollback+ callbacks will be executed. + # [+:inverse_of+] + # Specifies the name of the #has_one or #has_many association on the associated + # object that is the inverse of this #belongs_to association. + # See {Bi-directional associations}[rdoc-ref:Associations::ClassMethods@Bi-directional+associations] + # for more detail. + # [+:optional+] + # When set to +true+, the association will not have its presence validated. + # [+:required+] + # When set to +true+, the association will also have its presence validated. + # This will validate the association itself, not the id. You can use + # +:inverse_of+ to avoid an extra query during validation. + # NOTE: required is set to true by default and is deprecated. If + # you don't want to have association presence validated, use optional: true. + # [+:default+] + # Provide a callable (i.e. proc or lambda) to specify that the association should + # be initialized with a particular record before validation. + # Please note that callable won't be executed if the record exists. + # [+:strict_loading+] + # Enforces strict loading every time the associated record is loaded through this association. + # [+:ensuring_owner_was+] + # Specifies an instance method to be called on the owner. The method must return true in order for the + # associated records to be deleted in a background job. + # [+:query_constraints+] + # Serves as a composite foreign key. Defines the list of columns to be used to query the associated object. + # This is an optional option. By default Rails will attempt to derive the value automatically. + # When the value is set the Array size must match associated model's primary key or +query_constraints+ size. + # [+:deprecated+] + # If true, marks the association as deprecated. Usage of deprecated associations is reported. + # Please, check the class documentation above for details. + # + # Option examples: + # belongs_to :firm, foreign_key: "client_of" + # belongs_to :person, primary_key: "name", foreign_key: "person_name" + # belongs_to :author, class_name: "Person", foreign_key: "author_id" + # belongs_to :valid_coupon, ->(o) { where "discounts > ?", o.payments_count }, + # class_name: "Coupon", foreign_key: "coupon_id" + # belongs_to :attachable, polymorphic: true + # belongs_to :project, -> { readonly } + # belongs_to :post, counter_cache: true + # belongs_to :comment, touch: true + # belongs_to :company, touch: :employees_last_updated_at + # belongs_to :user, optional: true + # belongs_to :account, default: -> { company.account } + # belongs_to :account, strict_loading: true + # belongs_to :note, query_constraints: [:organization_id, :note_id] + # + # pkg:gem/activerecord#lib/active_record/associations.rb:1824 + def belongs_to(name, scope = T.unsafe(nil), **options); end + + # Specifies a many-to-many relationship with another class. This associates two classes via an + # intermediate join table. Unless the join table is explicitly specified as an option, it is + # guessed using the lexical order of the class names. So a join between Developer and Project + # will give the default join table name of "developers_projects" because "D" precedes "P" alphabetically. + # Note that this precedence is calculated using the < operator for String. This + # means that if the strings are of different lengths, and the strings are equal when compared + # up to the shortest length, then the longer string is considered of higher + # lexical precedence than the shorter one. For example, one would expect the tables "paper_boxes" and "papers" + # to generate a join table name of "papers_paper_boxes" because of the length of the name "paper_boxes", + # but it in fact generates a join table name of "paper_boxes_papers". Be aware of this caveat, and use the + # custom :join_table option if you need to. + # If your tables share a common prefix, it will only appear once at the beginning. For example, + # the tables "catalog_categories" and "catalog_products" generate a join table name of "catalog_categories_products". + # + # The join table should not have a primary key or a model associated with it. You must manually generate the + # join table with a migration such as this: + # + # class CreateDevelopersProjectsJoinTable < ActiveRecord::Migration[8.1] + # def change + # create_join_table :developers, :projects + # end + # end + # + # It's also a good idea to add indexes to each of those columns to speed up the joins process. + # However, in MySQL it is advised to add a compound index for both of the columns as MySQL only + # uses one index per table during the lookup. + # + # Adds the following methods for retrieval and query: + # + # +collection+ is a placeholder for the symbol passed as the +name+ argument, so + # has_and_belongs_to_many :categories would add among others categories.empty?. + # + # [collection] + # Returns a Relation of all the associated objects. + # An empty Relation is returned if none are found. + # [collection<<(object, ...)] + # Adds one or more objects to the collection by creating associations in the join table + # (collection.push and collection.concat are aliases to this method). + # Note that this operation instantly fires update SQL without waiting for the save or update call on the + # parent object, unless the parent object is a new record. + # [collection.delete(object, ...)] + # Removes one or more objects from the collection by removing their associations from the join table. + # This does not destroy the objects. + # [collection.destroy(object, ...)] + # Removes one or more objects from the collection by running destroy on each association in the join table, overriding any dependent option. + # This does not destroy the objects. + # [collection=objects] + # Replaces the collection's content by deleting and adding objects as appropriate. + # [collection_singular_ids] + # Returns an array of the associated objects' ids. + # [collection_singular_ids=ids] + # Replace the collection by the objects identified by the primary keys in +ids+. + # [collection.clear] + # Removes every object from the collection. This does not destroy the objects. + # [collection.empty?] + # Returns +true+ if there are no associated objects. + # [collection.size] + # Returns the number of associated objects. + # [collection.find(id)] + # Finds an associated object responding to the +id+ and that + # meets the condition that it has to be associated with this object. + # Uses the same rules as ActiveRecord::FinderMethods#find. + # [collection.exists?(...)] + # Checks whether an associated object with the given conditions exists. + # Uses the same rules as ActiveRecord::FinderMethods#exists?. + # [collection.build(attributes = {})] + # Returns a new object of the collection type that has been instantiated + # with +attributes+ and linked to this object through the join table, but has not yet been saved. + # [collection.create(attributes = {})] + # Returns a new object of the collection type that has been instantiated + # with +attributes+, linked to this object through the join table, and that has already been + # saved (if it passed the validation). + # [collection.reload] + # Returns a Relation of all of the associated objects, forcing a database read. + # An empty Relation is returned if none are found. + # + # ==== Example + # + # class Developer < ActiveRecord::Base + # has_and_belongs_to_many :projects + # end + # + # Declaring has_and_belongs_to_many :projects adds the following methods (and more): + # + # developer = Developer.find(11) + # project = Project.find(9) + # + # developer.projects + # developer.projects << project + # developer.projects.delete(project) + # developer.projects.destroy(project) + # developer.projects = [project] + # developer.project_ids + # developer.project_ids = [9] + # developer.projects.clear + # developer.projects.empty? + # developer.projects.size + # developer.projects.find(9) + # developer.projects.exists?(9) + # developer.projects.build # similar to Project.new(developer_id: 11) + # developer.projects.create # similar to Project.create(developer_id: 11) + # developer.projects.reload + # + # The declaration may include an +options+ hash to specialize the behavior of the association. + # + # ==== Scopes + # + # You can pass a second argument +scope+ as a callable (i.e. proc or + # lambda) to retrieve a specific set of records or customize the generated + # query when you access the associated collection. + # + # Scope examples: + # has_and_belongs_to_many :projects, -> { includes(:milestones, :manager) } + # has_and_belongs_to_many :categories, ->(post) { + # where("default_category = ?", post.default_category) + # } + # + # ==== Extensions + # + # The +extension+ argument allows you to pass a block into a + # has_and_belongs_to_many association. This is useful for adding new + # finders, creators, and other factory-type methods to be used as part of + # the association. + # + # Extension examples: + # has_and_belongs_to_many :contractors do + # def find_or_create_by_name(name) + # first_name, last_name = name.split(" ", 2) + # find_or_create_by(first_name: first_name, last_name: last_name) + # end + # end + # + # ==== Options + # + # [+:class_name+] + # Specify the class name of the association. Use it only if that name can't be inferred + # from the association name. So has_and_belongs_to_many :projects will by default be linked to the + # Project class, but if the real class name is SuperProject, you'll have to specify it with this option. + # [+:join_table+] + # Specify the name of the join table if the default based on lexical order isn't what you want. + # WARNING: If you're overwriting the table name of either class, the +table_name+ method + # MUST be declared underneath any #has_and_belongs_to_many declaration in order to work. + # [+:foreign_key+] + # Specify the foreign key used for the association. By default this is guessed to be the name + # of this class in lower-case and "_id" suffixed. So a Person class that makes + # a #has_and_belongs_to_many association to Project will use "person_id" as the + # default :foreign_key. + # + # Setting the :foreign_key option prevents automatic detection of the association's + # inverse, so it is generally a good idea to set the :inverse_of option as well. + # [+:association_foreign_key+] + # Specify the foreign key used for the association on the receiving side of the association. + # By default this is guessed to be the name of the associated class in lower-case and "_id" suffixed. + # So if a Person class makes a #has_and_belongs_to_many association to Project, + # the association will use "project_id" as the default :association_foreign_key. + # [+:validate+] + # When set to +true+, validates new objects added to association when saving the parent object. +true+ by default. + # If you want to ensure associated objects are revalidated on every update, use +validates_associated+. + # [+:autosave+] + # If true, always save the associated objects or destroy them if marked for destruction, when + # saving the parent object. + # If false, never save or destroy the associated objects. + # By default, only save associated objects that are new records. + # + # Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for sets + # :autosave to true. + # [+:strict_loading+] + # Enforces strict loading every time an associated record is loaded through this association. + # [+:deprecated+] + # If true, marks the association as deprecated. Usage of deprecated associations is reported. + # Please, check the class documentation above for details. + # + # Option examples: + # has_and_belongs_to_many :projects + # has_and_belongs_to_many :projects, -> { includes(:milestones, :manager) } + # has_and_belongs_to_many :nations, class_name: "Country" + # has_and_belongs_to_many :categories, join_table: "prods_cats" + # has_and_belongs_to_many :categories, -> { readonly } + # has_and_belongs_to_many :categories, strict_loading: true + # + # pkg:gem/activerecord#lib/active_record/associations.rb:2008 + def has_and_belongs_to_many(name, scope = T.unsafe(nil), **options, &extension); end + + # Specifies a one-to-many association. The following methods for retrieval and query of + # collections of associated objects will be added: + # + # +collection+ is a placeholder for the symbol passed as the +name+ argument, so + # has_many :clients would add among others clients.empty?. + # + # [collection] + # Returns a Relation of all the associated objects. + # An empty Relation is returned if none are found. + # [collection<<(object, ...)] + # Adds one or more objects to the collection by setting their foreign keys to the collection's primary key. + # Note that this operation instantly fires update SQL without waiting for the save or update call on the + # parent object, unless the parent object is a new record. + # This will also run validations and callbacks of associated object(s). + # [collection.delete(object, ...)] + # Removes one or more objects from the collection by setting their foreign keys to +NULL+. + # Objects will be in addition destroyed if they're associated with dependent: :destroy, + # and deleted if they're associated with dependent: :delete_all. + # + # If the :through option is used, then the join records are deleted (rather than + # nullified) by default, but you can specify dependent: :destroy or + # dependent: :nullify to override this. + # [collection.destroy(object, ...)] + # Removes one or more objects from the collection by running destroy on + # each record, regardless of any dependent option, ensuring callbacks are run. + # + # If the :through option is used, then the join records are destroyed + # instead, not the objects themselves. + # [collection=objects] + # Replaces the collections content by deleting and adding objects as appropriate. If the :through + # option is true callbacks in the join models are triggered except destroy callbacks, since deletion is + # direct by default. You can specify dependent: :destroy or + # dependent: :nullify to override this. + # [collection_singular_ids] + # Returns an array of the associated objects' ids + # [collection_singular_ids=ids] + # Replace the collection with the objects identified by the primary keys in +ids+. This + # method loads the models and calls collection=. See above. + # [collection.clear] + # Removes every object from the collection. This destroys the associated objects if they + # are associated with dependent: :destroy, deletes them directly from the + # database if dependent: :delete_all, otherwise sets their foreign keys to +NULL+. + # If the :through option is true no destroy callbacks are invoked on the join models. + # Join models are directly deleted. + # [collection.empty?] + # Returns +true+ if there are no associated objects. + # [collection.size] + # Returns the number of associated objects. + # [collection.find(...)] + # Finds an associated object according to the same rules as ActiveRecord::FinderMethods#find. + # [collection.exists?(...)] + # Checks whether an associated object with the given conditions exists. + # Uses the same rules as ActiveRecord::FinderMethods#exists?. + # [collection.build(attributes = {}, ...)] + # Returns one or more new objects of the collection type that have been instantiated + # with +attributes+ and linked to this object through a foreign key, but have not yet + # been saved. + # [collection.create(attributes = {})] + # Returns a new object of the collection type that has been instantiated + # with +attributes+, linked to this object through a foreign key, and that has already + # been saved (if it passed the validation). *Note*: This only works if the base model + # already exists in the DB, not if it is a new (unsaved) record! + # [collection.create!(attributes = {})] + # Does the same as collection.create, but raises ActiveRecord::RecordInvalid + # if the record is invalid. + # [collection.reload] + # Returns a Relation of all of the associated objects, forcing a database read. + # An empty Relation is returned if none are found. + # + # ==== Example + # + # class Firm < ActiveRecord::Base + # has_many :clients + # end + # + # Declaring has_many :clients adds the following methods (and more): + # + # firm = Firm.find(2) + # client = Client.find(6) + # + # firm.clients # similar to Client.where(firm_id: 2) + # firm.clients << client + # firm.clients.delete(client) + # firm.clients.destroy(client) + # firm.clients = [client] + # firm.client_ids + # firm.client_ids = [6] + # firm.clients.clear + # firm.clients.empty? # similar to firm.clients.size == 0 + # firm.clients.size # similar to Client.count "firm_id = 2" + # firm.clients.find # similar to Client.where(firm_id: 2).find(6) + # firm.clients.exists?(name: 'ACME') # similar to Client.exists?(name: 'ACME', firm_id: 2) + # firm.clients.build # similar to Client.new(firm_id: 2) + # firm.clients.create # similar to Client.create(firm_id: 2) + # firm.clients.create! # similar to Client.create!(firm_id: 2) + # firm.clients.reload + # + # The declaration can also include an +options+ hash to specialize the behavior of the association. + # + # ==== Scopes + # + # You can pass a second argument +scope+ as a callable (i.e. proc or + # lambda) to retrieve a specific set of records or customize the generated + # query when you access the associated collection. + # + # Scope examples: + # has_many :comments, -> { where(author_id: 1) } + # has_many :employees, -> { joins(:address) } + # has_many :posts, ->(blog) { where("max_post_length > ?", blog.max_post_length) } + # + # ==== Extensions + # + # The +extension+ argument allows you to pass a block into a has_many + # association. This is useful for adding new finders, creators, and other + # factory-type methods to be used as part of the association. + # + # Extension examples: + # has_many :employees do + # def find_or_create_by_name(name) + # first_name, last_name = name.split(" ", 2) + # find_or_create_by(first_name: first_name, last_name: last_name) + # end + # end + # + # ==== Options + # [+:class_name+] + # Specify the class name of the association. Use it only if that name can't be inferred + # from the association name. So has_many :products will by default be linked + # to the +Product+ class, but if the real class name is +SpecialProduct+, you'll have to + # specify it with this option. + # [+:foreign_key+] + # Specify the foreign key used for the association. By default this is guessed to be the name + # of this class in lower-case and "_id" suffixed. So a Person class that makes a #has_many + # association will use "person_id" as the default :foreign_key. + # + # Setting the :foreign_key option prevents automatic detection of the association's + # inverse, so it is generally a good idea to set the :inverse_of option as well. + # [+:foreign_type+] + # Specify the column used to store the associated object's type, if this is a polymorphic + # association. By default this is guessed to be the name of the polymorphic association + # specified on "as" option with a "_type" suffix. So a class that defines a + # has_many :tags, as: :taggable association will use "taggable_type" as the + # default :foreign_type. + # [+:primary_key+] + # Specify the name of the column to use as the primary key for the association. By default this is +id+. + # [+:dependent+] + # Controls what happens to the associated objects when + # their owner is destroyed. Note that these are implemented as + # callbacks, and \Rails executes callbacks in order. Therefore, other + # similar callbacks may affect the :dependent behavior, and the + # :dependent behavior may affect other callbacks. + # + # * nil do nothing (default). + # * :destroy causes all the associated objects to also be destroyed. + # * :destroy_async destroys all the associated objects in a background job. WARNING: Do not use + # this option if the association is backed by foreign key constraints in your database. The foreign key + # constraint actions will occur inside the same transaction that deletes its owner. + # * :delete_all causes all the associated objects to be deleted directly from the database (so callbacks will not be executed). + # * :nullify causes the foreign keys to be set to +NULL+. Polymorphic type will also be nullified + # on polymorphic associations. Callbacks are not executed. + # * :restrict_with_exception causes an ActiveRecord::DeleteRestrictionError exception to be raised if there are any associated records. + # * :restrict_with_error causes an error to be added to the owner if there are any associated objects. + # + # If using with the :through option, the association on the join model must be + # a #belongs_to, and the records which get deleted are the join records, rather than + # the associated records. + # + # If using dependent: :destroy on a scoped association, only the scoped objects are destroyed. + # For example, if a Post model defines + # has_many :comments, -> { where published: true }, dependent: :destroy and destroy is + # called on a post, only published comments are destroyed. This means that any unpublished comments in the + # database would still contain a foreign key pointing to the now deleted post. + # [+:counter_cache+] + # This option can be used to configure a custom named :counter_cache. You only need this option, + # when you customized the name of your :counter_cache on the #belongs_to association. + # [+:as+] + # Specifies a polymorphic interface (See #belongs_to). + # [+:through+] + # Specifies an association through which to perform the query. + # + # This can be any other type of association, including other :through associations, + # but it cannot be a polymorphic association. Options for :class_name, + # :primary_key and :foreign_key are ignored, as the association uses the + # source reflection. + # + # If the association on the join model is a #belongs_to, the collection can be modified + # and the records on the :through model will be automatically created and removed + # as appropriate. Otherwise, the collection is read-only, so you should manipulate the + # :through association directly. + # + # If you are going to modify the association (rather than just read from it), then it is + # a good idea to set the :inverse_of option on the source association on the + # join model. This allows associated records to be built which will automatically create + # the appropriate join model records when they are saved. See + # {Association Join Models}[rdoc-ref:Associations::ClassMethods@Association+Join+Models] + # and {Setting Inverses}[rdoc-ref:Associations::ClassMethods@Setting+Inverses] for + # more detail. + # + # [+:disable_joins+] + # Specifies whether joins should be skipped for an association. If set to true, two or more queries + # will be generated. Note that in some cases, if order or limit is applied, it will be done in-memory + # due to database limitations. This option is only applicable on has_many :through associations as + # +has_many+ alone do not perform a join. + # [+:source+] + # Specifies the source association name used by #has_many :through queries. + # Only use it if the name cannot be inferred from the association. + # has_many :subscribers, through: :subscriptions will look for either :subscribers or + # :subscriber on Subscription, unless a :source is given. + # [+:source_type+] + # Specifies type of the source association used by #has_many :through queries where the source + # association is a polymorphic #belongs_to. + # [+:validate+] + # When set to +true+, validates new objects added to association when saving the parent object. +true+ by default. + # If you want to ensure associated objects are revalidated on every update, use +validates_associated+. + # [+:autosave+] + # If true, always save the associated objects or destroy them if marked for destruction, + # when saving the parent object. If false, never save or destroy the associated objects. + # By default, only save associated objects that are new records. This option is implemented as a + # +before_save+ callback. Because callbacks are run in the order they are defined, associated objects + # may need to be explicitly saved in any user-defined +before_save+ callbacks. + # + # Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for sets + # :autosave to true. + # [+:inverse_of+] + # Specifies the name of the #belongs_to association on the associated object + # that is the inverse of this #has_many association. + # See {Bi-directional associations}[rdoc-ref:Associations::ClassMethods@Bi-directional+associations] + # for more detail. + # [+:extend+] + # Specifies a module or array of modules that will be extended into the association object returned. + # Useful for defining methods on associations, especially when they should be shared between multiple + # association objects. + # [+:strict_loading+] + # When set to +true+, enforces strict loading every time the associated record is loaded through this + # association. + # [+:ensuring_owner_was+] + # Specifies an instance method to be called on the owner. The method must return true in order for the + # associated records to be deleted in a background job. + # [+:query_constraints+] + # Serves as a composite foreign key. Defines the list of columns to be used to query the associated object. + # This is an optional option. By default Rails will attempt to derive the value automatically. + # When the value is set the Array size must match associated model's primary key or +query_constraints+ size. + # [+:index_errors+] + # Allows differentiation of multiple validation errors from the association records, by including + # an index in the error attribute name, e.g. +roles[2].level+. + # When set to +true+, the index is based on association order, i.e. database order, with yet to be + # persisted new records placed at the end. + # When set to +:nested_attributes_order+, the index is based on the record order received by + # nested attributes setter, when accepts_nested_attributes_for is used. + # [:before_add] + # Defines an {association callback}[rdoc-ref:Associations::ClassMethods@Association+callbacks] that gets triggered before an object is added to the association collection. + # [:after_add] + # Defines an {association callback}[rdoc-ref:Associations::ClassMethods@Association+callbacks] that gets triggered after an object is added to the association collection. + # [:before_remove] + # Defines an {association callback}[rdoc-ref:Associations::ClassMethods@Association+callbacks] that gets triggered before an object is removed from the association collection. + # [:after_remove] + # Defines an {association callback}[rdoc-ref:Associations::ClassMethods@Association+callbacks] that gets triggered after an object is removed from the association collection. + # [+:deprecated+] + # If true, marks the association as deprecated. Usage of deprecated associations is reported. + # Please, check the class documentation above for details. + # + # Option examples: + # has_many :comments, -> { order("posted_on") } + # has_many :comments, -> { includes(:author) } + # has_many :people, -> { where(deleted: false).order("name") }, class_name: "Person" + # has_many :tracks, -> { order("position") }, dependent: :destroy + # has_many :comments, dependent: :nullify + # has_many :tags, as: :taggable + # has_many :reports, -> { readonly } + # has_many :subscribers, through: :subscriptions, source: :user + # has_many :subscribers, through: :subscriptions, disable_joins: true + # has_many :comments, strict_loading: true + # has_many :comments, query_constraints: [:blog_id, :post_id] + # has_many :comments, index_errors: :nested_attributes_order + # + # pkg:gem/activerecord#lib/active_record/associations.rb:1427 + def has_many(name, scope = T.unsafe(nil), **options, &extension); end + + # Specifies a one-to-one association with another class. This method + # should only be used if the other class contains the foreign key. If + # the current class contains the foreign key, then you should use + # #belongs_to instead. See {Is it a belongs_to or has_one + # association?}[rdoc-ref:Associations::ClassMethods@Is+it+a+-23belongs_to+or+-23has_one+association-3F] + # for more detail on when to use #has_one and when to use #belongs_to. + # + # The following methods for retrieval and query of a single associated object will be added: + # + # +association+ is a placeholder for the symbol passed as the +name+ argument, so + # has_one :manager would add among others manager.nil?. + # + # [association] + # Returns the associated object. +nil+ is returned if none is found. + # [association=(associate)] + # Assigns the associate object, extracts the primary key, sets it as the foreign key, + # and saves the associate object. To avoid database inconsistencies, permanently deletes an existing + # associated object when assigning a new one, even if the new one isn't saved to database. + # [build_association(attributes = {})] + # Returns a new object of the associated type that has been instantiated + # with +attributes+ and linked to this object through a foreign key, but has not + # yet been saved. + # [create_association(attributes = {})] + # Returns a new object of the associated type that has been instantiated + # with +attributes+, linked to this object through a foreign key, and that + # has already been saved (if it passed the validation). + # [create_association!(attributes = {})] + # Does the same as create_association, but raises ActiveRecord::RecordInvalid + # if the record is invalid. + # [reload_association] + # Returns the associated object, forcing a database read. + # [reset_association] + # Unloads the associated object. The next access will query it from the database. + # + # ==== Example + # + # class Account < ActiveRecord::Base + # has_one :beneficiary + # end + # + # Declaring has_one :beneficiary adds the following methods (and more): + # + # account = Account.find(5) + # beneficiary = Beneficiary.find(8) + # + # account.beneficiary # similar to Beneficiary.find_by(account_id: 5) + # account.beneficiary = beneficiary # similar to beneficiary.update(account_id: 5) + # account.build_beneficiary # similar to Beneficiary.new(account_id: 5) + # account.create_beneficiary # similar to Beneficiary.create(account_id: 5) + # account.create_beneficiary! # similar to Beneficiary.create!(account_id: 5) + # account.reload_beneficiary + # account.reset_beneficiary + # + # ==== Scopes + # + # You can pass a second argument +scope+ as a callable (i.e. proc or + # lambda) to retrieve a specific record or customize the generated query + # when you access the associated object. + # + # Scope examples: + # has_one :author, -> { where(comment_id: 1) } + # has_one :employer, -> { joins(:company) } + # has_one :latest_post, ->(blog) { where("created_at > ?", blog.enabled_at) } + # + # ==== Options + # + # The declaration can also include an +options+ hash to specialize the behavior of the association. + # + # Options are: + # [+:class_name+] + # Specify the class name of the association. Use it only if that name can't be inferred + # from the association name. So has_one :manager will by default be linked to the Manager class, but + # if the real class name is Person, you'll have to specify it with this option. + # [+:dependent+] + # Controls what happens to the associated object when + # its owner is destroyed: + # + # * nil do nothing (default). + # * :destroy causes the associated object to also be destroyed + # * :destroy_async causes the associated object to be destroyed in a background job. WARNING: Do not use + # this option if the association is backed by foreign key constraints in your database. The foreign key + # constraint actions will occur inside the same transaction that deletes its owner. + # * :delete causes the associated object to be deleted directly from the database (so callbacks will not execute) + # * :nullify causes the foreign key to be set to +NULL+. Polymorphic type column is also nullified + # on polymorphic associations. Callbacks are not executed. + # * :restrict_with_exception causes an ActiveRecord::DeleteRestrictionError exception to be raised if there is an associated record + # * :restrict_with_error causes an error to be added to the owner if there is an associated object + # + # Note that :dependent option is ignored when using :through option. + # [+:foreign_key+] + # Specify the foreign key used for the association. By default this is guessed to be the name + # of this class in lower-case and "_id" suffixed. So a Person class that makes a #has_one association + # will use "person_id" as the default :foreign_key. + # + # Setting the :foreign_key option prevents automatic detection of the association's + # inverse, so it is generally a good idea to set the :inverse_of option as well. + # [+:foreign_type+] + # Specify the column used to store the associated object's type, if this is a polymorphic + # association. By default this is guessed to be the name of the polymorphic association + # specified on "as" option with a "_type" suffix. So a class that defines a + # has_one :tag, as: :taggable association will use "taggable_type" as the + # default :foreign_type. + # [+:primary_key+] + # Specify the method that returns the primary key used for the association. By default this is +id+. + # [+:as+] + # Specifies a polymorphic interface (See #belongs_to). + # [+:through+] + # Specifies an association through which to perform the query. + # + # The through association must be a +has_one+, has_one :through, or non-polymorphic +belongs_to+. + # That is, a non-polymorphic singular association. Options for :class_name, :primary_key, + # and :foreign_key are ignored, as the association uses the source reflection. You can only + # use a :through query through a #has_one or #belongs_to association on the join model. + # + # If the association on the join model is a #belongs_to, the collection can be modified + # and the records on the :through model will be automatically created and removed + # as appropriate. Otherwise, the collection is read-only, so you should manipulate the + # :through association directly. + # + # If you are going to modify the association (rather than just read from it), then it is + # a good idea to set the :inverse_of option on the source association on the + # join model. This allows associated records to be built which will automatically create + # the appropriate join model records when they are saved. See + # {Association Join Models}[rdoc-ref:Associations::ClassMethods@Association+Join+Models] + # and {Setting Inverses}[rdoc-ref:Associations::ClassMethods@Setting+Inverses] for + # more detail. + # [+:disable_joins+] + # Specifies whether joins should be skipped for an association. If set to true, two or more queries + # will be generated. Note that in some cases, if order or limit is applied, it will be done in-memory + # due to database limitations. This option is only applicable on has_one :through associations as + # +has_one+ alone does not perform a join. + # [+:source+] + # Specifies the source association name used by #has_one :through queries. + # Only use it if the name cannot be inferred from the association. + # has_one :favorite, through: :favorites will look for a + # :favorite on Favorite, unless a :source is given. + # [+:source_type+] + # Specifies type of the source association used by #has_one :through queries where the source + # association is a polymorphic #belongs_to. + # [+:validate+] + # When set to +true+, validates new objects added to association when saving the parent object. +false+ by default. + # If you want to ensure associated objects are revalidated on every update, use +validates_associated+. + # [+:autosave+] + # If +true+, always saves the associated object or destroys it if marked for destruction, + # when saving the parent object. + # If +false+, never save or destroy the associated object. + # + # By default, only saves the associated object if it's a new record. Setting this option + # to +true+ also enables validations on the associated object unless explicitly disabled + # with validate: false. This is because saving an object with invalid associated + # objects would fail, so any associated objects will go through validation checks. + # + # Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for sets + # :autosave to true. + # [+:touch+] + # If true, the associated object will be touched (the +updated_at+ / +updated_on+ attributes set to current time) + # when this record is either saved or destroyed. If you specify a symbol, that attribute + # will be updated with the current time in addition to the +updated_at+ / +updated_on+ attribute. + # Please note that no validation will be performed when touching, and only the +after_touch+, + # +after_commit+, and +after_rollback+ callbacks will be executed. + # [+:inverse_of+] + # Specifies the name of the #belongs_to association on the associated object + # that is the inverse of this #has_one association. + # See {Bi-directional associations}[rdoc-ref:Associations::ClassMethods@Bi-directional+associations] + # for more detail. + # [+:required+] + # When set to +true+, the association will also have its presence validated. + # This will validate the association itself, not the id. You can use + # +:inverse_of+ to avoid an extra query during validation. + # [+:strict_loading+] + # Enforces strict loading every time the associated record is loaded through this association. + # [+:ensuring_owner_was+] + # Specifies an instance method to be called on the owner. The method must return true in order for the + # associated records to be deleted in a background job. + # [+:query_constraints+] + # Serves as a composite foreign key. Defines the list of columns to be used to query the associated object. + # This is an optional option. By default Rails will attempt to derive the value automatically. + # When the value is set the Array size must match associated model's primary key or +query_constraints+ size. + # [+:deprecated+] + # If true, marks the association as deprecated. Usage of deprecated associations is reported. + # Please, check the class documentation above for details. + # + # Option examples: + # has_one :credit_card, dependent: :destroy # destroys the associated credit card + # has_one :credit_card, dependent: :nullify # updates the associated records foreign + # # key value to NULL rather than destroying it + # has_one :last_comment, -> { order('posted_on desc') }, class_name: "Comment" + # has_one :project_manager, -> { where(role: 'project_manager') }, class_name: "Person" + # has_one :attachment, as: :attachable + # has_one :boss, -> { readonly } + # has_one :club, through: :membership + # has_one :club, through: :membership, disable_joins: true + # has_one :primary_address, -> { where(primary: true) }, through: :addressables, source: :addressable + # has_one :credit_card, required: true + # has_one :credit_card, strict_loading: true + # has_one :employment_record_book, query_constraints: [:organization_id, :employee_id] + # + # pkg:gem/activerecord#lib/active_record/associations.rb:1628 + def has_one(name, scope = T.unsafe(nil), **options); end +end + +# = Active Record Association Collection +# +# CollectionAssociation is an abstract class that provides common stuff to +# ease the implementation of association proxies that represent +# collections. See the class hierarchy in Association. +# +# CollectionAssociation: +# HasManyAssociation => has_many +# HasManyThroughAssociation + ThroughAssociation => has_many :through +# +# The CollectionAssociation class provides common methods to the collections +# defined by +has_and_belongs_to_many+, +has_many+ or +has_many+ with +# the :through association option. +# +# You need to be careful with assumptions regarding the target: The proxy +# does not fetch records from the database until it needs them, but new +# ones created with +build+ are added to the target. So, the target may be +# non-empty and still lack children waiting to be read from the database. +# If you look directly to the database you cannot assume that's the entire +# collection because new records may have been added to the target, etc. +# +# If you need to work on all current children, new and existing records, +# +load_target+ and the +loaded+ flag are your friends. +# +# pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:30 +class ActiveRecord::Associations::CollectionAssociation < ::ActiveRecord::Associations::Association + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:285 + def add_to_target(record, skip_callbacks: T.unsafe(nil), replace: T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:121 + def build(attributes = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:320 + def collection?; end + + # Add +records+ to this association. Since +<<+ flattens its argument list + # and inserts each record, +push+ and +concat+ behave identically. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:131 + def concat(*records); end + + # Removes +records+ from this association calling +before_remove+ and + # +after_remove+ callbacks. + # + # This method is abstract in the sense that +delete_records+ has to be + # provided by descendants. Note this method does not imply the records + # are actually removed from the database, that depends precisely on + # +delete_records+. They are in any case removed from the collection. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:190 + def delete(*records); end + + # Removes all records from the association without calling callbacks + # on the associated records. It honors the +:dependent+ option. However + # if the +:dependent+ value is +:destroy+ then in that case the +:delete_all+ + # deletion strategy for the association is applied. + # + # You can force a particular deletion strategy by passing a parameter. + # + # Example: + # + # @author.books.delete_all(:nullify) + # @author.books.delete_all(:delete_all) + # + # See delete for more info. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:154 + def delete_all(dependent = T.unsafe(nil)); end + + # Deletes the +records+ and removes them from this association calling + # +before_remove+, +after_remove+, +before_destroy+ and +after_destroy+ callbacks. + # + # Note that this method removes records from the database ignoring the + # +:dependent+ option. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:199 + def destroy(*records); end + + # Destroy all the records from this association. + # + # See destroy for more info. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:176 + def destroy_all; end + + # Returns true if the collection is empty. + # + # If the collection has been loaded + # it is equivalent to collection.size.zero?. If the + # collection has not been loaded, it is equivalent to + # !collection.exists?. If the collection has not already been + # loaded and you are going to fetch the records anyway it is better to + # check collection.length.zero?. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:236 + def empty?; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:98 + def find(*args); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:312 + def find_from_target?; end + + # Implements the ids reader method, e.g. foo.item_ids for Foo.has_many :items + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:51 + def ids_reader; end + + # Implements the ids writer method, e.g. foo.item_ids= for Foo.has_many :items + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:62 + def ids_writer(ids); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:262 + def include?(record); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:276 + def load_target; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:31 + def nested_attributes_target; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:31 + def nested_attributes_target=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:308 + def null_scope?; end + + # Implements the reader method, e.g. foo.items for Foo.has_many :items + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:34 + def reader; end + + # Replace this collection with +other_array+. This will perform a diff + # and delete/add only records that have changed. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:246 + def replace(other_array); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:91 + def reset; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:302 + def scope; end + + # Returns the size of the collection by executing a SELECT COUNT(*) + # query if the collection hasn't been loaded, and calling + # collection.size if it has. + # + # If the collection has been already loaded +size+ and +length+ are + # equivalent. If not and you are going to need the records anyway + # +length+ will take one less query. Otherwise +size+ is more efficient. + # + # This method is abstract in the sense that it relies on + # +count_records+, which is a method descendants have to provide. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:213 + def size; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:289 + def target=(record); end + + # Implements the writer method, e.g. foo.items= for Foo.has_many :items + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:46 + def writer(records); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:358 + def _create_record(attributes, raise = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:496 + def callback(method, record); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:502 + def callbacks_for(callback_name); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:442 + def concat_records(records, raise = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:389 + def delete_or_destroy(records, method); end + + # Delete the given records from the association, + # using one of the methods +:destroy+, +:delete_all+ + # or +:nullify+ (or +nil+, in which case a default is used). + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:418 + def delete_records(records, method); end + + # If the :inverse_of option has been + # specified, then #find scans the entire collection. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:525 + def find_by_scan(*args); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:511 + def include_in_memory?(record); end + + # Do the relevant stuff to insert the given record into the association collection. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:381 + def insert_record(record, validate = T.unsafe(nil), raise = T.unsafe(nil), &block); end + + # We have some records loaded from the database (persisted) and some that are + # in-memory (memory). The same record may be represented in the persisted array + # and in the memory array. + # + # So the task of this method is to merge them according to the following rules: + # + # * The final array must not have duplicates + # * The order of the persisted array is to be preserved + # * Any changes made to attributes on objects in the memory array are to be preserved + # * Otherwise, attributes should have the value found in the database + # + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:339 + def merge_target_lists(persisted, memory); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:403 + def remove_records(existing_records, records, method); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:434 + def replace_common_records_in_memory(new_target, original_target); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:461 + def replace_on_target(record, skip_callbacks, replace:, inversing: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:422 + def replace_records(new_target, original_target); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_association.rb:325 + def transaction(&block); end +end + +# = Active Record Collection Proxy +# +# Collection proxies in Active Record are middlemen between an +# association, and its target result set. +# +# For example, given +# +# class Blog < ActiveRecord::Base +# has_many :posts +# end +# +# blog = Blog.first +# +# The collection proxy returned by blog.posts is built from a +# :has_many association, and delegates to a collection +# of posts as the target. +# +# This class delegates unknown methods to the association's +# relation class via a delegate cache. +# +# The target result set is not loaded until needed. For example, +# +# blog.posts.count +# +# is computed directly through SQL and does not trigger by itself the +# instantiation of the actual post records. +# +# pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:31 +class ActiveRecord::Associations::CollectionProxy < ::ActiveRecord::Relation + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:32 + def initialize(klass, association, **); end + + # Adds one or more +records+ to the collection by setting their foreign keys + # to the association's primary key. Since << flattens its argument list and + # inserts each record, +push+ and +concat+ behave identically. Returns +self+ + # so several appends may be chained together. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets.size # => 0 + # person.pets << Pet.new(name: 'Fancy-Fancy') + # person.pets << [Pet.new(name: 'Spook'), Pet.new(name: 'Choo-Choo')] + # person.pets.size # => 3 + # + # person.id # => 1 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1053 + def <<(*records); end + + # Equivalent to Array#==. Returns +true+ if the two arrays + # contain the same number of elements and if each element is equal + # to the corresponding element in the +other+ array, otherwise returns + # +false+. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets + # # => [ + # # #, + # # # + # # ] + # + # other = person.pets.to_ary + # + # person.pets == other + # # => true + # + # + # Note that unpersisted records can still be seen as equal: + # + # other = [Pet.new(id: 1), Pet.new(id: 2)] + # + # person.pets == other + # # => true + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:984 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def _select!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def and(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def and!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def annotate(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def annotate!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def annotate_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def annotate_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1057 + def append(*records); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def arel(*, **, &); end + + # Returns a new object of the collection type that has been instantiated + # with +attributes+ and linked to this object, but have not yet been saved. + # You can pass an array of attributes hashes, this will return an array + # with the new objects. + # + # class Person + # has_many :pets + # end + # + # person.pets.build + # # => # + # + # person.pets.build(name: 'Fancy-Fancy') + # # => # + # + # person.pets.build([{name: 'Spook'}, {name: 'Choo-Choo'}, {name: 'Brain'}]) + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.size # => 5 # size of the collection + # person.pets.count # => 0 # count from database + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:318 + def build(attributes = T.unsafe(nil), &block); end + + # -- + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:724 + def calculate(operation, column_name); end + + # Equivalent to +delete_all+. The difference is that returns +self+, instead + # of an array with the deleted objects, so methods can be chained. See + # +delete_all+ for more information. + # Note that because +delete_all+ removes records by directly + # running an SQL query into the database, the +updated_at+ column of + # the object is not changed. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1070 + def clear; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1058 + def concat(*records); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def construct_join_dependency(*, **, &); end + + # Returns a new object of the collection type that has been instantiated with + # attributes, linked to this object and that has already been saved (if it + # passes the validations). + # + # class Person + # has_many :pets + # end + # + # person.pets.create(name: 'Fancy-Fancy') + # # => # + # + # person.pets.create([{name: 'Spook'}, {name: 'Choo-Choo'}]) + # # => [ + # # #, + # # # + # # ] + # + # person.pets.size # => 3 + # person.pets.count # => 3 + # + # person.pets.find(1, 2, 3) + # # => [ + # # #, + # # #, + # # # + # # ] + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:349 + def create(attributes = T.unsafe(nil), &block); end + + # Like #create, except that if the record is invalid, raises an exception. + # + # class Person + # has_many :pets + # end + # + # class Pet + # validates :name, presence: true + # end + # + # person.pets.create!(name: nil) + # # => ActiveRecord::RecordInvalid: Validation failed: Name can't be blank + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:365 + def create!(attributes = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def create_with(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def create_with!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def create_with_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def create_with_value=(arg); end + + # Deletes the +records+ supplied from the collection according to the strategy + # specified by the +:dependent+ option. If no +:dependent+ option is given, + # then it will follow the default strategy. Returns an array with the + # deleted records. + # + # For has_many :through associations, the default deletion strategy is + # +:delete_all+. + # + # For +has_many+ associations, the default deletion strategy is +:nullify+. + # This sets the foreign keys to +NULL+. + # + # class Person < ActiveRecord::Base + # has_many :pets # dependent: :nullify option by default + # end + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.delete(Pet.find(1)) + # # => [#] + # + # person.pets.size # => 2 + # person.pets + # # => [ + # # #, + # # # + # # ] + # + # Pet.find(1) + # # => # + # + # If it is set to :destroy all the +records+ are removed by calling + # their +destroy+ method. See +destroy+ for more information. + # + # class Person < ActiveRecord::Base + # has_many :pets, dependent: :destroy + # end + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.delete(Pet.find(1), Pet.find(3)) + # # => [ + # # #, + # # # + # # ] + # + # person.pets.size # => 1 + # person.pets + # # => [#] + # + # Pet.find(1, 3) + # # => ActiveRecord::RecordNotFound: Couldn't find all Pets with 'id': (1, 3) + # + # If it is set to :delete_all, all the +records+ are deleted + # *without* calling their +destroy+ method. + # + # class Person < ActiveRecord::Base + # has_many :pets, dependent: :delete_all + # end + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.delete(Pet.find(1)) + # # => [#] + # + # person.pets.size # => 2 + # person.pets + # # => [ + # # #, + # # # + # # ] + # + # Pet.find(1) + # # => ActiveRecord::RecordNotFound: Couldn't find Pet with 'id'=1 + # + # You can pass +Integer+ or +String+ values, it finds the records + # responding to the +id+ and executes delete on them. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.delete("1") + # # => [#] + # + # person.pets.delete(2, 3) + # # => [ + # # #, + # # # + # # ] + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:620 + def delete(*records); end + + # Deletes all the records from the collection according to the strategy + # specified by the +:dependent+ option. If no +:dependent+ option is given, + # then it will follow the default strategy. + # + # For has_many :through associations, the default deletion strategy is + # +:delete_all+. + # + # For +has_many+ associations, the default deletion strategy is +:nullify+. + # This sets the foreign keys to +NULL+. + # + # class Person < ActiveRecord::Base + # has_many :pets # dependent: :nullify option by default + # end + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.delete_all + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.size # => 0 + # person.pets # => [] + # + # Pet.find(1, 2, 3) + # # => [ + # # #, + # # #, + # # # + # # ] + # + # Both +has_many+ and has_many :through dependencies default to the + # +:delete_all+ strategy if the +:dependent+ option is set to +:destroy+. + # Records are not instantiated and callbacks will not be fired. + # + # class Person < ActiveRecord::Base + # has_many :pets, dependent: :destroy + # end + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.delete_all + # + # Pet.find(1, 2, 3) + # # => ActiveRecord::RecordNotFound: Couldn't find all Pets with 'id': (1, 2, 3) + # + # If it is set to :delete_all, all the objects are deleted + # *without* calling their +destroy+ method. + # + # class Person < ActiveRecord::Base + # has_many :pets, dependent: :delete_all + # end + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.delete_all + # + # Pet.find(1, 2, 3) + # # => ActiveRecord::RecordNotFound: Couldn't find all Pets with 'id': (1, 2, 3) + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:474 + def delete_all(dependent = T.unsafe(nil)); end + + # Destroys the +records+ supplied and removes them from the collection. + # This method will _always_ remove record from the database ignoring + # the +:dependent+ option. Returns an array with the removed records. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.destroy(Pet.find(1)) + # # => [#] + # + # person.pets.size # => 2 + # person.pets + # # => [ + # # #, + # # # + # # ] + # + # person.pets.destroy(Pet.find(2), Pet.find(3)) + # # => [ + # # #, + # # # + # # ] + # + # person.pets.size # => 0 + # person.pets # => [] + # + # Pet.find(1, 2, 3) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with 'id': (1, 2, 3) + # + # You can pass +Integer+ or +String+ values, it finds the records + # responding to the +id+ and then deletes them from the database. + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.destroy("4") + # # => # + # + # person.pets.size # => 2 + # person.pets + # # => [ + # # #, + # # # + # # ] + # + # person.pets.destroy(5, 6) + # # => [ + # # #, + # # # + # # ] + # + # person.pets.size # => 0 + # person.pets # => [] + # + # Pet.find(4, 5, 6) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with 'id': (4, 5, 6) + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:692 + def destroy(*records); end + + # Deletes the records of the collection directly from the database + # ignoring the +:dependent+ option. Records are instantiated and it + # invokes +before_remove+, +after_remove+, +before_destroy+, and + # +after_destroy+ callbacks. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets.size # => 3 + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.destroy_all + # + # person.pets.size # => 0 + # person.pets # => [] + # + # Pet.find(1) # => Couldn't find Pet with id=1 + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:501 + def destroy_all; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def distinct(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def distinct!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def distinct_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def distinct_value=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def eager_load(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def eager_load!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def eager_load_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def eager_load_values=(arg); end + + # Returns +true+ if the collection is empty. If the collection has been + # loaded it is equivalent + # to collection.size.zero?. If the collection has not been loaded, + # it is equivalent to !collection.exists?. If the collection has + # not already been loaded and you are going to fetch the records anyway it + # is better to check collection.load.empty?. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets.count # => 1 + # person.pets.empty? # => false + # + # person.pets.delete_all + # + # person.pets.count # => 0 + # person.pets.empty? # => true + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:835 + def empty?; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def except(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def excluding(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def excluding!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def extending(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def extending!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def extending_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def extending_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def extensions(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def extract_associated(*, **, &); end + + # Finds an object in the collection responding to the +id+. Uses the same + # rules as ActiveRecord::FinderMethods.find. Raises ActiveRecord::RecordNotFound + # error if the object cannot be found. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.find(1) # => # + # person.pets.find(4) # => ActiveRecord::RecordNotFound: Couldn't find Pet with 'id'=4 + # + # person.pets.find(2) { |pet| pet.name.downcase! } + # # => # + # + # person.pets.find(2, 3) + # # => [ + # # #, + # # # + # # ] + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:138 + def find(*args); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def from(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def from!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def from_clause(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def from_clause=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def group(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def group!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def group_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def group_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def having(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def having!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def having_clause(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def having_clause=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def in_order_of(*, **, &); end + + # Returns +true+ if the given +record+ is present in the collection. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets # => [#] + # + # person.pets.include?(Pet.find(20)) # => true + # person.pets.include?(Pet.find(21)) # => false + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:931 + def include?(record); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def includes(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def includes!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def includes_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def includes_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1133 + def insert(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1133 + def insert!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1133 + def insert_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1133 + def insert_all!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1122 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def invert_where(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def invert_where!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def joins(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def joins!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def joins_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def joins_values=(arg); end + + # Returns the last record, or the last +n+ records, from the collection. + # If the collection is empty, the first form returns +nil+, and the second + # form returns an empty array. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.last # => # + # + # person.pets.last(2) + # # => [ + # # #, + # # # + # # ] + # + # another_person_without.pets # => [] + # another_person_without.pets.last # => nil + # another_person_without.pets.last(3) # => [] + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:259 + def last(limit = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def left_joins(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def left_outer_joins(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def left_outer_joins!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def left_outer_joins_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def left_outer_joins_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def limit(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def limit!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def limit_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def limit_value=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def load_async(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:44 + def load_target; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:56 + def loaded; end + + # Returns +true+ if the association has been loaded, otherwise +false+. + # + # person.pets.loaded? # => false + # person.pets.records + # person.pets.loaded? # => true + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:53 + def loaded?; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def lock(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def lock!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def lock_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def lock_value=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def merge(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def merge!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:321 + def new(attributes = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def none(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def none!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def null_relation?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def offset(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def offset!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def offset_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def offset_value=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def only(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def optimizer_hints(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def optimizer_hints!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def optimizer_hints_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def optimizer_hints_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def or(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def or!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def order(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def order!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def order_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def order_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:728 + def pluck(*column_names); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def preload(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def preload!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def preload_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def preload_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1060 + def prepend(*args); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1127 + def pretty_print(pp); end + + # Returns the association object for the collection. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets.proxy_association + # # => # + # + # Returns the same object as person.association(:pets), + # allowing you to make calls like person.pets.proxy_association.owner. + # + # See Associations::ClassMethods@Association+extensions for more. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:948 + def proxy_association; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1056 + def push(*records); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def readonly(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def readonly!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def readonly_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def readonly_value=(arg); end + + # :method: to_ary + # + # :call-seq: + # to_ary() + # + # Returns a new array of objects from the collection. If the collection + # hasn't been loaded, it fetches the records from the database. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # other_pets = person.pets.to_ary + # # => [ + # # #, + # # #, + # # # + # # ] + # + # other_pets.replace([Pet.new(name: 'BooGoo')]) + # + # other_pets + # # => [#] + # + # person.pets + # # This is not affected by replace + # # => [ + # # #, + # # #, + # # # + # # ] + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1028 + def records; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def references(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def references!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def references_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def references_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def regroup(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def regroup!(*, **, &); end + + # Reloads the collection from the database. Returns +self+. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets # fetches pets from the database + # # => [#] + # + # person.pets # uses the pets cache + # # => [#] + # + # person.pets.reload # fetches pets from the database + # # => [#] + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1089 + def reload; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reorder(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reorder!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reordering_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reordering_value=(arg); end + + # Replaces this collection with +other_array+. This will perform a diff + # and delete/add only records that have changed. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets + # # => [#] + # + # other_pets = [Pet.new(name: 'Puff', group: 'celebrities')] + # + # person.pets.replace(other_pets) + # + # person.pets + # # => [#] + # + # If the supplied array has an incorrect association type, it raises + # an ActiveRecord::AssociationTypeMismatch error: + # + # person.pets.replace(["doo", "ggie", "gaga"]) + # # => ActiveRecord::AssociationTypeMismatch: Pet expected, got String + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:391 + def replace(other_array); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reselect(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reselect!(*, **, &); end + + # Unloads the association. Returns +self+. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets # fetches pets from the database + # # => [#] + # + # person.pets # uses the pets cache + # # => [#] + # + # person.pets.reset # clears the pets cache + # + # person.pets # fetches pets from the database + # # => [#] + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1110 + def reset; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1116 + def reset_scope; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reverse_order(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reverse_order!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reverse_order_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def reverse_order_value=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def rewhere(*, **, &); end + + # Returns a Relation object for the records in this association + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:953 + def scope; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def scoping(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def select_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def select_values=(arg); end + + # Returns the size of the collection. If the collection hasn't been loaded, + # it executes a SELECT COUNT(*) query. Else it calls collection.size. + # + # If the collection has been already loaded +size+ and +length+ are + # equivalent. If not and you are going to need the records anyway + # +length+ will take one less query. Otherwise +size+ is more efficient. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets.size # => 3 + # # executes something like SELECT COUNT(*) FROM "pets" WHERE "pets"."person_id" = 1 + # + # person.pets # This will execute a SELECT * FROM query + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.size # => 3 + # # Because the collection is already loaded, this will behave like + # # collection.size and no SQL count query is executed. + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:786 + def size; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def skip_preloading!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def skip_query_cache!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def skip_query_cache_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def skip_query_cache_value=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def spawn(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def strict_loading(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def strict_loading!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def strict_loading_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def strict_loading_value=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def structurally_compatible?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def table_name_qualified_unscope_values(*, **, &); end + + # Gives a record (or N records if a parameter is supplied) from the collection + # using the same rules as ActiveRecord::FinderMethods.take. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets + # # => [ + # # #, + # # #, + # # # + # # ] + # + # person.pets.take # => # + # + # person.pets.take(2) + # # => [ + # # #, + # # # + # # ] + # + # another_person_without.pets # => [] + # another_person_without.pets.take # => nil + # another_person_without.pets.take(2) # => [] + # + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:289 + def take(limit = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:40 + def target; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def uniq!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def unscope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def unscope!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def unscope_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def unscope_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1133 + def upsert(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1133 + def upsert_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def where(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def where!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def where_clause(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def where_clause=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def with(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def with!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def with_recursive(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def with_recursive!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def with_values(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def with_values=(arg); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1159 + def without(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1180 + def exec_queries; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1176 + def find_from_target?; end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1167 + def find_nth_from_last(index); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1162 + def find_nth_with_limit(index, limit); end + + # pkg:gem/activerecord#lib/active_record/associations/collection_proxy.rb:1172 + def null_scope?; end +end + +# pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:6 +module ActiveRecord::Associations::Deprecation + class << self + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:14 + def backtrace; end + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:24 + def backtrace=(value); end + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:28 + def guard(reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:14 + def mode; end + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:16 + def mode=(value); end + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:39 + def report(reflection, context:); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:65 + def backtrace_cleaner; end + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:69 + def clean_frames; end + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:73 + def clean_locations; end + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:77 + def set_backtrace_supports_array_of_locations?; end + + # pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:81 + def user_facing_reflection(reflection); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:7 +ActiveRecord::Associations::Deprecation::EVENT = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/associations/deprecation.rb:10 +ActiveRecord::Associations::Deprecation::MODES = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/associations/disable_joins_association_scope.rb:5 +class ActiveRecord::Associations::DisableJoinsAssociationScope < ::ActiveRecord::Associations::AssociationScope + # pkg:gem/activerecord#lib/active_record/associations/disable_joins_association_scope.rb:6 + def scope(association); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/disable_joins_association_scope.rb:33 + def add_constraints(reflection, key, join_ids, owner, ordered); end + + # pkg:gem/activerecord#lib/active_record/associations/disable_joins_association_scope.rb:18 + def last_scope_chain(reverse_chain, owner); end +end + +# pkg:gem/activerecord#lib/active_record/associations/foreign_association.rb:4 +module ActiveRecord::Associations::ForeignAssociation + # pkg:gem/activerecord#lib/active_record/associations/foreign_association.rb:5 + def foreign_key_present?; end + + # pkg:gem/activerecord#lib/active_record/associations/foreign_association.rb:15 + def nullified_owner_attributes; end + + private + + # Sets the owner attributes on the given record + # + # pkg:gem/activerecord#lib/active_record/associations/foreign_association.rb:24 + def set_owner_attributes(record); end +end + +# = Active Record Has Many Association +# +# This is the proxy that handles a has many association. +# +# If the association has a :through option further specialization +# is provided by its child HasManyThroughAssociation. +# +# pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:11 +class ActiveRecord::Associations::HasManyAssociation < ::ActiveRecord::Associations::CollectionAssociation + include ::ActiveRecord::Associations::ForeignAssociation + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:14 + def handle_dependency; end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:61 + def insert_record(record, validate = T.unsafe(nil), raise = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:143 + def _create_record(attributes, *); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:139 + def concat_records(records, *); end + + # Returns the number of records in this collection. + # + # If the association has a counter cache it gets that value. Otherwise + # it will attempt to do a count via SQL, bounded to :limit if + # there's one. Some configuration options like :group make it impossible + # to do an SQL count, in those cases the array count will be used. + # + # That does not depend on whether the collection has already been loaded + # or not. The +size+ method is the one that takes the loaded flag into + # account and delegates to +count_records+ if needed. + # + # If the collection is empty the target is set to an empty array and + # the loaded flag is set to true as well. + # + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:80 + def count_records; end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:112 + def delete_count(method, scope); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:120 + def delete_or_nullify_all_records(method); end + + # Deletes the records according to the :dependent option. + # + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:127 + def delete_records(records, method); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:158 + def difference(a, b); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:162 + def intersection(a, b); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:98 + def update_counter(difference, reflection = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:151 + def update_counter_if_success(saved_successfully, difference); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_association.rb:104 + def update_counter_in_memory(difference, reflection = T.unsafe(nil)); end +end + +# = Active Record Has Many Through Association +# +# pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:6 +class ActiveRecord::Associations::HasManyThroughAssociation < ::ActiveRecord::Associations::HasManyAssociation + include ::ActiveRecord::Associations::ThroughAssociation + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:9 + def initialize(owner, reflection); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:14 + def concat(*records); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:24 + def insert_record(record, validate = T.unsafe(nil), raise = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:90 + def build_record(attributes); end + + # The through record (built with build_record) is temporarily cached + # so that it may be reused if insert_record is subsequently called. + # + # However, after insert_record has been called, the cache is cleared in + # order to allow multiple instances of the same record in an association. + # + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:56 + def build_through_record(record); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:37 + def concat_records(records); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:136 + def delete_or_nullify_all_records(method); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:140 + def delete_records(records, method); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:209 + def delete_through_records(records); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:177 + def difference(a, b); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:193 + def distribution(array); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:225 + def find_target(async: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:183 + def intersection(a, b); end + + # NOTE - not sure that we can actually cope with inverses here + # + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:233 + def invertible_for?(record); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:189 + def mark_occurrence(distribution, record); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:116 + def remove_records(existing_records, records, method); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:81 + def save_through_record(record); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:121 + def target_reflection_has_associated_record?; end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:199 + def through_records_for(record); end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:69 + def through_scope; end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:71 + def through_scope_attributes; end + + # pkg:gem/activerecord#lib/active_record/associations/has_many_through_association.rb:125 + def update_through_counter?(method); end +end + +# = Active Record Has One Association +# +# pkg:gem/activerecord#lib/active_record/associations/has_one_association.rb:6 +class ActiveRecord::Associations::HasOneAssociation < ::ActiveRecord::Associations::SingularAssociation + include ::ActiveRecord::Associations::ForeignAssociation + + # pkg:gem/activerecord#lib/active_record/associations/has_one_association.rb:26 + def delete(method = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/has_one_association.rb:9 + def handle_dependency; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/has_one_association.rb:134 + def _create_record(attributes, raise_error = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/has_one_association.rb:119 + def nullify_owner_attributes(record); end + + # pkg:gem/activerecord#lib/active_record/associations/has_one_association.rb:95 + def remove_target!(method); end + + # pkg:gem/activerecord#lib/active_record/associations/has_one_association.rb:59 + def replace(record, save = T.unsafe(nil)); end + + # The reason that the save param for replace is false, if for create (not just build), + # is because the setting of the foreign keys is actually handled by the scoping when + # the record is instantiated, and so they are set straight away and do not need to be + # updated within replace. + # + # pkg:gem/activerecord#lib/active_record/associations/has_one_association.rb:91 + def set_new_record(record); end + + # pkg:gem/activerecord#lib/active_record/associations/has_one_association.rb:126 + def transaction_if(value, &block); end +end + +# = Active Record Has One Through Association +# +# pkg:gem/activerecord#lib/active_record/associations/has_one_through_association.rb:6 +class ActiveRecord::Associations::HasOneThroughAssociation < ::ActiveRecord::Associations::HasOneAssociation + include ::ActiveRecord::Associations::ThroughAssociation + + private + + # pkg:gem/activerecord#lib/active_record/associations/has_one_through_association.rb:15 + def create_through_record(record, save); end + + # pkg:gem/activerecord#lib/active_record/associations/has_one_through_association.rb:10 + def replace(record, save = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:5 +class ActiveRecord::Associations::JoinDependency + extend ::ActiveSupport::Autoload + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:71 + def initialize(base, table, associations, join_type); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:153 + def apply_column_aliases(relation); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:77 + def base_klass; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:158 + def each(&block); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:105 + def instantiate(result_set, strict_loading_value, &block); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:85 + def join_constraints(joins_to_add, alias_tracker, references); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:81 + def reflections; end + + protected + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:163 + def join_root; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:163 + def join_type; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:166 + def alias_tracker; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:168 + def aliases; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:227 + def build(associations, base_klass); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:243 + def construct(ar_parent, parent, row, seen, model_cache, strict_loading_value); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:279 + def construct_model(record, node, row, model_cache, id, strict_loading_value); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:222 + def find_reflection(klass, name); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:166 + def join_root_alias; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:189 + def make_constraints(parent, child, join_type); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:183 + def make_join_constraints(join_root, join_type); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:213 + def walk(left, right, join_type); end + + class << self + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:47 + def make_tree(associations); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:53 + def walk_tree(associations, hash); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:13 +class ActiveRecord::Associations::JoinDependency::Aliases + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:14 + def initialize(tables); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:34 + def column_alias(node, column); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:30 + def column_aliases(node); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:26 + def columns; end +end + +# pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 +class ActiveRecord::Associations::JoinDependency::Aliases::Column < ::Struct + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 + def alias; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 + def alias=(_); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 + def name; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 + def name=(_); end + + class << self + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 + def members; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:44 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 +class ActiveRecord::Associations::JoinDependency::Aliases::Table < ::Struct + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:39 + def column_aliases; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 + def columns; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 + def columns=(_); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 + def node; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 + def node=(_); end + + class << self + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 + def members; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency.rb:38 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:9 +class ActiveRecord::Associations::JoinDependency::JoinAssociation < ::ActiveRecord::Associations::JoinDependency::JoinPart + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:13 + def initialize(reflection, children); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:24 + def join_constraints(foreign_table, foreign_klass, join_type, alias_tracker); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:19 + def match?(other); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:79 + def readonly?; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:10 + def reflection; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:85 + def strict_loading?; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:11 + def table; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:11 + def table=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:10 + def tables; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_association.rb:92 + def append_constraints(join, constraints); end +end + +# pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_base.rb:8 +class ActiveRecord::Associations::JoinDependency::JoinBase < ::ActiveRecord::Associations::JoinDependency::JoinPart + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_base.rb:11 + def initialize(base_klass, table, children); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_base.rb:16 + def match?(other); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_base.rb:9 + def table; end +end + +# A JoinPart represents a part of a JoinDependency. It is inherited +# by JoinBase and JoinAssociation. A JoinBase represents the Active Record which +# everything else is being joined onto. A JoinAssociation represents an association which +# is joining to the base. A JoinAssociation may result in more than one actual join +# operations (for example a has_and_belongs_to_many JoinAssociation would result in +# two; one for the join table and one for the target table). +# +# pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:12 +class ActiveRecord::Associations::JoinDependency::JoinPart + include ::Enumerable + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:22 + def initialize(base_klass, children); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:20 + def attribute_types(*, **, &); end + + # The Active Record class which this join part is associated 'about'; for a JoinBase + # this is the actual base model, for a JoinAssociation this is the target model of the + # association. + # + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:18 + def base_klass; end + + # The Active Record class which this join part is associated 'about'; for a JoinBase + # this is the actual base model, for a JoinAssociation this is the target model of the + # association. + # + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:18 + def children; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:20 + def column_names(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:31 + def each(&block); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:36 + def each_children(&block); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:48 + def extract_record(row, column_names_with_alias); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:65 + def instantiate(row, aliases, column_types = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:27 + def match?(other); end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:20 + def primary_key(*, **, &); end + + # An Arel::Table for the active_record + # + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:44 + def table; end + + # pkg:gem/activerecord#lib/active_record/associations/join_dependency/join_part.rb:20 + def table_name(*, **, &); end +end + +# pkg:gem/activerecord#lib/active_record/associations/nested_error.rb:7 +class ActiveRecord::Associations::NestedError < ::ActiveModel::NestedError + # pkg:gem/activerecord#lib/active_record/associations/nested_error.rb:8 + def initialize(association, inner_error); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/nested_error.rb:16 + def association; end + + # pkg:gem/activerecord#lib/active_record/associations/nested_error.rb:18 + def compute_attribute(inner_error); end + + # pkg:gem/activerecord#lib/active_record/associations/nested_error.rb:33 + def index; end + + # pkg:gem/activerecord#lib/active_record/associations/nested_error.rb:28 + def index_errors_setting; end + + # pkg:gem/activerecord#lib/active_record/associations/nested_error.rb:37 + def ordered_records; end +end + +# = Active Record \Preloader +# +# Implements the details of eager loading of Active Record associations. +# +# Suppose that you have the following two Active Record models: +# +# class Author < ActiveRecord::Base +# # columns: name, age +# has_many :books +# end +# +# class Book < ActiveRecord::Base +# # columns: title, sales, author_id +# end +# +# When you load an author with all associated books Active Record will make +# multiple queries like this: +# +# Author.includes(:books).where(name: ['bell hooks', 'Homer']).to_a +# +# # SELECT `authors`.* FROM `authors` WHERE `name` IN ('bell hooks', 'Homer') +# # SELECT `books`.* FROM `books` WHERE `author_id` IN (2, 5) +# +# Active Record saves the ids of the records from the first query to use in +# the second. Depending on the number of associations involved there can be +# arbitrarily many SQL queries made. +# +# However, if there is a WHERE clause that spans across tables Active +# Record will fall back to a slightly more resource-intensive single query: +# +# Author.includes(:books).where(books: {title: 'Illiad'}).to_a +# # SELECT `authors`.`id` AS t0_r0, `authors`.`name` AS t0_r1, `authors`.`age` AS t0_r2, +# # `books`.`id` AS t1_r0, `books`.`title` AS t1_r1, `books`.`sales` AS t1_r2 +# # FROM `authors` +# # LEFT OUTER JOIN `books` ON `authors`.`id` = `books`.`author_id` +# # WHERE `books`.`title` = 'Illiad' +# +# This could result in many rows that contain redundant data and it performs poorly at scale +# and is therefore only used when necessary. +# +# pkg:gem/activerecord#lib/active_record/associations/preloader.rb:46 +class ActiveRecord::Associations::Preloader + extend ::ActiveSupport::Autoload + + # Eager loads the named associations for the given Active Record record(s). + # + # In this description, 'association name' shall refer to the name passed + # to an association creation method. For example, a model that specifies + # belongs_to :author, has_many :buyers has association + # names +:author+ and +:buyers+. + # + # == Parameters + # +records+ is an array of ActiveRecord::Base. This array needs not be flat, + # i.e. +records+ itself may also contain arrays of records. In any case, + # +preload_associations+ will preload all associations records by + # flattening +records+. + # + # +associations+ specifies one or more associations that you want to + # preload. It may be: + # - a Symbol or a String which specifies a single association name. For + # example, specifying +:books+ allows this method to preload all books + # for an Author. + # - an Array which specifies multiple association names. This array + # is processed recursively. For example, specifying [:avatar, :books] + # allows this method to preload an author's avatar as well as all of their + # books. + # - a Hash which specifies multiple association names, as well as + # association names for the to-be-preloaded association objects. For + # example, specifying { author: :avatar } will preload a + # book's author, as well as that author's avatar. + # + # +:associations+ has the same format as the arguments to + # ActiveRecord::QueryMethods#includes. So +associations+ could look like + # this: + # + # :books + # [ :books, :author ] + # { author: :avatar } + # [ :books, { author: :avatar } ] + # + # +available_records+ is an array of ActiveRecord::Base. The Preloader + # will try to use the objects in this array to preload the requested + # associations before querying the database. This can save database + # queries by reusing in-memory objects. The optimization is only applied + # to single associations (i.e. :belongs_to, :has_one) with no scopes. + # + # pkg:gem/activerecord#lib/active_record/associations/preloader.rb:99 + def initialize(records:, associations:, scope: T.unsafe(nil), available_records: T.unsafe(nil), associate_by_default: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader.rb:56 + def associate_by_default; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader.rb:56 + def associations; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader.rb:126 + def branches; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader.rb:120 + def call; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader.rb:116 + def empty?; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader.rb:130 + def loaders; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader.rb:56 + def records; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader.rb:56 + def scope; end +end + +# pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:8 +class ActiveRecord::Associations::Preloader::Association + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:104 + def initialize(klass, owners, reflection, preload_scope, reflection_scope, associate_by_default); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:218 + def associate_records_from_unscoped(unscoped_records); end + + # The name of the key on the associated records + # + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:161 + def association_key_name; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:119 + def future_classes; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:102 + def klass; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:197 + def load_records(raw_records = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:176 + def loaded?(owner); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:165 + def loader_query; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:169 + def owners_by_key; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:154 + def preloaded_records; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:148 + def records_by_owner; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:135 + def run; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:131 + def run?; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:127 + def runnable_loaders; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:184 + def scope; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:188 + def set_inverse(record); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:115 + def table_name; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:180 + def target_for(owner); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:245 + def associate_records_to_owner(owner, records); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:282 + def association_key_type; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:294 + def build_scope; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:310 + def cascade_strict_loading(scope); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:274 + def convert_key(key); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:266 + def derive_key(owner, key); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:258 + def key_conversion_required?; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:238 + def model; end + + # The name of the key on the model which declares the association + # + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:241 + def owner_key_name; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:286 + def owner_key_type; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:238 + def owners; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:238 + def preload_scope; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:238 + def reflection; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:290 + def reflection_scope; end +end + +# pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:9 +class ActiveRecord::Associations::Preloader::Association::LoaderQuery + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:12 + def initialize(scope, association_key_name); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:10 + def association_key_name; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:17 + def eql?(other); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:24 + def hash; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:41 + def load_records_for_keys(keys, &block); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:32 + def load_records_in_batch(loaders); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:28 + def records_for(loaders); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:10 + def scope; end +end + +# pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:60 +class ActiveRecord::Associations::Preloader::Association::LoaderRecords + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:61 + def initialize(loaders, loader_query); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:70 + def records; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:97 + def already_loaded_records; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:75 + def already_loaded_records_by_key; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:75 + def keys_to_load; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:91 + def load_records; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:75 + def loader_query; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:75 + def loaders; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/association.rb:77 + def populate_keys_to_load_and_already_loaded_records; end +end + +# pkg:gem/activerecord#lib/active_record/associations/preloader/batch.rb:6 +class ActiveRecord::Associations::Preloader::Batch + # pkg:gem/activerecord#lib/active_record/associations/preloader/batch.rb:7 + def initialize(preloaders, available_records:); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/batch.rb:12 + def call; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/preloader/batch.rb:40 + def group_and_load_similar(loaders); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/batch.rb:38 + def loaders; end +end + +# pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:6 +class ActiveRecord::Associations::Preloader::Branch + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:11 + def initialize(association:, children:, parent:, associate_by_default:, scope:); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:8 + def associate_by_default; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:7 + def association; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:7 + def children; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:72 + def done?; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:27 + def future_classes; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:80 + def grouped_records; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:31 + def immediate_future_classes; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:53 + def likely_reflections; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:118 + def loaders; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:7 + def parent; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:108 + def polymorphic?; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:68 + def preloaded_records; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:9 + def preloaded_records=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:91 + def preloaders_for_reflection(reflection, reflection_records); end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:60 + def root?; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:76 + def runnable_loaders; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:8 + def scope; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:64 + def source_records; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:43 + def target_classes; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:127 + def build_children(children); end + + # Returns a class containing the logic needed to load preload the data + # and attach it to a relation. The class returned implements a `run` method + # that accepts a preloader. + # + # pkg:gem/activerecord#lib/active_record/associations/preloader/branch.rb:144 + def preloader_for(reflection); end +end + +# pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:6 +class ActiveRecord::Associations::Preloader::ThroughAssociation < ::ActiveRecord::Associations::Preloader::Association + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:49 + def future_classes; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:7 + def preloaded_records; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:11 + def records_by_owner; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:39 + def runnable_loaders; end + + private + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:65 + def data_available?; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:74 + def middle_records; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:98 + def preload_index; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:70 + def source_preloaders; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:90 + def source_records_by_owner; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:86 + def source_reflection; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:78 + def through_preloaders; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:94 + def through_records_by_owner; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:82 + def through_reflection; end + + # pkg:gem/activerecord#lib/active_record/associations/preloader/through_association.rb:104 + def through_scope; end +end + +# pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:5 +class ActiveRecord::Associations::SingularAssociation < ::ActiveRecord::Associations::Association + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:29 + def build(attributes = T.unsafe(nil), &block); end + + # Implements the reload reader method, e.g. foo.reload_bar for + # Foo.has_one :bar + # + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:37 + def force_reload_reader; end + + # Implements the reader method, e.g. foo.bar for Foo.has_one :bar + # + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:7 + def reader; end + + # Resets the \loaded flag to +false+ and sets the \target to +nil+. + # + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:18 + def reset; end + + # Implements the writer method, e.g. foo.bar= for Foo.belongs_to :bar + # + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:25 + def writer(record); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:67 + def _create_record(attributes, raise_error = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:47 + def find_target(async: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:59 + def replace(record); end + + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:43 + def scope_for_create; end + + # pkg:gem/activerecord#lib/active_record/associations/singular_association.rb:63 + def set_new_record(record); end +end + +# = Active Record Through Association +# +# pkg:gem/activerecord#lib/active_record/associations/through_association.rb:6 +module ActiveRecord::Associations::ThroughAssociation + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:7 + def source_reflection(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:116 + def build_record(attributes); end + + # Construct attributes for :through pointing to owner and associate. This is used by the + # methods which create and delete records on the association. + # + # We only support indirectly modifying through associations which have a belongs_to source. + # This is the "has_many :tags, through: :taggings" situation, where the join model + # typically has a belongs_to on both side. In other words, associations which could also + # be represented as has_and_belongs_to_many associations. + # + # We do not support creating/deleting records on the association where the source has + # some other type, because this opens up a whole can of worms, and in basically any + # situation it is more natural for the user to just create or modify their join records + # directly as required. + # + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:57 + def construct_join_attributes(*records); end + + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:96 + def ensure_mutable; end + + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:106 + def ensure_not_nested; end + + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:90 + def foreign_key_present?; end + + # Note: this does not capture all cases, for example it would be impractical + # to try to properly support stale-checking for nested associations. + # + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:82 + def stale_state; end + + # We merge in these scopes for two reasons: + # + # 1. To get the default_scope conditions for any of the other reflections in the chain + # 2. To get the type conditions for any STI models in the chain + # + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:34 + def target_scope; end + + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:26 + def through_association; end + + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:14 + def through_reflection; end + + # pkg:gem/activerecord#lib/active_record/associations/through_association.rb:10 + def transaction(&block); end +end + +# pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:7 +class ActiveRecord::AsynchronousQueriesTracker + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:45 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:49 + def current_session; end + + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:58 + def finalize_session(wait = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:53 + def start_session; end + + class << self + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:40 + def complete(asynchronous_queries_tracker); end + + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:32 + def install_executor_hooks(executor = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:36 + def run; end + end +end + +# pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:8 +class ActiveRecord::AsynchronousQueriesTracker::Session + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:9 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:14 + def active?; end + + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:22 + def finalize(wait = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/asynchronous_queries_tracker.rb:18 + def synchronize(&block); end +end + +# AsynchronousQueryInsideTransactionError will be raised when attempting +# to perform an asynchronous query from inside a transaction +# +# pkg:gem/activerecord#lib/active_record/errors.rb:544 +class ActiveRecord::AsynchronousQueryInsideTransactionError < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/attribute_assignment.rb:4 +module ActiveRecord::AttributeAssignment + private + + # pkg:gem/activerecord#lib/active_record/attribute_assignment.rb:6 + def _assign_attributes(attributes); end + + # Instantiates objects for all attribute classes that needs more than one constructor parameter. This is done + # by calling new on the column type or aggregation type (through composed_of) object with these parameters. + # So having the pairs written_on(1) = "2004", written_on(2) = "6", written_on(3) = "24", will instantiate + # written_on (a date type) with Date.new("2004", "6", "24"). You can also specify a typecast character in the + # parentheses to have the parameters typecasted before they're used in the constructor. Use i for Integer and + # f for Float. If all the values for a given attribute are empty, the attribute will be set to +nil+. + # + # pkg:gem/activerecord#lib/active_record/attribute_assignment.rb:36 + def assign_multiparameter_attributes(pairs); end + + # Assign any deferred nested attributes after the base attributes have been set. + # + # pkg:gem/activerecord#lib/active_record/attribute_assignment.rb:26 + def assign_nested_parameter_attributes(pairs); end + + # pkg:gem/activerecord#lib/active_record/attribute_assignment.rb:42 + def execute_callstack_for_multiparameter_attributes(callstack); end + + # pkg:gem/activerecord#lib/active_record/attribute_assignment.rb:60 + def extract_callstack_for_multiparameter_attributes(pairs); end + + # pkg:gem/activerecord#lib/active_record/attribute_assignment.rb:78 + def find_parameter_position(multiparameter_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_assignment.rb:74 + def type_cast_attribute_value(multiparameter_name, value); end +end + +# Raised when an error occurred while doing a mass assignment to an attribute through the +# {ActiveRecord::Base#attributes=}[rdoc-ref:ActiveModel::AttributeAssignment#attributes=] method. +# The exception has an +attribute+ property that is the name of the offending attribute. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:456 +class ActiveRecord::AttributeAssignmentError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/errors.rb:459 + def initialize(message = T.unsafe(nil), exception = T.unsafe(nil), attribute = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:457 + def attribute; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:457 + def exception; end +end + +# = Active Record Attribute Methods +# +# pkg:gem/activerecord#lib/active_record/attribute_methods.rb:7 +module ActiveRecord::AttributeMethods + extend ::ActiveSupport::Concern + extend ::ActiveSupport::Autoload + include GeneratedInstanceMethods + include ::ActiveModel::AttributeMethods + include ::ActiveRecord::AttributeMethods::Read + include ::ActiveRecord::AttributeMethods::Write + include ::ActiveRecord::AttributeMethods::BeforeTypeCast + include ::ActiveRecord::AttributeMethods::Query + include ::ActiveRecord::AttributeMethods::PrimaryKey + include ::ActiveRecord::AttributeMethods::TimeZoneConversion + include ::ActiveModel::Dirty + include ::ActiveRecord::AttributeMethods::Dirty + include ::ActiveRecord::AttributeMethods::Serialization + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::AttributeMethods::ClassMethods + mixes_in_class_methods ::ActiveRecord::AttributeMethods::ClassMethods + mixes_in_class_methods ::ActiveRecord::AttributeMethods::Read::ClassMethods + mixes_in_class_methods ::ActiveRecord::AttributeMethods::Write::ClassMethods + mixes_in_class_methods ::ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods + mixes_in_class_methods ::ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods + mixes_in_class_methods ::ActiveRecord::AttributeMethods::Serialization::ClassMethods + + # Returns the value of the attribute identified by +attr_name+ after it has + # been type cast. (For information about specific type casting behavior, see + # the types under ActiveModel::Type.) + # + # class Person < ActiveRecord::Base + # belongs_to :organization + # end + # + # person = Person.new(name: "Francesco", date_of_birth: "2004-12-12") + # person[:name] # => "Francesco" + # person[:date_of_birth] # => Date.new(2004, 12, 12) + # person[:organization_id] # => nil + # + # Raises ActiveModel::MissingAttributeError if the attribute is missing. + # Note, however, that the +id+ attribute will never be considered missing. + # + # person = Person.select(:name).first + # person[:name] # => "Francesco" + # person[:date_of_birth] # => ActiveModel::MissingAttributeError: missing attribute 'date_of_birth' for Person + # person[:organization_id] # => ActiveModel::MissingAttributeError: missing attribute 'organization_id' for Person + # person[:id] # => nil + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:415 + def [](attr_name); end + + # Updates the attribute identified by +attr_name+ using the specified + # +value+. The attribute value will be type cast upon being read. + # + # class Person < ActiveRecord::Base + # end + # + # person = Person.new + # person[:date_of_birth] = "2004-12-12" + # person[:date_of_birth] # => Date.new(2004, 12, 12) + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:428 + def []=(attr_name, value); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:322 + def _has_attribute?(attr_name); end + + # Returns the name of all database fields which have been read from this + # model. This can be useful in development mode to determine which fields + # need to be selected. For performance critical pages, selecting only the + # required fields can be an easy performance win (assuming you aren't using + # all of the fields on the model). + # + # For example: + # + # class PostsController < ActionController::Base + # after_action :print_accessed_fields, only: :index + # + # def index + # @posts = Post.all + # end + # + # private + # def print_accessed_fields + # p @posts.first.accessed_fields + # end + # end + # + # Which allows you to quickly change your code to: + # + # class PostsController < ActionController::Base + # def index + # @posts = Post.select(:id, :title, :author_id, :updated_at) + # end + # end + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:460 + def accessed_fields; end + + # Returns an #inspect-like string for the value of the + # attribute +attr_name+. String attributes are truncated up to 50 + # characters. Other attributes return the value of #inspect + # without modification. + # + # person = Person.create!(name: 'David Heinemeier Hansson ' * 3) + # + # person.attribute_for_inspect(:name) + # # => "\"David Heinemeier Hansson David Heinemeier Hansson ...\"" + # + # person.attribute_for_inspect(:created_at) + # # => "\"2012-10-22 00:15:07.000000000 +0000\"" + # + # person.attribute_for_inspect(:tag_ids) + # # => "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]" + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:365 + def attribute_for_inspect(attr_name); end + + # Returns an array of names for the attributes available on this object. + # + # class Person < ActiveRecord::Base + # end + # + # person = Person.new + # person.attribute_names + # # => ["id", "created_at", "updated_at", "name", "age"] + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:334 + def attribute_names; end + + # Returns +true+ if the specified +attribute+ has been set by the user or by a + # database load and is neither +nil+ nor empty? (the latter only applies + # to objects that respond to empty?, most notably Strings). Otherwise, +false+. + # Note that it always returns +true+ with boolean attributes. + # + # class Task < ActiveRecord::Base + # end + # + # task = Task.new(title: '', is_done: false) + # task.attribute_present?(:title) # => false + # task.attribute_present?(:is_done) # => true + # task.title = 'Buy milk' + # task.is_done = true + # task.attribute_present?(:title) # => true + # task.attribute_present?(:is_done) # => true + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:387 + def attribute_present?(attr_name); end + + # Returns a hash of all the attributes with their names as keys and the values of the attributes as values. + # + # class Person < ActiveRecord::Base + # end + # + # person = Person.create(name: 'Francesco', age: 22) + # person.attributes + # # => {"id"=>3, "created_at"=>Sun, 21 Oct 2012 04:53:04, "updated_at"=>Sun, 21 Oct 2012 04:53:04, "name"=>"Francesco", "age"=>22} + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:346 + def attributes; end + + # Returns +true+ if the given attribute is in the attributes hash, otherwise +false+. + # + # class Person < ActiveRecord::Base + # alias_attribute :new_name, :name + # end + # + # person = Person.new + # person.has_attribute?(:name) # => true + # person.has_attribute?(:new_name) # => true + # person.has_attribute?('age') # => true + # person.has_attribute?(:nothing) # => false + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:316 + def has_attribute?(attr_name); end + + # A Person object with a name attribute can ask person.respond_to?(:name), + # person.respond_to?(:name=), and person.respond_to?(:name?) + # which will all return +true+. It also defines the attribute methods if they have + # not been generated. + # + # class Person < ActiveRecord::Base + # end + # + # person = Person.new + # person.respond_to?(:name) # => true + # person.respond_to?(:name=) # => true + # person.respond_to?(:name?) # => true + # person.respond_to?('age') # => true + # person.respond_to?('age=') # => true + # person.respond_to?('age?') # => true + # person.respond_to?(:nothing) # => false + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:291 + def respond_to?(name, include_private = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:501 + def attribute_method?(attr_name); end + + # Filters out the virtual columns and also primary keys, from the attribute names, when the primary + # key is to be generated (e.g. the id attribute has no value). + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:521 + def attributes_for_create(attribute_names); end + + # Filters the primary keys, readonly attributes and virtual columns from the attribute names. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:510 + def attributes_for_update(attribute_names); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:505 + def attributes_with_values(attribute_names); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:529 + def format_for_inspect(name, value); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:475 + def method_missing(name, *, **, &); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:545 + def pk_attribute?(name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:465 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:30 + def dangerous_attribute_methods; end + end + + module GeneratedClassMethods + def attribute_aliases; end + def attribute_aliases=(value); end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns=(value); end + def attribute_method_patterns?; end + def default_column_serializer; end + def default_column_serializer=(value); end + def default_column_serializer?; end + def partial_inserts; end + def partial_inserts=(value); end + def partial_inserts?; end + def partial_updates; end + def partial_updates=(value); end + def partial_updates?; end + def skip_time_zone_conversion_for_attributes; end + def skip_time_zone_conversion_for_attributes=(value); end + def skip_time_zone_conversion_for_attributes?; end + def time_zone_aware_attributes; end + def time_zone_aware_attributes=(value); end + def time_zone_aware_attributes?; end + def time_zone_aware_types; end + def time_zone_aware_types=(value); end + def time_zone_aware_types?; end + end + + module GeneratedInstanceMethods + def attribute_aliases; end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns?; end + def partial_inserts; end + def partial_inserts?; end + def partial_updates; end + def partial_updates?; end + def skip_time_zone_conversion_for_attributes; end + def skip_time_zone_conversion_for_attributes?; end + def time_zone_aware_attributes; end + def time_zone_aware_attributes?; end + def time_zone_aware_types; end + def time_zone_aware_types?; end + end +end + +# = Active Record Attribute Methods Before Type Cast +# +# ActiveRecord::AttributeMethods::BeforeTypeCast provides a way to +# read the value of the attributes before typecasting and deserialization. +# +# class Task < ActiveRecord::Base +# end +# +# task = Task.new(id: '1', completed_on: '2012-10-21') +# task.id # => 1 +# task.completed_on # => Sun, 21 Oct 2012 +# +# task.attributes_before_type_cast +# # => {"id"=>"1", "completed_on"=>"2012-10-21", ... } +# task.read_attribute_before_type_cast('id') # => "1" +# task.read_attribute_before_type_cast('completed_on') # => "2012-10-21" +# +# In addition to #read_attribute_before_type_cast and #attributes_before_type_cast, +# it declares a method for all attributes with the *_before_type_cast +# suffix. +# +# task.id_before_type_cast # => "1" +# task.completed_on_before_type_cast # => "2012-10-21" +# +# pkg:gem/activerecord#lib/active_record/attribute_methods/before_type_cast.rb:28 +module ActiveRecord::AttributeMethods::BeforeTypeCast + extend ::ActiveSupport::Concern + + # Returns a hash of attributes before typecasting and deserialization. + # + # class Task < ActiveRecord::Base + # end + # + # task = Task.new(title: nil, is_done: true, completed_on: '2012-10-21') + # task.attributes + # # => {"id"=>nil, "title"=>nil, "is_done"=>true, "completed_on"=>Sun, 21 Oct 2012, "created_at"=>nil, "updated_at"=>nil} + # task.attributes_before_type_cast + # # => {"id"=>nil, "title"=>nil, "is_done"=>true, "completed_on"=>"2012-10-21", "created_at"=>nil, "updated_at"=>nil} + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/before_type_cast.rb:82 + def attributes_before_type_cast; end + + # Returns a hash of attributes for assignment to the database. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/before_type_cast.rb:87 + def attributes_for_database; end + + # Returns the value of the attribute identified by +attr_name+ before + # typecasting and deserialization. + # + # class Task < ActiveRecord::Base + # end + # + # task = Task.new(id: '1', completed_on: '2012-10-21') + # task.read_attribute('id') # => 1 + # task.read_attribute_before_type_cast('id') # => '1' + # task.read_attribute('completed_on') # => Sun, 21 Oct 2012 + # task.read_attribute_before_type_cast('completed_on') # => "2012-10-21" + # task.read_attribute_before_type_cast(:completed_on) # => "2012-10-21" + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/before_type_cast.rb:48 + def read_attribute_before_type_cast(attr_name); end + + # Returns the value of the attribute identified by +attr_name+ after + # serialization. + # + # class Book < ActiveRecord::Base + # enum :status, { draft: 1, published: 2 } + # end + # + # book = Book.new(status: "published") + # book.read_attribute(:status) # => "published" + # book.read_attribute_for_database(:status) # => 2 + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/before_type_cast.rb:65 + def read_attribute_for_database(attr_name); end + + private + + # Dispatch target for *_before_type_cast attribute methods. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/before_type_cast.rb:93 + def attribute_before_type_cast(attr_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/before_type_cast.rb:101 + def attribute_came_from_user?(attr_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/before_type_cast.rb:97 + def attribute_for_database(attr_name); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods.rb:41 +module ActiveRecord::AttributeMethods::ClassMethods + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:260 + def _has_attribute?(attr_name); end + + # Allows you to make aliases for attributes. + # + # class Person < ActiveRecord::Base + # alias_attribute :nickname, :name + # end + # + # person = Person.create(name: 'Bob') + # person.name # => "Bob" + # person.nickname # => "Bob" + # + # The alias can also be used for querying: + # + # Person.where(nickname: "Bob") + # # SELECT "people".* FROM "people" WHERE "people"."name" = "Bob" + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:66 + def alias_attribute(new_name, old_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:87 + def alias_attribute_method_definition(code_generator, pattern, new_name, old_name); end + + # Returns +true+ if +attribute+ is an attribute method and table exists, + # +false+ otherwise. + # + # class Person < ActiveRecord::Base + # end + # + # Person.attribute_method?('name') # => true + # Person.attribute_method?(:age=) # => true + # Person.attribute_method?(:nothing) # => false + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:224 + def attribute_method?(attribute); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:98 + def attribute_methods_generated?; end + + # Returns an array of column names as strings if it's not an abstract class and + # table exists. Otherwise it returns an empty array. + # + # class Person < ActiveRecord::Base + # end + # + # Person.attribute_names + # # => ["id", "created_at", "updated_at", "name", "age"] + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:236 + def attribute_names; end + + # A method name is 'dangerous' if it is already (re)defined by Active Record, but + # not by any ancestors. (So 'puts' is not dangerous but 'save' is.) + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:183 + def dangerous_attribute_method?(name); end + + # A class method is 'dangerous' if it is already (re)defined by Active Record, but + # not by any ancestors. (So 'puts' is not dangerous but 'new' is.) + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:201 + def dangerous_class_method?(method_name); end + + # Generates all the attribute related methods for columns in the database + # accessors, mutators and query methods. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:104 + def define_attribute_methods; end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:76 + def eagerly_generate_alias_attribute_methods(_new_name, _old_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:80 + def generate_alias_attribute_methods(code_generator, new_name, old_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:127 + def generate_alias_attributes; end + + # Returns true if the given attribute exists, otherwise false. + # + # class Person < ActiveRecord::Base + # alias_attribute :new_name, :name + # end + # + # Person.has_attribute?('name') # => true + # Person.has_attribute?('new_name') # => true + # Person.has_attribute?(:age) # => true + # Person.has_attribute?(:nothing) # => false + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:254 + def has_attribute?(attr_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:42 + def initialize_generated_modules; end + + # Raises an ActiveRecord::DangerousAttributeError exception when an + # \Active \Record method is defined in the model, otherwise +false+. + # + # class Person < ActiveRecord::Base + # def save + # 'already defined by Active Record' + # end + # end + # + # Person.instance_method_already_implemented?(:save) + # # => ActiveRecord::DangerousAttributeError: save is defined by Active Record. Check to make sure that you don't have an attribute or method with the same name. + # + # Person.instance_method_already_implemented?(:name) + # # => false + # + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:165 + def instance_method_already_implemented?(method_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:187 + def method_defined_within?(name, klass, superklass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:143 + def undefine_attribute_methods; end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods.rb:265 + def inherited(child_class); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/composite_primary_key.rb:5 +module ActiveRecord::AttributeMethods::CompositePrimaryKey + # Returns the primary key column's value. If the primary key is composite, + # returns an array of the primary key column values. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/composite_primary_key.rb:8 + def id; end + + # Sets the primary key column's value. If the primary key is composite, + # raises TypeError when the set value not enumerable. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/composite_primary_key.rb:26 + def id=(value); end + + # Queries the primary key column's value. If the primary key is composite, + # all primary key column values must be queryable. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/composite_primary_key.rb:37 + def id?; end + + # Returns the primary key column's value before type cast. If the primary key is composite, + # returns an array of primary key column values before type cast. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/composite_primary_key.rb:47 + def id_before_type_cast; end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/composite_primary_key.rb:75 + def id_for_database; end + + # Returns the primary key column's value from the database. If the primary key is composite, + # returns an array of primary key column values from database. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/composite_primary_key.rb:67 + def id_in_database; end + + # Returns the primary key column's previous value. If the primary key is composite, + # returns an array of primary key column previous values. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/composite_primary_key.rb:57 + def id_was; end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/composite_primary_key.rb:16 + def primary_key_values_present?; end +end + +# = Active Record Attribute Methods \Dirty +# +# Provides a way to track changes in your Active Record models. It adds all +# methods from ActiveModel::Dirty and adds database-specific methods. +# +# A newly created +Person+ object is unchanged: +# +# class Person < ActiveRecord::Base +# end +# +# person = Person.create(name: "Allison") +# person.changed? # => false +# +# Change the name: +# +# person.name = 'Alice' +# person.name_in_database # => "Allison" +# person.will_save_change_to_name? # => true +# person.name_change_to_be_saved # => ["Allison", "Alice"] +# person.changes_to_save # => {"name"=>["Allison", "Alice"]} +# +# Save the changes: +# +# person.save +# person.name_in_database # => "Alice" +# person.saved_change_to_name? # => true +# person.saved_change_to_name # => ["Allison", "Alice"] +# person.name_before_last_save # => "Allison" +# +# Similar to ActiveModel::Dirty, methods can be invoked as +# +saved_change_to_name?+ or by passing an argument to the generic method +# saved_change_to_attribute?("name"). +# +# pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:39 +module ActiveRecord::AttributeMethods::Dirty + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveModel::AttributeMethods + include ::ActiveModel::Dirty + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::AttributeMethods::ClassMethods + + # Returns the original value of an attribute before the last save. + # + # This method is useful in after callbacks to get the original value of an + # attribute before the save that triggered the callbacks to run. It can be + # invoked as +name_before_last_save+ instead of + # attribute_before_last_save("name"). + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:108 + def attribute_before_last_save(attr_name); end + + # Returns the change to an attribute that will be persisted during the + # next save. + # + # This method is useful in validations and before callbacks, to see the + # change to an attribute that will occur when the record is saved. It can + # be invoked as +name_change_to_be_saved+ instead of + # attribute_change_to_be_saved("name"). + # + # If the attribute will change, the result will be an array containing the + # original value and the new value about to be saved. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:152 + def attribute_change_to_be_saved(attr_name); end + + # Returns the value of an attribute in the database, as opposed to the + # in-memory value that will be persisted the next time the record is + # saved. + # + # This method is useful in validations and before callbacks, to see the + # original value of an attribute prior to any changes about to be + # saved. It can be invoked as +name_in_database+ instead of + # attribute_in_database("name"). + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:164 + def attribute_in_database(attr_name); end + + # Returns a hash of the attributes that will change when the record is + # next saved. + # + # The hash keys are the attribute names, and the hash values are the + # original attribute values in the database (as opposed to the in-memory + # values about to be saved). + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:191 + def attributes_in_database; end + + # Returns an array of the names of any attributes that will change when + # the record is next saved. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:181 + def changed_attribute_names_to_save; end + + # Returns a hash containing all the changes that will be persisted during + # the next save. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:175 + def changes_to_save; end + + # Will the next call to +save+ have any changes to persist? + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:169 + def has_changes_to_save?; end + + # reload the record and clears changed attributes. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:63 + def reload(*); end + + # Returns the change to an attribute during the last save. If the + # attribute was changed, the result will be an array containing the + # original value and the saved value. + # + # This method is useful in after callbacks, to see the change in an + # attribute during the save that triggered the callbacks to run. It can be + # invoked as +saved_change_to_name+ instead of + # saved_change_to_attribute("name"). + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:98 + def saved_change_to_attribute(attr_name); end + + # Did this attribute change when we last saved? + # + # This method is useful in after callbacks to determine if an attribute + # was changed during the save that triggered the callbacks to run. It can + # be invoked as +saved_change_to_name?+ instead of + # saved_change_to_attribute?("name"). + # + # ==== Options + # + # [+from+] + # When specified, this method will return false unless the original + # value is equal to the given value. + # + # [+to+] + # When specified, this method will return false unless the value will be + # changed to the given value. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:86 + def saved_change_to_attribute?(attr_name, **options); end + + # Returns a hash containing all the changes that were just saved. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:118 + def saved_changes; end + + # Did the last call to +save+ have any changes to change? + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:113 + def saved_changes?; end + + # Will this attribute change the next time we save? + # + # This method is useful in validations and before callbacks to determine + # if the next call to +save+ will change a particular attribute. It can be + # invoked as +will_save_change_to_name?+ instead of + # will_save_change_to_attribute?("name"). + # + # ==== Options + # + # [+from+] + # When specified, this method will return false unless the original + # value is equal to the given value. + # + # [+to+] + # When specified, this method will return false unless the value will be + # changed to the given value. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:138 + def will_save_change_to_attribute?(attr_name, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:239 + def _create_record(attribute_names = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:204 + def _touch_row(attribute_names, time); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:233 + def _update_record(attribute_names = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:249 + def attribute_names_for_partial_inserts; end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:245 + def attribute_names_for_partial_updates; end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/dirty.rb:196 + def init_internals; end + + module GeneratedClassMethods + def attribute_aliases; end + def attribute_aliases=(value); end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns=(value); end + def attribute_method_patterns?; end + def partial_inserts; end + def partial_inserts=(value); end + def partial_inserts?; end + def partial_updates; end + def partial_updates=(value); end + def partial_updates?; end + end + + module GeneratedInstanceMethods + def attribute_aliases; end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns?; end + def partial_inserts; end + def partial_inserts?; end + def partial_updates; end + def partial_updates?; end + end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods.rb:25 +class ActiveRecord::AttributeMethods::GeneratedAttributeMethods < ::Module; end + +# pkg:gem/activerecord#lib/active_record/attribute_methods.rb:26 +ActiveRecord::AttributeMethods::GeneratedAttributeMethods::LOCK = T.let(T.unsafe(nil), Monitor) + +# = Active Record Attribute Methods Primary Key +# +# pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:6 +module ActiveRecord::AttributeMethods::PrimaryKey + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods + + # Returns the primary key column's value. If the primary key is composite, + # returns an array of the primary key column values. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:18 + def id; end + + # Sets the primary key column's value. If the primary key is composite, + # raises TypeError when the set value not enumerable. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:28 + def id=(value); end + + # Queries the primary key column's value. If the primary key is composite, + # all primary key column values must be queryable. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:34 + def id?; end + + # Returns the primary key column's value before type cast. If the primary key is composite, + # returns an array of primary key column values before type cast. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:40 + def id_before_type_cast; end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:56 + def id_for_database; end + + # Returns the primary key column's value from the database. If the primary key is composite, + # returns an array of primary key column values from database. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:52 + def id_in_database; end + + # Returns the primary key column's previous value. If the primary key is composite, + # returns an array of primary key column previous values. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:46 + def id_was; end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:22 + def primary_key_values_present?; end + + # Returns this record's primary key value wrapped in an array if one is + # available. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:11 + def to_key; end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:61 + def attribute_method?(attr_name); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:65 +module ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:85 + def composite_primary_key?; end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:73 + def dangerous_attribute_method?(method_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:103 + def get_primary_key(base_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:69 + def instance_method_already_implemented?(method_name); end + + # Defines the primary key field -- can be overridden in subclasses. + # Overwriting will negate any effect of the +primary_key_prefix_type+ + # setting, though. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:80 + def primary_key; end + + # Sets the name of the primary key column. + # + # class Project < ActiveRecord::Base + # self.primary_key = 'sysid' + # end + # + # You can also define the #primary_key method yourself: + # + # class Project < ActiveRecord::Base + # def self.primary_key + # 'foo_' + super + # end + # end + # + # Project.primary_key # => "foo_id" + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:130 + def primary_key=(value); end + + # Returns a quoted version of the primary key name. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:91 + def quoted_primary_key; end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:95 + def reset_primary_key; end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:143 + def inherited(base); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:66 +ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods::ID_ATTRIBUTE_METHODS = T.let(T.unsafe(nil), Set) + +# pkg:gem/activerecord#lib/active_record/attribute_methods/primary_key.rb:67 +ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods::PRIMARY_KEY_NOT_SET = T.let(T.unsafe(nil), BasicObject) + +# = Active Record Attribute Methods \Query +# +# Adds query methods for attributes that return either +true+ or +false+ +# depending on the attribute type and value. +# +# For Boolean attributes this will return +true+ if the value is present +# and return +false+ otherwise: +# +# class Product < ActiveRecord::Base +# end +# +# product = Product.new(archived: false) +# product.archived? # => false +# product.archived = true +# product.archived? # => true +# +# For Numeric attributes this will return +true+ if the value is a non-zero +# number and return +false+ otherwise: +# +# product.inventory_count = 0 +# product.inventory_count? # => false +# product.inventory_count = 1 +# product.inventory_count? # => true +# +# For other attributes it will return +true+ if the value is present +# and return +false+ otherwise: +# +# product.name = nil +# product.name? # => false +# product.name = " " +# product.name? # => false +# product.name = "Orange" +# product.name? # => true +# +# pkg:gem/activerecord#lib/active_record/attribute_methods/query.rb:38 +module ActiveRecord::AttributeMethods::Query + extend ::ActiveSupport::Concern + + # pkg:gem/activerecord#lib/active_record/attribute_methods/query.rb:53 + def _query_attribute(attr_name); end + + # Returns +true+ or +false+ for the attribute identified by +attr_name+, + # depending on the attribute type and value. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/query.rb:47 + def query_attribute(attr_name); end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/query.rb:59 + def attribute?(attr_name); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/query.rb:63 + def query_cast_attribute(attr_name, value); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods.rb:23 +ActiveRecord::AttributeMethods::RESTRICTED_CLASS_METHODS = T.let(T.unsafe(nil), Array) + +# = Active Record Attribute Methods \Read +# +# pkg:gem/activerecord#lib/active_record/attribute_methods/read.rb:6 +module ActiveRecord::AttributeMethods::Read + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::AttributeMethods::Read::ClassMethods + + # This method exists to avoid the expensive primary_key check internally, without + # breaking compatibility with the read_attribute API + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/read.rb:38 + def _read_attribute(attr_name, &block); end + + # Returns the value of the attribute identified by +attr_name+ after it + # has been type cast. For example, a date attribute will cast "2004-12-12" + # to Date.new(2004, 12, 12). (For information about specific type + # casting behavior, see the types under ActiveModel::Type.) + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/read.rb:29 + def read_attribute(attr_name, &block); end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/read.rb:42 + def attribute(attr_name, &block); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/read.rb:9 +module ActiveRecord::AttributeMethods::Read::ClassMethods + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/read.rb:11 + def define_method_attribute(canonical_name, owner:, as: T.unsafe(nil)); end +end + +# = Active Record Attribute Methods \Serialization +# +# pkg:gem/activerecord#lib/active_record/attribute_methods/serialization.rb:6 +module ActiveRecord::AttributeMethods::Serialization + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::AttributeMethods::Serialization::ClassMethods + + module GeneratedClassMethods + def default_column_serializer; end + def default_column_serializer=(value); end + def default_column_serializer?; end + end + + module GeneratedInstanceMethods; end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/serialization.rb:23 +module ActiveRecord::AttributeMethods::Serialization::ClassMethods + # If you have an attribute that needs to be saved to the database as a + # serialized object, and retrieved by deserializing into the same object, + # then specify the name of that attribute using this method and serialization + # will be handled automatically. + # + # The serialization format may be YAML, JSON, or any custom format using a + # custom coder class. + # + # Keep in mind that database adapters handle certain serialization tasks + # for you. For instance: +json+ and +jsonb+ types in PostgreSQL will be + # converted between JSON object/array syntax and Ruby +Hash+ or +Array+ + # objects transparently. There is no need to use #serialize in this + # case. + # + # For more complex cases, such as conversion to or from your application + # domain objects, consider using the ActiveRecord::Attributes API. + # + # ==== Parameters + # + # * +attr_name+ - The name of the attribute to serialize. + # * +coder+ The serializer implementation to use, e.g. +JSON+. + # * The attribute value will be serialized + # using the coder's dump(value) method, and will be + # deserialized using the coder's load(string) method. The + # +dump+ method may return +nil+ to serialize the value as +NULL+. + # * +type+ - Optional. What the type of the serialized object should be. + # * Attempting to serialize another type will raise an + # ActiveRecord::SerializationTypeMismatch error. + # * If the column is +NULL+ or starting from a new record, the default value + # will set to +type.new+ + # * +comparable+ - Specify whether the deserialized object is safely comparable + # for the purpose of detecting changes. Defaults to +false+ + # When set to +false+ the old and new values will be compared by their serialized + # representation (e.g. JSON or YAML), which can sometimes cause two objects that are + # semantically equal to be considered different. + # For instance two hashes with the same keys and values but a different order have a + # different serialized representation, but are semantically equal once deserialized. + # If set to +true+ the comparison will be done on the deserialized object. + # This options should only be enabled if the +type+ is known to have + # a proper == method that deeply compare the objects. + # * +yaml+ - Optional. Yaml specific options. The allowed config is: + # * +:permitted_classes+ - +Array+ with the permitted classes. + # * +:unsafe_load+ - Unsafely load YAML blobs, allow YAML to load any class. + # + # ==== Options + # + # * +:default+ - The default value to use when no value is provided. If + # this option is not passed, the previous default value (if any) will + # be used. Otherwise, the default will be +nil+. + # + # ==== Choosing a serializer + # + # While any serialization format can be used, it is recommended to carefully + # evaluate the properties of a serializer before using it, as migrating to + # another format later on can be difficult. + # + # ===== Avoid accepting arbitrary types + # + # When serializing data in a column, it is heavily recommended to make sure + # only expected types will be serialized. For instance some serializer like + # +Marshal+ or +YAML+ are capable of serializing almost any Ruby object. + # + # This can lead to unexpected types being serialized, and it is important + # that type serialization remains backward and forward compatible as long + # as some database records still contain these serialized types. + # + # class Address + # def initialize(line, city, country) + # @line, @city, @country = line, city, country + # end + # end + # + # In the above example, if any of the +Address+ attributes is renamed, + # instances that were persisted before the change will be loaded with the + # old attributes. This problem is even worse when the serialized type comes + # from a dependency which doesn't expect to be serialized this way and may + # change its internal representation without notice. + # + # As such, it is heavily recommended to instead convert these objects into + # primitives of the serialization format, for example: + # + # class Address + # attr_reader :line, :city, :country + # + # def self.load(payload) + # data = YAML.safe_load(payload) + # new(data["line"], data["city"], data["country"]) + # end + # + # def self.dump(address) + # YAML.safe_dump( + # "line" => address.line, + # "city" => address.city, + # "country" => address.country, + # ) + # end + # + # def initialize(line, city, country) + # @line, @city, @country = line, city, country + # end + # end + # + # class User < ActiveRecord::Base + # serialize :address, coder: Address + # end + # + # This pattern allows to be more deliberate about what is serialized, and + # to evolve the format in a backward compatible way. + # + # ===== Ensure serialization stability + # + # Some serialization methods may accept some types they don't support by + # silently casting them to other types. This can cause bugs when the + # data is deserialized. + # + # For instance the +JSON+ serializer provided in the standard library will + # silently cast unsupported types to +String+: + # + # >> JSON.parse(JSON.dump(Struct.new(:foo))) + # # => "#" + # + # ==== Examples + # + # ===== Serialize the +preferences+ attribute using YAML + # + # class User < ActiveRecord::Base + # serialize :preferences, coder: YAML + # end + # + # ===== Serialize the +preferences+ attribute using JSON + # + # class User < ActiveRecord::Base + # serialize :preferences, coder: JSON + # end + # + # ===== Serialize the +preferences+ +Hash+ using YAML + # + # class User < ActiveRecord::Base + # serialize :preferences, type: Hash, coder: YAML + # end + # + # ===== Serializes +preferences+ to YAML, permitting select classes + # + # class User < ActiveRecord::Base + # serialize :preferences, coder: YAML, yaml: { permitted_classes: [Symbol, Time] } + # end + # + # ===== Serialize the +preferences+ attribute using a custom coder + # + # class Rot13JSON + # def self.rot13(string) + # string.tr("a-zA-Z", "n-za-mN-ZA-M") + # end + # + # # Serializes an attribute value to a string that will be stored in the database. + # def self.dump(value) + # rot13(ActiveSupport::JSON.dump(value)) + # end + # + # # Deserializes a string from the database to an attribute value. + # def self.load(string) + # ActiveSupport::JSON.load(rot13(string)) + # end + # end + # + # class User < ActiveRecord::Base + # serialize :preferences, coder: Rot13JSON + # end + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/serialization.rb:193 + def serialize(attr_name, coder: T.unsafe(nil), type: T.unsafe(nil), comparable: T.unsafe(nil), yaml: T.unsafe(nil), **options); end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/serialization.rb:218 + def build_column_serializer(attr_name, coder, type, yaml = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/serialization.rb:238 + def type_incompatible_with_serialize?(cast_type, coder, type); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/serialization.rb:9 +class ActiveRecord::AttributeMethods::Serialization::ColumnNotSerializableError < ::StandardError + # pkg:gem/activerecord#lib/active_record/attribute_methods/serialization.rb:10 + def initialize(name, type); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:7 +module ActiveRecord::AttributeMethods::TimeZoneConversion + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods + + module GeneratedClassMethods + def skip_time_zone_conversion_for_attributes; end + def skip_time_zone_conversion_for_attributes=(value); end + def skip_time_zone_conversion_for_attributes?; end + def time_zone_aware_attributes; end + def time_zone_aware_attributes=(value); end + def time_zone_aware_attributes?; end + def time_zone_aware_types; end + def time_zone_aware_types=(value); end + def time_zone_aware_types?; end + end + + module GeneratedInstanceMethods + def skip_time_zone_conversion_for_attributes; end + def skip_time_zone_conversion_for_attributes?; end + def time_zone_aware_attributes; end + def time_zone_aware_attributes?; end + def time_zone_aware_types; end + def time_zone_aware_types?; end + end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:73 +module ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:83 + def create_time_zone_conversion_attribute?(name, cast_type); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:75 + def hook_attribute_type(name, cast_type); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:8 +class ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter + # pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:39 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:17 + def cast(value); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:13 + def deserialize(value); end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:44 + def convert_time_to_time_zone(value); end + + # pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:60 + def set_time_zone_without_conversion(value); end + + class << self + # pkg:gem/activerecord#lib/active_record/attribute_methods/time_zone_conversion.rb:9 + def new(subtype); end + end +end + +# = Active Record Attribute Methods \Write +# +# pkg:gem/activerecord#lib/active_record/attribute_methods/write.rb:6 +module ActiveRecord::AttributeMethods::Write + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::AttributeMethods::Write::ClassMethods + + # This method exists to avoid the expensive primary_key check internally, without + # breaking compatibility with the write_attribute API + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/write.rb:41 + def _write_attribute(attr_name, value); end + + # Updates the attribute identified by +attr_name+ using the specified + # +value+. The attribute value will be type cast upon being read. + # + # pkg:gem/activerecord#lib/active_record/attribute_methods/write.rb:31 + def write_attribute(attr_name, value); end + + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/write.rb:45 + def attribute=(attr_name, value); end +end + +# pkg:gem/activerecord#lib/active_record/attribute_methods/write.rb:13 +module ActiveRecord::AttributeMethods::Write::ClassMethods + private + + # pkg:gem/activerecord#lib/active_record/attribute_methods/write.rb:15 + def define_method_attribute=(canonical_name, owner:, as: T.unsafe(nil)); end +end + +# See ActiveRecord::Attributes::ClassMethods for documentation +# +# pkg:gem/activerecord#lib/active_record/attributes.rb:7 +module ActiveRecord::Attributes + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveModel::AttributeRegistration + include ::ActiveModel::AttributeMethods + include ::ActiveModel::Dirty + include ::ActiveSupport::Callbacks + include ::ActiveModel::Validations::Callbacks + include ::ActiveModel::Attributes::Normalization + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::AttributeRegistration::ClassMethods + mixes_in_class_methods ::ActiveModel::Attributes::Normalization::ClassMethods + mixes_in_class_methods ::ActiveModel::AttributeMethods::ClassMethods + mixes_in_class_methods ::ActiveModel::Validations::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::DescendantsTracker + mixes_in_class_methods ::ActiveRecord::Attributes::ClassMethods + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + def attribute_aliases; end + def attribute_aliases=(value); end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns=(value); end + def attribute_method_patterns?; end + def normalized_attributes; end + def normalized_attributes=(value); end + def normalized_attributes?; end + end + + module GeneratedInstanceMethods + def __callbacks; end + def attribute_aliases; end + def attribute_aliases?; end + def attribute_method_patterns; end + def attribute_method_patterns?; end + def normalized_attributes; end + def normalized_attributes=(value); end + def normalized_attributes?; end + end +end + +# = Active Record \Attributes +# +# pkg:gem/activerecord#lib/active_record/attributes.rb:13 +module ActiveRecord::Attributes::ClassMethods + # pkg:gem/activerecord#lib/active_record/attributes.rb:253 + def _default_attributes; end + + # This API only accepts type objects, and will do its work immediately instead of + # waiting for the schema to load. While this method + # is provided so it can be used by plugin authors, application code + # should probably use ClassMethods#attribute. + # + # ==== Parameters + # + # [+name+] + # The name of the attribute being defined. Expected to be a +String+. + # + # [+cast_type+] + # The type object to use for this attribute. + # + # [+default+] + # The default value to use when no value is provided. If this option + # is not passed, the previous default value (if any) will be used. + # Otherwise, the default will be +nil+. A proc can also be passed, and + # will be called once each time a new value is needed. + # + # [+user_provided_default+] + # Whether the default value should be cast using +cast+ or +deserialize+. + # + # pkg:gem/activerecord#lib/active_record/attributes.rb:243 + def define_attribute(name, cast_type, default: T.unsafe(nil), user_provided_default: T.unsafe(nil)); end + + protected + + # pkg:gem/activerecord#lib/active_record/attributes.rb:281 + def reload_schema_from_cache(*); end + + private + + # pkg:gem/activerecord#lib/active_record/attributes.rb:290 + def define_default_attribute(name, value, type, from_user:); end + + # pkg:gem/activerecord#lib/active_record/attributes.rb:306 + def reset_default_attributes; end + + # pkg:gem/activerecord#lib/active_record/attributes.rb:310 + def resolve_type_name(name, **options); end + + # pkg:gem/activerecord#lib/active_record/attributes.rb:314 + def type_for_column(connection, column); end +end + +# pkg:gem/activerecord#lib/active_record/attributes.rb:287 +ActiveRecord::Attributes::ClassMethods::NO_DEFAULT_PROVIDED = T.let(T.unsafe(nil), Object) + +# = Active Record Autosave Association +# +# AutosaveAssociation is a module that takes care of automatically saving +# associated records when their parent is saved. In addition to saving, it +# also destroys any associated records that were marked for destruction. +# (See #mark_for_destruction and #marked_for_destruction?). +# +# Saving of the parent, its associations, and the destruction of marked +# associations, all happen inside a transaction. This should never leave the +# database in an inconsistent state. +# +# If validations for any of the associations fail, their error messages will +# be applied to the parent. +# +# Note that it also means that associations marked for destruction won't +# be destroyed directly. They will however still be marked for destruction. +# +# Note that autosave: false is not same as not declaring :autosave. +# When the :autosave option is not present then new association records are +# saved but the updated association records are not saved. +# +# == Validation +# +# Child records are validated unless :validate is +false+. +# +# == \Callbacks +# +# Association with autosave option defines several callbacks on your +# model (around_save, before_save, after_create, after_update). Please note that +# callbacks are executed in the order they were defined in +# model. You should avoid modifying the association content before +# autosave callbacks are executed. Placing your callbacks after +# associations is usually a good practice. +# +# === One-to-one Example +# +# class Post < ActiveRecord::Base +# has_one :author, autosave: true +# end +# +# Saving changes to the parent and its associated model can now be performed +# automatically _and_ atomically: +# +# post = Post.find(1) +# post.title # => "The current global position of migrating ducks" +# post.author.name # => "alloy" +# +# post.title = "On the migration of ducks" +# post.author.name = "Eloy Duran" +# +# post.save +# post.reload +# post.title # => "On the migration of ducks" +# post.author.name # => "Eloy Duran" +# +# Destroying an associated model, as part of the parent's save action, is as +# simple as marking it for destruction: +# +# post.author.mark_for_destruction +# post.author.marked_for_destruction? # => true +# +# Note that the model is _not_ yet removed from the database: +# +# id = post.author.id +# Author.find_by(id: id).nil? # => false +# +# post.save +# post.reload.author # => nil +# +# Now it _is_ removed from the database: +# +# Author.find_by(id: id).nil? # => true +# +# === One-to-many Example +# +# When :autosave is not declared new children are saved when their parent is saved: +# +# class Post < ActiveRecord::Base +# has_many :comments # :autosave option is not declared +# end +# +# post = Post.new(title: 'ruby rocks') +# post.comments.build(body: 'hello world') +# post.save # => saves both post and comment +# +# post = Post.create(title: 'ruby rocks') +# post.comments.build(body: 'hello world') +# post.save # => saves both post and comment +# +# post = Post.create(title: 'ruby rocks') +# comment = post.comments.create(body: 'hello world') +# comment.body = 'hi everyone' +# post.save # => saves post, but not comment +# +# When :autosave is true all children are saved, no matter whether they +# are new records or not: +# +# class Post < ActiveRecord::Base +# has_many :comments, autosave: true +# end +# +# post = Post.create(title: 'ruby rocks') +# comment = post.comments.create(body: 'hello world') +# comment.body = 'hi everyone' +# post.comments.build(body: "good morning.") +# post.save # => saves post and both comments. +# +# Destroying one of the associated models as part of the parent's save action +# is as simple as marking it for destruction: +# +# post.comments # => [#, # +# post.comments[1].mark_for_destruction +# post.comments[1].marked_for_destruction? # => true +# post.comments.length # => 2 +# +# Note that the model is _not_ yet removed from the database: +# +# id = post.comments.last.id +# Comment.find_by(id: id).nil? # => false +# +# post.save +# post.reload.comments.length # => 1 +# +# Now it _is_ removed from the database: +# +# Comment.find_by(id: id).nil? # => true +# +# === Caveats +# +# Note that autosave will only trigger for already-persisted association records +# if the records themselves have been changed. This is to protect against +# SystemStackError caused by circular association validations. The one +# exception is if a custom validation context is used, in which case the validations +# will always fire on the associated records. +# +# pkg:gem/activerecord#lib/active_record/autosave_association.rb:140 +module ActiveRecord::AutosaveAssociation + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::AutosaveAssociation::ClassMethods + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:284 + def autosaving_belongs_to_for?(association); end + + # Returns whether or not this record has been changed in any way (including whether + # any of its nested autosave associations are likewise changed) + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:275 + def changed_for_autosave?; end + + # Returns the association for the parent being destroyed. + # + # Used to avoid updating the counter cache unnecessarily. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:269 + def destroyed_by_association; end + + # Records the association that is being destroyed and destroying this + # record in the process. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:262 + def destroyed_by_association=(reflection); end + + # Marks this record to be destroyed as part of the parent's save transaction. + # This does _not_ actually destroy the record instantly, rather child record will be destroyed + # when parent.save is called. + # + # Only useful if the :autosave option on the parent is enabled for this associated model. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:249 + def mark_for_destruction; end + + # Returns whether or not this record will be destroyed as part of the parent's save transaction. + # + # Only useful if the :autosave option on the parent is enabled for this associated model. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:256 + def marked_for_destruction?; end + + # Reloads the attributes of the object as usual and clears marked_for_destruction flag. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:238 + def reload(options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:279 + def validating_belongs_to_for?(association); end + + private + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:592 + def _ensure_no_duplicate_errors; end + + # If the record is new or it has changed, returns true. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:510 + def _record_changed?(reflection, record, key); end + + # Is used as an around_save callback to check while saving a collection + # association whether or not the parent was a new record before saving. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:402 + def around_save_collection_association; end + + # Returns the record for an association collection that should be validated + # or saved. If +autosave+ is +false+ only new records will be returned, + # unless the parent is/was a new record itself. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:298 + def associated_records_to_validate_or_save(association, new_record, autosave); end + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:517 + def association_foreign_key_changed?(reflection, record, key); end + + # Returns whether or not the association is valid and applies any errors to + # the parent, self, if it wasn't. Skips any :autosave + # enabled records if they're marked_for_destruction? or destroyed. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:371 + def association_valid?(association, record); end + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:576 + def compute_primary_key(reflection, record); end + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:290 + def init_internals; end + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:526 + def inverse_polymorphic_association_changed?(reflection, record); end + + # Go through nested autosave associations that are loaded in memory (without loading + # any new ones), and return true if any are changed for autosave. + # Returns false if already called to prevent an infinite loop. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:311 + def nested_records_changed_for_autosave?; end + + # Saves the associated record if it's new or :autosave is enabled. + # + # In addition, it will destroy the association if it was marked for destruction. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:536 + def save_belongs_to_association(reflection); end + + # Saves any new associated records, or all loaded autosave associations if + # :autosave is enabled on the association. + # + # In addition, it destroys all children that were marked for destruction + # with #mark_for_destruction. + # + # This all happens inside a transaction, _if_ the Transactions module is included into + # ActiveRecord::Base after the AutosaveAssociation module, which it does by default. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:419 + def save_collection_association(reflection); end + + # Saves the associated record if it's new or :autosave is enabled + # on the association. + # + # In addition, it will destroy the association if it was marked for + # destruction with #mark_for_destruction. + # + # This all happens inside a transaction, _if_ the Transactions module is included into + # ActiveRecord::Base after the AutosaveAssociation module, which it does by default. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:473 + def save_has_one_association(reflection); end + + # Validate the association if :validate or :autosave is + # turned on for the belongs_to association. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:343 + def validate_belongs_to_association(reflection); end + + # Validate the associated records if :validate or + # :autosave is turned on for the association specified by + # +reflection+. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:360 + def validate_collection_association(reflection); end + + # Validate the association if :validate or :autosave is + # turned on for the has_one association. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:329 + def validate_has_one_association(reflection); end +end + +# pkg:gem/activerecord#lib/active_record/autosave_association.rb:143 +module ActiveRecord::AutosaveAssociation::AssociationBuilderExtension + class << self + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:144 + def build(model, reflection); end + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:148 + def valid_options; end + end +end + +# pkg:gem/activerecord#lib/active_record/autosave_association.rb:157 +module ActiveRecord::AutosaveAssociation::ClassMethods + private + + # Adds validation and save callbacks for the association as specified by + # the +reflection+. + # + # For performance reasons, we don't check whether to validate at runtime. + # However the validation and callback methods are lazy and those methods + # get created when they are invoked for the very first time. However, + # this can change, for instance, when using nested attributes, which is + # called _after_ the association has been defined. Since we don't want + # the callbacks to get defined multiple times, there are guards that + # check if the save or validation methods have already been defined + # before actually defining them. + # + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:189 + def add_autosave_association_callbacks(reflection); end + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:219 + def define_autosave_validation_callbacks(reflection); end + + # pkg:gem/activerecord#lib/active_record/autosave_association.rb:159 + def define_non_cyclic_method(name, &block); end +end + +# = Active Record +# +# Active Record objects don't specify their attributes directly, but rather infer them from +# the table definition with which they're linked. Adding, removing, and changing attributes +# and their type is done directly in the database. Any change is instantly reflected in the +# Active Record objects. The mapping that binds a given Active Record class to a certain +# database table will happen automatically in most common cases, but can be overwritten for the uncommon ones. +# +# See the mapping rules in table_name and the full example in link:files/activerecord/README_rdoc.html for more insight. +# +# == Creation +# +# Active Records accept constructor parameters either in a hash or as a block. The hash +# method is especially useful when you're receiving the data from somewhere else, like an +# HTTP request. It works like this: +# +# user = User.new(name: "David", occupation: "Code Artist") +# user.name # => "David" +# +# You can also use block initialization: +# +# user = User.new do |u| +# u.name = "David" +# u.occupation = "Code Artist" +# end +# +# And of course you can just create a bare object and specify the attributes after the fact: +# +# user = User.new +# user.name = "David" +# user.occupation = "Code Artist" +# +# == Conditions +# +# Conditions can either be specified as a string, array, or hash representing the WHERE-part of an SQL statement. +# The array form is to be used when the condition input is tainted and requires sanitization. The string form can +# be used for statements that don't involve tainted data. The hash form works much like the array form, except +# only equality and range is possible. Examples: +# +# class User < ActiveRecord::Base +# def self.authenticate_unsafely(user_name, password) +# where("user_name = '#{user_name}' AND password = '#{password}'").first +# end +# +# def self.authenticate_safely(user_name, password) +# where("user_name = ? AND password = ?", user_name, password).first +# end +# +# def self.authenticate_safely_simply(user_name, password) +# where(user_name: user_name, password: password).first +# end +# end +# +# The authenticate_unsafely method inserts the parameters directly into the query +# and is thus susceptible to SQL-injection attacks if the user_name and +password+ +# parameters come directly from an HTTP request. The authenticate_safely and +# authenticate_safely_simply both will sanitize the user_name and +password+ +# before inserting them in the query, which will ensure that an attacker can't escape the +# query and fake the login (or worse). +# +# When using multiple parameters in the conditions, it can easily become hard to read exactly +# what the fourth or fifth question mark is supposed to represent. In those cases, you can +# resort to named bind variables instead. That's done by replacing the question marks with +# symbols and supplying a hash with values for the matching symbol keys: +# +# Company.where( +# "id = :id AND name = :name AND division = :division AND created_at > :accounting_date", +# { id: 3, name: "37signals", division: "First", accounting_date: '2005-01-01' } +# ).first +# +# Similarly, a simple hash without a statement will generate conditions based on equality with the SQL AND +# operator. For instance: +# +# Student.where(first_name: "Harvey", status: 1) +# Student.where(params[:student]) +# +# A range may be used in the hash to use the SQL BETWEEN operator: +# +# Student.where(grade: 9..12) +# +# An array may be used in the hash to use the SQL IN operator: +# +# Student.where(grade: [9,11,12]) +# +# When joining tables, nested hashes or keys written in the form 'table_name.column_name' +# can be used to qualify the table name of a particular condition. For instance: +# +# Student.joins(:schools).where(schools: { category: 'public' }) +# Student.joins(:schools).where('schools.category' => 'public' ) +# +# == Overwriting default accessors +# +# All column values are automatically available through basic accessors on the Active Record +# object, but sometimes you want to specialize this behavior. This can be done by overwriting +# the default accessors (using the same name as the attribute) and calling +# +super+ to actually change things. +# +# class Song < ActiveRecord::Base +# # Uses an integer of seconds to hold the length of the song +# +# def length=(minutes) +# super(minutes.to_i * 60) +# end +# +# def length +# super / 60 +# end +# end +# +# == Attribute query methods +# +# In addition to the basic accessors, query methods are also automatically available on the Active Record object. +# Query methods allow you to test whether an attribute value is present. +# Additionally, when dealing with numeric values, a query method will return false if the value is zero. +# +# For example, an Active Record User with the name attribute has a name? method that you can call +# to determine whether the user has a name: +# +# user = User.new(name: "David") +# user.name? # => true +# +# anonymous = User.new(name: "") +# anonymous.name? # => false +# +# Query methods will also respect any overrides of default accessors: +# +# class User +# # Has admin boolean column +# def admin +# false +# end +# end +# +# user.update(admin: true) +# +# user.read_attribute(:admin) # => true, gets the column value +# user[:admin] # => true, also gets the column value +# +# user.admin # => false, due to the getter override +# user.admin? # => false, due to the getter override +# +# == Accessing attributes before they have been typecasted +# +# Sometimes you want to be able to read the raw attribute data without having the column-determined +# typecast run its course first. That can be done by using the _before_type_cast +# accessors that all attributes have. For example, if your Account model has a balance attribute, +# you can call account.balance_before_type_cast or account.id_before_type_cast. +# +# This is especially useful in validation situations where the user might supply a string for an +# integer field and you want to display the original string back in an error message. Accessing the +# attribute normally would typecast the string to 0, which isn't what you want. +# +# == Dynamic attribute-based finders +# +# Dynamic attribute-based finders are a mildly deprecated way of getting (and/or creating) objects +# by simple queries without turning to SQL. They work by appending the name of an attribute +# to find_by_ like Person.find_by_user_name. +# Instead of writing Person.find_by(user_name: user_name), you can use +# Person.find_by_user_name(user_name). +# +# It's possible to add an exclamation point (!) on the end of the dynamic finders to get them to raise an +# ActiveRecord::RecordNotFound error if they do not return any records, +# like Person.find_by_last_name!. +# +# It's also possible to use multiple attributes in the same find_by_ by separating them with +# "_and_". +# +# Person.find_by(user_name: user_name, password: password) +# Person.find_by_user_name_and_password(user_name, password) # with dynamic finder +# +# It's even possible to call these dynamic finder methods on relations and named scopes. +# +# Payment.order("created_on").find_by_amount(50) +# +# == Saving arrays, hashes, and other non-mappable objects in text columns +# +# Active Record can serialize any object in text columns using YAML. To do so, you must +# specify this with a call to the class method +# {serialize}[rdoc-ref:AttributeMethods::Serialization::ClassMethods#serialize]. +# This makes it possible to store arrays, hashes, and other non-mappable objects without doing +# any additional work. +# +# class User < ActiveRecord::Base +# serialize :preferences +# end +# +# user = User.create(preferences: { "background" => "black", "display" => large }) +# User.find(user.id).preferences # => { "background" => "black", "display" => large } +# +# You can also specify a class option as the second parameter that'll raise an exception +# if a serialized object is retrieved as a descendant of a class not in the hierarchy. +# +# class User < ActiveRecord::Base +# serialize :preferences, Hash +# end +# +# user = User.create(preferences: %w( one two three )) +# User.find(user.id).preferences # raises SerializationTypeMismatch +# +# When you specify a class option, the default value for that attribute will be a new +# instance of that class. +# +# class User < ActiveRecord::Base +# serialize :preferences, OpenStruct +# end +# +# user = User.new +# user.preferences.theme_color = "red" +# +# +# == Single table inheritance +# +# Active Record allows inheritance by storing the name of the class in a +# column that is named "type" by default. See ActiveRecord::Inheritance for +# more details. +# +# == Connection to multiple databases in different models +# +# Connections are usually created through +# {ActiveRecord::Base.establish_connection}[rdoc-ref:ConnectionHandling#establish_connection] and retrieved +# by ActiveRecord::Base.lease_connection. All classes inheriting from ActiveRecord::Base will use this +# connection. But you can also set a class-specific connection. For example, if Course is an +# ActiveRecord::Base, but resides in a different database, you can just say Course.establish_connection +# and Course and all of its subclasses will use this connection instead. +# +# This feature is implemented by keeping a connection pool in ActiveRecord::Base that is +# a hash indexed by the class. If a connection is requested, the +# {ActiveRecord::Base.retrieve_connection}[rdoc-ref:ConnectionHandling#retrieve_connection] method +# will go up the class-hierarchy until a connection is found in the connection pool. +# +# == Exceptions +# +# * ActiveRecordError - Generic error class and superclass of all other errors raised by Active Record. +# * AdapterNotSpecified - The configuration hash used in +# {ActiveRecord::Base.establish_connection}[rdoc-ref:ConnectionHandling#establish_connection] +# didn't include an :adapter key. +# * AdapterNotFound - The :adapter key used in +# {ActiveRecord::Base.establish_connection}[rdoc-ref:ConnectionHandling#establish_connection] +# specified a non-existent adapter +# (or a bad spelling of an existing one). +# * AssociationTypeMismatch - The object assigned to the association wasn't of the type +# specified in the association definition. +# * AttributeAssignmentError - An error occurred while doing a mass assignment through the +# {ActiveRecord::Base#attributes=}[rdoc-ref:ActiveModel::AttributeAssignment#attributes=] method. +# You can inspect the +attribute+ property of the exception object to determine which attribute +# triggered the error. +# * ConnectionNotEstablished - No connection has been established. +# Use {ActiveRecord::Base.establish_connection}[rdoc-ref:ConnectionHandling#establish_connection] before querying. +# * MultiparameterAssignmentErrors - Collection of errors that occurred during a mass assignment using the +# {ActiveRecord::Base#attributes=}[rdoc-ref:ActiveModel::AttributeAssignment#attributes=] method. +# The +errors+ property of this exception contains an array of +# AttributeAssignmentError +# objects that should be inspected to determine which attributes triggered the errors. +# * RecordInvalid - raised by {ActiveRecord::Base#save!}[rdoc-ref:Persistence#save!] and +# {ActiveRecord::Base.create!}[rdoc-ref:Persistence::ClassMethods#create!] +# when the record is invalid. +# * RecordNotFound - No record responded to the {ActiveRecord::Base.find}[rdoc-ref:FinderMethods#find] method. +# Either the row with the given ID doesn't exist or the row didn't meet the additional restrictions. +# Some {ActiveRecord::Base.find}[rdoc-ref:FinderMethods#find] calls do not raise this exception to signal +# nothing was found, please check its documentation for further details. +# * SerializationTypeMismatch - The serialized object wasn't of the class specified as the second parameter. +# * StatementInvalid - The database server rejected the SQL statement. The precise error is added in the message. +# +# *Note*: The attributes listed are class-level attributes (accessible from both the class and instance level). +# So it's possible to assign a logger to the class through Base.logger= which will then be used by all +# instances in the current object space. +# +# pkg:gem/activerecord#lib/active_record/base.rb:282 +class ActiveRecord::Base + include ::ActionText::Encryption + include ::ActiveModel::Validations + include ::ActiveSupport::Callbacks + include ::ActiveModel::Validations::HelperMethods + include ::ActiveModel::Conversion + include ::ActiveModel::ForbiddenAttributesProtection + include ::ActiveModel::AttributeAssignment + include ::ActiveModel::API + include ::ActiveModel::Access + include ::ActiveRecord::Core + include ::ActiveRecord::Persistence + include ::ActiveRecord::ReadonlyAttributes + include ::ActiveRecord::ModelSchema + include ::ActiveRecord::Inheritance + include ::ActiveRecord::Scoping + include ::ActiveRecord::Scoping::Default + include ::ActiveRecord::Scoping::Named + include ::ActiveRecord::Sanitization + include ::ActiveRecord::AttributeAssignment + include ::ActiveRecord::Integration + include ::ActiveRecord::Validations + include ::ActiveRecord::CounterCache + include ::ActiveModel::AttributeRegistration + include ::ActiveModel::Attributes::Normalization + include ::ActiveModel::AttributeMethods + include ::ActiveModel::Dirty + include ::ActiveModel::Validations::Callbacks + include ::ActiveRecord::Attributes + include ::ActiveRecord::Locking::Optimistic + include ::ActiveRecord::Locking::Pessimistic + include ::ActiveRecord::Encryption::EncryptableRecord + include ::ActiveRecord::AttributeMethods + include ::ActiveRecord::Base::GeneratedAttributeMethods + include ::ActiveRecord::Base::GeneratedAssociationMethods + include ::ActiveRecord::AttributeMethods::Read + include ::ActiveRecord::AttributeMethods::Write + include ::ActiveRecord::AttributeMethods::BeforeTypeCast + include ::ActiveRecord::AttributeMethods::Query + include ::ActiveRecord::AttributeMethods::PrimaryKey + include ::ActiveRecord::AttributeMethods::TimeZoneConversion + include ::ActiveRecord::AttributeMethods::Dirty + include ::ActiveRecord::AttributeMethods::Serialization + include ::ActiveRecord::Callbacks + include ::ActiveRecord::Timestamp + include ::ActiveRecord::Associations + include ::ActiveModel::SecurePassword + include ::ActiveRecord::SecurePassword + include ::ActiveRecord::AutosaveAssociation + include ::ActiveRecord::NestedAttributes + include ::ActiveRecord::Transactions + include ::ActiveRecord::TouchLater + include ::ActiveRecord::NoTouching + include ::ActiveRecord::Reflection + include ::ActiveModel::Serialization + include ::ActiveModel::Serializers::JSON + include ::ActiveRecord::Serialization + include ::ActiveRecord::Store + include ::ActiveRecord::SecureToken + include ::ActiveRecord::TokenFor + include ::ActiveRecord::SignedId + include ::ActiveRecord::Suppressor + include ::ActiveRecord::Marshalling::Methods + include ::CanCan::ModelAdditions + include ::ActiveStorage::Attached::Model + include ::ActiveStorage::Reflection::ActiveRecordExtensions + include ::ActionText::Attribute + extend ::ActiveModel::Validations::ClassMethods + extend ::ActiveModel::Naming + extend ::ActiveModel::Callbacks + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + extend ::ActiveModel::Translation + extend ::ActiveModel::Validations::HelperMethods + extend ::ActiveModel::Conversion::ClassMethods + extend ::ActiveSupport::Benchmarkable + extend ::ActiveRecord::ConnectionHandling + extend ::ActiveRecord::QueryCache::ClassMethods + extend ::ActiveRecord::Querying + extend ::ActiveRecord::Translation + extend ::ActiveRecord::DynamicMatchers + extend ::ActiveRecord::DelegatedType + extend ::ActiveRecord::Explain + extend ::ActiveRecord::Enum + extend ::ActiveRecord::Delegation::DelegateCache + extend ::ActiveRecord::Aggregations::ClassMethods + extend ::ActiveRecord::Core::ClassMethods + extend ::ActiveRecord::Persistence::ClassMethods + extend ::ActiveRecord::ReadonlyAttributes::ClassMethods + extend ::ActiveRecord::ModelSchema::ClassMethods + extend ::ActiveRecord::Inheritance::ClassMethods + extend ::ActiveRecord::Scoping::ClassMethods + extend ::ActiveRecord::Scoping::Default::ClassMethods + extend ::ActiveRecord::Scoping::Named::ClassMethods + extend ::ActiveRecord::Sanitization::ClassMethods + extend ::ActiveRecord::Integration::ClassMethods + extend ::ActiveRecord::Validations::ClassMethods + extend ::ActiveRecord::CounterCache::ClassMethods + extend ::ActiveModel::AttributeRegistration::ClassMethods + extend ::ActiveModel::Attributes::Normalization::ClassMethods + extend ::ActiveModel::AttributeMethods::ClassMethods + extend ::ActiveModel::Validations::Callbacks::ClassMethods + extend ::ActiveRecord::Attributes::ClassMethods + extend ::ActiveRecord::Locking::Optimistic::ClassMethods + extend ::ActiveRecord::Encryption::EncryptableRecord::ClassMethods + extend ::ActiveRecord::AttributeMethods::ClassMethods + extend ::ActiveRecord::AttributeMethods::Read::ClassMethods + extend ::ActiveRecord::AttributeMethods::Write::ClassMethods + extend ::ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods + extend ::ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods + extend ::ActiveRecord::AttributeMethods::Serialization::ClassMethods + extend ::ActiveRecord::Callbacks::ClassMethods + extend ::ActiveRecord::Timestamp::ClassMethods + extend ::ActiveRecord::Associations::ClassMethods + extend ::ActiveModel::SecurePassword::ClassMethods + extend ::ActiveRecord::SecurePassword::ClassMethods + extend ::ActiveRecord::AutosaveAssociation::ClassMethods + extend ::ActiveRecord::NestedAttributes::ClassMethods + extend ::ActiveRecord::Transactions::ClassMethods + extend ::ActiveRecord::NoTouching::ClassMethods + extend ::ActiveRecord::Reflection::ClassMethods + extend ::ActiveRecord::Store::ClassMethods + extend ::ActiveRecord::SecureToken::ClassMethods + extend ::ActiveRecord::TokenFor::ClassMethods + extend ::ActiveRecord::SignedId::ClassMethods + extend ::ActiveRecord::Suppressor::ClassMethods + extend ::CanCan::ModelAdditions::ClassMethods + extend ::ActiveStorage::Attached::Model::ClassMethods + extend ::ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods + extend ::ActionText::Attribute::ClassMethods + extend ::ActiveRecord::SignedId::DeprecateSignedIdVerifierSecret + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def __callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _before_commit_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _commit_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _create_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _destroy_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _find_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _initialize_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def _reflections; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def _reflections?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _rollback_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _run_before_commit_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _run_before_commit_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _run_commit_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _run_commit_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_create_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_create_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_destroy_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_destroy_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_find_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_find_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_initialize_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_initialize_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _run_rollback_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _run_rollback_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_save_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_save_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_touch_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_touch_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_update_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _run_update_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _run_validate_callbacks(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _run_validate_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def _run_validation_callbacks(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def _run_validation_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _save_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _touch_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _update_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _validate_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def _validation_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _validators; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _validators?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def aggregate_reflections; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def aggregate_reflections?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:336 + def attachment_reflections; end + + # pkg:gem/activerecord#lib/active_record/base.rb:336 + def attachment_reflections?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_aliases; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_aliases?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_method_patterns; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_method_patterns?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatic_scope_inversing; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatic_scope_inversing?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatically_invert_plural_associations; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatically_invert_plural_associations?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_timestamp_format; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_timestamp_format?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_versioning; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_versioning?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def collection_cache_versioning; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def collection_cache_versioning?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def column_for_attribute(name, &); end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def counter_cached_association_names; end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def counter_cached_association_names?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_connection_handler; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_connection_handler?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_role; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_role?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def default_scope_override; end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def default_scopes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_shard; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_shard?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:295 + def defined_enums; end + + # pkg:gem/activerecord#lib/active_record/base.rb:295 + def defined_enums?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def destroy_association_async_batch_size; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def destroy_association_async_job(&); end + + # pkg:gem/activerecord#lib/active_record/base.rb:313 + def encrypted_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:313 + def encrypted_attributes=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/base.rb:313 + def encrypted_attributes?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:325 + def include_root_in_json; end + + # pkg:gem/activerecord#lib/active_record/base.rb:325 + def include_root_in_json?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:311 + def lock_optimistically; end + + # pkg:gem/activerecord#lib/active_record/base.rb:311 + def lock_optimistically?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def logger; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def logger?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def model_name(&); end + + # pkg:gem/activerecord#lib/active_record/base.rb:320 + def nested_attributes_options; end + + # pkg:gem/activerecord#lib/active_record/base.rb:320 + def nested_attributes_options?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def normalized_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def normalized_attributes=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def normalized_attributes?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def param_delimiter=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_inserts; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_inserts?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_updates; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_updates?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def pluralize_table_names; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def pluralize_table_names?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def primary_key_prefix_type; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def primary_key_prefix_type?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:316 + def record_timestamps; end + + # pkg:gem/activerecord#lib/active_record/base.rb:316 + def record_timestamps=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/base.rb:316 + def record_timestamps?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def signed_id_verifier_secret; end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def signed_id_verifier_secret?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def skip_time_zone_conversion_for_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def skip_time_zone_conversion_for_attributes?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_class_name; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_class_name?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_sti_class; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_sti_class?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_prefix; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_prefix?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_suffix; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_suffix?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_attributes?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_types; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_types?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def type_for_attribute(*, **, &); end + + class << self + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def __callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def __callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:301 + def _attr_readonly; end + + # pkg:gem/activerecord#lib/active_record/base.rb:301 + def _attr_readonly=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:301 + def _attr_readonly?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _before_commit_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _before_commit_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _commit_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _commit_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def _counter_cache_columns; end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def _counter_cache_columns=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def _counter_cache_columns?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _create_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _create_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def _destroy_association_async_job; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def _destroy_association_async_job=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def _destroy_association_async_job?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _destroy_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _destroy_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _find_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _find_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _initialize_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _initialize_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def _reflections; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def _reflections=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def _reflections?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _rollback_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:321 + def _rollback_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _save_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _save_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def _signed_id_verifier; end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def _signed_id_verifier=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _touch_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _touch_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _update_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def _update_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _validate_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _validate_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def _validation_callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def _validation_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _validators; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _validators=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def _validators?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def after_create(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def after_destroy(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def after_find(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def after_initialize(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def after_save(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def after_touch(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def after_update(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def aggregate_reflections; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def aggregate_reflections=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def aggregate_reflections?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def application_record_class?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def around_create(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def around_destroy(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def around_save(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def around_update(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def asynchronous_queries_session; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def asynchronous_queries_tracker; end + + # pkg:gem/activerecord#lib/active_record/base.rb:336 + def attachment_reflections; end + + # pkg:gem/activerecord#lib/active_record/base.rb:336 + def attachment_reflections=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:336 + def attachment_reflections?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_aliases; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_aliases=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_aliases?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_method_patterns; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_method_patterns=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def attribute_method_patterns?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def attributes_for_inspect; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def attributes_for_inspect=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def attributes_for_inspect?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatic_scope_inversing; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatic_scope_inversing=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatic_scope_inversing?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatically_invert_plural_associations; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatically_invert_plural_associations=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def automatically_invert_plural_associations?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def before_create(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def before_destroy(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def before_save(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:315 + def before_update(*args, **options, &block); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def belongs_to_required_by_default; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def belongs_to_required_by_default=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def belongs_to_required_by_default?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_timestamp_format; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_timestamp_format=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_timestamp_format?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_versioning; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_versioning=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def cache_versioning?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def collection_cache_versioning; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def collection_cache_versioning=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def collection_cache_versioning?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def configurations; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def configurations=(config); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def connected_to_stack; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def connection_class; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def connection_class=(b); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def connection_class?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def connection_class_for_self; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def connection_handler; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def connection_handler=(handler); end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def counter_cached_association_names; end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def counter_cached_association_names=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def counter_cached_association_names?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def current_preventing_writes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def current_role; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def current_shard; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def default_column_serializer; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def default_column_serializer=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def default_column_serializer?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_connection_handler; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_connection_handler=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_connection_handler?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_role; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_role=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_role?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def default_scope_override; end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def default_scope_override=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def default_scopes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def default_scopes=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_shard; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_shard=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def default_shard?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:295 + def defined_enums; end + + # pkg:gem/activerecord#lib/active_record/base.rb:295 + def defined_enums=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:295 + def defined_enums?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def destroy_association_async_batch_size; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def destroy_association_async_batch_size=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def destroy_association_async_job; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def destroy_association_async_job=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:313 + def encrypted_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:313 + def encrypted_attributes=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:313 + def encrypted_attributes?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def enumerate_columns_in_select_statements; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def enumerate_columns_in_select_statements=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def enumerate_columns_in_select_statements?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:328 + def generated_token_verifier; end + + # pkg:gem/activerecord#lib/active_record/base.rb:328 + def generated_token_verifier=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def has_many_inversing; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def has_many_inversing=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def has_many_inversing?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def immutable_strings_by_default; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def immutable_strings_by_default=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def immutable_strings_by_default?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def implicit_order_column; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def implicit_order_column=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def implicit_order_column?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:325 + def include_root_in_json; end + + # pkg:gem/activerecord#lib/active_record/base.rb:325 + def include_root_in_json=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:325 + def include_root_in_json?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def inheritance_column; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def inheritance_column=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def inheritance_column?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def internal_metadata_table_name; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def internal_metadata_table_name=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def internal_metadata_table_name?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:326 + def local_stored_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:326 + def local_stored_attributes=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/base.rb:311 + def lock_optimistically; end + + # pkg:gem/activerecord#lib/active_record/base.rb:311 + def lock_optimistically=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:311 + def lock_optimistically?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def logger; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def logger=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def logger?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:320 + def nested_attributes_options; end + + # pkg:gem/activerecord#lib/active_record/base.rb:320 + def nested_attributes_options=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:320 + def nested_attributes_options?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def normalized_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def normalized_attributes=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def normalized_attributes?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def param_delimiter; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def param_delimiter=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def param_delimiter?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_inserts; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_inserts=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_inserts?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_updates; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_updates=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def partial_updates?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def pluralize_table_names; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def pluralize_table_names=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def pluralize_table_names?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def preventing_writes?(class_name); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def primary_key_prefix_type; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def primary_key_prefix_type=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def primary_key_prefix_type?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:316 + def record_timestamps; end + + # pkg:gem/activerecord#lib/active_record/base.rb:316 + def record_timestamps=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:316 + def record_timestamps?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def run_commit_callbacks_on_first_saved_instances_in_transaction; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def run_commit_callbacks_on_first_saved_instances_in_transaction=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def run_commit_callbacks_on_first_saved_instances_in_transaction?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def schema_migrations_table_name; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def schema_migrations_table_name=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def schema_migrations_table_name?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def shard_selector; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def shard_selector=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def shard_selector?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def signed_id_verifier_secret; end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def signed_id_verifier_secret=(secret); end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def signed_id_verifier_secret?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def skip_time_zone_conversion_for_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def skip_time_zone_conversion_for_attributes=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def skip_time_zone_conversion_for_attributes?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_class_name; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_class_name=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_class_name?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_sti_class; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_sti_class=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def store_full_sti_class?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def strict_loading_by_default; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def strict_loading_by_default=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def strict_loading_by_default?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def strict_loading_mode; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def strict_loading_mode=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def strict_loading_mode?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def strict_loading_violation!(owner:, reflection:); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_prefix; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_prefix=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_prefix?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_suffix; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_suffix=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def table_name_suffix?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_attributes=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_attributes?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_types; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_types=(value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def time_zone_aware_types?; end + + # pkg:gem/activerecord#lib/active_record/base.rb:328 + def token_definitions; end + + # pkg:gem/activerecord#lib/active_record/base.rb:328 + def token_definitions=(value); end + + private + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def __class_attr___callbacks; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:301 + def __class_attr__attr_readonly; end + + # pkg:gem/activerecord#lib/active_record/base.rb:301 + def __class_attr__attr_readonly=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def __class_attr__counter_cache_columns; end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def __class_attr__counter_cache_columns=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr__destroy_association_async_job; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr__destroy_association_async_job=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def __class_attr__reflections; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def __class_attr__reflections=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def __class_attr__signed_id_verifier; end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def __class_attr__signed_id_verifier=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def __class_attr__validators; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def __class_attr__validators=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def __class_attr_aggregate_reflections; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def __class_attr_aggregate_reflections=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:336 + def __class_attr_attachment_reflections; end + + # pkg:gem/activerecord#lib/active_record/base.rb:336 + def __class_attr_attachment_reflections=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def __class_attr_attribute_aliases; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def __class_attr_attribute_aliases=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def __class_attr_attribute_method_patterns; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def __class_attr_attribute_method_patterns=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_attributes_for_inspect; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_attributes_for_inspect=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def __class_attr_automatic_scope_inversing; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def __class_attr_automatic_scope_inversing=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def __class_attr_automatically_invert_plural_associations; end + + # pkg:gem/activerecord#lib/active_record/base.rb:324 + def __class_attr_automatically_invert_plural_associations=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_belongs_to_required_by_default; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_belongs_to_required_by_default=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def __class_attr_cache_timestamp_format; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def __class_attr_cache_timestamp_format=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def __class_attr_cache_versioning; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def __class_attr_cache_versioning=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def __class_attr_collection_cache_versioning; end + + # pkg:gem/activerecord#lib/active_record/base.rb:307 + def __class_attr_collection_cache_versioning=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def __class_attr_counter_cached_association_names; end + + # pkg:gem/activerecord#lib/active_record/base.rb:309 + def __class_attr_counter_cached_association_names=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_default_column_serializer; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_default_column_serializer=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_default_connection_handler; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_default_connection_handler=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_default_role; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_default_role=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def __class_attr_default_scope_override; end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def __class_attr_default_scope_override=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def __class_attr_default_scopes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:304 + def __class_attr_default_scopes=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_default_shard; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_default_shard=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:295 + def __class_attr_defined_enums; end + + # pkg:gem/activerecord#lib/active_record/base.rb:295 + def __class_attr_defined_enums=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_destroy_association_async_batch_size; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_destroy_association_async_batch_size=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:313 + def __class_attr_encrypted_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:313 + def __class_attr_encrypted_attributes=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_enumerate_columns_in_select_statements; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_enumerate_columns_in_select_statements=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:328 + def __class_attr_generated_token_verifier; end + + # pkg:gem/activerecord#lib/active_record/base.rb:328 + def __class_attr_generated_token_verifier=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_has_many_inversing; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_has_many_inversing=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_immutable_strings_by_default; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_immutable_strings_by_default=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_implicit_order_column; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_implicit_order_column=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:325 + def __class_attr_include_root_in_json; end + + # pkg:gem/activerecord#lib/active_record/base.rb:325 + def __class_attr_include_root_in_json=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_inheritance_column; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_inheritance_column=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_internal_metadata_table_name; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_internal_metadata_table_name=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:311 + def __class_attr_lock_optimistically; end + + # pkg:gem/activerecord#lib/active_record/base.rb:311 + def __class_attr_lock_optimistically=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_logger; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_logger=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:320 + def __class_attr_nested_attributes_options; end + + # pkg:gem/activerecord#lib/active_record/base.rb:320 + def __class_attr_nested_attributes_options=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def __class_attr_normalized_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:310 + def __class_attr_normalized_attributes=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def __class_attr_param_delimiter; end + + # pkg:gem/activerecord#lib/active_record/base.rb:283 + def __class_attr_param_delimiter=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_partial_inserts; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_partial_inserts=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_partial_updates; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_partial_updates=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_pluralize_table_names; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_pluralize_table_names=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_primary_key_prefix_type; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_primary_key_prefix_type=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:316 + def __class_attr_record_timestamps; end + + # pkg:gem/activerecord#lib/active_record/base.rb:316 + def __class_attr_record_timestamps=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_run_commit_callbacks_on_first_saved_instances_in_transaction; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_run_commit_callbacks_on_first_saved_instances_in_transaction=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_schema_migrations_table_name; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_schema_migrations_table_name=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_shard_selector; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_shard_selector=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def __class_attr_signed_id_verifier_secret; end + + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def __class_attr_signed_id_verifier_secret=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_skip_time_zone_conversion_for_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_skip_time_zone_conversion_for_attributes=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def __class_attr_store_full_class_name; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def __class_attr_store_full_class_name=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def __class_attr_store_full_sti_class; end + + # pkg:gem/activerecord#lib/active_record/base.rb:303 + def __class_attr_store_full_sti_class=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_strict_loading_by_default; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_strict_loading_by_default=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_strict_loading_mode; end + + # pkg:gem/activerecord#lib/active_record/base.rb:299 + def __class_attr_strict_loading_mode=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_table_name_prefix; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_table_name_prefix=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_table_name_suffix; end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def __class_attr_table_name_suffix=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_time_zone_aware_attributes; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_time_zone_aware_attributes=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_time_zone_aware_types; end + + # pkg:gem/activerecord#lib/active_record/base.rb:314 + def __class_attr_time_zone_aware_types=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:328 + def __class_attr_token_definitions; end + + # pkg:gem/activerecord#lib/active_record/base.rb:328 + def __class_attr_token_definitions=(new_value); end + + # pkg:gem/activerecord#lib/active_record/base.rb:302 + def _inheritance_column=(value); end + end +end + +# pkg:gem/activerecord#lib/active_record/base.rb:314 +module ActiveRecord::Base::GeneratedAssociationMethods; end + +# pkg:gem/activerecord#lib/active_record/base.rb:314 +module ActiveRecord::Base::GeneratedAttributeMethods; end + +# = Active Record \Batches +# +# pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:4 +module ActiveRecord::Batches + # Looping through a collection of records from the database + # (using the Scoping::Named::ClassMethods.all method, for example) + # is very inefficient since it will try to instantiate all the objects at once. + # + # In that case, batch processing methods allow you to work + # with the records in batches, thereby greatly reducing memory consumption. + # + # The #find_each method uses #find_in_batches with a batch size of 1000 (or as + # specified by the +:batch_size+ option). + # + # Person.find_each do |person| + # person.do_awesome_stuff + # end + # + # Person.where("age > 21").find_each do |person| + # person.party_all_night! + # end + # + # If you do not provide a block to #find_each, it will return an Enumerator + # for chaining with other methods: + # + # Person.find_each.with_index do |person, index| + # person.award_trophy(index + 1) + # end + # + # ==== Options + # * :batch_size - Specifies the size of the batch. Defaults to 1000. + # * :start - Specifies the cursor column value to start from, inclusive of the value. + # * :finish - Specifies the cursor column value to end at, inclusive of the value. + # * :error_on_ignore - Overrides the application config to specify if an error should be raised when + # an order is present in the relation. + # * :cursor - Specifies the column to use for batching (can be a column name or an array + # of column names). Defaults to primary key. + # * :order - Specifies the cursor column order (can be +:asc+ or +:desc+ or an array consisting + # of :asc or :desc). Defaults to +:asc+. + # + # class Order < ActiveRecord::Base + # self.primary_key = [:id_1, :id_2] + # end + # + # Order.find_each(order: [:asc, :desc]) + # + # In the above code, +id_1+ is sorted in ascending order and +id_2+ in descending order. + # + # Limits are honored, and if present there is no requirement for the batch + # size: it can be less than, equal to, or greater than the limit. + # + # The options +start+ and +finish+ are especially useful if you want + # multiple workers dealing with the same processing queue. You can make + # worker 1 handle all the records between id 1 and 9999 and worker 2 + # handle from 10000 and beyond by setting the +:start+ and +:finish+ + # option on each worker. + # + # # In worker 1, let's process until 9999 records. + # Person.find_each(finish: 9_999) do |person| + # person.party_all_night! + # end + # + # # In worker 2, let's process from record 10_000 and onwards. + # Person.find_each(start: 10_000) do |person| + # person.party_all_night! + # end + # + # NOTE: Order can be ascending (:asc) or descending (:desc). It is automatically set to + # ascending on the primary key ("id ASC"). + # This also means that this method only works when the cursor column is + # orderable (e.g. an integer or string). + # + # NOTE: When using custom columns for batching, they should include at least one unique column + # (e.g. primary key) as a tiebreaker. Also, to reduce the likelihood of race conditions, + # all columns should be static (unchangeable after it was set). + # + # NOTE: By its nature, batch processing is subject to race conditions if + # other processes are modifying the database. + # + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:85 + def find_each(start: T.unsafe(nil), finish: T.unsafe(nil), batch_size: T.unsafe(nil), error_on_ignore: T.unsafe(nil), cursor: T.unsafe(nil), order: T.unsafe(nil), &block); end + + # Yields each batch of records that was found by the find options as + # an array. + # + # Person.where("age > 21").find_in_batches do |group| + # sleep(50) # Make sure it doesn't get too crowded in there! + # group.each { |person| person.party_all_night! } + # end + # + # If you do not provide a block to #find_in_batches, it will return an Enumerator + # for chaining with other methods: + # + # Person.find_in_batches.with_index do |group, batch| + # puts "Processing group ##{batch}" + # group.each(&:recover_from_last_night!) + # end + # + # To be yielded each record one by one, use #find_each instead. + # + # ==== Options + # * :batch_size - Specifies the size of the batch. Defaults to 1000. + # * :start - Specifies the cursor column value to start from, inclusive of the value. + # * :finish - Specifies the cursor column value to end at, inclusive of the value. + # * :error_on_ignore - Overrides the application config to specify if an error should be raised when + # an order is present in the relation. + # * :cursor - Specifies the column to use for batching (can be a column name or an array + # of column names). Defaults to primary key. + # * :order - Specifies the cursor column order (can be +:asc+ or +:desc+ or an array consisting + # of :asc or :desc). Defaults to +:asc+. + # + # class Order < ActiveRecord::Base + # self.primary_key = [:id_1, :id_2] + # end + # + # Order.find_in_batches(order: [:asc, :desc]) + # + # In the above code, +id_1+ is sorted in ascending order and +id_2+ in descending order. + # + # Limits are honored, and if present there is no requirement for the batch + # size: it can be less than, equal to, or greater than the limit. + # + # The options +start+ and +finish+ are especially useful if you want + # multiple workers dealing with the same processing queue. You can make + # worker 1 handle all the records between id 1 and 9999 and worker 2 + # handle from 10000 and beyond by setting the +:start+ and +:finish+ + # option on each worker. + # + # # Let's process from record 10_000 on. + # Person.find_in_batches(start: 10_000) do |group| + # group.each { |person| person.party_all_night! } + # end + # + # NOTE: Order can be ascending (:asc) or descending (:desc). It is automatically set to + # ascending on the primary key ("id ASC"). + # This also means that this method only works when the cursor column is + # orderable (e.g. an integer or string). + # + # NOTE: When using custom columns for batching, they should include at least one unique column + # (e.g. primary key) as a tiebreaker. Also, to reduce the likelihood of race conditions, + # all columns should be static (unchangeable after it was set). + # + # NOTE: By its nature, batch processing is subject to race conditions if + # other processes are modifying the database. + # + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:161 + def find_in_batches(start: T.unsafe(nil), finish: T.unsafe(nil), batch_size: T.unsafe(nil), error_on_ignore: T.unsafe(nil), cursor: T.unsafe(nil), order: T.unsafe(nil)); end + + # Yields ActiveRecord::Relation objects to work with a batch of records. + # + # Person.where("age > 21").in_batches do |relation| + # relation.delete_all + # sleep(10) # Throttle the delete queries + # end + # + # If you do not provide a block to #in_batches, it will return a + # BatchEnumerator which is enumerable. + # + # Person.in_batches.each_with_index do |relation, batch_index| + # puts "Processing relation ##{batch_index}" + # relation.delete_all + # end + # + # Examples of calling methods on the returned BatchEnumerator object: + # + # Person.in_batches.delete_all + # Person.in_batches.update_all(awesome: true) + # Person.in_batches.each_record(&:party_all_night!) + # + # ==== Options + # * :of - Specifies the size of the batch. Defaults to 1000. + # * :load - Specifies if the relation should be loaded. Defaults to false. + # * :start - Specifies the cursor column value to start from, inclusive of the value. + # * :finish - Specifies the cursor column value to end at, inclusive of the value. + # * :error_on_ignore - Overrides the application config to specify if an error should be raised when + # an order is present in the relation. + # * :cursor - Specifies the column to use for batching (can be a column name or an array + # of column names). Defaults to primary key. + # * :order - Specifies the cursor column order (can be +:asc+ or +:desc+ or an array consisting + # of :asc or :desc). Defaults to +:asc+. + # + # class Order < ActiveRecord::Base + # self.primary_key = [:id_1, :id_2] + # end + # + # Order.in_batches(order: [:asc, :desc]) + # + # In the above code, +id_1+ is sorted in ascending order and +id_2+ in descending order. + # + # * :use_ranges - Specifies whether to use range iteration (id >= x AND id <= y). + # It can make iterating over the whole or almost whole tables several times faster. + # Only whole table iterations use this style of iteration by default. You can disable this behavior by passing +false+. + # If you iterate over the table and the only condition is, e.g., archived_at: nil (and only a tiny fraction + # of the records are archived), it makes sense to opt in to this approach. + # + # Limits are honored, and if present there is no requirement for the batch + # size, it can be less than, equal, or greater than the limit. + # + # The options +start+ and +finish+ are especially useful if you want + # multiple workers dealing with the same processing queue. You can make + # worker 1 handle all the records between id 1 and 9999 and worker 2 + # handle from 10000 and beyond by setting the +:start+ and +:finish+ + # option on each worker. + # + # # Let's process from record 10_000 on. + # Person.in_batches(start: 10_000).update_all(awesome: true) + # + # An example of calling where query method on the relation: + # + # Person.in_batches.each do |relation| + # relation.update_all('age = age + 1') + # relation.where('age > 21').update_all(should_party: true) + # relation.where('age <= 21').delete_all + # end + # + # NOTE: If you are going to iterate through each record, you should call + # #each_record on the yielded BatchEnumerator: + # + # Person.in_batches.each_record(&:party_all_night!) + # + # NOTE: Order can be ascending (:asc) or descending (:desc). It is automatically set to + # ascending on the primary key ("id ASC"). + # This also means that this method only works when the cursor column is + # orderable (e.g. an integer or string). + # + # NOTE: When using custom columns for batching, they should include at least one unique column + # (e.g. primary key) as a tiebreaker. Also, to reduce the likelihood of race conditions, + # all columns should be static (unchangeable after it was set). + # + # NOTE: By its nature, batch processing is subject to race conditions if + # other processes are modifying the database. + # + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:259 + def in_batches(of: T.unsafe(nil), start: T.unsafe(nil), finish: T.unsafe(nil), load: T.unsafe(nil), error_on_ignore: T.unsafe(nil), cursor: T.unsafe(nil), order: T.unsafe(nil), use_ranges: T.unsafe(nil), &block); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:369 + def act_on_ignored_order(error_on_ignore); end + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:341 + def apply_finish_limit(relation, cursor, finish, batch_orders); end + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:328 + def apply_limits(relation, cursor, start, finish, batch_orders); end + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:334 + def apply_start_limit(relation, cursor, start, batch_orders); end + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:348 + def batch_condition(relation, cursor, values, operators); end + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:379 + def batch_on_loaded_relation(relation:, start:, finish:, cursor:, order:, batch_limit:); end + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:426 + def batch_on_unloaded_relation(relation:, start:, finish:, load:, cursor:, order:, use_ranges:, remaining:, batch_limit:); end + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:363 + def build_batch_orders(cursor, order); end + + # This is a custom implementation of `<=>` operator, + # which also takes into account how the collection will be ordered. + # + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:414 + def compare_values_for_order(values1, values2, order); end + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:305 + def ensure_valid_options_for_batching!(cursor, start, finish, order); end + + # pkg:gem/activerecord#lib/active_record/relation/batches.rb:408 + def record_cursor_values(record, cursor); end +end + +# pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:5 +class ActiveRecord::Batches::BatchEnumerator + include ::Enumerable + + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:8 + def initialize(relation:, cursor:, of: T.unsafe(nil), start: T.unsafe(nil), finish: T.unsafe(nil), order: T.unsafe(nil), use_ranges: T.unsafe(nil)); end + + # The size of the batches yielded by the BatchEnumerator. + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:28 + def batch_size; end + + # Deletes records in batches. Returns the total number of rows affected. + # + # Person.in_batches.delete_all + # + # See Relation#delete_all for details of how each batch is deleted. + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:66 + def delete_all; end + + # Destroys records in batches. Returns the total number of rows affected. + # + # Person.where("age < 10").in_batches.destroy_all + # + # See Relation#destroy_all for details of how each batch is destroyed. + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:97 + def destroy_all; end + + # Yields an ActiveRecord::Relation object for each batch of records. + # + # Person.in_batches.each do |relation| + # relation.update_all(awesome: true) + # end + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:108 + def each(&block); end + + # Looping through a collection of records from the database (using the + # +all+ method, for example) is very inefficient since it will try to + # instantiate all the objects at once. + # + # In that case, batch processing methods allow you to work with the + # records in batches, thereby greatly reducing memory consumption. + # + # Person.in_batches.each_record do |person| + # person.do_awesome_stuff + # end + # + # Person.where("age > 21").in_batches(of: 10).each_record do |person| + # person.party_all_night! + # end + # + # If you do not provide a block to #each_record, it will return an Enumerator + # for chaining with other methods: + # + # Person.in_batches.each_record.with_index do |person, index| + # person.award_trophy(index + 1) + # end + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:53 + def each_record(&block); end + + # The primary key value at which the BatchEnumerator ends, inclusive of the value. + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:22 + def finish; end + + # The relation from which the BatchEnumerator yields batches. + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:25 + def relation; end + + # The primary key value from which the BatchEnumerator starts, inclusive of the value. + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:19 + def start; end + + # Touches records in batches. Returns the total number of rows affected. + # + # Person.in_batches.touch_all + # + # See Relation#touch_all for details of how each batch is touched. + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:86 + def touch_all(*, **, &); end + + # Updates records in batches. Returns the total number of rows affected. + # + # Person.in_batches.update_all("age = age + 1") + # + # See Relation#update_all for details of how each batch is updated. + # + # pkg:gem/activerecord#lib/active_record/relation/batches/batch_enumerator.rb:75 + def update_all(updates); end +end + +# pkg:gem/activerecord#lib/active_record/relation/batches.rb:9 +ActiveRecord::Batches::DEFAULT_ORDER = T.let(T.unsafe(nil), Symbol) + +# pkg:gem/activerecord#lib/active_record/relation/batches.rb:8 +ActiveRecord::Batches::ORDER_IGNORE_MESSAGE = T.let(T.unsafe(nil), String) + +# = Active Record \Calculations +# +# pkg:gem/activerecord#lib/active_record/relation/calculations.rb:7 +module ActiveRecord::Calculations + # Same as #average, but performs the query asynchronously and returns an + # ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:122 + def async_average(column_name); end + + # Same as #count, but performs the query asynchronously and returns an + # ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:108 + def async_count(column_name = T.unsafe(nil)); end + + # Same as #ids, but performs the query asynchronously and returns an + # ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:413 + def async_ids; end + + # Same as #maximum, but performs the query asynchronously and returns an + # ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:152 + def async_maximum(column_name); end + + # Same as #minimum, but performs the query asynchronously and returns an + # ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:137 + def async_minimum(column_name); end + + # Same as #pick, but performs the query asynchronously and returns an + # ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:367 + def async_pick(*column_names); end + + # Same as #pluck, but performs the query asynchronously and returns an + # ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:338 + def async_pluck(*column_names); end + + # Same as #sum, but performs the query asynchronously and returns an + # ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:181 + def async_sum(identity_or_column = T.unsafe(nil)); end + + # Calculates the average value on a given column. Returns +nil+ if there's + # no row. See #calculate for examples with options. + # + # Person.average(:age) # => 35.8 + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:116 + def average(column_name); end + + # This calculates aggregate values in the given column. Methods for #count, #sum, #average, + # #minimum, and #maximum have been added as shortcuts. + # + # Person.calculate(:count, :all) # The same as Person.count + # Person.average(:age) # SELECT AVG(age) FROM people... + # + # # Selects the minimum age for any family without any minors + # Person.group(:last_name).having("min(age) > 17").minimum(:age) + # + # Person.sum("2 * age") + # + # There are two basic forms of output: + # + # * Single aggregate value: The single value is type cast to Integer for COUNT, Float + # for AVG, and the given column's type for everything else. + # + # * Grouped values: This returns an ordered hash of the values and groups them. It + # takes either a column name, or the name of a belongs_to association. + # + # values = Person.group('last_name').maximum(:age) + # puts values["Drake"] + # # => 43 + # + # drake = Family.find_by(last_name: 'Drake') + # values = Person.group(:family).maximum(:age) # Person belongs_to :family + # puts values[drake] + # # => 43 + # + # values.each do |family, max_age| + # ... + # end + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:216 + def calculate(operation, column_name); end + + # Count the records. + # + # Person.count + # # => the total count of all people + # + # Person.count(:age) + # # => returns the total count of all people whose age is present in database + # + # Person.count(:all) + # # => performs a COUNT(*) (:all is an alias for '*') + # + # Person.distinct.count(:age) + # # => counts the number of different age values + # + # If +count+ is used with {Relation#group}[rdoc-ref:QueryMethods#group], + # it returns a Hash whose keys represent the aggregated column, + # and the values are the respective amounts: + # + # Person.group(:city).count + # # => { 'Rome' => 5, 'Paris' => 3 } + # + # If +count+ is used with {Relation#group}[rdoc-ref:QueryMethods#group] for multiple columns, it returns a Hash whose + # keys are an array containing the individual values of each column and the value + # of each key would be the count. + # + # Article.group(:status, :category).count + # # => {["draft", "business"]=>10, ["draft", "technology"]=>4, ["published", "technology"]=>2} + # + # If +count+ is used with {Relation#select}[rdoc-ref:QueryMethods#select], it will count the selected columns: + # + # Person.select(:age).count + # # => counts the number of different age values + # + # Note: not all valid {Relation#select}[rdoc-ref:QueryMethods#select] expressions are valid +count+ expressions. The specifics differ + # between databases. In invalid cases, an error from the database is thrown. + # + # When given a block, calls the block with each record in the relation and + # returns the number of records for which the block returns a truthy value. + # + # Person.count { |person| person.age > 21 } + # # => counts the number of people older that 21 + # + # If the relation hasn't been loaded yet, calling +count+ with a block will + # load all records in the relation. If there are a lot of records in the + # relation, loading all records could result in performance issues. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:94 + def count(column_name = T.unsafe(nil)); end + + # Returns the base model's ID's for the relation using the table's primary key + # + # Person.ids # SELECT people.id FROM people + # Person.joins(:company).ids # SELECT people.id FROM people INNER JOIN companies ON companies.id = people.company_id + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:375 + def ids; end + + # Calculates the maximum value on a given column. The value is returned + # with the same data type of the column, or +nil+ if there's no row. See + # #calculate for examples with options. + # + # Person.maximum(:age) # => 93 + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:146 + def maximum(column_name); end + + # Calculates the minimum value on a given column. The value is returned + # with the same data type of the column, or +nil+ if there's no row. See + # #calculate for examples with options. + # + # Person.minimum(:age) # => 7 + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:131 + def minimum(column_name); end + + # Pick the value(s) from the named column(s) in the current relation. + # This is short-hand for relation.limit(1).pluck(*column_names).first, and is primarily useful + # when you have a relation that's already narrowed down to a single row. + # + # Just like #pluck, #pick will only load the actual value, not the entire record object, so it's also + # more efficient. The value is, again like with pluck, typecast by the column type. + # + # Person.where(id: 1).pick(:name) + # # SELECT people.name FROM people WHERE id = 1 LIMIT 1 + # # => 'David' + # + # Person.where(id: 1).pick(:name, :email_address) + # # SELECT people.name, people.email_address FROM people WHERE id = 1 LIMIT 1 + # # => [ 'David', 'david@loudthinking.com' ] + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:356 + def pick(*column_names); end + + # Use #pluck as a shortcut to select one or more attributes without + # loading an entire record object per row. + # + # Person.pluck(:name) + # + # instead of + # + # Person.all.map(&:name) + # + # Pluck returns an Array of attribute values type-casted to match + # the plucked column names, if they can be deduced. Plucking an SQL fragment + # returns String values by default. + # + # Person.pluck(:name) + # # SELECT people.name FROM people + # # => ['David', 'Jeremy', 'Jose'] + # + # Person.pluck(:id, :name) + # # SELECT people.id, people.name FROM people + # # => [[1, 'David'], [2, 'Jeremy'], [3, 'Jose']] + # + # Person.distinct.pluck(:role) + # # SELECT DISTINCT role FROM people + # # => ['admin', 'member', 'guest'] + # + # Person.where(age: 21).limit(5).pluck(:id) + # # SELECT people.id FROM people WHERE people.age = 21 LIMIT 5 + # # => [2, 3] + # + # Comment.joins(:person).pluck(:id, person: :id) + # # SELECT comments.id, person.id FROM comments INNER JOIN people person ON person.id = comments.person_id + # # => [[1, 2], [2, 2]] + # + # Comment.joins(:person).pluck(:id, person: [:id, :name]) + # # SELECT comments.id, person.id, person.name FROM comments INNER JOIN people person ON person.id = comments.person_id + # # => [[1, 2, 'David'], [2, 2, 'David']] + # + # Person.pluck(Arel.sql('DATEDIFF(updated_at, created_at)')) + # # SELECT DATEDIFF(updated_at, created_at) FROM people + # # => ['0', '27761', '173'] + # + # Be aware that #pluck ignores any previous select clauses + # + # Person.select(:name).pluck(:id) + # # SELECT people.id FROM people + # + # See also #ids. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:295 + def pluck(*column_names); end + + # Calculates the sum of values on a given column. The value is returned + # with the same data type of the column, +0+ if there's no row. See + # #calculate for examples with options. + # + # Person.sum(:age) # => 4562 + # + # When given a block, calls the block with each record in the relation and + # returns the sum of +initial_value_or_column+ plus the block return values: + # + # Person.sum { |person| person.age } # => 4562 + # Person.sum(1000) { |person| person.age } # => 5562 + # + # If the relation hasn't been loaded yet, calling +sum+ with a block will + # load all records in the relation. If there are a lot of records in the + # relation, loading all records could result in performance issues. + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:171 + def sum(initial_value_or_column = T.unsafe(nil), &block); end + + protected + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:418 + def aggregate_column(column_name); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:430 + def all_attributes?(column_names); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:680 + def build_count_subquery(relation, column_name, distinct); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:673 + def build_count_subquery?(operation, column_name, distinct); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:465 + def distinct_select?(column_name); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:528 + def execute_grouped_calculation(operation, column_name, distinct); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:483 + def execute_simple_calculation(operation, column_name, distinct); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:434 + def has_include?(column_name); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:620 + def lookup_cast_type_from_join_dependencies(name, join_dependencies = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:479 + def operation_over_aggregate_column(column, operation, distinct); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:438 + def perform_calculation(operation, column_name); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:469 + def possible_aggregation?(column_names); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:663 + def select_for_count; end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:645 + def type_cast_calculated_value(value, operation, type); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:628 + def type_cast_pluck_values(result, columns); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:615 + def type_for(field, &block); end +end + +# pkg:gem/activerecord#lib/active_record/relation/calculations.rb:8 +class ActiveRecord::Calculations::ColumnAliasTracker + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:9 + def initialize(connection); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:14 + def alias_for(field); end + + private + + # Converts the given field to the value that the database adapter returns as + # a usable column name: + # + # column_alias_for("users.id") # => "users_id" + # column_alias_for("sum(id)") # => "sum_id" + # column_alias_for("count(distinct users.id)") # => "count_distinct_users_id" + # column_alias_for("count(*)") # => "count_all" + # + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:35 + def column_alias_for(field); end + + # pkg:gem/activerecord#lib/active_record/relation/calculations.rb:44 + def truncate(name); end +end + +# = Active Record \Callbacks +# +# \Callbacks are hooks into the life cycle of an Active Record object that allow you to trigger logic +# before or after a change in the object state. This can be used to make sure that associated and +# dependent objects are deleted when {ActiveRecord::Base#destroy}[rdoc-ref:Persistence#destroy] is called (by overwriting +before_destroy+) or +# to massage attributes before they're validated (by overwriting +before_validation+). +# As an example of the callbacks initiated, consider the {ActiveRecord::Base#save}[rdoc-ref:Persistence#save] call for a new record: +# +# * (-) save +# * (-) valid +# * (1) before_validation +# * (-) validate +# * (2) after_validation +# * (3) before_save +# * (4) before_create +# * (-) create +# * (5) after_create +# * (6) after_save +# * (7) after_commit +# +# Also, an after_rollback callback can be configured to be triggered whenever a rollback is issued. +# Check out ActiveRecord::Transactions for more details about after_commit and +# after_rollback. +# +# Additionally, an after_touch callback is triggered whenever an +# object is touched. +# +# Lastly an after_find and after_initialize callback is triggered for each object that +# is found and instantiated by a finder, with after_initialize being triggered after new objects +# are instantiated as well. +# +# There are nineteen callbacks in total, which give a lot of control over how to react and prepare for each state in the +# Active Record life cycle. The sequence for calling {ActiveRecord::Base#save}[rdoc-ref:Persistence#save] for an existing record is similar, +# except that each _create callback is replaced by the corresponding _update callback. +# +# Examples: +# class CreditCard < ActiveRecord::Base +# # Strip everything but digits, so the user can specify "555 234 34" or +# # "5552-3434" and both will mean "55523434" +# before_validation(on: :create) do +# self.number = number.gsub(/[^0-9]/, "") if attribute_present?("number") +# end +# end +# +# class Subscription < ActiveRecord::Base +# before_create :record_signup +# +# private +# def record_signup +# self.signed_up_on = Date.today +# end +# end +# +# class Firm < ActiveRecord::Base +# # Disables access to the system, for associated clients and people when the firm is destroyed +# before_destroy { |record| Person.where(firm_id: record.id).update_all(access: 'disabled') } +# before_destroy { |record| Client.where(client_of: record.id).update_all(access: 'disabled') } +# end +# +# == Inheritable callback queues +# +# Besides the overwritable callback methods, it's also possible to register callbacks through the +# use of the callback macros. Their main advantage is that the macros add behavior into a callback +# queue that is kept intact through an inheritance hierarchy. +# +# class Topic < ActiveRecord::Base +# before_destroy :destroy_author +# end +# +# class Reply < Topic +# before_destroy :destroy_readers +# end +# +# When Topic#destroy is run only +destroy_author+ is called. When Reply#destroy is +# run, both +destroy_author+ and +destroy_readers+ are called. +# +# *IMPORTANT:* In order for inheritance to work for the callback queues, you must specify the +# callbacks before specifying the associations. Otherwise, you might trigger the loading of a +# child before the parent has registered the callbacks and they won't be inherited. +# +# == Types of callbacks +# +# There are three types of callbacks accepted by the callback macros: method references (symbol), callback objects, +# inline methods (using a proc). \Method references and callback objects are the recommended approaches, +# inline methods using a proc are sometimes appropriate (such as for creating mix-ins). +# +# The method reference callbacks work by specifying a protected or private method available in the object, like this: +# +# class Topic < ActiveRecord::Base +# before_destroy :delete_parents +# +# private +# def delete_parents +# self.class.delete_by(parent_id: id) +# end +# end +# +# The callback objects have methods named after the callback called with the record as the only parameter, such as: +# +# class BankAccount < ActiveRecord::Base +# before_save EncryptionWrapper.new +# after_save EncryptionWrapper.new +# after_initialize EncryptionWrapper.new +# end +# +# class EncryptionWrapper +# def before_save(record) +# record.credit_card_number = encrypt(record.credit_card_number) +# end +# +# def after_save(record) +# record.credit_card_number = decrypt(record.credit_card_number) +# end +# +# alias_method :after_initialize, :after_save +# +# private +# def encrypt(value) +# # Secrecy is committed +# end +# +# def decrypt(value) +# # Secrecy is unveiled +# end +# end +# +# So you specify the object you want to be messaged on a given callback. When that callback is triggered, the object has +# a method by the name of the callback messaged. You can make these callbacks more flexible by passing in other +# initialization data such as the name of the attribute to work with: +# +# class BankAccount < ActiveRecord::Base +# before_save EncryptionWrapper.new("credit_card_number") +# after_save EncryptionWrapper.new("credit_card_number") +# after_initialize EncryptionWrapper.new("credit_card_number") +# end +# +# class EncryptionWrapper +# def initialize(attribute) +# @attribute = attribute +# end +# +# def before_save(record) +# record.send("#{@attribute}=", encrypt(record.send("#{@attribute}"))) +# end +# +# def after_save(record) +# record.send("#{@attribute}=", decrypt(record.send("#{@attribute}"))) +# end +# +# alias_method :after_initialize, :after_save +# +# private +# def encrypt(value) +# # Secrecy is committed +# end +# +# def decrypt(value) +# # Secrecy is unveiled +# end +# end +# +# == before_validation* returning statements +# +# If the +before_validation+ callback throws +:abort+, the process will be +# aborted and {ActiveRecord::Base#save}[rdoc-ref:Persistence#save] will return +false+. +# If {ActiveRecord::Base#save!}[rdoc-ref:Persistence#save!] is called it will raise an ActiveRecord::RecordInvalid exception. +# Nothing will be appended to the errors object. +# +# == Canceling callbacks +# +# If a before_* callback throws +:abort+, all the later callbacks and +# the associated action are cancelled. +# \Callbacks are run in the order they are defined. +# +# == Ordering callbacks +# +# Sometimes application code requires that callbacks execute in a specific order. For example, a +before_destroy+ +# callback (+log_children+ in this case) should be executed before records in the +children+ association are destroyed by the +# dependent: :destroy option. +# +# Let's look at the code below: +# +# class Topic < ActiveRecord::Base +# has_many :children, dependent: :destroy +# +# before_destroy :log_children +# +# private +# def log_children +# # Child processing +# end +# end +# +# In this case, the problem is that when the +before_destroy+ callback is executed, records in the +children+ association no +# longer exist because the {ActiveRecord::Base#destroy}[rdoc-ref:Persistence#destroy] callback was executed first. +# You can use the +prepend+ option on the +before_destroy+ callback to avoid this. +# +# class Topic < ActiveRecord::Base +# has_many :children, dependent: :destroy +# +# before_destroy :log_children, prepend: true +# +# private +# def log_children +# # Child processing +# end +# end +# +# This way, the +before_destroy+ is executed before the dependent: :destroy is called, and the data is still available. +# +# Also, there are cases when you want several callbacks of the same type to +# be executed in order. +# +# For example: +# +# class Topic < ActiveRecord::Base +# has_many :children +# +# after_save :log_children +# after_save :do_something_else +# +# private +# def log_children +# # Child processing +# end +# +# def do_something_else +# # Something else +# end +# end +# +# In this case the +log_children+ is executed before +do_something_else+. +# This applies to all non-transactional callbacks, and to +before_commit+. +# +# For transactional +after_+ callbacks (+after_commit+, +after_rollback+, etc), the order +# can be set via configuration. +# +# config.active_record.run_after_transaction_callbacks_in_order_defined = false +# +# When set to +true+ (the default from \Rails 7.1), callbacks are executed in the order they +# are defined, just like the example above. When set to +false+, the order is reversed, so +# +do_something_else+ is executed before +log_children+. +# +# == \Transactions +# +# The entire callback chain of a {#save}[rdoc-ref:Persistence#save], {#save!}[rdoc-ref:Persistence#save!], +# or {#destroy}[rdoc-ref:Persistence#destroy] call runs within a transaction. That includes after_* hooks. +# If everything goes fine a +COMMIT+ is executed once the chain has been completed. +# +# If a before_* callback cancels the action a +ROLLBACK+ is issued. You +# can also trigger a +ROLLBACK+ raising an exception in any of the callbacks, +# including after_* hooks. Note, however, that in that case the client +# needs to be aware of it because an ordinary {#save}[rdoc-ref:Persistence#save] will raise such exception +# instead of quietly returning +false+. +# +# == Debugging callbacks +# +# The callback chain is accessible via the _*_callbacks method on an object. Active Model \Callbacks support +# :before, :after and :around as values for the kind property. The kind property +# defines what part of the chain the callback runs in. +# +# To find all callbacks in the +before_save+ callback chain: +# +# Topic._save_callbacks.select { |cb| cb.kind.eql?(:before) } +# +# Returns an array of callback objects that form the +before_save+ chain. +# +# To further check if the before_save chain contains a proc defined as rest_when_dead use the filter property of the callback object: +# +# Topic._save_callbacks.select { |cb| cb.kind.eql?(:before) }.collect(&:filter).include?(:rest_when_dead) +# +# Returns true or false depending on whether the proc is contained in the +before_save+ callback chain on a Topic model. +# +# pkg:gem/activerecord#lib/active_record/callbacks.rb:277 +module ActiveRecord::Callbacks + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveSupport::Callbacks + include ::ActiveModel::Validations::Callbacks + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveModel::Validations::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::DescendantsTracker + + # pkg:gem/activerecord#lib/active_record/callbacks.rb:418 + def destroy; end + + # pkg:gem/activerecord#lib/active_record/callbacks.rb:434 + def increment!(attribute, by = T.unsafe(nil), touch: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/callbacks.rb:430 + def touch(*, **); end + + private + + # pkg:gem/activerecord#lib/active_record/callbacks.rb:443 + def _create_record; end + + # pkg:gem/activerecord#lib/active_record/callbacks.rb:447 + def _update_record; end + + # pkg:gem/activerecord#lib/active_record/callbacks.rb:439 + def create_or_update(**); end + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + end + + module GeneratedInstanceMethods + def __callbacks; end + end +end + +# pkg:gem/activerecord#lib/active_record/callbacks.rb:280 +ActiveRecord::Callbacks::CALLBACKS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/callbacks.rb:287 +module ActiveRecord::Callbacks::ClassMethods + include ::ActiveModel::Callbacks +end + +# Raised when a record cannot be inserted or updated because it would violate a check constraint. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:296 +class ActiveRecord::CheckViolation < ::ActiveRecord::StatementInvalid; end + +# pkg:gem/activerecord#lib/active_record.rb:126 +module ActiveRecord::Coders; end + +# pkg:gem/activerecord#lib/active_record/coders/column_serializer.rb:5 +class ActiveRecord::Coders::ColumnSerializer + # pkg:gem/activerecord#lib/active_record/coders/column_serializer.rb:9 + def initialize(attr_name, coder, object_class = T.unsafe(nil)); end + + # Public because it's called by Type::Serialized + # + # pkg:gem/activerecord#lib/active_record/coders/column_serializer.rb:46 + def assert_valid_value(object, action:); end + + # pkg:gem/activerecord#lib/active_record/coders/column_serializer.rb:7 + def coder; end + + # pkg:gem/activerecord#lib/active_record/coders/column_serializer.rb:22 + def dump(object); end + + # pkg:gem/activerecord#lib/active_record/coders/column_serializer.rb:16 + def init_with(coder); end + + # pkg:gem/activerecord#lib/active_record/coders/column_serializer.rb:29 + def load(payload); end + + # pkg:gem/activerecord#lib/active_record/coders/column_serializer.rb:6 + def object_class; end + + private + + # pkg:gem/activerecord#lib/active_record/coders/column_serializer.rb:54 + def check_arity_of_constructor; end +end + +# pkg:gem/activerecord#lib/active_record/coders/json.rb:7 +class ActiveRecord::Coders::JSON + # pkg:gem/activerecord#lib/active_record/coders/json.rb:10 + def initialize(encode_options: T.unsafe(nil), decode_options: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/coders/json.rb:16 + def dump(obj); end + + # pkg:gem/activerecord#lib/active_record/coders/json.rb:20 + def load(json); end +end + +# pkg:gem/activerecord#lib/active_record/coders/json.rb:8 +ActiveRecord::Coders::JSON::DEFAULT_ENCODE_OPTIONS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activerecord#lib/active_record/coders/yaml_column.rb:7 +class ActiveRecord::Coders::YAMLColumn < ::ActiveRecord::Coders::ColumnSerializer + # pkg:gem/activerecord#lib/active_record/coders/yaml_column.rb:59 + def initialize(attr_name, object_class = T.unsafe(nil), permitted_classes: T.unsafe(nil), unsafe_load: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/coders/yaml_column.rb:77 + def coder; end + + # pkg:gem/activerecord#lib/active_record/coders/yaml_column.rb:68 + def init_with(coder); end + + private + + # pkg:gem/activerecord#lib/active_record/coders/yaml_column.rb:88 + def check_arity_of_constructor; end +end + +# pkg:gem/activerecord#lib/active_record/coders/yaml_column.rb:8 +class ActiveRecord::Coders::YAMLColumn::SafeCoder + # pkg:gem/activerecord#lib/active_record/coders/yaml_column.rb:9 + def initialize(permitted_classes: T.unsafe(nil), unsafe_load: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/coders/yaml_column.rb:15 + def dump(object); end + + # pkg:gem/activerecord#lib/active_record/coders/yaml_column.rb:33 + def load(payload); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:187 +class ActiveRecord::CompositePrimaryKeyMismatchError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:190 + def initialize(reflection = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:188 + def reflection; end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:186 +class ActiveRecord::ConcurrentMigrationError < ::ActiveRecord::MigrationError + # pkg:gem/activerecord#lib/active_record/migration.rb:190 + def initialize(message = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:187 +ActiveRecord::ConcurrentMigrationError::DEFAULT_MESSAGE = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/migration.rb:188 +ActiveRecord::ConcurrentMigrationError::RELEASE_LOCK_FAILED_MESSAGE = T.let(T.unsafe(nil), String) + +# Raised when association is being configured improperly or user tries to use +# offset and limit together with +# {ActiveRecord::Base.has_many}[rdoc-ref:Associations::ClassMethods#has_many] or +# {ActiveRecord::Base.has_and_belongs_to_many}[rdoc-ref:Associations::ClassMethods#has_and_belongs_to_many] +# associations. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:397 +class ActiveRecord::ConfigurationError < ::ActiveRecord::ActiveRecordError; end + +# :stopdoc: +# +# pkg:gem/activerecord#lib/active_record/connection_adapters.rb:6 +module ActiveRecord::ConnectionAdapters + extend ::ActiveSupport::Autoload + + class << self + # Registers a custom database adapter. + # + # Can also be used to define aliases. + # + # == Example + # + # ActiveRecord::ConnectionAdapters.register("megadb", "MegaDB::ActiveRecordAdapter", "mega_db/active_record_adapter") + # + # ActiveRecord::ConnectionAdapters.register("mysql", "ActiveRecord::ConnectionAdapters::TrilogyAdapter", "active_record/connection_adapters/trilogy_adapter") + # + # pkg:gem/activerecord#lib/active_record/connection_adapters.rb:22 + def register(name, class_name, path = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters.rb:26 + def resolve(adapter_name); end + end +end + +# = Active Record Abstract Adapter +# +# Active Record supports multiple database systems. AbstractAdapter and +# related classes form the abstraction layer which makes this possible. +# An AbstractAdapter represents a connection to a database, and provides an +# abstract interface for database-specific functionality such as establishing +# a connection, escaping values, building the right SQL fragments for +:offset+ +# and +:limit+ options, etc. +# +# All the concrete database adapters follow the interface laid down in this class. +# {ActiveRecord::Base.lease_connection}[rdoc-ref:ConnectionHandling#lease_connection] returns an AbstractAdapter object, which +# you can use. +# +# Most of the methods in the adapter are useful during migrations. Most +# notably, the instance methods provided by SchemaStatements are very useful. +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:31 +class ActiveRecord::ConnectionAdapters::AbstractAdapter + include ::ActiveSupport::Callbacks + include ::ActiveRecord::Migration::JoinTable + include ::ActiveRecord::ConnectionAdapters::SchemaStatements + include ::ActiveRecord::ConnectionAdapters::DatabaseStatements + include ::ActiveRecord::ConnectionAdapters::Quoting + include ::ActiveRecord::ConnectionAdapters::DatabaseLimits + include ::ActiveRecord::ConnectionAdapters::QueryCache + include ::ActiveRecord::ConnectionAdapters::Savepoints + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + extend ::ActiveRecord::ConnectionAdapters::Quoting::ClassMethods + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:132 + def initialize(config_or_deprecated_connection, deprecated_logger = T.unsafe(nil), deprecated_connection_options = T.unsafe(nil), deprecated_config = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:33 + def __callbacks; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _checkin_callbacks; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _checkout_callbacks; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _run_checkin_callbacks; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _run_checkin_callbacks!(&block); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _run_checkout_callbacks; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _run_checkout_callbacks!(&block); end + + # Checks whether the connection to the database is still active. This includes + # checking whether the database is actually capable of responding, i.e. whether + # the connection isn't stale. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:710 + def active?; end + + # Returns the human-readable name of the adapter. Use mixed case - one + # can always use downcase if needed. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:398 + def adapter_name; end + + # This is meant to be implemented by the adapters that support custom enum types + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:637 + def add_enum_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:657 + def advisory_locks_enabled?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:46 + def allow_preconnect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:56 + def allow_preconnect=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:611 + def async_enabled?; end + + # Called by ActiveRecord::InsertAll, + # Passed an instance of ActiveRecord::InsertAll::Builder, + # This method implements standard bulk inserts for all databases, but + # should be overridden by adapters to implement common features with + # non-standard syntax like handling duplicates or returning values. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:915 + def build_insert_sql(insert); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:886 + def case_insensitive_comparison(attribute, value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:882 + def case_sensitive_comparison(attribute, value); end + + # Override to check all foreign key constraints in a database. + # The adapter should raise a +ActiveRecord::StatementInvalid+ if foreign key + # constraints are not met. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:695 + def check_all_foreign_keys_valid!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:930 + def check_version; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:848 + def clean!; end + + # Clear any caching the database adapter may be doing. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:800 + def clear_cache!(new_connection: T.unsafe(nil)); end + + # Check the connection back in to the connection pool + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:902 + def close; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:843 + def connect!; end + + # Checks whether the connection to the database was established. This doesn't + # include checking whether the database is actually capable of responding, i.e. + # whether the connection is stale. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:703 + def connected?; end + + # Seconds since this connection was established. nil if not + # connected; infinity if the connection has been explicitly + # retired. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:377 + def connection_age; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:304 + def connection_descriptor; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:221 + def connection_retries; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def create(*, **, &); end + + # This is meant to be implemented by the adapters that support custom enum types + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:625 + def create_enum(*, **, &); end + + # Lock used to read an existing record after a duplicate INSERT in a transaction. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:653 + def create_or_find_by_lock; end + + # This is meant to be implemented by the adapters that support virtual tables + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:645 + def create_virtual_table(*); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:407 + def database_exists?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:926 + def database_version; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:906 + def default_index_type?(index); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:237 + def default_timezone; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:878 + def default_uniqueness_comparison(attribute, value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def delete(*, **, &); end + + # This is meant to be implemented by the adapters that support extensions + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:617 + def disable_extension(name, **); end + + # Override to turn off referential integrity while executing &block. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:688 + def disable_referential_integrity; end + + # Immediately forget this connection ever existed. Unlike disconnect!, + # this will not communicate with the server. + # + # After calling this method, the behavior of all other methods becomes + # undefined. This is called internally just before a forked process gets + # rid of a connection that belonged to its parent. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:773 + def discard!; end + + # Disconnects from the database if already connected. Otherwise, this + # method does nothing. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:756 + def disconnect!; end + + # This is meant to be implemented by the adapters that support custom enum types + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:629 + def drop_enum(*, **, &); end + + # This is meant to be implemented by the adapters that support virtual tables + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:649 + def drop_virtual_table(*); end + + # This is meant to be implemented by the adapters that support extensions + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:621 + def enable_extension(name, **); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:206 + def ensure_writes_are_allowed(sql); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def exec_insert_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def exec_query(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def execute(*, **, &); end + + # this method must only be called while holding connection pool's mutex + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:329 + def expire(update_idle = T.unsafe(nil)); end + + # A list of extensions, to be filled in by adapters that support them. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:676 + def extensions; end + + # Mark the connection as needing to be retired, as if the age has + # exceeded the maximum allowed. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:385 + def force_retirement; end + + # This is meant to be implemented by the adapters that support advisory + # locks + # + # Return true if we got the lock, otherwise false + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:665 + def get_advisory_lock(lock_id); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:923 + def get_database_version; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:48 + def in_use?; end + + # A list of index algorithms, to be filled by adapters that support them. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:681 + def index_algorithms; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def insert(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:187 + def inspect; end + + # this method must only be called while holding connection pool's mutex + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:289 + def lease; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:45 + def lock; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:194 + def lock_thread=(lock_thread); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:45 + def logger; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:213 + def max_jitter; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:284 + def native_database_types; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:45 + def owner; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:47 + def pinned; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:47 + def pinned=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:44 + def pool; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:50 + def pool=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:324 + def pool_jitter(duration); end + + # Should primary key values be selected from their corresponding + # sequence before the insert statement? If true, next_sequence_value + # is called before each insert to set the record's primary key. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:447 + def prefetch_primary_key?(table_name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:255 + def prepared_statements; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:252 + def prepared_statements?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:257 + def prepared_statements_disabled_cache; end + + # Determines whether writes are currently being prevented. + # + # Returns true if the connection is a replica or returns + # the value of +current_preventing_writes+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:245 + def preventing_writes?; end + + # Provides access to the underlying database driver for this adapter. For + # example, this method returns a Mysql2::Client object in case of Mysql2Adapter, + # and a PG::Connection object in case of PostgreSQLAdapter. + # + # This is useful for when you need to call a proprietary method such as + # PostgreSQL's lo_* methods. + # + # Active Record cannot track if the database is getting modified using + # this client. If that is the case, generally you'll want to invalidate + # the query cache using +ActiveRecord::Base.clear_query_cache+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:870 + def raw_connection; end + + # Disconnects from the database if already connected, and establishes a new + # connection with the database. Implementors should define private #reconnect + # instead. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:716 + def reconnect!(restore_transactions: T.unsafe(nil)); end + + # This is meant to be implemented by the adapters that support advisory + # locks. + # + # Return true if we released the lock, otherwise false + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:672 + def release_advisory_lock(lock_id); end + + # This is meant to be implemented by the adapters that support custom enum types + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:633 + def rename_enum(*, **, &); end + + # This is meant to be implemented by the adapters that support custom enum types + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:641 + def rename_enum_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:217 + def replica?; end + + # Returns true if its required to reload the connection between requests for development mode. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:813 + def requires_reloading?; end + + # Reset the state of this connection, directing the DBMS to clear + # transactions and other connection-related server-side state. Usually a + # database-dependent operation. + # + # If a database driver or protocol does not support such a feature, + # implementors may alias this to #reconnect!. Otherwise, implementors + # should call super immediately after resetting the connection (and while + # still holding @lock). + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:785 + def reset!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def restart_db_transaction(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:229 + def retry_deadline; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:607 + def return_value_after_insert?(column); end + + # The role (e.g. +:writing+) for the current connection. In a + # non-multi role application, +:writing+ is returned. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:310 + def role; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def rollback_db_transaction(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def rollback_to_savepoint(*, **, &); end + + # Do TransactionRollbackErrors on savepoints affect the parent + # transaction? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:431 + def savepoint_errors_invalidate_transactions?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:320 + def schema_cache; end + + # Returns the version identifier of the schema currently available in + # the database. This is generally equal to the number of the highest- + # numbered migration that has been executed, or 0 if no schema + # information is present / the database is empty. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:937 + def schema_version; end + + # Seconds since this connection was returned to the pool + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:362 + def seconds_idle; end + + # Seconds since this connection last communicated with the server + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:368 + def seconds_since_last_activity; end + + # The shard (e.g. +:default+) for the current connection. In + # a non-sharded application, +:default+ is returned. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:316 + def shard; end + + # this method must only be called while holding connection pool's mutex (and a desire for segfaults) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:349 + def steal!; end + + # Does this adapter support application-enforced advisory locking? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:440 + def supports_advisory_locks?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:420 + def supports_bulk_alter?; end + + # Does this adapter support creating check constraints? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:512 + def supports_check_constraints?; end + + # Does this adapter support metadata comments on database objects (tables, columns, indexes)? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:547 + def supports_comments?; end + + # Can comments for tables, columns, and indexes be specified in create/alter table statements? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:552 + def supports_comments_in_create?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:571 + def supports_common_table_expressions?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:595 + def supports_concurrent_connections?; end + + # Does this adapter support datetime with precision? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:537 + def supports_datetime_with_precision?; end + + # Does this adapter support DDL rollbacks in transactions? That is, would + # CREATE TABLE or ALTER TABLE get rolled back by a transaction? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:416 + def supports_ddl_transactions?; end + + # Does this adapter support creating deferrable constraints? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:507 + def supports_deferrable_constraints?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:603 + def supports_disabling_indexes?; end + + # Does this adapter support creating exclusion constraints? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:517 + def supports_exclusion_constraints?; end + + # Does this adapter support explain? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:476 + def supports_explain?; end + + # Does this adapter support expression indices? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:471 + def supports_expression_index?; end + + # Does this adapter support database extensions? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:486 + def supports_extensions?; end + + # Does this adapter support creating foreign key constraints? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:497 + def supports_foreign_keys?; end + + # Does this adapter support foreign/external tables? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:562 + def supports_foreign_tables?; end + + # Does this adapter support including non-key columns? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:466 + def supports_index_include?; end + + # Does this adapter support index sort order? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:456 + def supports_index_sort_order?; end + + # Does this adapter support creating indexes in the same statement as + # creating the table? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:492 + def supports_indexes_in_create?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:591 + def supports_insert_conflict_target?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:583 + def supports_insert_on_duplicate_skip?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:587 + def supports_insert_on_duplicate_update?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:579 + def supports_insert_returning?; end + + # Does this adapter support JSON data type? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:542 + def supports_json?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:575 + def supports_lazy_transactions?; end + + # Does this adapter support materialized views? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:532 + def supports_materialized_views?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:599 + def supports_nulls_not_distinct?; end + + # Does this adapter support optimizer hints? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:567 + def supports_optimizer_hints?; end + + # Does this adapter support partial indices? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:461 + def supports_partial_index?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:451 + def supports_partitioned_indexes?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:435 + def supports_restart_db_transaction?; end + + # Does this adapter support savepoints? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:425 + def supports_savepoints?; end + + # Does this adapter support setting the isolation level for a transaction? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:481 + def supports_transaction_isolation?; end + + # Does this adapter support creating unique constraints? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:522 + def supports_unique_constraints?; end + + # Does this adapter support creating invalid constraints? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:502 + def supports_validate_constraints?; end + + # Does this adapter support views? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:527 + def supports_views?; end + + # Does this adapter support virtual columns? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:557 + def supports_virtual_columns?; end + + # Removes the connection from the pool and disconnect it. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:794 + def throw_away!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def truncate(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def truncate_tables(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:389 + def unprepared_statement; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:38 + def update(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:280 + def valid_type?(type); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:856 + def verified?; end + + # Checks whether the connection to the database is still active (i.e. not stale). + # This is done under the hood by calling #active?. If the connection + # is no longer active, then this method will reconnect to the database. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:820 + def verify!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:225 + def verify_timeout; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:45 + def visitor; end + + private + + # Returns a raw connection for internal use with methods that are known + # to both be thread-safe and not rely upon actual server communication. + # This is useful for e.g. string escaping methods. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1172 + def any_raw_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1275 + def arel_visitor; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1301 + def attempt_configure_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1161 + def backoff(counter); end + + # Builds the result object. + # + # This is an internal hook to make possible connection adapters to build + # custom result objects with connection-specific data. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1286 + def build_result(columns:, rows:, column_types: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1279 + def build_statement_pool; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:896 + def can_perform_case_insensitive_comparison_for?(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1261 + def collector; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1250 + def column_for(table_name, column_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1256 + def column_for_attribute(attribute); end + + # Perform any necessary initialization upon the newly-established + # @raw_connection -- this is the place to modify the adapter's + # connection settings, run queries to configure any application-global + # "session" variables, etc. + # + # Implementations may assume this method will only be called while + # holding @lock (or from #initialize). + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1297 + def configure_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1308 + def default_prepared_statements; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1189 + def extended_type_map_key; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1236 + def instrumenter; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1147 + def invalidate_transaction(exception); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1217 + def log(sql, name = T.unsafe(nil), binds = T.unsafe(nil), type_casted_binds = T.unsafe(nil), async: T.unsafe(nil), allow_retry: T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1165 + def reconnect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1022 + def reconnect_can_restore_state?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1142 + def retryable_connection_error?(exception); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1154 + def retryable_query_error?(exception); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1240 + def translate_exception(exception, message:, sql:, binds:); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1205 + def translate_exception_class(native_error, sql, binds); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1195 + def type_map; end + + # Similar to any_raw_connection, but ensures it is validated and + # connected. Any method called on this result still needs to be + # independently thread-safe, so it probably shouldn't talk to the + # server... but some drivers fail if they know the connection has gone + # away. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1181 + def valid_raw_connection; end + + # Mark the connection as verified. Call this inside a + # `with_raw_connection` block only when the block is guaranteed to + # exercise the raw connection. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1137 + def verified!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1312 + def warning_ignored?(warning); end + + # Lock the monitor, ensure we're properly connected and + # transactions are materialized, and then yield the underlying + # raw connection object. + # + # If +allow_retry+ is true, a connection-related exception will + # cause an automatic reconnect and re-run of the block, up to + # the connection's configured +connection_retries+ setting + # and the configured +retry_deadline+ limit. (Note that when + # +allow_retry+ is true, it's possible to return without having marked + # the connection as verified. If the block is guaranteed to exercise the + # connection, consider calling `verified!` to avoid needless + # verification queries in subsequent calls.) + # + # If +materialize_transactions+ is false, the block will be run without + # ensuring virtual transactions have been materialized in the DB + # server's state. The active transaction will also remain clean + # (if it is not already dirty), meaning it's able to be restored + # by reconnecting and opening an equivalent-depth set of new + # transactions. This should only be used by transaction control + # methods, and internal transaction-agnostic queries. + # + # + # + # It's not the primary use case, so not something to optimize + # for, but note that this method does need to be re-entrant: + # +materialize_transactions+ will re-enter if it has work to do, + # and the yield block can also do so under some circumstances. + # + # In the latter case, we really ought to guarantee the inner + # call will not reconnect (which would interfere with the + # still-yielded connection in the outer block), but we currently + # provide no special enforcement there. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1059 + def with_raw_connection(allow_retry: T.unsafe(nil), materialize_transactions: T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:33 + def __callbacks; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:33 + def __callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _checkin_callbacks; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _checkin_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _checkout_callbacks; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:34 + def _checkout_callbacks=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:93 + def build_read_query_regexp(*parts); end + + # Does the database for this adapter exist? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:403 + def database_exists?(config); end + + # Opens a database console session. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:128 + def dbconsole(config, options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:949 + def extended_type_map(default_timezone:); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:99 + def find_cmd_and_exec(commands, *args); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:942 + def register_class_with_precision(mapping, key, klass, **kwargs); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:72 + def type_cast_config_to_boolean(config); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:62 + def type_cast_config_to_integer(config); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:957 + def valid_type?(type); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:80 + def validate_default_timezone(config); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:33 + def __class_attr___callbacks; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:33 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1013 + def extract_limit(sql_type); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1009 + def extract_precision(sql_type); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1002 + def extract_scale(sql_type); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:962 + def initialize_type_map(m); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:995 + def register_class_with_limit(mapping, key, klass); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:32 +ActiveRecord::ConnectionAdapters::AbstractAdapter::ADAPTER_NAME = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:42 +ActiveRecord::ConnectionAdapters::AbstractAdapter::COMMENT_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:90 +ActiveRecord::ConnectionAdapters::AbstractAdapter::DEFAULT_READ_QUERY = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1019 +ActiveRecord::ConnectionAdapters::AbstractAdapter::EXTENDED_TYPE_MAPS = T.let(T.unsafe(nil), Concurrent::Map) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:212 +ActiveRecord::ConnectionAdapters::AbstractAdapter::MAX_JITTER = T.let(T.unsafe(nil), Range) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:41 +ActiveRecord::ConnectionAdapters::AbstractAdapter::SIMPLE_INT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:1018 +ActiveRecord::ConnectionAdapters::AbstractAdapter::TYPE_MAP = T.let(T.unsafe(nil), ActiveRecord::Type::TypeMap) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:261 +class ActiveRecord::ConnectionAdapters::AbstractAdapter::Version + include ::Comparable + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:266 + def initialize(version_string, full_version_string = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:271 + def <=>(version_string); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:264 + def full_version_string; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract_adapter.rb:275 + def to_s; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:117 +class ActiveRecord::ConnectionAdapters::AddColumnDefinition < ::Struct + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:117 + def column; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:117 + def column=(_); end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:117 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:117 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:117 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:117 + def members; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:117 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:616 +class ActiveRecord::ConnectionAdapters::AlterTable + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:622 + def initialize(td); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:642 + def add_check_constraint(expression, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:654 + def add_column(name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:634 + def add_foreign_key(to_table, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:617 + def adds; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:619 + def check_constraint_adds; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:619 + def check_constraint_drops; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:620 + def constraint_drops; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:646 + def drop_check_constraint(constraint_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:650 + def drop_constraint(constraint_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:638 + def drop_foreign_key(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:618 + def foreign_key_adds; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:618 + def foreign_key_drops; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:632 + def name; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:143 +class ActiveRecord::ConnectionAdapters::BoundSchemaReflection + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:160 + def initialize(abstract_schema_reflection, pool); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:185 + def add(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:173 + def cached?(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:165 + def clear!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:217 + def clear_data_source_cache!(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:193 + def columns(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:197 + def columns_hash(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:201 + def columns_hash?(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:181 + def data_source_exists?(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:189 + def data_sources(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:221 + def dump_to(filename); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:205 + def indexes(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:169 + def load!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:177 + def primary_keys(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:213 + def size; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:209 + def version; end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:155 + def for_lone_connection(abstract_schema_reflection, connection); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:144 +class ActiveRecord::ConnectionAdapters::BoundSchemaReflection::FakePool + # :nodoc + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:145 + def initialize(connection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:149 + def with_connection; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 +class ActiveRecord::ConnectionAdapters::ChangeColumnDefaultDefinition < ::Struct + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 + def column; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 + def column=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 + def default; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 + def default=(_); end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 + def members; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:121 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 +class ActiveRecord::ConnectionAdapters::ChangeColumnDefinition < ::Struct + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 + def column; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 + def column=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 + def name=(_); end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 + def members; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:119 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 +class ActiveRecord::ConnectionAdapters::CheckConstraintDefinition < ::Struct + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:193 + def defined_for?(name:, expression: T.unsafe(nil), validate: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:189 + def export_name_on_schema_dump?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def expression; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def expression=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:180 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def options=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def table_name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def table_name=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:184 + def validate?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:187 + def validated?; end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def members; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:179 + def new(*_arg0); end + end +end + +# An abstract definition of a column in a table. +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:7 +class ActiveRecord::ConnectionAdapters::Column + include ::ActiveRecord::ConnectionAdapters::Deduplicable + extend ::ActiveRecord::ConnectionAdapters::Deduplicable::ClassMethods + + # Instantiates a new column in the table. + # + # +name+ is the column's name, such as supplier_id in supplier_id bigint. + # +default+ is the type-casted default value, such as +new+ in sales_stage varchar(20) default 'new'. + # +sql_type_metadata+ is various information about the type of the column + # +null+ determines if this column allows +NULL+ values. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:20 + def initialize(name, cast_type, default, sql_type_metadata = T.unsafe(nil), null = T.unsafe(nil), default_function = T.unsafe(nil), collation: T.unsafe(nil), comment: T.unsafe(nil), **); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:83 + def ==(other); end + + # whether the column is auto-populated by the database using a sequence + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:75 + def auto_incremented_by_db?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:79 + def auto_populated?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:40 + def bigint?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:10 + def cast_type; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:10 + def collation; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:10 + def comment; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:10 + def default; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:10 + def default_function; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:63 + def encode_with(coder); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:94 + def eql?(other); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:31 + def fetch_cast_type(connection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:36 + def has_default?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:96 + def hash; end + + # Returns the human name of the column name. + # + # ===== Examples + # Column.new('sales_stage', ...).human_name # => 'Sales stage' + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:48 + def human_name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:52 + def init_with(coder); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:12 + def limit(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:10 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:10 + def null; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:12 + def precision(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:12 + def scale(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:12 + def sql_type(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:10 + def sql_type_metadata; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:12 + def type(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:109 + def virtual?; end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:114 + def deduplicated; end +end + +# Abstract representation of a column definition. Instances of this type +# are typically created by methods in TableDefinition, and added to the +# +columns+ attribute of said TableDefinition object, in order to be used +# for generating a number of table creation or table changing SQL statements. +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 +class ActiveRecord::ConnectionAdapters::ColumnDefinition < ::Struct + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:108 + def aliased_types(name, fallback); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def cast_type; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def cast_type=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def collation; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def collation=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def comment; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def comment=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def default; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def default=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:112 + def fetch_cast_type(connection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def if_exists; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def if_exists=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def if_not_exists; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def if_not_exists=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def limit; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def limit=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def name=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def null; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def null=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def options=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def precision; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def precision=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:92 + def primary_key?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def scale; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:97 + def scale=(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def sql_type; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def sql_type=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def type; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def type=(_); end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def members; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:78 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:79 +ActiveRecord::ConnectionAdapters::ColumnDefinition::OPTION_NAMES = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:307 +module ActiveRecord::ConnectionAdapters::ColumnMethods + extend ::ActiveSupport::Concern + extend ::ActiveRecord::ConnectionAdapters::ColumnMethods::ClassMethods + + mixes_in_class_methods ::ActiveRecord::ConnectionAdapters::ColumnMethods::ClassMethods + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def bigint(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def binary(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:334 + def blob(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def boolean(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def date(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def datetime(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def decimal(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def float(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def integer(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def json(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:335 + def numeric(*names, **options); end + + # Appends a primary key definition to the table definition. + # Can be called multiple times, but this is probably not a good idea. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:327 + def primary_key(name, type = T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def string(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def text(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def time(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def timestamp(*names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:314 + def virtual(*names, **options); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:310 +module ActiveRecord::ConnectionAdapters::ColumnMethods::ClassMethods + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:312 + def define_column_methods(*column_types); end +end + +# = Active Record Connection Handler +# +# ConnectionHandler is a collection of ConnectionPool objects. It is used +# for keeping separate connection pools that connect to different databases. +# +# For example, suppose that you have 5 models, with the following hierarchy: +# +# class Author < ActiveRecord::Base +# end +# +# class BankAccount < ActiveRecord::Base +# end +# +# class Book < ActiveRecord::Base +# establish_connection :library_db +# end +# +# class ScaryBook < Book +# end +# +# class GoodBook < Book +# end +# +# And a database.yml that looked like this: +# +# development: +# database: my_application +# host: localhost +# +# library_db: +# database: library +# host: some.library.org +# +# Your primary database in the development environment is "my_application" +# but the Book model connects to a separate database called "library_db" +# (this can even be a database on a different machine). +# +# Book, ScaryBook, and GoodBook will all use the same connection pool to +# "library_db" while Author, BankAccount, and any other models you create +# will use the default connection pool to "my_application". +# +# The various connection pools are managed by a single instance of +# ConnectionHandler accessible via ActiveRecord::Base.connection_handler. +# All Active Record models use this handler to determine the connection pool that they +# should use. +# +# The ConnectionHandler class is not coupled with the Active models, as it has no knowledge +# about the model. The model needs to pass a connection specification name to the handler, +# in order to look up the correct connection pool. +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:56 +class ActiveRecord::ConnectionAdapters::ConnectionHandler + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:76 + def initialize; end + + # Returns true if there are any active connections among the connection + # pools that the ConnectionHandler is managing. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:157 + def active_connections?(role = T.unsafe(nil)); end + + # Returns any connections in use by the current thread back to the pool. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:162 + def clear_active_connections!(role = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:176 + def clear_all_connections!(role = T.unsafe(nil)); end + + # Clears reloadable connection caches in all connection pools. + # + # See ConnectionPool#clear_reloadable_connections! for details. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:172 + def clear_reloadable_connections!(role = T.unsafe(nil)); end + + # Returns true if a connection that's accessible to this class has + # already been opened. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:198 + def connected?(connection_name, role: T.unsafe(nil), shard: T.unsafe(nil)); end + + # Returns the pools for a connection handler and given role. If +:all+ is passed, + # all pools belonging to the connection handler will be returned. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:95 + def connection_pool_list(role = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:89 + def connection_pool_names; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:102 + def connection_pools(role = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:104 + def each_connection_pool(role = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:115 + def establish_connection(*args, **kwargs, &block); end + + # Disconnects all currently idle connections. + # + # See ConnectionPool#flush! for details. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:183 + def flush_idle_connections!(role = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:81 + def prevent_writes; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:85 + def prevent_writes=(prevent_writes); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:203 + def remove_connection_pool(connection_name, role: T.unsafe(nil), shard: T.unsafe(nil)); end + + # Locate the connection of the nearest super class. This can be an + # active or defined connection: if it is the latter, it will be + # opened and set as the active connection for the class it was defined + # for (not necessarily the current class). + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:191 + def retrieve_connection(connection_name, role: T.unsafe(nil), shard: T.unsafe(nil)); end + + # Retrieving the connection pool happens a lot, so we cache it in @connection_name_to_pool_manager. + # This makes retrieving the connection pool O(1) once the process is warm. + # When a connection is established or removed, we invalidate the cache. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:212 + def retrieve_connection_pool(connection_name, role: T.unsafe(nil), shard: T.unsafe(nil), strict: T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:238 + def connection_name_to_pool_manager; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:280 + def determine_owner_name(owner_name, config); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:254 + def disconnect_pool_from_pool_manager(pool_manager, role, shard); end + + # Returns the pool manager for a connection name / identifier. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:241 + def get_pool_manager(connection_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:250 + def pool_managers; end + + # Returns an instance of PoolConfig for a given adapter. + # Accepts a hash one layer deep that contains all connection information. + # + # == Example + # + # config = { "production" => { "host" => "localhost", "database" => "foo", "adapter" => "sqlite3" } } + # pool_config = Base.configurations.resolve_pool_config(:production) + # pool_config.db_config.configuration_hash + # # => { host: "localhost", database: "foo", adapter: "sqlite3" } + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:273 + def resolve_pool_config(config, connection_name, role, shard); end + + # Get the existing pool manager or initialize and assign a new one. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:246 + def set_pool_manager(connection_descriptor); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:57 +class ActiveRecord::ConnectionAdapters::ConnectionHandler::ConnectionDescriptor + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:58 + def initialize(name, primary = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:71 + def current_preventing_writes; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:63 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_handler.rb:67 + def primary_class?; end +end + +# = Active Record Connection Pool +# +# Connection pool base class for managing Active Record database +# connections. +# +# == Introduction +# +# A connection pool synchronizes thread access to a limited number of +# database connections. The basic idea is that each thread checks out a +# database connection from the pool, uses that connection, and checks the +# connection back in. ConnectionPool is completely thread-safe, and will +# ensure that a connection cannot be used by two threads at the same time, +# as long as ConnectionPool's contract is correctly followed. It will also +# handle cases in which there are more threads than connections: if all +# connections have been checked out, and a thread tries to checkout a +# connection anyway, then ConnectionPool will wait until some other thread +# has checked in a connection, or the +checkout_timeout+ has expired. +# +# == Obtaining (checking out) a connection +# +# Connections can be obtained and used from a connection pool in several +# ways: +# +# 1. Simply use {ActiveRecord::Base.lease_connection}[rdoc-ref:ConnectionHandling#lease_connection]. +# When you're done with the connection(s) and wish it to be returned to the pool, you call +# {ActiveRecord::Base.connection_handler.clear_active_connections!}[rdoc-ref:ConnectionAdapters::ConnectionHandler#clear_active_connections!]. +# This is the default behavior for Active Record when used in conjunction with +# Action Pack's request handling cycle. +# 2. Manually check out a connection from the pool with +# {ActiveRecord::Base.connection_pool.checkout}[rdoc-ref:#checkout]. You are responsible for +# returning this connection to the pool when finished by calling +# {ActiveRecord::Base.connection_pool.checkin(connection)}[rdoc-ref:#checkin]. +# 3. Use {ActiveRecord::Base.connection_pool.with_connection(&block)}[rdoc-ref:#with_connection], which +# obtains a connection, yields it as the sole argument to the block, +# and returns it to the pool after the block completes. +# +# Connections in the pool are actually AbstractAdapter objects (or objects +# compatible with AbstractAdapter's interface). +# +# While a thread has a connection checked out from the pool using one of the +# above three methods, that connection will automatically be the one used +# by ActiveRecord queries executing on that thread. It is not required to +# explicitly pass the checked out connection to \Rails models or queries, for +# example. +# +# == Options +# +# There are several connection-pooling-related options that you can add to +# your database connection configuration: +# +# * +checkout_timeout+: number of seconds to wait for a connection to +# become available before giving up and raising a timeout error (default +# 5 seconds). +# * +idle_timeout+: number of seconds that a connection will be kept +# unused in the pool before it is automatically disconnected (default +# 300 seconds). Set this to zero to keep connections forever. +# * +keepalive+: number of seconds between keepalive checks if the +# connection has been idle (default 600 seconds). +# * +max_age+: number of seconds the pool will allow the connection to +# exist before retiring it at next checkin. (default Float::INFINITY). +# * +max_connections+: maximum number of connections the pool may manage (default 5). +# Set to +nil+ or -1 for unlimited connections. +# * +min_connections+: minimum number of connections the pool will open and maintain (default 0). +# * +pool_jitter+: maximum reduction factor to apply to +max_age+ and +# +keepalive+ intervals (default 0.2; range 0.0-1.0). +# +# -- +# Synchronization policy: +# * all public methods can be called outside +synchronize+ +# * access to these instance variables needs to be in +synchronize+: +# * @connections +# * @now_connecting +# * @maintaining +# * private methods that require being called in a +synchronize+ blocks +# are now explicitly documented +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:7 +class ActiveRecord::ConnectionAdapters::ConnectionPool + include ::ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration + include ::MonitorMixin + + # Creates a new ConnectionPool object. +pool_config+ is a PoolConfig + # object which describes database connection information (e.g. adapter, + # host name, username, password, etc), as well as the maximum size for + # this ConnectionPool. + # + # The default ConnectionPool maximum size is 5. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:253 + def initialize(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:344 + def activate; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:348 + def activated?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:424 + def active_connection; end + + # Returns true if there is an open connection being used for the current thread. + # + # This method only works for connections that have been obtained through + # #lease_connection or #with_connection methods. Connections obtained through + # #checkout will not be detected by #active_connection? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:421 + def active_connection?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def async_executor; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:241 + def automatic_reconnect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:241 + def automatic_reconnect=(_arg0); end + + # Check-in a database connection back into the pool, indicating that you + # no longer need this connection. + # + # +conn+: an AbstractAdapter object, which was obtained by earlier by + # calling #checkout on this pool. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:667 + def checkin(conn); end + + # Check-out a database connection from the pool, indicating that you want + # to use it. You should call #checkin when you no longer need this. + # + # This is done by either returning and leasing existing connection, or by + # creating a new connection and leasing it. + # + # If all connections are leased and the pool is at capacity (meaning the + # number of currently leased connections is greater than or equal to the + # size limit set), an ActiveRecord::ConnectionTimeoutError exception will be raised. + # + # Returns: an AbstractAdapter object. + # + # Raises: + # - ActiveRecord::ConnectionTimeoutError no connection can be obtained from the pool. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:639 + def checkout(checkout_timeout = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1286 + def checkout_and_verify(connection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:241 + def checkout_timeout; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:241 + def checkout_timeout=(_arg0); end + + # Clears reloadable connections from the pool and re-connects connections that + # require reloading. + # + # Raises: + # - ActiveRecord::ExclusiveConnectionTimeoutError if unable to gain ownership of all + # connections in the pool within a timeout interval (default duration is + # spec.db_config.checkout_timeout * 2 seconds). + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:597 + def clear_reloadable_connections(raise_on_acquisition_timeout = T.unsafe(nil)); end + + # Clears reloadable connections from the pool and re-connects connections that + # require reloading. + # + # The pool first tries to gain ownership of all connections. If unable to + # do so within a timeout interval (default duration is + # spec.db_config.checkout_timeout * 2 seconds), then the pool forcefully + # clears the cache and reloads connections without any regard for other + # connection owning threads. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:621 + def clear_reloadable_connections!; end + + # Returns true if a connection has already been opened. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:492 + def connected?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:412 + def connection_descriptor; end + + # Returns an array containing the connections currently in the pool. + # Access to the array does not require synchronization on the pool because + # the array is newly created and not retained by the pool. + # + # However; this method bypasses the ConnectionPool's thread-safe connection + # access pattern. A returned connection may be owned by another thread, + # unowned, or by happen-stance owned by the calling thread. + # + # Calling methods on a connection without ownership is subject to the + # thread-safety guarantees of the underlying method. Many of the methods + # on connection adapter classes are inherently multi-thread unsafe. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:507 + def connections; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def db_config; end + + # Discards all connections in the pool (even if they're currently + # leased!), along with the pool itself. Any further interaction with the + # pool (except #spec and #schema_cache) is undefined. + # + # See AbstractAdapter#discard! + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:563 + def discard!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:576 + def discarded?; end + + # Disconnects all connections in the pool, and clears the pool. + # + # Raises: + # - ActiveRecord::ExclusiveConnectionTimeoutError if unable to gain ownership of all + # connections in the pool within a timeout interval (default duration is + # spec.db_config.checkout_timeout * 2 seconds). + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:517 + def disconnect(raise_on_acquisition_timeout = T.unsafe(nil)); end + + # Disconnects all connections in the pool, and clears the pool. + # + # The pool first tries to gain ownership of all connections. If unable to + # do so within a timeout interval (default duration is + # spec.db_config.checkout_timeout * 2 seconds), then the pool is forcefully + # disconnected without any regard for other connection owning threads. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:554 + def disconnect!; end + + # Disconnect all connections that have been idle for at least + # +minimum_idle+ seconds. Connections currently checked out, or that were + # checked in less than +minimum_idle+ seconds ago, are unaffected. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:736 + def flush(minimum_idle = T.unsafe(nil)); end + + # Disconnect all currently idle connections. Connections currently checked + # out are unaffected. The pool will stop maintaining its minimum size until + # it is reactivated (such as by a subsequent checkout). + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:775 + def flush!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:312 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:340 + def internal_metadata; end + + # Prod any connections that have been idle for longer than the configured + # keepalive time. This will incidentally verify the connection is still + # alive, but the main purpose is to show the server (and any intermediate + # network hops) that we're still here and using the connection. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:836 + def keep_alive(threshold = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def keepalive; end + + # Retrieve the connection associated with the current thread, or call + # #checkout to obtain one if necessary. + # + # #lease_connection can be called any number of times; the connection is + # held in a cache keyed by a thread. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:357 + def lease_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:580 + def maintainable?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def max_age; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def max_connections; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:328 + def migration_context; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:332 + def migrations_paths; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def min_connections; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:894 + def new_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:868 + def num_available_in_queue; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:864 + def num_waiting_in_queue; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:364 + def permanent_lease?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:368 + def pin_connection!(lock_thread); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def pool_config; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:902 + def pool_transaction_isolation_level; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:907 + def pool_transaction_isolation_level=(isolation_level); end + + # Preconnect all connections in the pool. This saves pool users from + # having to wait for a connection to be established when first using it + # after checkout. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:819 + def preconnect; end + + # Ensure that the pool contains at least the configured minimum number of + # connections. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:785 + def prepopulate; end + + # Recover lost connections for the pool. A lost connection can occur if + # a programmer forgets to checkin a connection at the end of a thread + # or a thread dies unexpectedly. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:713 + def reap; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def reaper; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:586 + def reaper_lock(&block); end + + # Immediately mark all current connections as due for replacement, + # equivalent to them having reached +max_age+ -- even if there is + # no +max_age+ configured. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:852 + def recycle!; end + + # Signal that the thread is finished with the current connection. + # #release_connection releases the connection-thread association + # and returns the connection to the pool. + # + # This method only works for connections that have been obtained through + # #lease_connection or #with_connection methods, connections obtained through + # #checkout will not be automatically released. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:433 + def release_connection(existing_lease = T.unsafe(nil)); end + + # Remove a connection from the connection pool. The connection will + # remain open and active but will no longer be managed by this pool. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:681 + def remove(conn); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:806 + def retire_old_connections(max_age = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def role; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:889 + def schedule_query(future_result); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:319 + def schema_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:336 + def schema_migration; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:245 + def schema_reflection(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:323 + def schema_reflection=(schema_reflection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:245 + def server_version(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:242 + def shard; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:243 + def size; end + + # Returns the connection pool's usage statistic. + # + # ActiveRecord::Base.connection_pool.stat # => { size: 15, connections: 1, busy: 1, dead: 0, idle: 0, waiting: 0, checkout_timeout: 5 } + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:875 + def stat; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:384 + def unpin_connection!; end + + # Yields a connection from the connection pool to the block. If no connection + # is already checked out by the current thread, a connection will be checked + # out from the pool, yielded to the block, and then returned to the pool when + # the block is finished. If a connection has already been checked out on the + # current thread, such as via #lease_connection or #with_connection, that existing + # connection will be the one yielded and it will not be returned to the pool + # automatically at the end of the block; it is expected that such an existing + # connection will be properly returned to the pool by the code that checked + # it out. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:452 + def with_connection(prevent_permanent_checkout: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:473 + def with_pool_transaction_isolation_level(isolation_level, transaction_open, &block); end + + private + + # Acquire a connection by one of 1) immediately removing one + # from the queue of available connections, 2) creating a new + # connection if the pool is not at capacity, 3) waiting on the + # queue for a connection to become available. + # + # Raises: + # - ActiveRecord::ConnectionTimeoutError if a connection could not be acquired + # + # -- + # Implementation detail: the connection returned by +acquire_connection+ + # will already be "+connection.lease+ -ed" to the current thread. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1167 + def acquire_connection(checkout_timeout); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1270 + def adopt_connection(conn); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1058 + def attempt_to_checkout_all_existing_connections(raise_on_acquisition_timeout = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:917 + def build_async_executor; end + + # -- + # this is unfortunately not concurrent + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1035 + def bulk_make_new_connections(num_new_conns_needed); end + + # -- + # Must be called in a synchronize block. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1107 + def checkout_for_exclusive_access(checkout_timeout); end + + # Directly check a specific connection out of the pool. Skips callbacks. + # + # The connection must later either #return_from_maintenance or + # #remove_from_maintenance, or the pool will hang. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:998 + def checkout_for_maintenance(conn); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1281 + def checkout_new_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:913 + def connection_lease; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1294 + def name_inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1223 + def release(conn, owner_thread = T.unsafe(nil)); end + + # -- + # if owner_thread param is omitted, this must be called in synchronize block + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1218 + def remove_connection_from_thread_cache(conn, owner_thread = T.unsafe(nil)); end + + # Remove a connection from the pool after it has been checked out for + # maintenance. It will be automatically replaced with a new connection if + # necessary. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1026 + def remove_from_maintenance(conn); end + + # Return a connection to the pool after it has been checked out for + # maintenance. Does not update the connection's idle time, and skips + # callbacks. + # -- + # We assume that a connection that has required maintenance is less + # desirable (either it's been idle for a long time, or it was just + # created and hasn't been used yet). We'll put it at the back of the + # queue. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1015 + def return_from_maintenance(conn); end + + # Perform maintenance work on pool connections. This method will + # select a connection to work on by calling the +candidate_selector+ + # proc while holding the pool lock. If a connection is selected, it + # will be checked out for maintenance and passed to the + # +maintenance_work+ proc. The connection will always be returned to + # the pool after the proc completes. + # + # If the pool has async threads, all work will be scheduled there. + # Otherwise, this method will block until all work is complete. + # + # Each connection will only be processed once per call to this method, + # but (particularly in the async case) there is no protection against + # a second call to this method starting to work through the list + # before the first call has completed. (Though regular pool behavior + # will prevent two instances from working on the same specific + # connection at the same time.) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:951 + def sequential_maintenance(candidate_selector, &maintenance_work); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1298 + def shard_inspect; end + + # If the pool is not at a @max_connections limit, establish new connection. Connecting + # to the DB is done outside main synchronized section. + # + # If a block is supplied, it is an additional constraint (checked while holding the + # pool lock) on whether a new connection should be established. + # -- + # Implementation constraint: a newly established connection returned by this + # method must be in the +.leased+ state. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1233 + def try_to_checkout_new_connection; end + + # -- + # If new connections are already being established in the background, + # and there are fewer threads already waiting than the number of + # upcoming connections, we can just get in queue and wait to be handed a + # connection. This avoids us overshooting the required connection count + # by starting a new connection ourselves, and is likely to be faster + # too (because at least some of the time it takes to establish a new + # connection must have already passed). + # + # If background connections are available, this method will block and + # return a connection. If no background connections are available, it + # will immediately return +nil+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1202 + def try_to_queue_for_background_connection(checkout_timeout); end + + # Take control of all existing connections so a "group" action such as + # reload/disconnect can be performed safely. It is no longer enough to + # wrap it in +synchronize+ because some pool's actions are allowed + # to be performed outside of the main +synchronize+ block. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1049 + def with_exclusively_acquired_all_connections(raise_on_acquisition_timeout = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:1127 + def with_new_connections_blocked; end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:233 + def install_executor_hooks(executor = T.unsafe(nil)); end + end +end + +# Adds the ability to turn a basic fair FIFO queue into one +# biased to some thread. +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:150 +module ActiveRecord::ConnectionAdapters::ConnectionPool::BiasableQueue + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:190 + def with_a_bias_for(thread); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:151 +class ActiveRecord::ConnectionAdapters::ConnectionPool::BiasableQueue::BiasedConditionVariable + # semantics of condition variables guarantee that +broadcast+, +broadcast_on_biased+, + # +signal+ and +wait+ methods are only called while holding a lock + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:154 + def initialize(lock, other_cond, preferred_thread); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:161 + def broadcast; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:166 + def broadcast_on_biased; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:171 + def signal; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:180 + def wait(timeout); end +end + +# Connections must be leased while holding the main pool mutex. This is +# an internal subclass that also +.leases+ returned connections while +# still in queue's critical section (queue synchronizes with the same +# @lock as the main pool) so that a returned connection is already +# leased and there is no need to re-enter synchronized block. +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:211 +class ActiveRecord::ConnectionAdapters::ConnectionPool::ConnectionLeasingQueue < ::ActiveRecord::ConnectionAdapters::ConnectionPool::Queue + include ::ActiveRecord::ConnectionAdapters::ConnectionPool::BiasableQueue + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:215 + def internal_poll(timeout); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:213 +module ActiveRecord::ConnectionAdapters::ConnectionPool::ExecutorHooks + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:219 + def complete(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:215 + def run; end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:159 +class ActiveRecord::ConnectionAdapters::ConnectionPool::Lease + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:162 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:174 + def clear(connection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:160 + def connection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:160 + def connection=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:167 + def release; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:160 + def sticky; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:160 + def sticky=(_arg0); end +end + +# Thanks to the GVL, the LeaseRegistry doesn't need to be synchronized on MRI +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:187 +class ActiveRecord::ConnectionAdapters::ConnectionPool::LeaseRegistry < ::ObjectSpace::WeakKeyMap + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:188 + def [](context); end +end + +# = Active Record Connection Pool \Queue +# +# Threadsafe, fair, LIFO queue. Meant to be used by ConnectionPool +# with which it shares a Monitor. +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:12 +class ActiveRecord::ConnectionAdapters::ConnectionPool::Queue + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:13 + def initialize(lock = T.unsafe(nil)); end + + # Add +element+ to the queue. Never blocks. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:36 + def add(element); end + + # Add +element+ to the back of the queue. Never blocks. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:44 + def add_back(element); end + + # Test if any threads are currently waiting on the queue. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:21 + def any_waiting?; end + + # Remove all elements from the queue. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:59 + def clear; end + + # If +element+ is in the queue, remove and return it, or +nil+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:52 + def delete(element); end + + # Returns the number of threads currently waiting on this + # queue. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:29 + def num_waiting; end + + # Remove the head of the queue. + # + # If +timeout+ is not given, remove and return the head of the + # queue if the number of available elements is strictly + # greater than the number of threads currently waiting (that + # is, don't jump ahead in line). Otherwise, return +nil+. + # + # If +timeout+ is given, block if there is no element + # available, waiting up to +timeout+ seconds for an element to + # become available. + # + # Raises: + # - ActiveRecord::ConnectionTimeoutError if +timeout+ is given and no element + # becomes available within +timeout+ seconds, + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:86 + def poll(timeout = T.unsafe(nil)); end + + # Number of elements in the queue. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:66 + def size; end + + private + + # Test if the queue currently contains any elements. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:100 + def any?; end + + # A thread can remove an element from the queue without + # waiting if and only if the number of currently available + # connections is strictly greater than the number of waiting + # threads. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:108 + def can_remove_no_wait?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:91 + def internal_poll(timeout); end + + # Remove and return the head of the queue if the number of + # available elements is strictly greater than the number of + # threads currently waiting. Otherwise, return +nil+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:120 + def no_wait_poll; end + + # Removes and returns the head of the queue if possible, or +nil+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:113 + def remove; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:95 + def synchronize(&block); end + + # Waits on the queue up to +timeout+ seconds, then removes and + # returns the head of the queue. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/queue.rb:126 + def wait_poll(timeout); end +end + +# = Active Record Connection Pool \Reaper +# +# The reaper is a singleton that exists in the background of the process +# and is responsible for general maintenance of all the connection pools. +# +# It will reclaim connections that are leased to now-dead threads, +# ensuring that a bad thread can't leak a pool slot forever. By definition, +# this involves touching currently-leased connections, but that is safe +# because the owning thread is known to be dead. +# +# Beyond that, it manages the health of available / unleased connections: +# * retiring connections that have been idle[1] for too long +# * creating occasional activity on inactive[1] connections +# * keeping the pool prepopulated up to its minimum size +# * proactively connecting to the target database from any pooled +# connections that had lazily deferred that step +# * resetting or replacing connections that are known to be broken +# +# +# [1]: "idle" and "inactive" here distinguish between connections that +# have not been requested by the application in a while (idle) and those +# that have not spoken to their remote server in a while (inactive). The +# former is a desirable opportunity to reduce our connection count +# (`idle_timeout`); the latter is a risk that the server or a firewall may +# drop a connection we still anticipate using (avoided by `keepalive`). +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:33 +class ActiveRecord::ConnectionAdapters::ConnectionPool::Reaper + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:36 + def initialize(pool, frequency); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:34 + def frequency; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:34 + def pool; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:127 + def run; end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:56 + def discard_pool(pool); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:73 + def pools(refs = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:46 + def register_pool(pool, frequency); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:83 + def spawn_thread(frequency); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:133 +ActiveRecord::ConnectionAdapters::ConnectionPool::WeakThreadKeyMap = ObjectSpace::WeakKeyMap + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 +class ActiveRecord::ConnectionAdapters::CreateIndexDefinition < ::Struct + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def algorithm; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def algorithm=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def if_not_exists; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def if_not_exists=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def index; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def index=(_); end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def members; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:123 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_limits.rb:5 +module ActiveRecord::ConnectionAdapters::DatabaseLimits + # Returns the maximum length of an index name. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_limits.rb:21 + def index_name_length; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_limits.rb:6 + def max_identifier_length; end + + # Returns the maximum length of a table alias. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_limits.rb:16 + def table_alias_length; end + + # Returns the maximum length of a table name. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_limits.rb:11 + def table_name_length; end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_limits.rb:26 + def bind_params_length; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:5 +module ActiveRecord::ConnectionAdapters::DatabaseStatements + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:6 + def initialize; end + + # Register a record with the current transaction so that its after_commit and after_rollback callbacks + # can be called. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:424 + def add_transaction_record(record, ensure_finalize = T.unsafe(nil)); end + + # Begins the transaction (and turns off auto-committing). + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:429 + def begin_db_transaction; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:431 + def begin_deferred_transaction(isolation_level = T.unsafe(nil)); end + + # Begins the transaction with the isolation level set. Raises an error by + # default; adapters that support setting the isolation level should implement + # this method. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:454 + def begin_isolated_db_transaction(isolation); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def begin_transaction(*, **, &); end + + # This is used in the StatementCache object. It returns an object that + # can be used to query the database repeatedly. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:56 + def cacheable_query(klass, arel); end + + # Commits the transaction (and turns on auto-committing). + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:468 + def commit_db_transaction; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def commit_transaction(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:206 + def create(arel, name = T.unsafe(nil), pk = T.unsafe(nil), id_value = T.unsafe(nil), sequence_name = T.unsafe(nil), binds = T.unsafe(nil), returning: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def current_transaction(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:558 + def default_insert_value(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:490 + def default_sequence_name(table, column); end + + # Executes the delete statement and returns the number of rows affected. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:215 + def delete(arel, name = T.unsafe(nil), binds = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def dirty_current_transaction(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def disable_lazy_transactions!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:520 + def empty_insert_statement_value(primary_key = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def enable_lazy_transactions!(*, **, &); end + + # Executes delete +sql+ statement in the context of this connection using + # +binds+ as the bind substitutes. +name+ is logged along with + # the executed +sql+ statement. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:168 + def exec_delete(sql, name = T.unsafe(nil), binds = T.unsafe(nil)); end + + # Executes insert +sql+ statement in the context of this connection using + # +binds+ as the bind substitutes. +name+ is logged along with + # the executed +sql+ statement. + # Some adapters support the `returning` keyword argument which allows to control the result of the query: + # `nil` is the default value and maintains default behavior. If an array of column names is passed - + # the result will contain values of the specified columns from the inserted row. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:160 + def exec_insert(sql, name = T.unsafe(nil), binds = T.unsafe(nil), pk = T.unsafe(nil), sequence_name = T.unsafe(nil), returning: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:179 + def exec_insert_all(sql, name); end + + # Executes +sql+ statement in the context of this connection using + # +binds+ as the bind substitutes. +name+ is logged along with + # the executed +sql+ statement. + # + # Note: the query is assumed to have side effects and the query cache + # will be cleared. If the query is read-only, consider using #select_all + # instead. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:150 + def exec_query(sql, name = T.unsafe(nil), binds = T.unsafe(nil), prepare: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:484 + def exec_restart_db_transaction; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:478 + def exec_rollback_db_transaction; end + + # Executes update +sql+ statement in the context of this connection using + # +binds+ as the bind substitutes. +name+ is logged along with + # the executed +sql+ statement. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:175 + def exec_update(sql, name = T.unsafe(nil), binds = T.unsafe(nil)); end + + # Executes the SQL statement in the context of this connection and returns + # the raw result from the connection adapter. + # + # Setting +allow_retry+ to true causes the db to reconnect and retry + # executing the SQL statement in case of a connection-related exception. + # This option should only be enabled for known idempotent queries. + # + # Note: the query is assumed to have side effects and the query cache + # will be cleared. If the query is read-only, consider using #select_all + # instead. + # + # Note: depending on your database connector, the result returned by this + # method may be manually memory managed. Consider using #exec_query + # wrapper instead. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:139 + def execute(sql, name = T.unsafe(nil), allow_retry: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:183 + def explain(arel, binds = T.unsafe(nil), options = T.unsafe(nil)); end + + # Returns an Arel SQL literal for the CURRENT_TIMESTAMP for usage with + # arbitrary precision date/time columns. + # + # Adapters supporting datetime with precision should override this to + # provide as much precision as is available. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:544 + def high_precision_current_timestamp; end + + # Executes an INSERT query and returns the new record's ID + # + # +id_value+ will be returned unless the value is +nil+, in + # which case the database will attempt to calculate the last inserted + # id and return that value. + # + # If the next id was calculated in advance (as in Oracle), it should be + # passed in as +id_value+. + # Some adapters support the `returning` keyword argument which allows defining the return value of the method: + # `nil` is the default value and maintains default behavior. If an array of column names is passed - + # an array of is returned from the method representing values of the specified columns from the inserted row. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:198 + def insert(arel, name = T.unsafe(nil), pk = T.unsafe(nil), id_value = T.unsafe(nil), sequence_name = T.unsafe(nil), binds = T.unsafe(nil), returning: T.unsafe(nil)); end + + # Inserts the given fixture into the table. Overridden in adapters that require + # something beyond a simple insert (e.g. Oracle). + # Most of adapters should implement +insert_fixtures_set+ that leverages bulk SQL insert. + # We keep this method to provide fallback + # for databases like SQLite that do not support bulk inserts. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:504 + def insert_fixture(fixture, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:508 + def insert_fixtures_set(fixture_set, tables_to_delete = T.unsafe(nil)); end + + # Execute a query and returns an ActiveRecord::Result + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:554 + def internal_exec_query(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:391 + def mark_transaction_written; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def materialize_transactions(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def open_transactions(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:116 + def query(sql, name = T.unsafe(nil), allow_retry: T.unsafe(nil), materialize_transactions: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:108 + def query_value(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:112 + def query_values(*, **, &); end + + # Same as raw_execute but returns an ActiveRecord::Result object. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:549 + def raw_exec_query(*, **, &); end + + # Hook point called after an isolated DB transaction is committed + # or rolled back. + # Most adapters don't need to implement anything because the isolation + # level is set on a per transaction basis. + # But some databases like SQLite set it on a per connection level + # and need to explicitly reset it after commit or rollback. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:464 + def reset_isolation_level; end + + # Set the sequence to the max value of the table's column. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:495 + def reset_sequence!(table, column, sequence = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:402 + def reset_transaction(restore: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:480 + def restart_db_transaction; end + + # Rolls back the transaction (and turns on auto-committing). Must be + # done if the transaction block raises an exception or returns false. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:472 + def rollback_db_transaction; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:486 + def rollback_to_savepoint(name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def rollback_transaction(*, **, &); end + + # Returns an ActiveRecord::Result instance. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:72 + def select_all(arel, name = T.unsafe(nil), binds = T.unsafe(nil), preparable: T.unsafe(nil), async: T.unsafe(nil), allow_retry: T.unsafe(nil)); end + + # Returns a record hash with the column names as keys and column values + # as values. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:87 + def select_one(arel, name = T.unsafe(nil), binds = T.unsafe(nil), async: T.unsafe(nil)); end + + # Returns an array of arrays containing the field values. + # Order is the same as that returned by +columns+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:104 + def select_rows(arel, name = T.unsafe(nil), binds = T.unsafe(nil), async: T.unsafe(nil)); end + + # Returns a single value from a record + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:92 + def select_value(arel, name = T.unsafe(nil), binds = T.unsafe(nil), async: T.unsafe(nil)); end + + # Returns an array of the values of the first column in a select: + # select_values("SELECT id FROM companies LIMIT 3") => [1,2,3] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:98 + def select_values(arel, name = T.unsafe(nil), binds = T.unsafe(nil)); end + + # Converts an arel AST to SQL + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:12 + def to_sql(arel_or_sql_string, binds = T.unsafe(nil)); end + + # Runs the given block in a database transaction, and returns the result + # of the block. + # + # == Transaction callbacks + # + # #transaction yields an ActiveRecord::Transaction object on which it is + # possible to register callback: + # + # ActiveRecord::Base.transaction do |transaction| + # transaction.before_commit { puts "before commit!" } + # transaction.after_commit { puts "after commit!" } + # transaction.after_rollback { puts "after rollback!" } + # end + # + # == Nested transactions support + # + # #transaction calls can be nested. By default, this makes all database + # statements in the nested transaction block become part of the parent + # transaction. For example, the following behavior may be surprising: + # + # ActiveRecord::Base.transaction do + # Post.create(title: 'first') + # ActiveRecord::Base.transaction do + # Post.create(title: 'second') + # raise ActiveRecord::Rollback + # end + # end + # + # This creates both "first" and "second" posts. Reason is the + # ActiveRecord::Rollback exception in the nested block does not issue a + # ROLLBACK. Since these exceptions are captured in transaction blocks, + # the parent block does not see it and the real transaction is committed. + # + # Most databases don't support true nested transactions. At the time of + # writing, the only database that supports true nested transactions that + # we're aware of, is MS-SQL. + # + # In order to get around this problem, #transaction will emulate the effect + # of nested transactions, by using savepoints: + # https://dev.mysql.com/doc/refman/en/savepoint.html. + # + # It is safe to call this method if a database transaction is already open, + # i.e. if #transaction is called within another #transaction block. In case + # of a nested call, #transaction will behave as follows: + # + # - The block will be run without doing anything. All database statements + # that happen within the block are effectively appended to the already + # open database transaction. + # - However, if +:requires_new+ is set, the block will be wrapped in a + # database savepoint acting as a sub-transaction. + # + # In order to get a ROLLBACK for the nested transaction you may ask for a + # real sub-transaction by passing requires_new: true. + # If anything goes wrong, the database rolls back to the beginning of + # the sub-transaction without rolling back the parent transaction. + # If we add it to the previous example: + # + # ActiveRecord::Base.transaction do + # Post.create(title: 'first') + # ActiveRecord::Base.transaction(requires_new: true) do + # Post.create(title: 'second') + # raise ActiveRecord::Rollback + # end + # end + # + # only post with title "first" is created. + # + # See ActiveRecord::Transactions to learn more. + # + # === Caveats + # + # MySQL doesn't support DDL transactions. If you perform a DDL operation, + # then any created savepoints will be automatically released. For example, + # if you've created a savepoint, then you execute a CREATE TABLE statement, + # then the savepoint that was created will be automatically released. + # + # This means that, on MySQL, you shouldn't execute DDL operations inside + # a #transaction call that you know might create a savepoint. Otherwise, + # #transaction will raise exceptions when it tries to release the + # already-automatically-released savepoints: + # + # Model.lease_connection.transaction do # BEGIN + # Model.lease_connection.transaction(requires_new: true) do # CREATE SAVEPOINT active_record_1 + # Model.lease_connection.create_table(...) + # # active_record_1 now automatically released + # end # RELEASE SAVEPOINT active_record_1 <--- BOOM! database error! + # end + # + # == Transaction isolation + # + # If your database supports setting the isolation level for a transaction, you can set + # it like so: + # + # Post.transaction(isolation: :serializable) do + # # ... + # end + # + # Valid isolation levels are: + # + # * :read_uncommitted + # * :read_committed + # * :repeatable_read + # * :serializable + # + # You should consult the documentation for your database to understand the + # semantics of these different levels: + # + # * https://www.postgresql.org/docs/current/static/transaction-iso.html + # * https://dev.mysql.com/doc/refman/en/set-transaction.html + # + # An ActiveRecord::TransactionIsolationError will be raised if: + # + # * The adapter does not support setting the isolation level + # * You are joining an existing open transaction + # * You are creating a nested (savepoint) transaction + # + # The mysql2, trilogy, and postgresql adapters support setting the transaction + # isolation level. + # :args: (requires_new: nil, isolation: nil, &block) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:355 + def transaction(requires_new: T.unsafe(nil), isolation: T.unsafe(nil), joinable: T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:447 + def transaction_isolation_levels; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:384 + def transaction_manager; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:398 + def transaction_open?; end + + # Executes the truncate statement. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:221 + def truncate(table_name, name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:225 + def truncate_tables(*table_names); end + + # Executes the update statement and returns the number of rows affected. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:209 + def update(arel, name = T.unsafe(nil), binds = T.unsafe(nil)); end + + # Fixture value is quoted by Arel, however scalar values + # are not quotable. In this case we want to convert + # the column value to YAML. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:527 + def with_yaml_fallback(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:386 + def within_new_transaction(*, **, &); end + + # Determines whether the SQL statement is a write query. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:121 + def write_query?(sql); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:602 + def affected_rows(raw_result); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:759 + def arel_from_relation(relation); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:634 + def build_fixture_sql(fixtures, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:676 + def build_fixture_statements(fixture_set); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:683 + def build_truncate_statement(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:687 + def build_truncate_statements(table_names); end + + # Receive a native adapter result object and returns an ActiveRecord::Result object. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:598 + def cast_result(raw_result); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:693 + def combine_multi_statements(total_sql); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:628 + def execute_batch(statements, name = T.unsafe(nil), **kwargs); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:767 + def extract_table_ref_from_insert_sql(sql); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:594 + def handle_warnings(raw_result, sql); end + + # Same as #internal_exec_query, but yields a native adapter result + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:623 + def internal_execute(sql, name = T.unsafe(nil), binds = T.unsafe(nil), prepare: T.unsafe(nil), async: T.unsafe(nil), allow_retry: T.unsafe(nil), materialize_transactions: T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:746 + def last_inserted_id(result); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:590 + def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch:); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:606 + def preprocess_query(sql); end + + # Lowest level way to execute a query. Doesn't check for illegal writes, doesn't annotate queries, yields a native result object. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:567 + def raw_execute(sql, name = T.unsafe(nil), binds = T.unsafe(nil), prepare: T.unsafe(nil), async: T.unsafe(nil), allow_retry: T.unsafe(nil), materialize_transactions: T.unsafe(nil), batch: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:750 + def returning_column_values(result); end + + # Returns an ActiveRecord::Result instance. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:698 + def select(sql, name = T.unsafe(nil), binds = T.unsafe(nil), prepare: T.unsafe(nil), async: T.unsafe(nil), allow_retry: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:754 + def single_value_from_rows(rows); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:729 + def sql_for_insert(sql, pk, binds, returning); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:17 + def to_sql_and_binds(arel_or_sql_string, binds = T.unsafe(nil), preparable = T.unsafe(nil), allow_retry = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:563 +ActiveRecord::ConnectionAdapters::DatabaseStatements::DEFAULT_INSERT_VALUE = T.let(T.unsafe(nil), Arel::Nodes::SqlLiteral) + +# This is a safe default, even if not high precision on all databases +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:536 +ActiveRecord::ConnectionAdapters::DatabaseStatements::HIGH_PRECISION_CURRENT_TIMESTAMP = T.let(T.unsafe(nil), Arel::Nodes::SqlLiteral) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/database_statements.rb:439 +ActiveRecord::ConnectionAdapters::DatabaseStatements::TRANSACTION_ISOLATION_LEVELS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/deduplicable.rb:5 +module ActiveRecord::ConnectionAdapters::Deduplicable + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::ConnectionAdapters::Deduplicable::ClassMethods + + # pkg:gem/activerecord#lib/active_record/connection_adapters/deduplicable.rb:21 + def -@; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/deduplicable.rb:18 + def deduplicate; end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/deduplicable.rb:24 + def deduplicated; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/deduplicable.rb:8 +module ActiveRecord::ConnectionAdapters::Deduplicable::ClassMethods + # pkg:gem/activerecord#lib/active_record/connection_adapters/deduplicable.rb:13 + def new(*, **); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/deduplicable.rb:9 + def registry; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 +class ActiveRecord::ConnectionAdapters::ForeignKeyDefinition < ::Struct + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:132 + def column; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:152 + def custom_primary_key?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:148 + def deferrable; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:165 + def defined_for?(to_table: T.unsafe(nil), validate: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:161 + def export_name_on_schema_dump?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def from_table; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def from_table=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:128 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:140 + def on_delete; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:144 + def on_update; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def options=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:136 + def primary_key; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def to_table; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def to_table=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:156 + def validate?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:159 + def validated?; end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:174 + def default_primary_key; end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def members; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:127 + def new(*_arg0); end + end +end + +# Abstract representation of an index definition on a table. Instances of +# this type are typically created and returned by methods in database +# adapters. e.g. ActiveRecord::ConnectionAdapters::MySQL::SchemaStatements#indexes +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:8 +class ActiveRecord::ConnectionAdapters::IndexDefinition + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:11 + def initialize(table, name, unique = T.unsafe(nil), columns = T.unsafe(nil), lengths: T.unsafe(nil), orders: T.unsafe(nil), opclasses: T.unsafe(nil), where: T.unsafe(nil), type: T.unsafe(nil), using: T.unsafe(nil), include: T.unsafe(nil), nulls_not_distinct: T.unsafe(nil), comment: T.unsafe(nil), valid: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:46 + def column_options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def columns; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def comment; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:54 + def defined_for?(columns = T.unsafe(nil), name: T.unsafe(nil), unique: T.unsafe(nil), valid: T.unsafe(nil), include: T.unsafe(nil), nulls_not_distinct: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def include; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def lengths; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def nulls_not_distinct; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def opclasses; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def orders; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def table; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def type; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def unique; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def using; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def valid; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:42 + def valid?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:9 + def where; end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:65 + def concise_options(options); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:125 +class ActiveRecord::ConnectionAdapters::NullColumn < ::ActiveRecord::ConnectionAdapters::Column + # pkg:gem/activerecord#lib/active_record/connection_adapters/column.rb:126 + def initialize(name, **); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:11 +class ActiveRecord::ConnectionAdapters::NullPool + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:19 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:38 + def async_executor; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:36 + def checkin(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:35 + def connection_descriptor; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:40 + def db_config; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:44 + def dirties_query_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:48 + def pool_transaction_isolation_level; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:49 + def pool_transaction_isolation_level=(isolation_level); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:34 + def query_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:37 + def remove(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:33 + def schema_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:29 + def schema_reflection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:25 + def server_version(connection); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:17 +ActiveRecord::ConnectionAdapters::NullPool::NULL_CONFIG = T.let(T.unsafe(nil), ActiveRecord::ConnectionAdapters::NullPool::NullConfig) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:12 +class ActiveRecord::ConnectionAdapters::NullPool::NullConfig + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/connection_pool.rb:13 + def method_missing(*, **, &); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:110 +class ActiveRecord::ConnectionAdapters::NullTransaction + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:116 + def add_record(record, _ = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:124 + def after_commit; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:125 + def after_rollback; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:123 + def before_commit; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:112 + def closed?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:119 + def dirty!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:118 + def dirty?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:121 + def invalidate!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:120 + def invalidated?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:115 + def isolation; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:127 + def isolation=(_); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:114 + def joinable?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:122 + def materialized?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:113 + def open?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:117 + def restartable?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:111 + def state; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:126 + def user_transaction; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:5 +class ActiveRecord::ConnectionAdapters::PoolConfig + include ::MonitorMixin + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:28 + def initialize(connection_class, db_config, role, shard); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:8 + def connection_descriptor; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:43 + def connection_descriptor=(connection_descriptor); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:8 + def db_config; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:69 + def discard_pool!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:52 + def disconnect!(automatic_reconnect: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:65 + def pool; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:8 + def role; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:11 + def schema_reflection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:9 + def schema_reflection=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:39 + def server_version(connection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:9 + def server_version=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:8 + def shard; end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:19 + def discard_pools!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:23 + def disconnect_all!; end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/pool_config.rb:15 +ActiveRecord::ConnectionAdapters::PoolConfig::INSTANCES = T.let(T.unsafe(nil), ObjectSpace::WeakMap) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:5 +class ActiveRecord::ConnectionAdapters::PoolManager + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:6 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:26 + def each_pool_config(role = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:44 + def get_pool_config(role, shard); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:18 + def pool_configs(role = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:40 + def remove_pool_config(role, shard); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:36 + def remove_role(role); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:14 + def role_names; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:48 + def set_pool_config(role, shard, pool_config); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/pool_manager.rb:10 + def shard_names; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:125 +class ActiveRecord::ConnectionAdapters::PrimaryKeyDefinition < ::Struct + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:125 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:125 + def name=(_); end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:125 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:125 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:125 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:125 + def members; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:125 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:8 +module ActiveRecord::ConnectionAdapters::QueryCache + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:210 + def initialize(*); end + + # Enable the query cache within the block. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:233 + def cache(&block); end + + # Clears the query cache. + # + # One reason you may wish to call this method explicitly is between queries + # that ask the database to randomize results. Otherwise the cache would see + # the same SQL query and repeatedly return the same result each time, silently + # undermining the randomness you were expecting. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:259 + def clear_query_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:249 + def disable_query_cache!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:237 + def enable_query_cache!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:217 + def query_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:215 + def query_cache=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:228 + def query_cache_enabled; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:263 + def select_all(arel, name = T.unsafe(nil), binds = T.unsafe(nil), preparable: T.unsafe(nil), async: T.unsafe(nil), allow_retry: T.unsafe(nil)); end + + # Disable the query cache within the block. + # + # Set dirties: false to prevent query caches on all connections from being cleared by write operations. + # (By default, write operations dirty all connections' query caches in case they are replicas whose cache would now be outdated.) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:245 + def uncached(dirties: T.unsafe(nil), &block); end + + private + + # Database adapters can override this method to + # provide custom cache information. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:335 + def cache_notification_info(sql, name, binds); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:327 + def cache_notification_info_result(sql, name, binds, result); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:305 + def cache_sql(sql, name, binds); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:287 + def lookup_sql_cache(sql, name, binds); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:283 + def unset_query_cache!; end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:18 + def dirties_query_cache(base, *method_names); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:12 + def included(base); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:132 +module ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:133 + def initialize(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:148 + def checkout_and_verify(connection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:193 + def clear_query_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:189 + def dirties_query_cache; end + + # Disable the query cache within the block. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:155 + def disable_query_cache(dirties: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:180 + def disable_query_cache!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:165 + def enable_query_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:175 + def enable_query_cache!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:203 + def query_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:185 + def query_cache_enabled; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:9 +ActiveRecord::ConnectionAdapters::QueryCache::DEFAULT_SIZE = T.let(T.unsafe(nil), Integer) + +# Each connection pool has one of these registries. They map execution +# contexts to query cache stores. +# +# The keys of the internal map are threads or fibers (whatever +# ActiveSupport::IsolatedExecutionState.context returns), and their +# associated values are their respective query cache stores. +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:113 +class ActiveRecord::ConnectionAdapters::QueryCache::QueryCacheRegistry + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:114 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:125 + def clear; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:119 + def compute_if_absent(context); end +end + +# This is the actual query cache store. +# +# It has an internal hash whose keys are either SQL strings, or arrays of +# two elements [SQL string, binds], if there are binds. The hash values +# are their corresponding ActiveRecord::Result objects. +# +# Keeping the hash size under max size is achieved with LRU eviction. +# +# The store gets passed a version object, which is shared among the query +# cache stores of a given connection pool (see ConnectionPoolConfiguration +# down below). The version value may be externally changed as a way to +# signal cache invalidation, that is why all methods have a guard for it. +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:44 +class ActiveRecord::ConnectionAdapters::QueryCache::Store + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:49 + def initialize(version, max_size); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:68 + def [](key); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:93 + def clear; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:77 + def compute_if_absent(key); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:45 + def dirties; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:45 + def dirties=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:47 + def dirties?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:63 + def empty?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:45 + def enabled; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:45 + def enabled=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:46 + def enabled?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:58 + def size; end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/query_cache.rb:99 + def check_version; end +end + +# = Active Record Connection Adapters \Quoting +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:8 +module ActiveRecord::ConnectionAdapters::Quoting + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::ConnectionAdapters::Quoting::ClassMethods + + # Cast a value to be used as a bound parameter of unknown type. For example, + # MySQL might perform dangerous castings when comparing a string to a number, + # so this method will cast numbers to string. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:113 + def cast_bound_value(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:213 + def lookup_cast_type(sql_type); end + + # Quotes the column value to help prevent + # {SQL injection attacks}[https://en.wikipedia.org/wiki/SQL_injection]. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:72 + def quote(value); end + + # Quotes the column name. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:124 + def quote_column_name(column_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:145 + def quote_default_expression(value, column); end + + # Quotes a string, escaping any ' (single quote) and \ (backslash) + # characters. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:119 + def quote_string(s); end + + # Quotes the table name. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:129 + def quote_table_name(table_name); end + + # Override to return the quoted table name for assignment. Defaults to + # table quoting. + # + # This works for MySQL where table.column can be used to + # resolve ambiguity. + # + # We override this in the sqlite3 and postgresql adapters to use only + # the column name (as per syntax requirements). + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:141 + def quote_table_name_for_assignment(table, attr); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:196 + def quoted_binary(value); end + + # Quote date/time values for use in SQL input. Includes microseconds + # if the value is a Time responding to usec. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:174 + def quoted_date(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:164 + def quoted_false; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:191 + def quoted_time(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:156 + def quoted_true; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:200 + def sanitize_as_sql_comment(value); end + + # Cast a +value+ to a type that the database understands. For example, + # SQLite does not understand dates, so this method will convert a Date + # to a String. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:94 + def type_cast(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:168 + def unquoted_false; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:160 + def unquoted_true; end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:219 + def type_casted_binds(binds); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:11 +module ActiveRecord::ConnectionAdapters::Quoting::ClassMethods + # Regexp for column names (with or without a table name prefix). + # Matches the following: + # + # "#{table_name}.#{column_name}" + # "#{column_name}" + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:17 + def column_name_matcher; end + + # Regexp for column names with order (with or without a table name prefix, + # with or without various order modifiers). Matches the following: + # + # "#{table_name}.#{column_name}" + # "#{table_name}.#{column_name} #{direction}" + # "#{table_name}.#{column_name} #{direction} NULLS FIRST" + # "#{table_name}.#{column_name} NULLS LAST" + # "#{column_name}" + # "#{column_name} #{direction}" + # "#{column_name} #{direction} NULLS FIRST" + # "#{column_name} NULLS LAST" + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:43 + def column_name_with_order_matcher; end + + # Quotes the column name. Must be implemented by subclasses + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:60 + def quote_column_name(column_name); end + + # Quotes the table name. Defaults to column name quoting. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/quoting.rb:65 + def quote_table_name(table_name); end +end + +# = Active Record Real \Transaction +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:470 +class ActiveRecord::ConnectionAdapters::RealTransaction < ::ActiveRecord::ConnectionAdapters::Transaction + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:508 + def commit; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:471 + def materialize!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:485 + def restart; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:499 + def rollback; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:202 +class ActiveRecord::ConnectionAdapters::ReferenceDefinition + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:203 + def initialize(name, polymorphic: T.unsafe(nil), index: T.unsafe(nil), foreign_key: T.unsafe(nil), type: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:223 + def add(table_name, connection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:237 + def add_to(table); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:254 + def as_options(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:292 + def column_name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:296 + def column_names; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:284 + def columns; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:258 + def conditional_options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:252 + def foreign_key; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:280 + def foreign_key_options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:300 + def foreign_table_name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:252 + def index; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:270 + def index_options(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:252 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:252 + def options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:252 + def polymorphic; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:266 + def polymorphic_index_name(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:262 + def polymorphic_options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:252 + def type; end +end + +# = Active Record Restart Parent \Transaction +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:387 +class ActiveRecord::ConnectionAdapters::RestartParentTransaction < ::ActiveRecord::ConnectionAdapters::Transaction + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:388 + def initialize(connection, parent_transaction, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:407 + def commit; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:411 + def full_rollback?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:400 + def isolation(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:400 + def materialize!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:400 + def materialized?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:400 + def restart(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:402 + def rollback; end +end + +# = Active Record Savepoint \Transaction +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:415 +class ActiveRecord::ConnectionAdapters::SavepointTransaction < ::ActiveRecord::ConnectionAdapters::Transaction + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:416 + def initialize(connection, savepoint_name, parent_transaction, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:460 + def commit; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:466 + def full_rollback?; end + + # Delegates to parent transaction's isolation level + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:430 + def isolation; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:434 + def isolation=(isolation); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:438 + def materialize!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:443 + def restart; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:452 + def rollback; end +end + +# = Active Record Connection Adapters \Savepoints +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/savepoints.rb:6 +module ActiveRecord::ConnectionAdapters::Savepoints + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/savepoints.rb:11 + def create_savepoint(name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/savepoints.rb:7 + def current_savepoint_name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/savepoints.rb:15 + def exec_rollback_to_savepoint(name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/savepoints.rb:19 + def release_savepoint(name = T.unsafe(nil)); end +end + +# = Active Record Connection Adapters Schema Cache +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:227 +class ActiveRecord::ConnectionAdapters::SchemaCache + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:255 + def initialize; end + + # Add internal cache for table with +table_name+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:326 + def add(pool, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:396 + def add_all(pool); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:294 + def cached?(table_name); end + + # Clear out internal caches for the data source +name+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:388 + def clear_data_source_cache!(_connection, name); end + + # Get the columns for a table + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:338 + def columns(pool, table_name); end + + # Get the columns for a table as a hash, key is the column name + # value is the column object. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:352 + def columns_hash(pool, table_name); end + + # Checks whether the columns hash is already cached for a table. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:359 + def columns_hash?(_pool, table_name); end + + # A cached lookup for table existence. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:309 + def data_source_exists?(pool, name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:406 + def dump_to(filename); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:273 + def encode_with(coder); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:363 + def indexes(pool, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:281 + def init_with(coder); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:416 + def marshal_dump; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:420 + def marshal_load(array); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:298 + def primary_keys(pool, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:379 + def schema_version; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:383 + def size; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:375 + def version(pool); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:448 + def deep_deduplicate(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:440 + def derive_columns_hash_and_deduplicate_values; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:436 + def ignored_table?(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:264 + def initialize_dup(other); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:461 + def open(filename); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:428 + def tables_to_cache(pool); end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:228 + def _load_from(filename); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:244 + def read(filename, &block); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:5 +class ActiveRecord::ConnectionAdapters::SchemaCreation + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:6 + def initialize(conn); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:11 + def accept(o); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:180 + def action_sql(action, dependency); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:150 + def add_column_options!(sql, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:141 + def add_table_options!(create_sql, o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:146 + def column_options(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def lookup_cast_type(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def options_include_default?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def quote_column_name(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def quote_default_expression(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:165 + def quote_default_expression_for_column_definition(default, column_definition); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def quote_table_name(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:133 + def quoted_columns(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def quoted_columns_for_index(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def supports_check_constraints?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def supports_exclusion_constraints?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def supports_index_include?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:137 + def supports_index_using?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def supports_indexes_in_create?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def supports_nulls_not_distinct?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def supports_partial_index?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def supports_unique_constraints?(*, **, &); end + + # Returns any SQL string to go between CREATE and TABLE. May be nil. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:176 + def table_modifier_in_create(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:170 + def to_sql(sql); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def type_to_sql(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:16 + def use_foreign_keys?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:129 + def visit_AddCheckConstraint(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:41 + def visit_AddColumnDefinition(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:96 + def visit_AddForeignKey(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:24 + def visit_AlterTable(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:125 + def visit_CheckConstraintDefinition(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:34 + def visit_ColumnDefinition(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:106 + def visit_CreateIndexDefinition(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:104 + def visit_DropCheckConstraint(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:100 + def visit_DropConstraint(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:103 + def visit_DropForeignKey(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:83 + def visit_ForeignKeyDefinition(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:79 + def visit_PrimaryKeyDefinition(o); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_creation.rb:45 + def visit_TableDefinition(o); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:5 +class ActiveRecord::ConnectionAdapters::SchemaDumper < ::ActiveRecord::SchemaDumper + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:13 + def column_spec(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:17 + def column_spec_for_primary_key(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:38 + def default_primary_key?(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:42 + def explicit_primary_key_default?(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:25 + def prepare_column_options(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:102 + def schema_collation(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:86 + def schema_default(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:98 + def schema_expression(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:62 + def schema_limit(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:67 + def schema_precision(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:82 + def schema_scale(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:54 + def schema_type(column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:46 + def schema_type_with_virtual(column); end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:8 + def create(connection, options); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_dumper.rb:6 +ActiveRecord::ConnectionAdapters::SchemaDumper::DEFAULT_DATETIME_PRECISION = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:7 +class ActiveRecord::ConnectionAdapters::SchemaReflection + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:16 + def initialize(cache_path, cache = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:41 + def add(pool, name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:79 + def cached?(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:21 + def clear!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:73 + def clear_data_source_cache!(pool, name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:49 + def columns(pool, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:53 + def columns_hash(pool, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:57 + def columns_hash?(pool, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:37 + def data_source_exists?(pool, name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:45 + def data_sources(pool, name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:91 + def dump_to(pool, filename); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:61 + def indexes(pool, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:27 + def load!(pool); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:33 + def primary_keys(pool, table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:69 + def size(pool); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:65 + def version(pool); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:106 + def cache(pool); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:100 + def empty_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:116 + def load_cache(pool); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:110 + def possible_cache_available?; end + + class << self + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:10 + def check_schema_cache_dump_version; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:10 + def check_schema_cache_dump_version=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:9 + def use_schema_cache_dump; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/schema_cache.rb:9 + def use_schema_cache_dump=(_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:9 +module ActiveRecord::ConnectionAdapters::SchemaStatements + include ::ActiveRecord::Migration::JoinTable + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1098 + def add_belongs_to(table_name, ref_name, **options); end + + # Adds a new check constraint to the table. +expression+ is a String + # representation of verifiable boolean condition. + # + # add_check_constraint :products, "price > 0", name: "price_check" + # + # generates: + # + # ALTER TABLE "products" ADD CONSTRAINT price_check CHECK (price > 0) + # + # The +options+ hash can include the following keys: + # [:name] + # The constraint name. Defaults to chk_rails_. + # [:if_not_exists] + # Silently ignore if the constraint already exists, rather than raise an error. + # [:validate] + # (PostgreSQL only) Specify whether or not the constraint should be validated. Defaults to +true+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1326 + def add_check_constraint(table_name, expression, if_not_exists: T.unsafe(nil), **options); end + + # Add a new +type+ column named +column_name+ to +table_name+. + # + # See {ActiveRecord::ConnectionAdapters::TableDefinition.column}[rdoc-ref:ActiveRecord::ConnectionAdapters::TableDefinition#column]. + # + # The +type+ parameter is normally one of the migration's native types, + # which is one of the following: + # :primary_key, :string, :text, + # :integer, :bigint, :float, :decimal, :numeric, + # :datetime, :time, :date, + # :binary, :blob, :boolean. + # + # You may use a type not in this list as long as it is supported by your + # database (for example, "polygon" in MySQL), but this will not be database + # agnostic and should usually be avoided. + # + # Available options are (none of these exists by default): + # * :comment - + # Specifies the comment for the column. This option is ignored by some backends. + # * :collation - + # Specifies the collation for a :string or :text column. + # If not specified, the column will have the same collation as the table. + # * :default - + # The column's default value. Use +nil+ for +NULL+. + # * :limit - + # Requests a maximum column length. This is the number of characters for a :string column + # and number of bytes for :text, :binary, :blob, and :integer columns. + # This option is ignored by some backends. + # * :null - + # Allows or disallows +NULL+ values in the column. + # * :precision - + # Specifies the precision for the :decimal, :numeric, + # :datetime, and :time columns. + # * :scale - + # Specifies the scale for the :decimal and :numeric columns. + # * :if_not_exists - + # Specifies if the column already exists to not try to re-add it. This will avoid + # duplicate column errors. + # + # Note: The precision is the total number of significant digits, + # and the scale is the number of digits that can be stored following + # the decimal point. For example, the number 123.45 has a precision of 5 + # and a scale of 2. A decimal with a precision of 5 and a scale of 2 can + # range from -999.99 to 999.99. + # + # Please be aware of different RDBMS implementations behavior with + # :decimal columns: + # * The SQL standard says the default scale should be 0, :scale <= + # :precision, and makes no comments about the requirements of + # :precision. + # * MySQL: :precision [1..65], :scale [0..30]. + # Default is (10,0). + # * PostgreSQL: :precision [1..infinity], + # :scale [0..infinity]. No default. + # * SQLite3: No restrictions on :precision and :scale, + # but the maximum supported :precision is 16. No default. + # * Oracle: :precision [1..38], :scale [-84..127]. + # Default is (38,0). + # * SqlServer: :precision [1..38], :scale [0..38]. + # Default (38,0). + # + # == Examples + # + # add_column(:users, :picture, :binary, limit: 2.megabytes) + # # ALTER TABLE "users" ADD "picture" blob(2097152) + # + # add_column(:articles, :status, :string, limit: 20, default: 'draft', null: false) + # # ALTER TABLE "articles" ADD "status" varchar(20) DEFAULT 'draft' NOT NULL + # + # add_column(:answers, :bill_gates_money, :decimal, precision: 15, scale: 2) + # # ALTER TABLE "answers" ADD "bill_gates_money" decimal(15,2) + # + # add_column(:measurements, :sensor_reading, :decimal, precision: 30, scale: 20) + # # ALTER TABLE "measurements" ADD "sensor_reading" decimal(30,20) + # + # # While :scale defaults to zero on most databases, it + # # probably wouldn't hurt to include it. + # add_column(:measurements, :huge_integer, :decimal, precision: 30) + # # ALTER TABLE "measurements" ADD "huge_integer" decimal(30) + # + # # Defines a column that stores an array of a type. + # add_column(:users, :skills, :text, array: true) + # # ALTER TABLE "users" ADD "skills" text[] + # + # # Defines a column with a database-specific type. + # add_column(:shapes, :triangle, 'polygon') + # # ALTER TABLE "shapes" ADD "triangle" polygon + # + # # Ignores the method call if the column exists + # add_column(:shapes, :triangle, 'polygon', if_not_exists: true) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:655 + def add_column(table_name, column_name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:662 + def add_columns(table_name, *column_names, type:, **options); end + + # Adds a new foreign key. +from_table+ is the table with the key column, + # +to_table+ contains the referenced primary key. + # + # The foreign key will be named after the following pattern: fk_rails_. + # +identifier+ is a 10 character long string which is deterministically generated from the + # +from_table+ and +column+. A custom name can be specified with the :name option. + # + # ====== Creating a simple foreign key + # + # add_foreign_key :articles, :authors + # + # generates: + # + # ALTER TABLE "articles" ADD CONSTRAINT fk_rails_e74ce85cbc FOREIGN KEY ("author_id") REFERENCES "authors" ("id") + # + # ====== Creating a foreign key, ignoring method call if the foreign key exists + # + # add_foreign_key(:articles, :authors, if_not_exists: true) + # + # ====== Creating a foreign key on a specific column + # + # add_foreign_key :articles, :users, column: :author_id, primary_key: "lng_id" + # + # generates: + # + # ALTER TABLE "articles" ADD CONSTRAINT fk_rails_58ca3d3a82 FOREIGN KEY ("author_id") REFERENCES "users" ("lng_id") + # + # ====== Creating a composite foreign key + # + # Assuming "carts" table has "(shop_id, user_id)" as a primary key. + # + # add_foreign_key :orders, :carts, primary_key: [:shop_id, :user_id] + # + # generates: + # + # ALTER TABLE "orders" ADD CONSTRAINT fk_rails_6f5e4cb3a4 FOREIGN KEY ("cart_shop_id", "cart_user_id") REFERENCES "carts" ("shop_id", "user_id") + # + # ====== Creating a cascading foreign key + # + # add_foreign_key :articles, :authors, on_delete: :cascade + # + # generates: + # + # ALTER TABLE "articles" ADD CONSTRAINT fk_rails_e74ce85cbc FOREIGN KEY ("author_id") REFERENCES "authors" ("id") ON DELETE CASCADE + # + # The +options+ hash can include the following keys: + # [:column] + # The foreign key column name on +from_table+. Defaults to to_table.singularize + "_id". + # Pass an array to create a composite foreign key. + # [:primary_key] + # The primary key column name on +to_table+. Defaults to +id+. + # Pass an array to create a composite foreign key. + # [:name] + # The constraint name. Defaults to fk_rails_. + # [:on_delete] + # Action that happens ON DELETE. Valid values are +:nullify+, +:cascade+, and +:restrict+ + # [:on_update] + # Action that happens ON UPDATE. Valid values are +:nullify+, +:cascade+, and +:restrict+ + # [:if_not_exists] + # Specifies if the foreign key already exists to not try to re-add it. This will avoid + # duplicate column errors. + # [:validate] + # (PostgreSQL only) Specify whether or not the constraint should be validated. Defaults to +true+. + # [:deferrable] + # (PostgreSQL only) Specify whether or not the foreign key should be deferrable. Valid values are booleans or + # +:deferred+ or +:immediate+ to specify the default behavior. Defaults to +false+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1205 + def add_foreign_key(from_table, to_table, **options); end + + # Adds a new index to the table. +column_name+ can be a single Symbol, or + # an Array of Symbols. + # + # The index will be named after the table and the column name(s), unless + # you pass :name as an option. + # + # ====== Creating a simple index + # + # add_index(:suppliers, :name) + # + # generates: + # + # CREATE INDEX index_suppliers_on_name ON suppliers(name) + # + # ====== Creating a index which already exists + # + # add_index(:suppliers, :name, if_not_exists: true) + # + # generates: + # + # CREATE INDEX IF NOT EXISTS index_suppliers_on_name ON suppliers(name) + # + # Note: Not supported by MySQL. + # + # ====== Creating a unique index + # + # add_index(:accounts, [:branch_id, :party_id], unique: true) + # + # generates: + # + # CREATE UNIQUE INDEX index_accounts_on_branch_id_and_party_id ON accounts(branch_id, party_id) + # + # ====== Creating a named index + # + # add_index(:accounts, [:branch_id, :party_id], unique: true, name: 'by_branch_party') + # + # generates: + # + # CREATE UNIQUE INDEX by_branch_party ON accounts(branch_id, party_id) + # + # ====== Creating an index with specific key length + # + # add_index(:accounts, :name, name: 'by_name', length: 10) + # + # generates: + # + # CREATE INDEX by_name ON accounts(name(10)) + # + # ====== Creating an index with specific key lengths for multiple keys + # + # add_index(:accounts, [:name, :surname], name: 'by_name_surname', length: {name: 10, surname: 15}) + # + # generates: + # + # CREATE INDEX by_name_surname ON accounts(name(10), surname(15)) + # + # Note: only supported by MySQL + # + # ====== Creating an index with a sort order (desc or asc, asc is the default) + # + # add_index(:accounts, [:branch_id, :party_id, :surname], name: 'by_branch_desc_party', order: {branch_id: :desc, party_id: :asc}) + # + # generates: + # + # CREATE INDEX by_branch_desc_party ON accounts(branch_id DESC, party_id ASC, surname) + # + # Note: MySQL only supports index order from 8.0.1 onwards (earlier versions accepted the syntax but ignored it). + # + # ====== Creating a partial index + # + # add_index(:accounts, [:branch_id, :party_id], unique: true, where: "active") + # + # generates: + # + # CREATE UNIQUE INDEX index_accounts_on_branch_id_and_party_id ON accounts(branch_id, party_id) WHERE active + # + # Note: Partial indexes are only supported for PostgreSQL and SQLite. + # + # ====== Creating an index that includes additional columns + # + # add_index(:accounts, :branch_id, include: :party_id) + # + # generates: + # + # CREATE INDEX index_accounts_on_branch_id ON accounts USING btree(branch_id) INCLUDE (party_id) + # + # Note: only supported by PostgreSQL. + # + # ====== Creating an index where NULLs are treated equally + # + # add_index(:people, :last_name, nulls_not_distinct: true) + # + # generates: + # + # CREATE INDEX index_people_on_last_name ON people (last_name) NULLS NOT DISTINCT + # + # Note: only supported by PostgreSQL version 15.0.0 and greater. + # + # ====== Creating an index with a specific method + # + # add_index(:developers, :name, using: 'btree') + # + # generates: + # + # CREATE INDEX index_developers_on_name ON developers USING btree (name) -- PostgreSQL + # CREATE INDEX index_developers_on_name USING btree ON developers (name) -- MySQL + # + # Note: only supported by PostgreSQL and MySQL + # + # ====== Creating an index with a specific operator class + # + # add_index(:developers, :name, using: 'gist', opclass: :gist_trgm_ops) + # # CREATE INDEX developers_on_name ON developers USING gist (name gist_trgm_ops) -- PostgreSQL + # + # add_index(:developers, [:name, :city], using: 'gist', opclass: { city: :gist_trgm_ops }) + # # CREATE INDEX developers_on_name_and_city ON developers USING gist (name, city gist_trgm_ops) -- PostgreSQL + # + # add_index(:developers, [:name, :city], using: 'gist', opclass: :gist_trgm_ops) + # # CREATE INDEX developers_on_name_and_city ON developers USING gist (name gist_trgm_ops, city gist_trgm_ops) -- PostgreSQL + # + # Note: only supported by PostgreSQL + # + # ====== Creating an index with a specific type + # + # add_index(:developers, :name, type: :fulltext) + # + # generates: + # + # CREATE FULLTEXT INDEX index_developers_on_name ON developers (name) -- MySQL + # + # Note: only supported by MySQL. + # + # ====== Creating an index with a specific algorithm + # + # add_index(:developers, :name, algorithm: :concurrently) + # # CREATE INDEX CONCURRENTLY developers_on_name on developers (name) -- PostgreSQL + # + # add_index(:developers, :name, algorithm: :inplace) + # # CREATE INDEX `index_developers_on_name` ON `developers` (`name`) ALGORITHM = INPLACE -- MySQL + # + # Note: only supported by PostgreSQL and MySQL. + # + # Concurrently adding an index is not supported in a transaction. + # + # For more information see the {"Transactional Migrations" section}[rdoc-ref:Migration]. + # + # ====== Creating an index that is not used by queries + # + # add_index(:developers, :name, enabled: false) + # + # generates: + # + # CREATE INDEX index_developers_on_name ON developers (name) INVISIBLE -- MySQL + # + # CREATE INDEX index_developers_on_name ON developers (name) IGNORED -- MariaDB + # + # Note: only supported by MySQL version 8.0.0 and greater, and MariaDB version 10.6.0 and greater. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:947 + def add_index(table_name, column_name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1509 + def add_index_options(table_name, column_name, name: T.unsafe(nil), if_not_exists: T.unsafe(nil), internal: T.unsafe(nil), **options); end + + # Adds a reference. The reference column is a bigint by default, + # the :type option can be used to specify a different type. + # Optionally adds a +_type+ column, if :polymorphic option is provided. + # + # The +options+ hash can include the following keys: + # [:type] + # The reference column type. Defaults to +:bigint+. + # [:index] + # Add an appropriate index. Defaults to true. + # See #add_index for usage of this option. + # [:foreign_key] + # Add an appropriate foreign key constraint. Defaults to false, pass true + # to add. In case the join table can't be inferred from the association + # pass :to_table with the appropriate table name. + # [:polymorphic] + # Whether an additional +_type+ column should be added. Defaults to false. + # [:null] + # Whether the column allows nulls. Defaults to true. + # + # ====== Create a user_id bigint column without an index + # + # add_reference(:products, :user, index: false) + # + # ====== Create a user_id string column + # + # add_reference(:products, :user, type: :string) + # + # ====== Create supplier_id, supplier_type columns + # + # add_reference(:products, :supplier, polymorphic: true) + # + # ====== Create a supplier_id column with a unique index + # + # add_reference(:products, :supplier, index: { unique: true }) + # + # ====== Create a supplier_id column with a named index + # + # add_reference(:products, :supplier, index: { name: "my_supplier_index" }) + # + # ====== Create a supplier_id column and appropriate foreign key + # + # add_reference(:products, :supplier, foreign_key: true) + # + # ====== Create a supplier_id column and a foreign key to the firms table + # + # add_reference(:products, :supplier, foreign_key: { to_table: :firms }) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1095 + def add_reference(table_name, ref_name, **options); end + + # Adds timestamps (+created_at+ and +updated_at+) columns to +table_name+. + # Additional options (like +:null+) are forwarded to #add_column. + # + # add_timestamps(:suppliers, null: true) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1492 + def add_timestamps(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1397 + def assume_migrated_upto_version(version); end + + # Builds an AlterTable object for adding a column to a table. + # + # This definition object contains information about the column that would be created + # if the same arguments were passed to #add_column. See #add_column for information about + # passing a +table_name+, +column_name+, +type+ and other options that can be passed. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:673 + def build_add_column_definition(table_name, column_name, type, **options); end + + # Builds a ChangeColumnDefaultDefinition object. + # + # This definition object contains information about the column change that would occur + # if the same arguments were passed to #change_column_default. See #change_column_default for + # information about passing a +table_name+, +column_name+, +type+ and other options that can be passed. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:757 + def build_change_column_default_definition(table_name, column_name, default_or_changes); end + + # Builds a CreateIndexDefinition object. + # + # This definition object contains information about the index that would be created + # if the same arguments were passed to #add_index. See #add_index for information about + # passing a +table_name+, +column_name+, and other additional options that can be passed. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:957 + def build_create_index_definition(table_name, column_name, **options); end + + # Builds a TableDefinition object for a join table. + # + # This definition object contains information about the table that would be created + # if the same arguments were passed to #create_join_table. See #create_join_table for + # information about what arguments should be passed. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:427 + def build_create_join_table_definition(table_1, table_2, column_options: T.unsafe(nil), **options); end + + # Returns a TableDefinition object containing information about the table that would be created + # if the same arguments were passed to #create_table. See #create_table for information about + # passing a +table_name+, and other additional options that can be passed. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:337 + def build_create_table_definition(table_name, id: T.unsafe(nil), primary_key: T.unsafe(nil), force: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1602 + def bulk_change_table(table_name, operations); end + + # Changes the column's definition according to the new options. + # See TableDefinition#column for details of the options you can use. + # + # change_column(:suppliers, :name, :string, limit: 80) + # change_column(:accounts, :description, :text) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:730 + def change_column(table_name, column_name, type, **options); end + + # Changes the comment for a column or removes it if +nil+. + # + # Passing a hash containing +:from+ and +:to+ will make this change + # reversible in migration: + # + # change_column_comment(:posts, :state, from: "old_comment", to: "new_comment") + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1570 + def change_column_comment(table_name, column_name, comment_or_changes); end + + # Sets a new default value for a column: + # + # change_column_default(:suppliers, :qualification, 'new') + # change_column_default(:accounts, :authorized, 1) + # + # Setting the default to +nil+ effectively drops the default: + # + # change_column_default(:users, :email, nil) + # + # Passing a hash containing +:from+ and +:to+ will make this change + # reversible in migration: + # + # change_column_default(:posts, :state, from: nil, to: "draft") + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:748 + def change_column_default(table_name, column_name, default_or_changes); end + + # Sets or removes a NOT NULL constraint on a column. The +null+ flag + # indicates whether the value can be +NULL+. For example + # + # change_column_null(:users, :nickname, false) + # + # says nicknames cannot be +NULL+ (adds the constraint), whereas + # + # change_column_null(:users, :nickname, true) + # + # allows them to be +NULL+ (drops the constraint). + # + # The method accepts an optional fourth argument to replace existing + # NULLs with some other value. Use that one when enabling the + # constraint if needed, since otherwise those rows would not be valid. + # + # Please note the fourth argument does not set a column's default. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:777 + def change_column_null(table_name, column_name, null, default = T.unsafe(nil)); end + + # A block for changing columns in +table+. + # + # # change_table() yields a Table instance + # change_table(:suppliers) do |t| + # t.column :name, :string, limit: 60 + # # Other column alterations here + # end + # + # The +options+ hash can include the following keys: + # [:bulk] + # Set this to true to make this a bulk alter query, such as + # + # ALTER TABLE `users` ADD COLUMN age INT, ADD COLUMN birthdate DATETIME ... + # + # Defaults to false. + # + # Only supported on the MySQL and PostgreSQL adapter, ignored elsewhere. + # + # ====== Add a column + # + # change_table(:suppliers) do |t| + # t.column :name, :string, limit: 60 + # end + # + # ====== Change type of a column + # + # change_table(:suppliers) do |t| + # t.change :metadata, :json + # end + # + # ====== Add 2 integer columns + # + # change_table(:suppliers) do |t| + # t.integer :width, :height, null: false, default: 0 + # end + # + # ====== Add created_at/updated_at columns + # + # change_table(:suppliers) do |t| + # t.timestamps + # end + # + # ====== Add a foreign key column + # + # change_table(:suppliers) do |t| + # t.references :company + # end + # + # Creates a company_id(bigint) column. + # + # ====== Add a polymorphic foreign key column + # + # change_table(:suppliers) do |t| + # t.belongs_to :company, polymorphic: true + # end + # + # Creates company_type(varchar) and company_id(bigint) columns. + # + # ====== Remove a column + # + # change_table(:suppliers) do |t| + # t.remove :company + # end + # + # ====== Remove several columns + # + # change_table(:suppliers) do |t| + # t.remove :company_id + # t.remove :width, :height + # end + # + # ====== Remove an index + # + # change_table(:suppliers) do |t| + # t.remove_index :company_id + # end + # + # See also Table for details on all of the various column transformations. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:529 + def change_table(table_name, base = T.unsafe(nil), **options); end + + # Changes the comment for a table or removes it if +nil+. + # + # Passing a hash containing +:from+ and +:to+ will make this change + # reversible in migration: + # + # change_table_comment(:posts, from: "old_comment", to: "new_comment") + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1560 + def change_table_comment(table_name, comment_or_changes); end + + # Checks to see if a check constraint exists on a table for a given check constraint definition. + # + # check_constraint_exists?(:products, name: "price_check") + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1374 + def check_constraint_exists?(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1338 + def check_constraint_options(table_name, expression, options); end + + # Returns an array of check constraints for the given table. + # The check constraints are represented as CheckConstraintDefinition objects. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1306 + def check_constraints(table_name); end + + # Checks to see if a column exists in a given table. + # + # # Check a column exists + # column_exists?(:suppliers, :name) + # + # # Check a column exists of a particular type + # # + # # This works for standard non-casted types (eg. string) but is unreliable + # # for types that may get cast to something else (eg. char, bigint). + # column_exists?(:suppliers, :name, :string) + # + # # Check a column exists with a specific definition + # column_exists?(:suppliers, :name, :string, limit: 100) + # column_exists?(:suppliers, :name, :string, default: 'default') + # column_exists?(:suppliers, :name, :string, null: false) + # column_exists?(:suppliers, :tax, :decimal, precision: 8, scale: 2) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:133 + def column_exists?(table_name, column_name, type = T.unsafe(nil), **options); end + + # Returns an array of +Column+ objects for the table specified by +table_name+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:108 + def columns(table_name); end + + # Given a set of columns and an ORDER BY clause, returns the columns for a SELECT DISTINCT. + # PostgreSQL, MySQL, and Oracle override this for custom DISTINCT syntax - they + # require the order columns appear in the SELECT. + # + # columns_for_distinct("posts.id", ["posts.created_at desc"]) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1458 + def columns_for_distinct(columns, orders); end + + # Creates a new join table with the name created using the lexical order of the first two + # arguments. These arguments can be a String or a Symbol. + # + # # Creates a table called 'assemblies_parts' with no id. + # create_join_table(:assemblies, :parts) + # + # # Creates a table called 'paper_boxes_papers' with no id. + # create_join_table('papers', 'paper_boxes') + # + # A duplicate prefix is combined into a single prefix. This is useful for + # namespaced models like Music::Artist and Music::Record: + # + # # Creates a table called 'music_artists_records' with no id. + # create_join_table('music_artists', 'music_records') + # + # See {connection.add_reference}[rdoc-ref:SchemaStatements#add_reference] + # for details of the options you can use in +column_options+. +column_options+ + # will be applied to both columns. + # + # You can pass an +options+ hash which can include the following keys: + # [:table_name] + # Sets the table name, overriding the default. + # [:options] + # Any extra options you want appended to the table definition. + # [:temporary] + # Make a temporary table. + # [:force] + # Set to true to drop the table before creating it. + # Defaults to false. + # + # Note that #create_join_table does not create any indices by default; you can use + # its block form to do so yourself: + # + # create_join_table :products, :categories do |t| + # t.index :product_id + # t.index :category_id + # end + # + # ====== Add foreign keys with delete cascade + # + # create_join_table(:assemblies, :parts, column_options: { foreign_key: { on_delete: :cascade } }) + # + # generates: + # + # CREATE TABLE assemblies_parts ( + # assembly_id bigint NOT NULL, + # part_id bigint NOT NULL, + # CONSTRAINT fk_rails_0d8a572d89 FOREIGN KEY ("assembly_id") REFERENCES "assemblies" ("id") ON DELETE CASCADE, + # CONSTRAINT fk_rails_ec7b48402b FOREIGN KEY ("part_id") REFERENCES "parts" ("id") ON DELETE CASCADE + # ) + # + # ====== Add a backend specific option to the generated SQL (MySQL) + # + # create_join_table(:assemblies, :parts, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8') + # + # generates: + # + # CREATE TABLE assemblies_parts ( + # assembly_id bigint NOT NULL, + # part_id bigint NOT NULL, + # ) ENGINE=InnoDB DEFAULT CHARSET=utf8 + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:408 + def create_join_table(table_1, table_2, column_options: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1588 + def create_schema_dumper(options); end + + # Creates a new table with the name +table_name+. +table_name+ may either + # be a String or a Symbol. + # + # There are two ways to work with #create_table. You can use the block + # form or the regular form, like this: + # + # === Block form + # + # # create_table() passes a TableDefinition object to the block. + # # This form will not only create the table, but also columns for the + # # table. + # + # create_table(:suppliers) do |t| + # t.column :name, :string, limit: 60 + # # Other fields here + # end + # + # === Block form, with shorthand + # + # # You can also use the column types as method calls, rather than calling the column method. + # create_table(:suppliers) do |t| + # t.string :name, limit: 60 + # # Other fields here + # end + # + # === Regular form + # + # # Creates a table called 'suppliers' with no columns. + # create_table(:suppliers) + # # Add a column to 'suppliers'. + # add_column(:suppliers, :name, :string, {limit: 60}) + # + # The +options+ hash can include the following keys: + # [:id] + # Whether to automatically add a primary key column. Defaults to true. + # Join tables for {ActiveRecord::Base.has_and_belongs_to_many}[rdoc-ref:Associations::ClassMethods#has_and_belongs_to_many] should set it to false. + # + # A Symbol can be used to specify the type of the generated primary key column. + # + # A Hash can be used to specify the generated primary key column creation options. + # See {add_column}[rdoc-ref:ConnectionAdapters::SchemaStatements#add_column] for available options. + # [:primary_key] + # The name of the primary key, if one is to be added automatically. + # Defaults to +id+. If :id is false, then this option is ignored. + # + # If an array is passed, a composite primary key will be created. + # + # Note that Active Record models will automatically detect their + # primary key. This can be avoided by using + # {self.primary_key=}[rdoc-ref:AttributeMethods::PrimaryKey::ClassMethods#primary_key=] on the model + # to define the key explicitly. + # + # [:options] + # Any extra options you want appended to the table definition. + # [:temporary] + # Make a temporary table. + # [:force] + # Set to true to drop the table before creating it. + # Set to +:cascade+ to drop dependent objects as well. + # Defaults to false. + # [:if_not_exists] + # Set to true to avoid raising an error when the table already exists. + # Defaults to false. + # [:as] + # SQL to use to generate the table. When this option is used, the block is + # ignored, as are the :id and :primary_key options. + # + # ====== Add a backend specific option to the generated SQL (MySQL) + # + # create_table(:suppliers, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8mb4') + # + # generates: + # + # CREATE TABLE suppliers ( + # id bigint auto_increment PRIMARY KEY + # ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 + # + # ====== Rename the primary key column + # + # create_table(:objects, primary_key: 'guid') do |t| + # t.column :name, :string, limit: 80 + # end + # + # generates: + # + # CREATE TABLE objects ( + # guid bigint auto_increment PRIMARY KEY, + # name varchar(80) + # ) + # + # ====== Change the primary key column type + # + # create_table(:tags, id: :string) do |t| + # t.column :label, :string + # end + # + # generates: + # + # CREATE TABLE tags ( + # id varchar PRIMARY KEY, + # label varchar + # ) + # + # ====== Create a composite primary key + # + # create_table(:orders, primary_key: [:product_id, :client_id]) do |t| + # t.belongs_to :product + # t.belongs_to :client + # end + # + # generates: + # + # CREATE TABLE orders ( + # product_id bigint NOT NULL, + # client_id bigint NOT NULL + # ); + # + # ALTER TABLE ONLY "orders" + # ADD CONSTRAINT orders_pkey PRIMARY KEY (product_id, client_id); + # + # ====== Do not add a primary key column + # + # create_table(:categories_suppliers, id: false) do |t| + # t.column :category_id, :bigint + # t.column :supplier_id, :bigint + # end + # + # generates: + # + # CREATE TABLE categories_suppliers ( + # category_id bigint, + # supplier_id bigint + # ) + # + # ====== Create a temporary table based on a query + # + # create_table(:long_query, temporary: true, + # as: "SELECT * FROM orders INNER JOIN line_items ON order_id=orders.id") + # + # generates: + # + # CREATE TEMPORARY TABLE long_query AS + # SELECT * FROM orders INNER JOIN line_items ON order_id=orders.id + # + # See also TableDefinition#column for details on how to create columns. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:297 + def create_table(table_name, id: T.unsafe(nil), primary_key: T.unsafe(nil), force: T.unsafe(nil), **options, &block); end + + # Checks to see if the data source +name+ exists on the database. + # + # data_source_exists?(:ebooks) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:45 + def data_source_exists?(name); end + + # Returns the relation names usable to back Active Record models. + # For most adapters this means all #tables and #views. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:35 + def data_sources; end + + # Prevents an index from being used by queries. + # + # disable_index(:users, :email) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1584 + def disable_index(table_name, index_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1462 + def distinct_relation_for_primary_key(relation); end + + # Drops the join table specified by the given arguments. + # See #create_join_table and #drop_table for details. + # + # Although this command ignores the block if one is given, it can be helpful + # to provide one in a migration's +change+ method so it can be reverted. + # In that case, the block will be used by #create_join_table. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:446 + def drop_join_table(table_1, table_2, **options); end + + # Drops a table or tables from the database. + # + # [:force] + # Set to +:cascade+ to drop dependent objects as well. + # Defaults to false. + # [:if_exists] + # Set to +true+ to only drop the table if it exists. + # Defaults to false. + # + # Although this command ignores most +options+ and the block if one is given, + # it can be helpful to provide these in a migration's +change+ method so it can be reverted. + # In that case, +options+ and the block will be used by #create_table except if you provide more than one table which is not supported. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:559 + def drop_table(*table_names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1388 + def dump_schema_versions; end + + # Enables an index to be used by queries. + # + # enable_index(:users, :email) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1577 + def enable_index(table_name, index_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1274 + def foreign_key_column_for(table_name, column_name); end + + # Checks to see if a foreign key exists on a table for a given foreign key definition. + # + # # Checks to see if a foreign key exists. + # foreign_key_exists?(:accounts, :branches) + # + # # Checks to see if a foreign key on a specified column exists. + # foreign_key_exists?(:accounts, column: :owner_id) + # + # # Checks to see if a foreign key with a custom name exists. + # foreign_key_exists?(:accounts, name: "special_fk_name") + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1270 + def foreign_key_exists?(from_table, to_table = T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1279 + def foreign_key_options(from_table, to_table, options); end + + # Returns an array of foreign keys for the given table. + # The foreign keys are represented as ForeignKeyDefinition objects. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1135 + def foreign_keys(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1537 + def index_algorithm(algorithm); end + + # Checks to see if an index exists on a table for a given index definition. + # + # # Check an index exists + # index_exists?(:suppliers, :company_id) + # + # # Check an index on multiple columns exists + # index_exists?(:suppliers, [:company_id, :company_type]) + # + # # Check a unique index exists + # index_exists?(:suppliers, :company_id, unique: true) + # + # # Check an index with a custom name exists + # index_exists?(:suppliers, :company_id, name: "idx_company_id") + # + # # Check a valid index exists (PostgreSQL only) + # index_exists?(:suppliers, :company_id, valid: true) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:103 + def index_exists?(table_name, column_name = T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1024 + def index_name(table_name, options); end + + # Verifies the existence of an index with a given name. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1043 + def index_name_exists?(table_name, index_name); end + + # Returns an array of indexes for the given table. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:82 + def indexes(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1393 + def internal_string_options_for_primary_key; end + + # Returns the maximum length of an index name in bytes. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1640 + def max_index_name_size; end + + # Returns a hash of mappings from the abstract data types to the native + # database types. See TableDefinition#column for details on the recognized + # abstract data types. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:15 + def native_database_types; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1550 + def options_include_default?(options); end + + # Returns just a table's primary key + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:146 + def primary_key(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1543 + def quoted_columns_for_index(column_names, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1131 + def remove_belongs_to(table_name, ref_name, foreign_key: T.unsafe(nil), polymorphic: T.unsafe(nil), **options); end + + # Removes the given check constraint from the table. Removing a check constraint + # that does not exist will raise an error. + # + # remove_check_constraint :products, name: "price_check" + # + # To silently ignore a non-existent check constraint rather than raise an error, + # use the +if_exists+ option. + # + # remove_check_constraint :products, name: "price_check", if_exists: true + # + # The +expression+ parameter will be ignored if present. It can be helpful + # to provide this in a migration's +change+ method so it can be reverted. + # In that case, +expression+ will be used by #add_check_constraint. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1357 + def remove_check_constraint(table_name, expression = T.unsafe(nil), if_exists: T.unsafe(nil), **options); end + + # Removes the column from the table definition. + # + # remove_column(:suppliers, :qualification) + # + # The +type+ and +options+ parameters will be ignored if present. It can be helpful + # to provide these in a migration's +change+ method so it can be reverted. + # In that case, +type+ and +options+ will be used by #add_column. + # Depending on the database you're using, indexes using this column may be + # automatically removed or modified to remove this column from the index. + # + # If the options provided include an +if_exists+ key, it will be used to check if the + # column does not exist. This will silently ignore the migration rather than raising + # if the column was already removed. + # + # remove_column(:suppliers, :qualification, if_exists: true) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:718 + def remove_column(table_name, column_name, type = T.unsafe(nil), **options); end + + # Removes the given columns from the table definition. + # + # remove_columns(:suppliers, :qualification, :experience) + # + # +type+ and other column options can be passed to make migration reversible. + # + # remove_columns(:suppliers, :qualification, :experience, type: :string, null: false) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:694 + def remove_columns(table_name, *column_names, type: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1381 + def remove_constraint(table_name, constraint_name); end + + # Removes the given foreign key from the table. Any option parameters provided + # will be used to re-add the foreign key in case of a migration rollback. + # It is recommended that you provide any options used when creating the foreign + # key so that the migration can be reverted properly. + # + # Removes the foreign key on +accounts.branch_id+. + # + # remove_foreign_key :accounts, :branches + # + # Removes the foreign key on +accounts.owner_id+. + # + # remove_foreign_key :accounts, column: :owner_id + # + # Removes the foreign key on +accounts.owner_id+. + # + # remove_foreign_key :accounts, to_table: :owners + # + # Removes the foreign key named +special_fk_name+ on the +accounts+ table. + # + # remove_foreign_key :accounts, name: :special_fk_name + # + # Checks if the foreign key exists before trying to remove it. Will silently ignore indexes that + # don't exist. + # + # remove_foreign_key :accounts, :branches, if_exists: true + # + # The +options+ hash accepts the same keys as SchemaStatements#add_foreign_key + # with an addition of + # [:to_table] + # The name of the table that contains the referenced primary key. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1247 + def remove_foreign_key(from_table, to_table = T.unsafe(nil), **options); end + + # Removes the given index from the table. + # + # Removes the index on +branch_id+ in the +accounts+ table if exactly one such index exists. + # + # remove_index :accounts, :branch_id + # + # Removes the index on +branch_id+ in the +accounts+ table if exactly one such index exists. + # + # remove_index :accounts, column: :branch_id + # + # Removes the index on +branch_id+ and +party_id+ in the +accounts+ table if exactly one such index exists. + # + # remove_index :accounts, column: [:branch_id, :party_id] + # + # Removes the index named +by_branch_party+ in the +accounts+ table. + # + # remove_index :accounts, name: :by_branch_party + # + # Removes the index on +branch_id+ named +by_branch_party+ in the +accounts+ table. + # + # remove_index :accounts, :branch_id, name: :by_branch_party + # + # Checks if the index exists before trying to remove it. Will silently ignore indexes that + # don't exist. + # + # remove_index :accounts, if_exists: true + # + # Removes the index named +by_branch_party+ in the +accounts+ table +concurrently+. + # + # remove_index :accounts, name: :by_branch_party, algorithm: :concurrently + # + # Note: only supported by PostgreSQL. + # + # Concurrently removing an index is not supported in a transaction. + # + # For more information see the {"Transactional Migrations" section}[rdoc-ref:Migration]. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:998 + def remove_index(table_name, column_name = T.unsafe(nil), **options); end + + # Removes the reference(s). Also removes a +type+ column if one exists. + # + # ====== Remove the reference + # + # remove_reference(:products, :user, index: false) + # + # ====== Remove polymorphic reference + # + # remove_reference(:products, :supplier, polymorphic: true) + # + # ====== Remove the reference with a foreign key + # + # remove_reference(:products, :user, foreign_key: true) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1114 + def remove_reference(table_name, ref_name, foreign_key: T.unsafe(nil), polymorphic: T.unsafe(nil), **options); end + + # Removes the timestamp columns (+created_at+ and +updated_at+) from the table definition. + # + # remove_timestamps(:suppliers) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1501 + def remove_timestamps(table_name, **options); end + + # Renames a column. + # + # rename_column(:suppliers, :description, :name) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:785 + def rename_column(table_name, column_name, new_column_name); end + + # Renames an index. + # + # Rename the +index_people_on_last_name+ index to +index_users_on_last_name+: + # + # rename_index :people, 'index_people_on_last_name', 'index_users_on_last_name' + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1012 + def rename_index(table_name, old_name, new_name); end + + # Renames a table. + # + # rename_table('octopuses', 'octopi') + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:543 + def rename_table(table_name, new_name, **); end + + # Returns an instance of SchemaCreation, which can be used to visit a schema definition + # object and return DDL. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1598 + def schema_creation; end + + # Truncates a table alias according to the limits of the current adapter. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:29 + def table_alias_for(table_name); end + + # Returns the table comment that's stored in database metadata. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:24 + def table_comment(table_name); end + + # Checks to see if the table +table_name+ exists on the database. + # + # table_exists?(:developers) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:60 + def table_exists?(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:19 + def table_options(table_name); end + + # Returns an array of table names defined in the database. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:52 + def tables; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1418 + def type_to_sql(type, limit: T.unsafe(nil), precision: T.unsafe(nil), scale: T.unsafe(nil), **); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1505 + def update_table_definition(table_name, base); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1592 + def use_foreign_keys?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1631 + def valid_column_definition_options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1635 + def valid_primary_key_options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1627 + def valid_table_definition_options; end + + # Checks to see if the view +view_name+ exists on the database. + # + # view_exists?(:ebooks) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:75 + def view_exists?(view_name); end + + # Returns an array of view names defined in the database. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:67 + def views; end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1911 + def add_column_for_alter(table_name, column_name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1669 + def add_index_sort_order(quoted_columns, **options); end + + # Overridden by the MySQL adapter for supporting index lengths and by + # the PostgreSQL adapter for supporting operator classes. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1690 + def add_options_for_index_columns(quoted_columns, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1934 + def add_timestamps_for_alter(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1903 + def can_remove_index_by_name?(column_name, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1917 + def change_column_default_for_alter(table_name, column_name, default_or_changes); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1865 + def check_constraint_for(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1871 + def check_constraint_for!(table_name, expression: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1855 + def check_constraint_name(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1665 + def column_options_keys; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1760 + def create_alter_table(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1756 + def create_index_definition(table_name, name, unique, columns, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1752 + def create_table_definition(name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1956 + def data_source_sql(name = T.unsafe(nil), type: T.unsafe(nil)); end + + # Try to identify whether the given column name is an expression + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1800 + def expression_column_name?(column_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1843 + def extract_foreign_key_action(specifier); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1901 + def extract_new_comment_value(default_or_changes); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1894 + def extract_new_default_value(default_or_changes); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1772 + def fetch_type_metadata(sql_type); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1820 + def foreign_key_for(from_table, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1838 + def foreign_key_for!(from_table, to_table: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1810 + def foreign_key_name(table_name, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1851 + def foreign_keys_enabled?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1645 + def generate_index_name(table_name, column); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1783 + def index_column_names(column_names); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1698 + def index_name_for_remove(table_name, column_name, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1791 + def index_name_options(column_names); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1951 + def insert_versions_sql(versions); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1680 + def options_for_index_columns(options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1960 + def quoted_scope(name = T.unsafe(nil), type: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1907 + def reference_name_for_table(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1926 + def remove_column_for_alter(table_name, column_name, type = T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1930 + def remove_columns_for_alter(table_name, *column_names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1947 + def remove_timestamps_for_alter(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1739 + def rename_column_indexes(table_name, column_name, new_column_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1922 + def rename_column_sql(table_name, column_name, new_column_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1730 + def rename_table_indexes(table_name, new_name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1804 + def strip_table_name_prefix_and_suffix(table_name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1676 + def valid_index_options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1659 + def validate_change_column_null_argument!(value); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1764 + def validate_create_table_options!(options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1876 + def validate_index_length!(table_name, new_name, internal = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_statements.rb:1885 + def validate_table_length!(table_name); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:6 +class ActiveRecord::ConnectionAdapters::SqlTypeMetadata + include ::ActiveRecord::ConnectionAdapters::Deduplicable + extend ::ActiveRecord::ConnectionAdapters::Deduplicable::ClassMethods + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:11 + def initialize(sql_type: T.unsafe(nil), type: T.unsafe(nil), limit: T.unsafe(nil), precision: T.unsafe(nil), scale: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:19 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:27 + def eql?(other); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:29 + def hash; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:9 + def limit; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:9 + def precision; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:9 + def scale; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:9 + def sql_type; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:9 + def type; end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/sql_type_metadata.rb:39 + def deduplicated; end +end + +# = Active Record Connection Adapters \Table +# +# Represents an SQL table in an abstract way for updating a table. +# Also see TableDefinition and {connection.create_table}[rdoc-ref:SchemaStatements#create_table] +# +# Available transformations are: +# +# change_table :table do |t| +# t.primary_key +# t.column +# t.index +# t.rename_index +# t.timestamps +# t.change +# t.change_default +# t.change_null +# t.rename +# t.references +# t.belongs_to +# t.check_constraint +# t.string +# t.text +# t.integer +# t.bigint +# t.float +# t.decimal +# t.numeric +# t.datetime +# t.timestamp +# t.time +# t.date +# t.binary +# t.blob +# t.boolean +# t.foreign_key +# t.json +# t.virtual +# t.remove +# t.remove_foreign_key +# t.remove_references +# t.remove_belongs_to +# t.remove_index +# t.remove_check_constraint +# t.remove_timestamps +# end +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:707 +class ActiveRecord::ConnectionAdapters::Table + include ::ActiveRecord::ConnectionAdapters::ColumnMethods + extend ::ActiveRecord::ConnectionAdapters::ColumnMethods::ClassMethods + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:712 + def initialize(table_name, base); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:869 + def belongs_to(*args, **options); end + + # Changes the column's definition according to the new options. + # + # t.change(:name, :string, limit: 80) + # t.change(:description, :text) + # + # See TableDefinition#column for details of the options you can use. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:789 + def change(column_name, type, **options); end + + # Sets a new default value for a column. + # + # t.change_default(:qualification, 'new') + # t.change_default(:authorized, 1) + # t.change_default(:status, from: nil, to: "draft") + # + # See {connection.change_column_default}[rdoc-ref:SchemaStatements#change_column_default] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:801 + def change_default(column_name, default_or_changes); end + + # Sets or removes a NOT NULL constraint on a column. + # + # t.change_null(:qualification, true) + # t.change_null(:qualification, false, 0) + # + # See {connection.change_column_null}[rdoc-ref:SchemaStatements#change_column_null] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:811 + def change_null(column_name, null, default = T.unsafe(nil)); end + + # Adds a check constraint. + # + # t.check_constraint("price > 0", name: "price_check") + # + # See {connection.add_check_constraint}[rdoc-ref:SchemaStatements#add_check_constraint] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:921 + def check_constraint(*args, **options); end + + # Checks if a check_constraint exists on a table. + # + # unless t.check_constraint_exists?(name: "price_check") + # t.check_constraint("price > 0", name: "price_check") + # end + # + # See {connection.check_constraint_exists?}[rdoc-ref:SchemaStatements#check_constraint_exists?] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:941 + def check_constraint_exists?(*args, **options); end + + # Adds a new column to the named table. + # + # t.column(:name, :string) + # + # See TableDefinition#column for details of the options you can use. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:722 + def column(column_name, type, index: T.unsafe(nil), **options); end + + # Checks to see if a column exists. + # + # t.string(:name) unless t.column_exists?(:name, :string) + # + # See {connection.column_exists?}[rdoc-ref:SchemaStatements#column_exists?] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:736 + def column_exists?(column_name, type = T.unsafe(nil), **options); end + + # Adds a foreign key to the table using a supplied table name. + # + # t.foreign_key(:authors) + # t.foreign_key(:authors, column: :author_id, primary_key: "id") + # + # See {connection.add_foreign_key}[rdoc-ref:SchemaStatements#add_foreign_key] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:891 + def foreign_key(*args, **options); end + + # Checks to see if a foreign key exists. + # + # t.foreign_key(:authors) unless t.foreign_key_exists?(:authors) + # + # See {connection.foreign_key_exists?}[rdoc-ref:SchemaStatements#foreign_key_exists?] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:912 + def foreign_key_exists?(*args, **options); end + + # Adds a new index to the table. +column_name+ can be a single Symbol, or + # an Array of Symbols. + # + # t.index(:name) + # t.index([:branch_id, :party_id], unique: true) + # t.index([:branch_id, :party_id], unique: true, name: 'by_branch_party') + # + # See {connection.add_index}[rdoc-ref:SchemaStatements#add_index] for details of the options you can use. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:748 + def index(column_name, **options); end + + # Checks to see if an index exists. + # + # unless t.index_exists?(:branch_id) + # t.index(:branch_id) + # end + # + # See {connection.index_exists?}[rdoc-ref:SchemaStatements#index_exists?] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:760 + def index_exists?(column_name = T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:710 + def name; end + + # Adds a reference. + # + # t.references(:user) + # t.belongs_to(:supplier, foreign_key: true) + # + # See {connection.add_reference}[rdoc-ref:SchemaStatements#add_reference] for details of the options you can use. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:863 + def references(*args, **options); end + + # Removes the column(s) from the table definition. + # + # t.remove(:qualification) + # t.remove(:qualification, :experience) + # + # See {connection.remove_columns}[rdoc-ref:SchemaStatements#remove_columns] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:821 + def remove(*column_names, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:883 + def remove_belongs_to(*args, **options); end + + # Removes the given check constraint from the table. + # + # t.remove_check_constraint(name: "price_check") + # + # See {connection.remove_check_constraint}[rdoc-ref:SchemaStatements#remove_check_constraint] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:930 + def remove_check_constraint(*args, **options); end + + # Removes the given foreign key from the table. + # + # t.remove_foreign_key(:authors) + # t.remove_foreign_key(column: :author_id) + # + # See {connection.remove_foreign_key}[rdoc-ref:SchemaStatements#remove_foreign_key] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:902 + def remove_foreign_key(*args, **options); end + + # Removes the given index from the table. + # + # t.remove_index(:branch_id) + # t.remove_index(column: [:branch_id, :party_id]) + # t.remove_index(name: :by_branch_party) + # t.remove_index(:branch_id, name: :by_branch_party) + # + # See {connection.remove_index}[rdoc-ref:SchemaStatements#remove_index] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:834 + def remove_index(column_name = T.unsafe(nil), **options); end + + # Removes a reference. Optionally removes a +type+ column. + # + # t.remove_references(:user) + # t.remove_belongs_to(:supplier, polymorphic: true) + # + # See {connection.remove_reference}[rdoc-ref:SchemaStatements#remove_reference] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:877 + def remove_references(*args, **options); end + + # Removes the timestamp columns (+created_at+ and +updated_at+) from the table. + # + # t.remove_timestamps + # + # See {connection.remove_timestamps}[rdoc-ref:SchemaStatements#remove_timestamps] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:844 + def remove_timestamps(**options); end + + # Renames a column. + # + # t.rename(:description, :name) + # + # See {connection.rename_column}[rdoc-ref:SchemaStatements#rename_column] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:853 + def rename(column_name, new_column_name); end + + # Renames the given index on the table. + # + # t.rename_index(:user_id, :account_id) + # + # See {connection.rename_index}[rdoc-ref:SchemaStatements#rename_index] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:769 + def rename_index(index_name, new_index_name); end + + # Adds timestamps (+created_at+ and +updated_at+) columns to the table. + # + # t.timestamps(null: false) + # + # See {connection.add_timestamps}[rdoc-ref:SchemaStatements#add_timestamps] + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:778 + def timestamps(**options); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:946 + def raise_on_if_exist_options(options); end +end + +# = Active Record Connection Adapters \Table \Definition +# +# Represents the schema of an SQL table in an abstract way. This class +# provides methods for manipulating the schema representation. +# +# Inside migration files, the +t+ object in {create_table}[rdoc-ref:SchemaStatements#create_table] +# is actually of this type: +# +# class SomeMigration < ActiveRecord::Migration[8.1] +# def up +# create_table :foo do |t| +# puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition" +# end +# end +# +# def down +# ... +# end +# end +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:358 +class ActiveRecord::ConnectionAdapters::TableDefinition + include ::ActiveRecord::ConnectionAdapters::ColumnMethods + extend ::ActiveRecord::ConnectionAdapters::ColumnMethods::ClassMethods + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:363 + def initialize(conn, name, temporary: T.unsafe(nil), if_not_exists: T.unsafe(nil), options: T.unsafe(nil), as: T.unsafe(nil), comment: T.unsafe(nil), **); end + + # Returns a ColumnDefinition for the column with name +name+. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:413 + def [](name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:361 + def as; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:548 + def belongs_to(*args, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:517 + def check_constraint(expression, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:361 + def check_constraints; end + + # Instantiates a new column for the table. + # See {connection.add_column}[rdoc-ref:ConnectionAdapters::SchemaStatements#add_column] + # for available options. + # + # Additional options are: + # * :index - + # Create an index for the column. Can be either true or an options hash. + # + # This method returns self. + # + # == Examples + # + # # Assuming `td` is an instance of TableDefinition + # td.column(:granted, :boolean, index: true) + # + # == Short-hand examples + # + # Instead of calling #column directly, you can also work with the short-hand definitions for the default types. + # They use the type as the method name instead of as a parameter and allow for multiple columns to be defined + # in a single statement. + # + # What can be written like this with the regular calls to column: + # + # create_table :products do |t| + # t.column :shop_id, :integer + # t.column :creator_id, :integer + # t.column :item_number, :string + # t.column :name, :string, default: "Untitled" + # t.column :value, :string, default: "Untitled" + # t.column :created_at, :datetime + # t.column :updated_at, :datetime + # end + # add_index :products, :item_number + # + # can also be written as follows using the short-hand: + # + # create_table :products do |t| + # t.integer :shop_id, :creator_id + # t.string :item_number, index: true + # t.string :name, :value, default: "Untitled" + # t.timestamps null: false + # end + # + # There's a short-hand method for each of the type values declared at the top. And then there's + # TableDefinition#timestamps that'll add +created_at+ and +updated_at+ as datetimes. + # + # TableDefinition#references will add an appropriately-named _id column, plus a corresponding _type + # column if the :polymorphic option is supplied. If :polymorphic is a hash of + # options, these will be used when creating the _type column. The :index option + # will also create an index, similar to calling {add_index}[rdoc-ref:ConnectionAdapters::SchemaStatements#add_index]. + # So what can be written like this: + # + # create_table :taggings do |t| + # t.integer :tag_id, :tagger_id, :taggable_id + # t.string :tagger_type + # t.string :taggable_type, default: 'Photo' + # end + # add_index :taggings, :tag_id, name: 'index_taggings_on_tag_id' + # add_index :taggings, [:tagger_id, :tagger_type] + # + # Can also be written as follows using references: + # + # create_table :taggings do |t| + # t.references :tag, index: { name: 'index_taggings_on_tag_id' } + # t.references :tagger, polymorphic: true + # t.references :taggable, polymorphic: { default: 'Photo' }, index: false + # end + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:484 + def column(name, type, index: T.unsafe(nil), **options); end + + # Returns an array of ColumnDefinition objects for the columns of the table. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:410 + def columns; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:361 + def comment; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:513 + def foreign_key(to_table, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:361 + def foreign_keys; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:361 + def if_not_exists; end + + # Adds index options to the indexes hash, keyed by column name + # This is primarily used to track indexes that need to be created after the table + # + # index(:account_id, name: 'index_projects_on_account_id') + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:509 + def index(column_name, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:361 + def indexes; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:361 + def name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:575 + def new_check_constraint_definition(expression, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:550 + def new_column_definition(name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:567 + def new_foreign_key_definition(to_table, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:361 + def options; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:404 + def primary_keys(name = T.unsafe(nil)); end + + # Adds a reference. + # + # t.references(:user) + # t.belongs_to(:supplier, foreign_key: true) + # t.belongs_to(:supplier, foreign_key: true, type: :integer) + # + # See {connection.add_reference}[rdoc-ref:SchemaStatements#add_reference] for details of the options you can use. + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:543 + def references(*args, **options); end + + # remove the column +name+ from the table. + # remove_column(:account_id) + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:501 + def remove_column(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:387 + def set_primary_key(table_name, id, primary_key, **options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:361 + def temporary; end + + # Appends :datetime columns :created_at and + # :updated_at to the table. See {connection.add_timestamps}[rdoc-ref:SchemaStatements#add_timestamps] + # + # t.timestamps null: false + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:525 + def timestamps(**options); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:593 + def aliased_types(name, fallback); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:585 + def create_column_definition(name, type, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:597 + def integer_like_primary_key?(type, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:601 + def integer_like_primary_key_type(type, options); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:605 + def raise_on_duplicate_column(name); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/schema_definitions.rb:581 + def valid_column_definition_options; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:130 +class ActiveRecord::ConnectionAdapters::Transaction + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:164 + def initialize(connection, isolation: T.unsafe(nil), joinable: T.unsafe(nil), run_commit_callbacks: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:196 + def add_record(record, ensure_finalize = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:214 + def after_commit(&block); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:222 + def after_rollback(&block); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:206 + def before_commit(&block); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:285 + def before_commit_records; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:192 + def closed?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:309 + def commit_records; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:150 + def connection; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:180 + def dirty!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:184 + def dirty?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:338 + def full_rollback?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:244 + def incomplete!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:153 + def invalidate!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:153 + def invalidated?(*, **, &); end + + # Returns the isolation level if it was explicitly set, nil otherwise + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:156 + def isolation; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:160 + def isolation=(isolation); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:150 + def isolation_level; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:339 + def joinable?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:248 + def materialize!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:253 + def materialized?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:188 + def open?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:230 + def records; end + + # Can this transaction's current state be recreated by + # rollback+begin ? + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:240 + def restartable?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:257 + def restore!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:265 + def rollback_records; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:150 + def savepoint_name; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:150 + def state; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:150 + def user_transaction; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:151 + def written; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:151 + def written=(_arg0); end + + protected + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:342 + def append_callbacks(callbacks); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:359 + def prepare_instances_to_run_callbacks_on(records); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:351 + def run_action_on_records(records, instances_to_run_callbacks_on); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:347 + def unique_records; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:131 +class ActiveRecord::ConnectionAdapters::Transaction::Callback + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:132 + def initialize(event, callback); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:141 + def after_commit; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:145 + def after_rollback; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:137 + def before_commit; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:79 +class ActiveRecord::ConnectionAdapters::TransactionInstrumenter + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:80 + def initialize(payload = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:101 + def finish(outcome); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:90 + def start; end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:88 +class ActiveRecord::ConnectionAdapters::TransactionInstrumenter::InstrumentationAlreadyStartedError < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:87 +class ActiveRecord::ConnectionAdapters::TransactionInstrumenter::InstrumentationNotStartedError < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:518 +class ActiveRecord::ConnectionAdapters::TransactionManager + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:519 + def initialize(connection); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:527 + def begin_transaction(isolation: T.unsafe(nil), joinable: T.unsafe(nil), _lazy: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:614 + def commit_transaction; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:683 + def current_transaction; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:582 + def dirty_current_transaction; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:569 + def disable_lazy_transactions!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:574 + def enable_lazy_transactions!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:578 + def lazy_transactions_enabled?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:598 + def materialize_transactions; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:679 + def open_transactions; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:594 + def restorable?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:586 + def restore_transactions; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:631 + def rollback_transaction(transaction = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:643 + def within_new_transaction(isolation: T.unsafe(nil), joinable: T.unsafe(nil)); end + + private + + # Deallocate invalidated prepared statements outside of the transaction + # + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:691 + def after_failure_actions(transaction, error); end +end + +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:688 +ActiveRecord::ConnectionAdapters::TransactionManager::NULL_TRANSACTION = T.let(T.unsafe(nil), ActiveRecord::ConnectionAdapters::NullTransaction) + +# = Active Record Connection Adapters Transaction State +# +# pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:8 +class ActiveRecord::ConnectionAdapters::TransactionState + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:9 + def initialize(state = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:14 + def add_child(state); end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:66 + def commit!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:23 + def committed?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:47 + def completed?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:19 + def finalized?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:70 + def full_commit!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:56 + def full_rollback!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:27 + def fully_committed?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:43 + def fully_completed?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:35 + def fully_rolledback?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:61 + def invalidate!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:39 + def invalidated?; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:74 + def nullify!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:51 + def rollback!; end + + # pkg:gem/activerecord#lib/active_record/connection_adapters/abstract/transaction.rb:31 + def rolledback?; end +end + +# ConnectionFailed will be raised when the network connection to the +# database fails while sending a query or waiting for its result. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:595 +class ActiveRecord::ConnectionFailed < ::ActiveRecord::QueryAborted; end + +# = Active Record Connection Handling +# +# pkg:gem/activerecord#lib/active_record/connection_handling.rb:5 +module ActiveRecord::ConnectionHandling + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:341 + def adapter_class; end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:375 + def clear_cache!; end + + # Clears the query cache for all connections associated with the current thread. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:261 + def clear_query_caches_for_current_thread; end + + # Returns +true+ if Active Record is connected. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:354 + def connected?; end + + # Connects to a role (e.g. writing, reading, or a custom role) and/or + # shard for the duration of the block. At the end of the block the + # connection will be returned to the original role / shard. + # + # If only a role is passed, Active Record will look up the connection + # based on the requested role. If a non-established role is requested + # an +ActiveRecord::ConnectionNotEstablished+ error will be raised: + # + # ActiveRecord::Base.connected_to(role: :writing) do + # Dog.create! # creates dog using dog writing connection + # end + # + # ActiveRecord::Base.connected_to(role: :reading) do + # Dog.create! # throws exception because we're on a replica + # end + # + # When swapping to a shard, the role must be passed as well. If a non-existent + # shard is passed, an +ActiveRecord::ConnectionNotEstablished+ error will be + # raised. + # + # When a shard and role is passed, Active Record will first lookup the role, + # and then look up the connection by shard key. + # + # ActiveRecord::Base.connected_to(role: :reading, shard: :shard_one_replica) do + # Dog.first # finds first Dog record stored on the shard one replica + # end + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:137 + def connected_to(role: T.unsafe(nil), shard: T.unsafe(nil), prevent_writes: T.unsafe(nil), &blk); end + + # Returns true if role is the current connected role and/or + # current connected shard. If no shard is passed, the default will be + # used. + # + # ActiveRecord::Base.connected_to(role: :writing) do + # ActiveRecord::Base.connected_to?(role: :writing) #=> true + # ActiveRecord::Base.connected_to?(role: :reading) #=> false + # end + # + # ActiveRecord::Base.connected_to(role: :reading, shard: :shard_one) do + # ActiveRecord::Base.connected_to?(role: :reading, shard: :shard_one) #=> true + # ActiveRecord::Base.connected_to?(role: :reading, shard: :default) #=> false + # ActiveRecord::Base.connected_to?(role: :writing, shard: :shard_one) #=> true + # end + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:256 + def connected_to?(role:, shard: T.unsafe(nil)); end + + # Passes the block to +connected_to+ for every +shard+ the + # model is configured to connect to (if any), and returns the + # results in an array. + # + # Optionally, +role+ and/or +prevent_writes+ can be passed which + # will be forwarded to each +connected_to+ call. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:189 + def connected_to_all_shards(role: T.unsafe(nil), prevent_writes: T.unsafe(nil), &blk); end + + # Connects a role and/or shard to the provided connection names. Optionally +prevent_writes+ + # can be passed to block writes on a connection. +reading+ will automatically set + # +prevent_writes+ to true. + # + # +connected_to_many+ is an alternative to deeply nested +connected_to+ blocks. + # + # Usage: + # + # ActiveRecord::Base.connected_to_many(AnimalsRecord, MealsRecord, role: :reading) do + # Dog.first # Read from animals replica + # Dinner.first # Read from meals replica + # Person.first # Read from primary writer + # end + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:166 + def connected_to_many(*classes, role:, shard: T.unsafe(nil), prevent_writes: T.unsafe(nil)); end + + # Use a specified connection. + # + # This method is useful for ensuring that a specific connection is + # being used. For example, when booting a console in readonly mode. + # + # It is not recommended to use this method in a request since it + # does not yield to a block like +connected_to+. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:202 + def connecting_to(role: T.unsafe(nil), shard: T.unsafe(nil), prevent_writes: T.unsafe(nil)); end + + # Soft deprecated. Use +#with_connection+ or +#lease_connection+ instead. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:277 + def connection; end + + # Returns the db_config object from the associated connection: + # + # ActiveRecord::Base.connection_db_config + # # + # + # Use only for reading. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:337 + def connection_db_config; end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:345 + def connection_pool; end + + # Returns the connection specification name from the current class or its parent. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:319 + def connection_specification_name; end + + # Returns the connection specification name from the current class or its parent. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:316 + def connection_specification_name=(_arg0); end + + # Connects a model to the databases specified. The +database+ keyword + # takes a hash consisting of a +role+ and a +database_key+. + # + # This will look up the database config using the +database_key+ and + # establish a connection to that config. + # + # class AnimalsModel < ApplicationRecord + # self.abstract_class = true + # + # connects_to database: { writing: :primary, reading: :primary_replica } + # end + # + # +connects_to+ also supports horizontal sharding. The horizontal sharding API + # supports read replicas as well. You can connect a model to a list of shards like this: + # + # class AnimalsModel < ApplicationRecord + # self.abstract_class = true + # + # connects_to shards: { + # default: { writing: :primary, reading: :primary_replica }, + # shard_two: { writing: :primary_shard_two, reading: :primary_shard_replica_two } + # } + # end + # + # Returns an array of database connections. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:81 + def connects_to(database: T.unsafe(nil), shards: T.unsafe(nil)); end + + # Establishes the connection to the database. Accepts a hash as input where + # the :adapter key must be specified with the name of a database adapter (in lower-case) + # example for regular databases (MySQL, PostgreSQL, etc): + # + # ActiveRecord::Base.establish_connection( + # adapter: "mysql2", + # host: "localhost", + # username: "myuser", + # password: "mypass", + # database: "somedatabase" + # ) + # + # Example for SQLite database: + # + # ActiveRecord::Base.establish_connection( + # adapter: "sqlite3", + # database: "path/to/dbfile" + # ) + # + # Also accepts keys as strings (for parsing from YAML for example): + # + # ActiveRecord::Base.establish_connection( + # "adapter" => "sqlite3", + # "database" => "path/to/dbfile" + # ) + # + # Or a URL: + # + # ActiveRecord::Base.establish_connection( + # "postgres://myuser:mypass@localhost/somedatabase" + # ) + # + # In case {ActiveRecord::Base.configurations}[rdoc-ref:Core.configurations] + # is set (\Rails automatically loads the contents of config/database.yml into it), + # a symbol can also be given as argument, representing a key in the + # configuration hash: + # + # ActiveRecord::Base.establish_connection(:production) + # + # The exceptions AdapterNotSpecified, AdapterNotFound, and +ArgumentError+ + # may be returned on an error. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:50 + def establish_connection(config_or_env = T.unsafe(nil)); end + + # Returns the connection currently associated with the class. This can + # also be used to "borrow" the connection to do database work unrelated + # to any of the specific Active Records. + # The connection will remain leased for the entire duration of the request + # or job, or until +#release_connection+ is called. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:272 + def lease_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:326 + def primary_class?; end + + # Prohibit swapping shards while inside of the passed block. + # + # In some cases you may want to be able to swap shards but not allow a + # nested call to connected_to or connected_to_many to swap again. This + # is useful in cases you're using sharding to provide per-request + # database isolation. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:214 + def prohibit_shard_swapping(enabled = T.unsafe(nil)); end + + # Return the currently leased connection into the pool + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:301 + def release_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:358 + def remove_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:349 + def retrieve_connection; end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:371 + def schema_cache; end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:379 + def shard_keys; end + + # Determine whether or not shard swapping is currently prohibited + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:223 + def shard_swapping_prohibited?; end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:383 + def sharded?; end + + # Prevent writing to the database regardless of role. + # + # In some cases you may want to prevent writes to the database + # even if you are on a database that can write. +while_preventing_writes+ + # will prevent writes to the database for the duration of the block. + # + # This method does not provide the same protection as a readonly + # user and is meant to be a safeguard against accidental writes. + # + # See +READ_QUERY+ for the queries that are blocked by this + # method. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:238 + def while_preventing_writes(enabled = T.unsafe(nil), &block); end + + # Checkouts a connection from the pool, yield it and then check it back in. + # If a connection was already leased via #lease_connection or a parent call to + # #with_connection, that same connection is yielded. + # If #lease_connection is called inside the block, the connection won't be checked + # back in. + # If #connection is called inside the block, the connection won't be checked back in + # unless the +prevent_permanent_checkout+ argument is set to +true+. + # + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:312 + def with_connection(prevent_permanent_checkout: T.unsafe(nil), &block); end + + private + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:410 + def append_to_connected_to_stack(entry); end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:388 + def resolve_config_for_connection(config_or_env); end + + # pkg:gem/activerecord#lib/active_record/connection_handling.rb:397 + def with_role_and_shard(role, shard, prevent_writes); end +end + +# pkg:gem/activerecord#lib/active_record/connection_handling.rb:7 +ActiveRecord::ConnectionHandling::DEFAULT_ENV = T.let(T.unsafe(nil), Proc) + +# pkg:gem/activerecord#lib/active_record/connection_handling.rb:6 +ActiveRecord::ConnectionHandling::RAILS_ENV = T.let(T.unsafe(nil), Proc) + +# Raised when a database connection pool is requested but +# has not been defined. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:88 +class ActiveRecord::ConnectionNotDefined < ::ActiveRecord::ConnectionNotEstablished + # pkg:gem/activerecord#lib/active_record/errors.rb:89 + def initialize(message = T.unsafe(nil), connection_name: T.unsafe(nil), role: T.unsafe(nil), shard: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:96 + def connection_name; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:96 + def role; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:96 + def shard; end +end + +# Raised when connection to the database could not been established (for example when +# {ActiveRecord::Base.lease_connection=}[rdoc-ref:ConnectionHandling#lease_connection] +# is given a +nil+ object). +# +# pkg:gem/activerecord#lib/active_record/errors.rb:66 +class ActiveRecord::ConnectionNotEstablished < ::ActiveRecord::AdapterError + # pkg:gem/activerecord#lib/active_record/errors.rb:67 + def initialize(message = T.unsafe(nil), connection_pool: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:71 + def set_pool(connection_pool); end +end + +# Raised when a connection could not be obtained within the connection +# acquisition timeout period: because max connections in pool +# are in use. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:83 +class ActiveRecord::ConnectionTimeoutError < ::ActiveRecord::ConnectionNotEstablished; end + +# = Active Record \Core +# +# pkg:gem/activerecord#lib/active_record/core.rb:9 +module ActiveRecord::Core + include ::ActiveModel::Access + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::Core::ClassMethods + + # New objects can be instantiated as either empty (pass no construction parameter) or pre-set with + # attributes but not yet saved (pass a hash with key names matching the associated table column names). + # In both instances, valid attribute keys are determined by the column names of the associated table -- + # hence you can't have attributes that aren't part of the table columns. + # + # ==== Example + # # Instantiates a single new object + # User.new(first_name: 'Jamie') + # + # pkg:gem/activerecord#lib/active_record/core.rb:472 + def initialize(attributes = T.unsafe(nil)); end + + # Allows sort on objects + # + # pkg:gem/activerecord#lib/active_record/core.rb:666 + def <=>(other_object); end + + # Returns true if +comparison_object+ is the same exact object, or +comparison_object+ + # is of the same type and +self+ has an ID and it is equal to +comparison_object.id+. + # + # Note that new records are different from any other record by definition, unless the + # other record is the receiver itself. Besides, if you fetch existing records with + # +select+ and leave the ID out, you're on your own, this predicate will return false. + # + # Note also that destroying a record preserves its ID in the model instance, so deleted + # models are still comparable. + # + # pkg:gem/activerecord#lib/active_record/core.rb:632 + def ==(comparison_object); end + + # pkg:gem/activerecord#lib/active_record/core.rb:678 + def blank?; end + + # pkg:gem/activerecord#lib/active_record/core.rb:771 + def connection_handler; end + + # Populate +coder+ with attributes about this record that should be + # serialized. The structure of +coder+ defined in this method is + # guaranteed to match the structure of +coder+ passed to the #init_with + # method. + # + # Example: + # + # class Post < ActiveRecord::Base + # end + # coder = {} + # Post.new.encode_with(coder) + # coder # => {"attributes" => {"id" => nil, ... }} + # + # pkg:gem/activerecord#lib/active_record/core.rb:588 + def encode_with(coder); end + + # pkg:gem/activerecord#lib/active_record/core.rb:638 + def eql?(comparison_object); end + + # Clone and freeze the attributes hash such that associations are still + # accessible, even on destroyed records, but cloned models will not be + # frozen. + # + # pkg:gem/activerecord#lib/active_record/core.rb:655 + def freeze; end + + # Returns +true+ if the attributes hash has been frozen. + # + # pkg:gem/activerecord#lib/active_record/core.rb:661 + def frozen?; end + + # Returns all attributes of the record as a nicely formatted string, + # ignoring .attributes_for_inspect. + # + # Post.first.full_inspect + # #=> "#" + # + # pkg:gem/activerecord#lib/active_record/core.rb:795 + def full_inspect; end + + # Delegates to id in order to allow two records of the same type and id to work with something like: + # [ Person.find(1), Person.find(2), Person.find(3) ] & [ Person.find(1), Person.find(4) ] # => [ Person.find(1) ] + # + # pkg:gem/activerecord#lib/active_record/core.rb:642 + def hash; end + + # pkg:gem/activerecord#lib/active_record/core.rb:564 + def init_attributes(_); end + + # Initialize an empty model object from +coder+. +coder+ should be + # the result of previously encoding an Active Record model, using + # #encode_with. + # + # class Post < ActiveRecord::Base + # end + # + # old_post = Post.new(title: "hello world") + # coder = {} + # old_post.encode_with(coder) + # + # post = Post.allocate + # post.init_with(coder) + # post.title # => 'hello world' + # + # pkg:gem/activerecord#lib/active_record/core.rb:499 + def init_with(coder, &block); end + + # Initialize an empty model object from +attributes+. + # +attributes+ should be an attributes object, and unlike the + # `initialize` method, no assignment calls are made per attribute. + # + # pkg:gem/activerecord#lib/active_record/core.rb:509 + def init_with_attributes(attributes, new_record = T.unsafe(nil)); end + + # Returns the attributes of the record as a nicely formatted string. + # + # Post.first.inspect + # #=> "#" + # + # The attributes can be limited by setting .attributes_for_inspect. + # + # Post.attributes_for_inspect = [:id, :title] + # Post.first.inspect + # #=> "#" + # + # pkg:gem/activerecord#lib/active_record/core.rb:785 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/core.rb:674 + def present?; end + + # Takes a PP and prettily prints this record to it, allowing you to get a nice result from pp record + # when pp is required. + # + # pkg:gem/activerecord#lib/active_record/core.rb:801 + def pretty_print(pp); end + + # Prevents records from being written to the database: + # + # customer = Customer.new + # customer.readonly! + # customer.save # raises ActiveRecord::ReadOnlyRecord + # + # customer = Customer.first + # customer.readonly! + # customer.update(name: 'New Name') # raises ActiveRecord::ReadOnlyRecord + # + # Read-only records cannot be deleted from the database either: + # + # customer = Customer.first + # customer.readonly! + # customer.destroy # raises ActiveRecord::ReadOnlyRecord + # + # Please, note that the objects themselves are still mutable in memory: + # + # customer = Customer.new + # customer.readonly! + # customer.name = 'New Name' # OK + # + # but you won't be able to persist the changes. + # + # pkg:gem/activerecord#lib/active_record/core.rb:767 + def readonly!; end + + # Returns +true+ if the record is read only. + # + # pkg:gem/activerecord#lib/active_record/core.rb:683 + def readonly?; end + + # Sets the record to strict_loading mode. This will raise an error + # if the record tries to lazily load an association. + # + # NOTE: Strict loading is disabled during validation in order to let the record validate its association. + # + # user = User.first + # user.strict_loading! # => true + # user.address.city + # # => ActiveRecord::StrictLoadingViolationError + # user.comments.to_a + # # => ActiveRecord::StrictLoadingViolationError + # + # ==== Parameters + # + # * +value+ - Boolean specifying whether to enable or disable strict loading. + # * :mode - Symbol specifying strict loading mode. Defaults to :all. Using + # :n_plus_one_only mode will only raise an error if an association that + # will lead to an n plus one query is lazily loaded. + # + # ==== Examples + # + # user = User.first + # user.strict_loading!(false) # => false + # user.address.city # => "Tatooine" + # user.comments.to_a # => [# "Tatooine" + # user.comments.to_a # => [# ActiveRecord::StrictLoadingViolationError + # + # pkg:gem/activerecord#lib/active_record/core.rb:723 + def strict_loading!(value = T.unsafe(nil), mode: T.unsafe(nil)); end + + # Returns +true+ if the record is in strict_loading mode. + # + # pkg:gem/activerecord#lib/active_record/core.rb:688 + def strict_loading?; end + + # Returns +true+ if the record uses strict_loading with +:all+ mode enabled. + # + # pkg:gem/activerecord#lib/active_record/core.rb:740 + def strict_loading_all?; end + + # pkg:gem/activerecord#lib/active_record/core.rb:732 + def strict_loading_mode; end + + # Returns +true+ if the record uses strict_loading with +:n_plus_one_only+ mode enabled. + # + # pkg:gem/activerecord#lib/active_record/core.rb:735 + def strict_loading_n_plus_one_only?; end + + private + + # pkg:gem/activerecord#lib/active_record/core.rb:891 + def all_attributes_for_inspect; end + + # pkg:gem/activerecord#lib/active_record/core.rb:887 + def attributes_for_inspect; end + + # pkg:gem/activerecord#lib/active_record/core.rb:857 + def custom_inspect_method_defined?; end + + # pkg:gem/activerecord#lib/active_record/core.rb:837 + def init_internals; end + + # pkg:gem/activerecord#lib/active_record/core.rb:551 + def initialize_dup(other); end + + # pkg:gem/activerecord#lib/active_record/core.rb:854 + def initialize_internals_callback; end + + # pkg:gem/activerecord#lib/active_record/core.rb:872 + def inspect_with_attributes(attributes_to_list); end + + # pkg:gem/activerecord#lib/active_record/core.rb:868 + def inspection_filter; end + + # +Array#flatten+ will call +#to_ary+ (recursively) on each of the elements of + # the array, and then rescues from the possible +NoMethodError+. If those elements are + # +ActiveRecord::Base+'s, then this triggers the various +method_missing+'s that we have, + # which significantly impacts upon performance. + # + # So we can avoid the +method_missing+ hit by explicitly defining +#to_ary+ as +nil+ here. + # + # See also https://tenderlovemaking.com/2011/06/28/til-its-ok-to-return-nil-from-to_ary.html + # + # pkg:gem/activerecord#lib/active_record/core.rb:833 + def to_ary; end + + module GeneratedClassMethods + def _destroy_association_async_job; end + def _destroy_association_async_job=(value); end + def _destroy_association_async_job?; end + def attributes_for_inspect; end + def attributes_for_inspect=(value); end + def attributes_for_inspect?; end + def belongs_to_required_by_default; end + def belongs_to_required_by_default=(value); end + def belongs_to_required_by_default?; end + def default_connection_handler; end + def default_connection_handler=(value); end + def default_connection_handler?; end + def default_role; end + def default_role=(value); end + def default_role?; end + def default_shard; end + def default_shard=(value); end + def default_shard?; end + def destroy_association_async_batch_size; end + def destroy_association_async_batch_size=(value); end + def enumerate_columns_in_select_statements; end + def enumerate_columns_in_select_statements=(value); end + def enumerate_columns_in_select_statements?; end + def has_many_inversing; end + def has_many_inversing=(value); end + def has_many_inversing?; end + def logger; end + def logger=(value); end + def logger?; end + def run_commit_callbacks_on_first_saved_instances_in_transaction; end + def run_commit_callbacks_on_first_saved_instances_in_transaction=(value); end + def run_commit_callbacks_on_first_saved_instances_in_transaction?; end + def shard_selector; end + def shard_selector=(value); end + def shard_selector?; end + def strict_loading_by_default; end + def strict_loading_by_default=(value); end + def strict_loading_by_default?; end + def strict_loading_mode; end + def strict_loading_mode=(value); end + def strict_loading_mode?; end + end + + module GeneratedInstanceMethods + def default_connection_handler; end + def default_connection_handler?; end + def default_role; end + def default_role?; end + def default_shard; end + def default_shard?; end + def destroy_association_async_batch_size; end + def logger; end + def logger?; end + end +end + +# pkg:gem/activerecord#lib/active_record/core.rb:264 +module ActiveRecord::Core::ClassMethods + # Returns an instance of +Arel::Table+ loaded with the current table name. + # + # pkg:gem/activerecord#lib/active_record/core.rb:392 + def arel_table; end + + # pkg:gem/activerecord#lib/active_record/core.rb:404 + def cached_find_by_statement(connection, key, &block); end + + # Returns columns which shouldn't be exposed while calling +#inspect+. + # + # pkg:gem/activerecord#lib/active_record/core.rb:348 + def filter_attributes; end + + # Specifies columns which shouldn't be exposed while calling +#inspect+. + # + # pkg:gem/activerecord#lib/active_record/core.rb:357 + def filter_attributes=(filter_attributes); end + + # pkg:gem/activerecord#lib/active_record/core.rb:269 + def find(*ids); end + + # pkg:gem/activerecord#lib/active_record/core.rb:282 + def find_by(*args); end + + # pkg:gem/activerecord#lib/active_record/core.rb:329 + def find_by!(*args); end + + # pkg:gem/activerecord#lib/active_record/core.rb:337 + def generated_association_methods; end + + # pkg:gem/activerecord#lib/active_record/core.rb:265 + def initialize_find_by_cache; end + + # pkg:gem/activerecord#lib/active_record/core.rb:333 + def initialize_generated_modules; end + + # Returns a string like 'Post(id:integer, title:string, body:text)' + # + # pkg:gem/activerecord#lib/active_record/core.rb:376 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/core.rb:364 + def inspection_filter; end + + # pkg:gem/activerecord#lib/active_record/core.rb:396 + def predicate_builder; end + + # pkg:gem/activerecord#lib/active_record/core.rb:400 + def type_caster; end + + private + + # pkg:gem/activerecord#lib/active_record/core.rb:442 + def cached_find_by(keys, values); end + + # pkg:gem/activerecord#lib/active_record/core.rb:410 + def inherited(subclass); end + + # pkg:gem/activerecord#lib/active_record/core.rb:432 + def relation; end +end + +# pkg:gem/activerecord#lib/active_record/core.rb:861 +class ActiveRecord::Core::InspectionMask + # pkg:gem/activerecord#lib/active_record/core.rb:862 + def pretty_print(pp); end +end + +# = Active Record Counter Cache +# +# pkg:gem/activerecord#lib/active_record/counter_cache.rb:5 +module ActiveRecord::CounterCache + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::CounterCache::ClassMethods + + private + + # pkg:gem/activerecord#lib/active_record/counter_cache.rb:227 + def _create_record(attribute_names = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/counter_cache.rb:253 + def _foreign_keys_equal?(fkey1, fkey2); end + + # pkg:gem/activerecord#lib/active_record/counter_cache.rb:237 + def destroy_row; end + + module GeneratedClassMethods + def _counter_cache_columns; end + def _counter_cache_columns=(value); end + def _counter_cache_columns?; end + def counter_cached_association_names; end + def counter_cached_association_names=(value); end + def counter_cached_association_names?; end + end + + module GeneratedInstanceMethods + def counter_cached_association_names; end + def counter_cached_association_names?; end + end +end + +# pkg:gem/activerecord#lib/active_record/counter_cache.rb:13 +module ActiveRecord::CounterCache::ClassMethods + # pkg:gem/activerecord#lib/active_record/counter_cache.rb:209 + def counter_cache_column?(name); end + + # Decrement a numeric field by one, via a direct SQL update. + # + # This works the same as #increment_counter but reduces the column value by + # 1 instead of increasing it. + # + # ==== Parameters + # + # * +counter_name+ - The name of the field that should be decremented. + # * +id+ - The id of the object that should be decremented or an array of ids. + # * :by - The amount by which to decrement the value. Defaults to +1+. + # * :touch - Touch timestamp columns when updating. + # Pass +true+ to touch +updated_at+ and/or +updated_on+. Pass a symbol to + # touch that column or an array of symbols to touch just those ones. + # + # ==== Examples + # + # # Decrement the posts_count column for the record with an id of 5 + # DiscussionBoard.decrement_counter(:posts_count, 5) + # + # # Decrement the posts_count column for the record with an id of 5 + # by a specific amount. + # DiscussionBoard.decrement_counter(:posts_count, 5, by: 3) + # + # # Decrement the posts_count column for the record with an id of 5 + # # and update the updated_at value. + # DiscussionBoard.decrement_counter(:posts_count, 5, touch: true) + # + # pkg:gem/activerecord#lib/active_record/counter_cache.rb:205 + def decrement_counter(counter_name, id, by: T.unsafe(nil), touch: T.unsafe(nil)); end + + # Increment a numeric field by one, via a direct SQL update. + # + # This method is used primarily for maintaining counter_cache columns that are + # used to store aggregate values. For example, a +DiscussionBoard+ may cache + # posts_count and comments_count to avoid running an SQL query to calculate the + # number of posts and comments there are, each time it is displayed. + # + # ==== Parameters + # + # * +counter_name+ - The name of the field that should be incremented. + # * +id+ - The id of the object that should be incremented or an array of ids. + # * :by - The amount by which to increment the value. Defaults to +1+. + # * :touch - Touch timestamp columns when updating. + # Pass +true+ to touch +updated_at+ and/or +updated_on+. Pass a symbol to + # touch that column or an array of symbols to touch just those ones. + # + # ==== Examples + # + # # Increment the posts_count column for the record with an id of 5 + # DiscussionBoard.increment_counter(:posts_count, 5) + # + # # Increment the posts_count column for the record with an id of 5 + # # by a specific amount. + # DiscussionBoard.increment_counter(:posts_count, 5, by: 3) + # + # # Increment the posts_count column for the record with an id of 5 + # # and update the updated_at value. + # DiscussionBoard.increment_counter(:posts_count, 5, touch: true) + # + # pkg:gem/activerecord#lib/active_record/counter_cache.rb:175 + def increment_counter(counter_name, id, by: T.unsafe(nil), touch: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/counter_cache.rb:213 + def load_schema!; end + + # Resets one or more counter caches to their correct value using an SQL + # count query. This is useful when adding new counter caches, or if the + # counter has been corrupted or modified directly by SQL. + # + # ==== Parameters + # + # * +id+ - The id of the object you wish to reset a counter on or an array of ids. + # * +counters+ - One or more association counters to reset. Association name or counter name can be given. + # * :touch - Touch timestamp columns when updating. + # Pass +true+ to touch +updated_at+ and/or +updated_on+. Pass a symbol to + # touch that column or an array of symbols to touch just those ones. + # + # ==== Examples + # + # # For the Post with id #1, reset the comments_count + # Post.reset_counters(1, :comments) + # + # # For posts with ids #1 and #2, reset the comments_count + # Post.reset_counters([1, 2], :comments) + # + # # Like above, but also touch the updated_at and/or updated_on + # # attributes. + # Post.reset_counters(1, :comments, touch: true) + # + # pkg:gem/activerecord#lib/active_record/counter_cache.rb:37 + def reset_counters(id, *counters, touch: T.unsafe(nil)); end + + # A generic "counter updater" implementation, intended primarily to be + # used by #increment_counter and #decrement_counter, but which may also + # be useful on its own. It simply does a direct SQL update for the record + # with the given ID, altering the given hash of counters by the amount + # given by the corresponding value: + # + # ==== Parameters + # + # * +id+ - The id of the object you wish to update a counter on or an array of ids. + # * +counters+ - A Hash containing the names of the fields + # to update as keys and the amount to update the field by as values. + # * :touch option - Touch timestamp columns when updating. + # If attribute names are passed, they are updated along with updated_at/on + # attributes. + # + # ==== Examples + # + # # For the Post with id of 5, decrement the comments_count by 1, and + # # increment the actions_count by 1 + # Post.update_counters 5, comments_count: -1, actions_count: 1 + # # Executes the following SQL: + # # UPDATE posts + # # SET comments_count = COALESCE(comments_count, 0) - 1, + # # actions_count = COALESCE(actions_count, 0) + 1 + # # WHERE id = 5 + # + # # For the Posts with id of 10 and 15, increment the comments_count by 1 + # Post.update_counters [10, 15], comments_count: 1 + # # Executes the following SQL: + # # UPDATE posts + # # SET comments_count = COALESCE(comments_count, 0) + 1 + # # WHERE id IN (10, 15) + # + # # For the Posts with id of 10 and 15, increment the comments_count by 1 + # # and update the updated_at value for each counter. + # Post.update_counters [10, 15], comments_count: 1, touch: true + # # Executes the following SQL: + # # UPDATE posts + # # SET comments_count = COALESCE(comments_count, 0) + 1, + # # `updated_at` = '2016-10-13T09:59:23-05:00' + # # WHERE id IN (10, 15) + # + # pkg:gem/activerecord#lib/active_record/counter_cache.rb:142 + def update_counters(id, counters); end +end + +# Raised when attribute has a name reserved by Active Record (when attribute +# has name of one of Active Record instance methods). +# +# pkg:gem/activerecord#lib/active_record/errors.rb:447 +class ActiveRecord::DangerousAttributeError < ::ActiveRecord::ActiveRecordError; end + +# Raised when creating a database if it exists. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:364 +class ActiveRecord::DatabaseAlreadyExists < ::ActiveRecord::StatementInvalid; end + +# = Active Record Database Configurations +# +# +ActiveRecord::DatabaseConfigurations+ returns an array of +DatabaseConfig+ +# objects that are constructed from the application's database +# configuration hash or URL string. +# +# The array of +DatabaseConfig+ objects in an application default to either a +# HashConfig or UrlConfig. You can retrieve your application's config by using +# ActiveRecord::Base.configurations. +# +# If you register a custom handler, objects will be created according to the +# conditions of the handler. See ::register_db_config_handler for more on +# registering custom handlers. +# +# pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:4 +class ActiveRecord::DatabaseConfigurations + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:75 + def initialize(configurations = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:27 + def any?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:155 + def blank?; end + + # Collects the configs for the environment and optionally the specification + # name passed in. To include replica configurations pass include_hidden: true. + # + # If a name is provided a single +DatabaseConfig+ object will be + # returned, otherwise an array of +DatabaseConfig+ objects will be + # returned that corresponds with the environment and type requested. + # + # ==== Options + # + # * env_name: The environment name. Defaults to +nil+ which will collect + # configs for all environments. + # * name: The db config name (i.e. primary, animals, etc.). Defaults + # to +nil+. If no +env_name+ is specified the config for the default env and the + # passed +name+ will be returned. + # * config_key: Selects configs that contain a particular key in the configuration + # hash. Useful for selecting configs that use a custom db config handler or finding + # configs with hashes that contain a particular key. + # * include_hidden: Determines whether to include replicas and configurations + # hidden by database_tasks: false in the returned list. Most of the time we're only + # iterating over the primary connections (i.e. migrations don't need to run for the + # write and read connection). Defaults to +false+. + # + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:100 + def configs_for(env_name: T.unsafe(nil), name: T.unsafe(nil), config_key: T.unsafe(nil), include_hidden: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:26 + def configurations; end + + # Checks if the application's configurations are empty. + # + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:152 + def empty?; end + + # Returns a single +DatabaseConfig+ object based on the requested environment. + # + # If the application has multiple databases +find_db_config+ will return + # the first +DatabaseConfig+ for the environment. + # + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:129 + def find_db_config(env); end + + # A primary configuration is one that is named primary or if there is + # no primary, the first configuration for an environment will be treated + # as primary. This is used as the "default" configuration and is used + # when the application needs to treat one configuration differently. For + # example, when Rails dumps the schema, the primary configuration's schema + # file will be named `schema.rb` instead of `primary_schema.rb`. + # + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:144 + def primary?(name); end + + # Returns fully resolved connection, accepts hash, string or symbol. + # Always returns a DatabaseConfiguration::DatabaseConfig + # + # == Examples + # + # Symbol representing current environment. + # + # DatabaseConfigurations.new("production" => {}).resolve(:production) + # # => DatabaseConfigurations::HashConfig.new(env_name: "production", config: {}) + # + # One layer deep hash of connection values. + # + # DatabaseConfigurations.new({}).resolve("adapter" => "sqlite3") + # # => DatabaseConfigurations::HashConfig.new(config: {"adapter" => "sqlite3"}) + # + # Connection URL. + # + # DatabaseConfigurations.new({}).resolve("postgresql://localhost/foo") + # # => DatabaseConfigurations::UrlConfig.new(config: {"adapter" => "postgresql", "host" => "localhost", "database" => "foo"}) + # + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:176 + def resolve(config); end + + private + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:202 + def build_configs(configs); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:241 + def build_configuration_sentence; end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:275 + def build_db_config_from_hash(env_name, name, config); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:254 + def build_db_config_from_raw_config(env_name, name, config); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:265 + def build_db_config_from_string(env_name, name, config); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:190 + def default_env; end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:194 + def env_with_configs(env = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:297 + def environment_url_config(env, name, config); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:304 + def environment_value_for(name); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:288 + def merge_db_environment_variables(current_env, configs); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:227 + def resolve_symbol_connection(name); end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:221 + def walk_configs(env_name, config); end + + class << self + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:29 + def db_config_handlers; end + + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:29 + def db_config_handlers=(_arg0); end + + # Allows an application to register a custom handler for database configuration + # objects. This is useful for creating a custom handler that responds to + # methods your application needs but Active Record doesn't implement. For + # example if you are using Vitess, you may want your Vitess configurations + # to respond to `sharded?`. To implement this define the following in an + # initializer: + # + # ActiveSupport.on_load(:active_record_database_configurations) do + # ActiveRecord::DatabaseConfigurations.register_db_config_handler do |env_name, name, url, config| + # next unless config.key?(:vitess) + # VitessConfig.new(env_name, name, config) + # end + # end + # + # Note: applications must handle the condition in which custom config should be + # created in your handler registration otherwise all objects will use the custom + # handler. + # + # Then define your +VitessConfig+ to respond to the methods your application + # needs. It is recommended that you inherit from one of the existing + # database config classes to avoid having to reimplement all methods. Custom + # config handlers should only implement methods Active Record does not. + # + # class VitessConfig < ActiveRecord::DatabaseConfigurations::UrlConfig + # def sharded? + # configuration_hash.fetch("sharded", false) + # end + # end + # + # For configs that have a +:vitess+ key, a +VitessConfig+ object will be + # created instead of a +UrlConfig+. + # + # pkg:gem/activerecord#lib/active_record/database_configurations.rb:63 + def register_db_config_handler(&block); end + end +end + +# Expands a connection string into a hash. +# +# pkg:gem/activerecord#lib/active_record/database_configurations/connection_url_resolver.rb:10 +class ActiveRecord::DatabaseConfigurations::ConnectionUrlResolver + # == Example + # + # url = "postgresql://foo:bar@localhost:9000/foo_test?pool=5&timeout=3000" + # ConnectionUrlResolver.new(url).to_hash + # # => { + # adapter: "postgresql", + # host: "localhost", + # port: 9000, + # database: "foo_test", + # username: "foo", + # password: "bar", + # pool: "5", + # timeout: "3000" + # } + # + # pkg:gem/activerecord#lib/active_record/database_configurations/connection_url_resolver.rb:25 + def initialize(url); end + + # Converts the given URL to a full connection hash. + # + # pkg:gem/activerecord#lib/active_record/database_configurations/connection_url_resolver.rb:38 + def to_hash; end + + private + + # Returns name of the database. + # + # pkg:gem/activerecord#lib/active_record/database_configurations/connection_url_resolver.rb:91 + def database_from_path; end + + # Converts the query parameters of the URI into a hash. + # + # "localhost?pool=5&reaping_frequency=2" + # # => { pool: "5", reaping_frequency: "2" } + # + # returns empty hash if no query present. + # + # "localhost" + # # => {} + # + # pkg:gem/activerecord#lib/active_record/database_configurations/connection_url_resolver.rb:60 + def query_hash; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/connection_url_resolver.rb:64 + def raw_config; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/connection_url_resolver.rb:82 + def resolved_adapter; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/connection_url_resolver.rb:45 + def uri; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/connection_url_resolver.rb:47 + def uri_parser; end +end + +# ActiveRecord::Base.configurations will return either a HashConfig or +# UrlConfig respectively. It will never return a +DatabaseConfig+ object, +# as this is the parent class for the types of database configuration objects. +# +# pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:8 +class ActiveRecord::DatabaseConfigurations::DatabaseConfig + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:11 + def initialize(env_name, name); end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:43 + def _database=(database); end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:47 + def adapter; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:17 + def adapter_class; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:75 + def checkout_timeout; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:39 + def database; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:9 + def env_name; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:95 + def for_current_env?; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:35 + def host; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:83 + def idle_timeout; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:21 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:55 + def max_connections; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:67 + def max_queue; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:63 + def max_threads; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:91 + def migrations_paths; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:51 + def min_connections; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:59 + def min_threads; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:9 + def name; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:25 + def new_connection; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:71 + def query_cache; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:79 + def reaping_frequency; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:87 + def replica?; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:99 + def schema_cache_path; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:107 + def seeds?; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:103 + def use_metadata_table?; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/database_config.rb:29 + def validate!; end +end + +# # Active Record Database Hash Config +# +# A `HashConfig` object is created for each database configuration entry that is +# created from a hash. +# +# A hash config: +# +# { "development" => { "database" => "db_name" } } +# +# Becomes: +# +# # +# +# See ActiveRecord::DatabaseConfigurations for more info. +# +# pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:22 +class ActiveRecord::DatabaseConfigurations::HashConfig < ::ActiveRecord::DatabaseConfigurations::DatabaseConfig + # Initialize a new `HashConfig` object + # + # #### Parameters + # + # * `env_name` - The Rails environment, i.e. "development". + # * `name` - The db config name. In a standard two-tier database configuration + # this will default to "primary". In a multiple database three-tier database + # configuration this corresponds to the name used in the second tier, for + # example "primary_readonly". + # * `configuration_hash` - The config hash. This is the hash that contains the + # database adapter, name, and other important information for database + # connections. + # + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:38 + def initialize(env_name, name, configuration_hash); end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:69 + def _database=(database); end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:137 + def adapter; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:112 + def checkout_timeout; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:23 + def configuration_hash; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:65 + def database; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:197 + def database_tasks?; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:147 + def default_schema_cache_path(db_dir = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:57 + def host; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:120 + def idle_timeout; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:125 + def keepalive; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:155 + def lazy_schema_cache_path; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:95 + def max_age; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:73 + def max_connections; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:108 + def max_queue; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:91 + def max_threads; end + + # The migrations paths for a database configuration. If the `migrations_paths` + # key is present in the config, `migrations_paths` will return its value. + # + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:53 + def migrations_paths; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:80 + def min_connections; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:87 + def min_threads; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:84 + def pool(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:159 + def primary?; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:104 + def query_cache; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:116 + def reaping_frequency; end + + # Determines whether a database configuration is for a replica / readonly + # connection. If the `replica` key is present in the config, `replica?` will + # return `true`. + # + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:47 + def replica?; end + + # The path to the schema cache dump file for a database. If omitted, the + # filename will be read from ENV or a default will be derived. + # + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:143 + def schema_cache_path; end + + # Determines whether to dump the schema/structure files and the filename that + # should be used. + # + # If `configuration_hash[:schema_dump]` is set to `false` or `nil` the schema + # will not be dumped. + # + # If the config option is set that will be used. Otherwise Rails will generate + # the filename from the database config name. + # + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:179 + def schema_dump(format = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:191 + def schema_format; end + + # Determines whether the db:prepare task should seed the database from db/seeds.rb. + # + # If the `seeds` key is present in the config, `seeds?` will return its value. Otherwise, it + # will return `true` for the primary database and `false` for all other configs. + # + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:167 + def seeds?; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:61 + def socket; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:201 + def use_metadata_table?; end + + private + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:215 + def default_reaping_frequency; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:206 + def schema_file_type(format); end + + # pkg:gem/activerecord#lib/active_record/database_configurations/hash_config.rb:221 + def validate_configuration!; end +end + +# pkg:gem/activerecord#lib/active_record/database_configurations.rb:24 +class ActiveRecord::DatabaseConfigurations::InvalidConfigurationError < ::StandardError; end + +# = Active Record Database Url Config +# +# A +UrlConfig+ object is created for each database configuration +# entry that is created from a URL. This can either be a URL string +# or a hash with a URL in place of the config hash. +# +# A URL config: +# +# postgres://localhost/foo +# +# Becomes: +# +# # +# +# See ActiveRecord::DatabaseConfigurations for more info. +# +# pkg:gem/activerecord#lib/active_record/database_configurations/url_config.rb:24 +class ActiveRecord::DatabaseConfigurations::UrlConfig < ::ActiveRecord::DatabaseConfigurations::HashConfig + # Initialize a new +UrlConfig+ object + # + # ==== Options + # + # * :env_name - The \Rails environment, i.e. "development". + # * :name - The db config name. In a standard two-tier + # database configuration this will default to "primary". In a multiple + # database three-tier database configuration this corresponds to the name + # used in the second tier, for example "primary_readonly". + # * :url - The database URL. + # * :config - The config hash. This is the hash that contains the + # database adapter, name, and other important information for database + # connections. + # + # pkg:gem/activerecord#lib/active_record/database_configurations/url_config.rb:40 + def initialize(env_name, name, url, configuration_hash = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/database_configurations/url_config.rb:25 + def url; end + + private + + # Return a Hash that can be merged into the main config that represents + # the passed in url + # + # pkg:gem/activerecord#lib/active_record/database_configurations/url_config.rb:81 + def build_url_hash; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/url_config.rb:62 + def parse_query_cache; end + + # pkg:gem/activerecord#lib/active_record/database_configurations/url_config.rb:73 + def to_boolean!(configuration_hash, key); end +end + +# Raised when connection to the database could not been established because it was not +# able to connect to the host or when the authorization failed. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:101 +class ActiveRecord::DatabaseConnectionError < ::ActiveRecord::ConnectionNotEstablished + # pkg:gem/activerecord#lib/active_record/errors.rb:102 + def initialize(message = T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/active_record/errors.rb:107 + def hostname_error(hostname); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:114 + def username_error(username); end + end +end + +# DatabaseVersionError will be raised when the database version is not supported, or when +# the database version cannot be determined. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:623 +class ActiveRecord::DatabaseVersionError < ::ActiveRecord::ActiveRecordError; end + +# Deadlocked will be raised when a transaction is rolled +# back by the database when a deadlock is encountered. +# +# This is a subclass of TransactionRollbackError, please make sure to check +# its documentation to be aware of its caveats. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:560 +class ActiveRecord::Deadlocked < ::ActiveRecord::TransactionRollbackError; end + +# = Delegated types +# +# Class hierarchies can map to relational database tables in many ways. Active Record, for example, offers +# purely abstract classes, where the superclass doesn't persist any attributes, and single-table inheritance, +# where all attributes from all levels of the hierarchy are represented in a single table. Both have their +# places, but neither are without their drawbacks. +# +# The problem with purely abstract classes is that all concrete subclasses must persist all the shared +# attributes themselves in their own tables (also known as class-table inheritance). This makes it hard to +# do queries across the hierarchy. For example, imagine you have the following hierarchy: +# +# Entry < ApplicationRecord +# Message < Entry +# Comment < Entry +# +# How do you show a feed that has both +Message+ and +Comment+ records, which can be easily paginated? +# Well, you can't! Messages are backed by a messages table and comments by a comments table. You can't +# pull from both tables at once and use a consistent OFFSET/LIMIT scheme. +# +# You can get around the pagination problem by using single-table inheritance, but now you're forced into +# a single mega table with all the attributes from all subclasses. No matter how divergent. If a Message +# has a subject, but the comment does not, well, now the comment does anyway! So STI works best when there's +# little divergence between the subclasses and their attributes. +# +# But there's a third way: Delegated types. With this approach, the "superclass" is a concrete class +# that is represented by its own table, where all the superclass attributes that are shared amongst all the +# "subclasses" are stored. And then each of the subclasses have their own individual tables for additional +# attributes that are particular to their implementation. This is similar to what's called multi-table +# inheritance in Django, but instead of actual inheritance, this approach uses delegation to form the +# hierarchy and share responsibilities. +# +# Let's look at that entry/message/comment example using delegated types: +# +# # Schema: entries[ id, account_id, creator_id, entryable_type, entryable_id, created_at, updated_at ] +# class Entry < ApplicationRecord +# belongs_to :account +# belongs_to :creator +# delegated_type :entryable, types: %w[ Message Comment ] +# end +# +# module Entryable +# extend ActiveSupport::Concern +# +# included do +# has_one :entry, as: :entryable, touch: true +# end +# end +# +# # Schema: messages[ id, subject, body, created_at, updated_at ] +# class Message < ApplicationRecord +# include Entryable +# end +# +# # Schema: comments[ id, content, created_at, updated_at ] +# class Comment < ApplicationRecord +# include Entryable +# end +# +# As you can see, neither +Message+ nor +Comment+ are meant to stand alone. Crucial metadata for both classes +# resides in the +Entry+ "superclass". But the +Entry+ absolutely can stand alone in terms of querying capacity +# in particular. You can now easily do things like: +# +# Account.find(1).entries.order(created_at: :desc).limit(50) +# +# Which is exactly what you want when displaying both comments and messages together. The entry itself can +# be rendered as its delegated type easily, like so: +# +# # entries/_entry.html.erb +# <%= render "entries/entryables/#{entry.entryable_name}", entry: entry %> +# +# # entries/entryables/_message.html.erb +#
    +#
    <%= entry.message.subject %>
    +#

    <%= entry.message.body %>

    +# Posted on <%= entry.created_at %> by <%= entry.creator.name %> +#
    +# +# # entries/entryables/_comment.html.erb +#
    +# <%= entry.creator.name %> said: <%= entry.comment.content %> +#
    +# +# == Sharing behavior with concerns and controllers +# +# The entry "superclass" also serves as a perfect place to put all that shared logic that applies to both +# messages and comments, and which acts primarily on the shared attributes. Imagine: +# +# class Entry < ApplicationRecord +# include Eventable, Forwardable, Redeliverable +# end +# +# Which allows you to have controllers for things like +ForwardsController+ and +RedeliverableController+ +# that both act on entries, and thus provide the shared functionality to both messages and comments. +# +# == Creating new records +# +# You create a new record that uses delegated typing by creating the delegator and delegatee at the same time, +# like so: +# +# Entry.create! entryable: Comment.new(content: "Hello!"), creator: Current.user, account: Current.account +# +# If you need more complicated composition, or you need to perform dependent validation, you should build a factory +# method or class to take care of the complicated needs. This could be as simple as: +# +# class Entry < ApplicationRecord +# def self.create_with_comment(content, creator: Current.user, account: Current.account) +# create! entryable: Comment.new(content: content), creator: creator, account: account +# end +# end +# +# == Querying across records +# +# A consequence of delegated types is that querying attributes spread across multiple classes becomes slightly more +# tricky, but not impossible. +# +# The simplest method is to join the "superclass" to the "subclass" and apply the query parameters (i.e. #where) +# in appropriate places: +# +# Comment.joins(:entry).where(comments: { content: 'Hello!' }, entry: { creator: Current.user } ) +# +# For convenience, add a scope on the concern. Now all classes that implement the concern will automatically include +# the method: +# +# # app/models/concerns/entryable.rb +# scope :with_entry, ->(attrs) { joins(:entry).where(entry: attrs) } +# +# Now the query can be shortened significantly: +# +# Comment.where(content: 'Hello!').with_entry(creator: Current.user) +# +# == Adding further delegation +# +# The delegated type shouldn't just answer the question of what the underlying class is called. In fact, that's +# an anti-pattern most of the time. The reason you're building this hierarchy is to take advantage of polymorphism. +# So here's a simple example of that: +# +# class Entry < ApplicationRecord +# delegated_type :entryable, types: %w[ Message Comment ] +# delegate :title, to: :entryable +# end +# +# class Message < ApplicationRecord +# def title +# subject +# end +# end +# +# class Comment < ApplicationRecord +# def title +# content.truncate(20) +# end +# end +# +# Now you can list a bunch of entries, call Entry#title, and polymorphism will provide you with the answer. +# +# == Nested \Attributes +# +# Enabling nested attributes on a delegated_type association allows you to +# create the entry and message in one go: +# +# class Entry < ApplicationRecord +# delegated_type :entryable, types: %w[ Message Comment ] +# accepts_nested_attributes_for :entryable +# end +# +# params = { entry: { entryable_type: 'Message', entryable_attributes: { subject: 'Smiling' } } } +# entry = Entry.create(params[:entry]) +# entry.entryable.id # => 2 +# entry.entryable.subject # => 'Smiling' +# +# pkg:gem/activerecord#lib/active_record/delegated_type.rb:175 +module ActiveRecord::DelegatedType + # Defines this as a class that'll delegate its type for the passed +role+ to the class references in +types+. + # That'll create a polymorphic +belongs_to+ relationship to that +role+, and it'll add all the delegated + # type convenience methods: + # + # class Entry < ApplicationRecord + # delegated_type :entryable, types: %w[ Message Comment ], dependent: :destroy + # end + # + # @entry.entryable_class # => Message or Comment + # @entry.entryable_name # => "message" or "comment" + # Entry.messages # => Entry.where(entryable_type: "Message") + # @entry.message? # => true when entryable_type == "Message" + # @entry.message # => returns the message record, when entryable_type == "Message", otherwise nil + # @entry.message_id # => returns entryable_id, when entryable_type == "Message", otherwise nil + # Entry.comments # => Entry.where(entryable_type: "Comment") + # @entry.comment? # => true when entryable_type == "Comment" + # @entry.comment # => returns the comment record, when entryable_type == "Comment", otherwise nil + # @entry.comment_id # => returns entryable_id, when entryable_type == "Comment", otherwise nil + # + # You can also declare namespaced types: + # + # class Entry < ApplicationRecord + # delegated_type :entryable, types: %w[ Message Comment Access::NoticeMessage ], dependent: :destroy + # end + # + # Entry.access_notice_messages + # @entry.access_notice_message + # @entry.access_notice_message? + # + # ==== Options + # + # The +options+ are passed directly to the +belongs_to+ call, so this is where you declare +dependent+ etc. + # The following options can be included to specialize the behavior of the delegated type convenience methods. + # + # [+:foreign_key+] + # Specify the foreign key used for the convenience methods. By default this is guessed to be the passed + # +role+ with an "_id" suffix. So a class that defines a + # delegated_type :entryable, types: %w[ Message Comment ] association will use "entryable_id" as + # the default :foreign_key. + # [+:foreign_type+] + # Specify the column used to store the associated object's type. By default this is inferred to be the passed + # +role+ with a "_type" suffix. A class that defines a + # delegated_type :entryable, types: %w[ Message Comment ] association will use "entryable_type" as + # the default :foreign_type. + # [+:primary_key+] + # Specify the method that returns the primary key of associated object used for the convenience methods. + # By default this is +id+. + # + # Option examples: + # class Entry < ApplicationRecord + # delegated_type :entryable, types: %w[ Message Comment ], primary_key: :uuid, foreign_key: :entryable_uuid + # end + # + # @entry.message_uuid # => returns entryable_uuid, when entryable_type == "Message", otherwise nil + # @entry.comment_uuid # => returns entryable_uuid, when entryable_type == "Comment", otherwise nil + # + # pkg:gem/activerecord#lib/active_record/delegated_type.rb:231 + def delegated_type(role, types:, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/delegated_type.rb:237 + def define_delegated_type_methods(role, types:, options:); end +end + +# pkg:gem/activerecord#lib/active_record/relation/delegation.rb:5 +module ActiveRecord::Delegation + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Delegation::ClassMethods + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def &(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def +(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def -(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def [](*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def as_json(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def compact(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:105 + def connection(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def each(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def encode_with(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def in_groups(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def in_groups_of(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def index(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def intersect?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def join(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def length(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:105 + def name(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:105 + def primary_key(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def reverse(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def rindex(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def rotate(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def sample(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:105 + def sanitize_sql_like(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def shuffle(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def slice(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def split(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:105 + def table_name(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def to_formatted_s(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def to_fs(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def to_sentence(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def to_xml(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:105 + def transaction(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:105 + def unscoped(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:105 + def with_connection(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:100 + def |(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:149 + def respond_to_missing?(method, _); end + + class << self + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:7 + def delegated_classes; end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:16 + def uncacheable_methods; end + end +end + +# pkg:gem/activerecord#lib/active_record/relation/delegation.rb:137 +module ActiveRecord::Delegation::ClassMethods + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:138 + def create(model, *, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:143 + def relation_class_for(model); end +end + +# pkg:gem/activerecord#lib/active_record/relation/delegation.rb:107 +module ActiveRecord::Delegation::ClassSpecificRelation + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Delegation::ClassSpecificRelation::ClassMethods + + private + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:117 + def method_missing(method, *, **, &); end +end + +# pkg:gem/activerecord#lib/active_record/relation/delegation.rb:110 +module ActiveRecord::Delegation::ClassSpecificRelation::ClassMethods + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:111 + def name; end +end + +# pkg:gem/activerecord#lib/active_record/relation/delegation.rb:23 +module ActiveRecord::Delegation::DelegateCache + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:51 + def generate_relation_method(method); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:46 + def inherited(child_class); end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:31 + def initialize_relation_delegate_cache; end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:27 + def relation_delegate_class(klass); end + + protected + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:56 + def include_relation_methods(delegate); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:62 + def generated_relation_methods; end + + class << self + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:25 + def delegate_base_methods; end + + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:25 + def delegate_base_methods=(_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/relation/delegation.rb:70 +class ActiveRecord::Delegation::GeneratedRelationMethods < ::Module + # pkg:gem/activerecord#lib/active_record/relation/delegation.rb:73 + def generate_method(method); end +end + +# pkg:gem/activerecord#lib/active_record/relation/delegation.rb:71 +ActiveRecord::Delegation::GeneratedRelationMethods::MUTEX = T.let(T.unsafe(nil), Thread::Mutex) + +# This error is raised when trying to destroy a parent instance in N:1 or 1:1 associations +# (has_many, has_one) when there is at least 1 child associated instance. +# ex: if @project.tasks.size > 0, DeleteRestrictionError will be raised when trying to destroy @project +# +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:256 +class ActiveRecord::DeleteRestrictionError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:257 + def initialize(name = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/errors.rb:626 +class ActiveRecord::DeprecatedAssociationError < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/destroy_association_async_job.rb:4 +class ActiveRecord::DestroyAssociationAsyncError < ::StandardError; end + +# = Active Record Destroy Association Async Job +# +# Job to destroy the records associated with a destroyed record in background. +# +# pkg:gem/activerecord#lib/active_record/destroy_association_async_job.rb:10 +class ActiveRecord::DestroyAssociationAsyncJob < ::ActiveJob::Base + # pkg:gem/activerecord#lib/active_record/destroy_association_async_job.rb:15 + def perform(owner_model_name: T.unsafe(nil), owner_id: T.unsafe(nil), association_class: T.unsafe(nil), association_ids: T.unsafe(nil), association_primary_key_column: T.unsafe(nil), ensuring_owner_was_method: T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/destroy_association_async_job.rb:34 + def owner_destroyed?(owner, ensuring_owner_was_method); end + + class << self + private + + # pkg:gem/activerecord#lib/active_record/destroy_association_async_job.rb:11 + def __class_attr_queue_name; end + + # pkg:gem/activerecord#lib/active_record/destroy_association_async_job.rb:11 + def __class_attr_queue_name=(new_value); end + + # pkg:gem/activerecord#lib/active_record/destroy_association_async_job.rb:13 + def __class_attr_rescue_handlers; end + + # pkg:gem/activerecord#lib/active_record/destroy_association_async_job.rb:13 + def __class_attr_rescue_handlers=(new_value); end + end +end + +# pkg:gem/activerecord#lib/active_record/disable_joins_association_relation.rb:4 +class ActiveRecord::DisableJoinsAssociationRelation < ::ActiveRecord::Relation + # pkg:gem/activerecord#lib/active_record/disable_joins_association_relation.rb:7 + def initialize(klass, key, ids); end + + # pkg:gem/activerecord#lib/active_record/disable_joins_association_relation.rb:17 + def first(limit = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/disable_joins_association_relation.rb:5 + def ids; end + + # pkg:gem/activerecord#lib/active_record/disable_joins_association_relation.rb:5 + def key; end + + # pkg:gem/activerecord#lib/active_record/disable_joins_association_relation.rb:13 + def limit(value); end + + # pkg:gem/activerecord#lib/active_record/disable_joins_association_relation.rb:25 + def load; end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:101 +class ActiveRecord::DuplicateMigrationNameError < ::ActiveRecord::MigrationError + # pkg:gem/activerecord#lib/active_record/migration.rb:102 + def initialize(name = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:91 +class ActiveRecord::DuplicateMigrationVersionError < ::ActiveRecord::MigrationError + # pkg:gem/activerecord#lib/active_record/migration.rb:92 + def initialize(version = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:4 +module ActiveRecord::DynamicMatchers + private + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:17 + def method_missing(name, *, **, &); end + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:6 + def respond_to_missing?(name, _); end +end + +# pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:74 +class ActiveRecord::DynamicMatchers::FindBy < ::ActiveRecord::DynamicMatchers::Method + class << self + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:84 + def finder; end + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:80 + def match?(name); end + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:78 + def pattern; end + end +end + +# pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:90 +class ActiveRecord::DynamicMatchers::FindByBang < ::ActiveRecord::DynamicMatchers::Method + class << self + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:100 + def finder; end + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:96 + def match?(name); end + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:94 + def pattern; end + end +end + +# pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:28 +class ActiveRecord::DynamicMatchers::Method + class << self + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:38 + def define(model, name); end + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:30 + def match(name); end + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:34 + def valid?(model, name); end + + private + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:51 + def attribute_names(model, name); end + + # Given that the parameters starts with `_`, the finder needs to use the + # same parameter name. + # + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:68 + def attributes_hash(model, method_name); end + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:56 + def body(model, method_name); end + + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:47 + def make_pattern(prefix, suffix); end + + # The parameters in the signature may have reserved Ruby words, in order + # to prevent errors, we start each param name with `_`. + # + # pkg:gem/activerecord#lib/active_record/dynamic_matchers.rb:62 + def signature(model, method_name); end + end +end + +# This error is raised when trying to eager load a polymorphic association using a JOIN. +# Eager loading polymorphic associations is only possible with +# {ActiveRecord::Relation#preload}[rdoc-ref:QueryMethods#preload]. +# +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:243 +class ActiveRecord::EagerLoadPolymorphicError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:244 + def initialize(reflection = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/encryption.rb:7 +module ActiveRecord::Encryption + include ::ActiveRecord::Encryption::Configurable + include ::ActiveRecord::Encryption::Contexts + extend ::ActiveSupport::Autoload + extend ::ActiveRecord::Encryption::Configurable::ClassMethods + extend ::ActiveRecord::Encryption::Contexts::ClassMethods + + # pkg:gem/activerecord#lib/active_record/encryption.rb:47 + def config; end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:48 + def custom_contexts; end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:48 + def custom_contexts=(obj); end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:48 + def default_context; end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:48 + def default_context=(val); end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:47 + def encrypted_attribute_declaration_listeners; end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:47 + def encrypted_attribute_declaration_listeners=(val); end + + class << self + # pkg:gem/activerecord#lib/active_record/encryption.rb:47 + def config; end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:48 + def custom_contexts; end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:48 + def custom_contexts=(obj); end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:48 + def default_context; end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:48 + def default_context=(val); end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:50 + def eager_load!; end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:47 + def encrypted_attribute_declaration_listeners; end + + # pkg:gem/activerecord#lib/active_record/encryption.rb:47 + def encrypted_attribute_declaration_listeners=(val); end + end +end + +# pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:5 +class ActiveRecord::Encryption::AutoFilteredParameters + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:6 + def initialize(app); end + + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:14 + def enable; end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:20 + def app; end + + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:36 + def apply_collected_attributes; end + + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:53 + def apply_filter(klass, attribute); end + + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:28 + def attribute_was_declared(klass, attribute); end + + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:48 + def collect_for_later(klass, attribute); end + + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:44 + def collecting?; end + + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:61 + def excluded_from_filter_parameters?(filter_parameter); end + + # pkg:gem/activerecord#lib/active_record/encryption/auto_filtered_parameters.rb:22 + def install_collecting_hook; end +end + +# The algorithm used for encrypting and decrypting +Message+ objects. +# +# It uses AES-256-GCM. It will generate a random IV for non deterministic encryption (default) +# or derive an initialization vector from the encrypted content for deterministic encryption. +# +# See +Cipher::Aes256Gcm+. +# +# pkg:gem/activerecord#lib/active_record/encryption/cipher.rb:11 +class ActiveRecord::Encryption::Cipher + extend ::ActiveSupport::Autoload + + # Decrypt the provided +Message+. + # + # When +key+ is an Array, it will try all the keys raising a + # +ActiveRecord::Encryption::Errors::Decryption+ if none works. + # + # pkg:gem/activerecord#lib/active_record/encryption/cipher.rb:25 + def decrypt(encrypted_message, key:); end + + # Encrypts the provided text and return an encrypted +Message+. + # + # pkg:gem/activerecord#lib/active_record/encryption/cipher.rb:15 + def encrypt(clean_text, key:, deterministic: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/cipher.rb:35 + def iv_length; end + + # pkg:gem/activerecord#lib/active_record/encryption/cipher.rb:31 + def key_length; end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/cipher.rb:48 + def cipher_for(secret, deterministic: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/cipher.rb:40 + def try_to_decrypt_with_each(encrypted_text, keys:); end +end + +# A 256-GCM cipher. +# +# By default it will use random initialization vectors. For deterministic encryption, it will use a SHA-256 hash of +# the text to encrypt and the secret. +# +# See +Encryptor+ +# +# pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:14 +class ActiveRecord::Encryption::Cipher::Aes256Gcm + # When iv not provided, it will generate a random iv on each encryption operation (default and + # recommended operation) + # + # pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:29 + def initialize(secret, deterministic: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:55 + def decrypt(encrypted_message); end + + # pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:34 + def encrypt(clear_text); end + + # pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:82 + def inspect; end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:95 + def generate_deterministic_iv(clear_text); end + + # pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:87 + def generate_iv(cipher, clear_text); end + + class << self + # pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:22 + def iv_length; end + + # pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:18 + def key_length; end + end +end + +# pkg:gem/activerecord#lib/active_record/encryption/cipher/aes256_gcm.rb:15 +ActiveRecord::Encryption::Cipher::Aes256Gcm::CIPHER_TYPE = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/encryption/cipher.rb:12 +ActiveRecord::Encryption::Cipher::DEFAULT_ENCODING = T.let(T.unsafe(nil), Encoding) + +# Container of configuration options +# +# pkg:gem/activerecord#lib/active_record/encryption/config.rb:8 +class ActiveRecord::Encryption::Config + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:14 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def add_to_filter_parameters; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def add_to_filter_parameters=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def compressor; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def compressor=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def deterministic_key; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def deterministic_key=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def encrypt_fixtures; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def encrypt_fixtures=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def excluded_from_filter_parameters; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def excluded_from_filter_parameters=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def extend_queries; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def extend_queries=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def forced_encoding_for_deterministic_encryption; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def forced_encoding_for_deterministic_encryption=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:37 + def has_deterministic_key?; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:37 + def has_key_derivation_salt?; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:37 + def has_primary_key?; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def hash_digest_class; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def hash_digest_class=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def key_derivation_salt; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def key_derivation_salt=(_arg0); end + + # Configure previous encryption schemes. + # + # config.active_record.encryption.previous = [ { key_provider: MyOldKeyProvider.new } ] + # + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:21 + def previous=(previous_schemes_properties); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def previous_schemes; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def previous_schemes=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def primary_key; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def primary_key=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def store_key_references; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def store_key_references=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:27 + def support_sha1_for_non_deterministic_encryption=(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def support_unencrypted_data; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def support_unencrypted_data=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def validate_column_size; end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:9 + def validate_column_size=(_arg0); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:65 + def add_previous_scheme(**properties); end + + # pkg:gem/activerecord#lib/active_record/encryption/config.rb:49 + def set_defaults; end +end + +# Configuration API for ActiveRecord::Encryption +# +# pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:6 +module ActiveRecord::Encryption::Configurable + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Encryption::Configurable::ClassMethods +end + +# pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:14 +module ActiveRecord::Encryption::Configurable::ClassMethods + # pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:17 + def cipher(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:20 + def configure(primary_key: T.unsafe(nil), deterministic_key: T.unsafe(nil), key_derivation_salt: T.unsafe(nil), **properties); end + + # pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:52 + def encrypted_attribute_was_declared(klass, name); end + + # pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:17 + def encryptor(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:17 + def frozen_encryption(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:17 + def key_generator(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:17 + def key_provider(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:17 + def message_serializer(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/configurable.rb:47 + def on_encrypted_attribute_declared(&block); end +end + +# An encryption context configures the different entities used to perform encryption: +# +# * A key provider +# * A key generator +# * An encryptor, the facade to encrypt data +# * A cipher, the encryption algorithm +# * A message serializer +# +# pkg:gem/activerecord#lib/active_record/encryption/context.rb:12 +class ActiveRecord::Encryption::Context + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:17 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def cipher; end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def cipher=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def encryptor; end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def encryptor=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def frozen_encryption; end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def frozen_encryption=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:21 + def frozen_encryption?; end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def key_generator; end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def key_generator=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def key_provider; end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def key_provider=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def message_serializer; end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:15 + def message_serializer=(_arg0); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:37 + def build_default_key_provider; end + + # pkg:gem/activerecord#lib/active_record/encryption/context.rb:29 + def set_defaults; end +end + +# pkg:gem/activerecord#lib/active_record/encryption/context.rb:13 +ActiveRecord::Encryption::Context::PROPERTIES = T.let(T.unsafe(nil), Array) + +# ActiveRecord::Encryption uses encryption contexts to configure the different entities used to +# encrypt/decrypt at a given moment in time. +# +# By default, the library uses a default encryption context. This is the Context that gets configured +# initially via +config.active_record.encryption+ options. Library users can define nested encryption contexts +# when running blocks of code. +# +# See Context. +# +# pkg:gem/activerecord#lib/active_record/encryption/contexts.rb:13 +module ActiveRecord::Encryption::Contexts + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Encryption::Contexts::ClassMethods +end + +# pkg:gem/activerecord#lib/active_record/encryption/contexts.rb:21 +module ActiveRecord::Encryption::Contexts::ClassMethods + # pkg:gem/activerecord#lib/active_record/encryption/contexts.rb:62 + def context; end + + # pkg:gem/activerecord#lib/active_record/encryption/contexts.rb:66 + def current_custom_context; end + + # pkg:gem/activerecord#lib/active_record/encryption/contexts.rb:57 + def protecting_encrypted_data(&block); end + + # pkg:gem/activerecord#lib/active_record/encryption/contexts.rb:70 + def reset_default_context; end + + # pkg:gem/activerecord#lib/active_record/encryption/contexts.rb:33 + def with_encryption_context(properties); end + + # pkg:gem/activerecord#lib/active_record/encryption/contexts.rb:49 + def without_encryption(&block); end +end + +# A KeyProvider that derives keys from passwords. +# +# pkg:gem/activerecord#lib/active_record/encryption/derived_secret_key_provider.rb:6 +class ActiveRecord::Encryption::DerivedSecretKeyProvider < ::ActiveRecord::Encryption::KeyProvider + # pkg:gem/activerecord#lib/active_record/encryption/derived_secret_key_provider.rb:7 + def initialize(passwords, key_generator: T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/derived_secret_key_provider.rb:12 + def derive_key_from(password, using: T.unsafe(nil)); end +end + +# A KeyProvider that derives keys from passwords. +# +# pkg:gem/activerecord#lib/active_record/encryption/deterministic_key_provider.rb:6 +class ActiveRecord::Encryption::DeterministicKeyProvider < ::ActiveRecord::Encryption::DerivedSecretKeyProvider + # pkg:gem/activerecord#lib/active_record/encryption/deterministic_key_provider.rb:7 + def initialize(password); end +end + +# This is the concern mixed in Active Record models to make them encryptable. It adds the +encrypts+ +# attribute declaration, as well as the API to encrypt and decrypt records. +# +# pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:7 +module ActiveRecord::Encryption::EncryptableRecord + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::Encryption::EncryptableRecord::ClassMethods + + # Returns the ciphertext for +attribute_name+. + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:157 + def ciphertext_for(attribute_name); end + + # Decrypts all the encryptable attributes and saves the changes. + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:171 + def decrypt; end + + # Encrypts all the encryptable attributes and saves the changes. + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:166 + def encrypt; end + + # Returns whether a given attribute is encrypted or not. + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:146 + def encrypted_attribute?(attribute_name); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:178 + def _create_record(attribute_names = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:214 + def build_decrypt_attribute_assignments; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:208 + def build_encrypt_attribute_assignments; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:223 + def cant_modify_encrypted_attributes_when_frozen; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:193 + def decrypt_attributes; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:187 + def encrypt_attributes; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:204 + def has_encrypted_attributes?; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:200 + def validate_encryption_allowed; end + + module GeneratedClassMethods + def encrypted_attributes; end + def encrypted_attributes=(value); end + def encrypted_attributes?; end + end + + module GeneratedInstanceMethods + def encrypted_attributes; end + def encrypted_attributes=(value); end + def encrypted_attributes?; end + end +end + +# pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:16 +module ActiveRecord::Encryption::EncryptableRecord::ClassMethods + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:58 + def deterministic_encrypted_attributes; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:49 + def encrypts(*names, key_provider: T.unsafe(nil), key: T.unsafe(nil), deterministic: T.unsafe(nil), support_unencrypted_data: T.unsafe(nil), downcase: T.unsafe(nil), ignore_case: T.unsafe(nil), previous: T.unsafe(nil), compress: T.unsafe(nil), compressor: T.unsafe(nil), **context_properties); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:65 + def source_attribute_from_preserved_attribute(attribute_name); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:132 + def add_length_validation_for_encrypted_columns; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:84 + def encrypt_attribute(name, key_provider: T.unsafe(nil), key: T.unsafe(nil), deterministic: T.unsafe(nil), support_unencrypted_data: T.unsafe(nil), downcase: T.unsafe(nil), ignore_case: T.unsafe(nil), previous: T.unsafe(nil), compress: T.unsafe(nil), compressor: T.unsafe(nil), **context_properties); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:78 + def global_previous_schemes_for(scheme); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:126 + def load_schema!; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:109 + def override_accessors_to_preserve_original(name, original_attribute_name); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:98 + def preserve_original_encrypted(name); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:70 + def scheme_for(key_provider: T.unsafe(nil), key: T.unsafe(nil), deterministic: T.unsafe(nil), support_unencrypted_data: T.unsafe(nil), downcase: T.unsafe(nil), ignore_case: T.unsafe(nil), previous: T.unsafe(nil), **context_properties); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:138 + def validate_column_size(attribute_name); end +end + +# pkg:gem/activerecord#lib/active_record/encryption/encryptable_record.rb:176 +ActiveRecord::Encryption::EncryptableRecord::ORIGINAL_ATTRIBUTE_PREFIX = T.let(T.unsafe(nil), String) + +# An ActiveModel::Type::Value that encrypts/decrypts strings of text. +# +# This is the central piece that connects the encryption system with +encrypts+ declarations in the +# model classes. Whenever you declare an attribute as encrypted, it configures an +EncryptedAttributeType+ +# for that attribute. +# +# pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:10 +class ActiveRecord::Encryption::EncryptedAttributeType < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Mutable + + # ==== Options + # + # * :scheme - A +Scheme+ with the encryption properties for this attribute. + # * :cast_type - A type that will be used to serialize (before encrypting) and deserialize + # (after decrypting). ActiveModel::Type::String by default. + # + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:23 + def initialize(scheme:, cast_type: T.unsafe(nil), previous_type: T.unsafe(nil), default: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:16 + def accessor(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:31 + def cast(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:13 + def cast_type; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:51 + def changed_in_place?(raw_old_value, new_value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:35 + def deserialize(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:15 + def deterministic?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:15 + def downcase?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:47 + def encrypted?(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:15 + def fixed?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:15 + def key_provider(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:15 + def previous_schemes(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:56 + def previous_types; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:13 + def scheme; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:39 + def serialize(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:61 + def support_unencrypted_data?; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:16 + def type(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:15 + def with_context(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:74 + def build_previous_types_for(schemes); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:162 + def clean_text_scheme; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:174 + def database_type_to_text(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:102 + def decrypt(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:84 + def decrypt_as_text(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:158 + def decryption_options; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:146 + def encrypt(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:136 + def encrypt_as_text(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:154 + def encryption_options; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:150 + def encryptor; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:114 + def handle_deserialize_error(error, value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:66 + def previous_schemes_including_clean_text; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:80 + def previous_type?; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:70 + def previous_types_without_clean_text; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:130 + def serialize_with_current(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:126 + def serialize_with_oldest(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:122 + def serialize_with_oldest?; end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:166 + def text_to_database_type(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_attribute_type.rb:106 + def try_to_deserialize_with_previous_encrypted_types(value); end +end + +# pkg:gem/activerecord#lib/active_record/encryption/encrypted_fixtures.rb:5 +module ActiveRecord::Encryption::EncryptedFixtures + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_fixtures.rb:6 + def initialize(fixture, model_class); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_fixtures.rb:32 + def encrypt(model_class, attribute_name, clean_value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_fixtures.rb:14 + def encrypt_fixture_data(fixture, model_class); end + + # pkg:gem/activerecord#lib/active_record/encryption/encrypted_fixtures.rb:23 + def process_preserved_original_columns(fixture, model_class); end +end + +# An encryptor that can encrypt data but can't decrypt it. +# +# pkg:gem/activerecord#lib/active_record/encryption/encrypting_only_encryptor.rb:6 +class ActiveRecord::Encryption::EncryptingOnlyEncryptor < ::ActiveRecord::Encryption::Encryptor + # pkg:gem/activerecord#lib/active_record/encryption/encrypting_only_encryptor.rb:7 + def decrypt(encrypted_text, key_provider: T.unsafe(nil), cipher_options: T.unsafe(nil)); end +end + +# An encryptor exposes the encryption API that ActiveRecord::Encryption::EncryptedAttributeType +# uses for encrypting and decrypting attribute values. +# +# It interacts with a KeyProvider for getting the keys, and delegate to +# ActiveRecord::Encryption::Cipher the actual encryption algorithm. +# +# pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:13 +class ActiveRecord::Encryption::Encryptor + # ==== Options + # + # [+:compress+] + # Boolean indicating whether records should be compressed before + # encryption. Defaults to +true+. + # + # [+:compressor+] + # The compressor to use. It must respond to +deflate+ and +inflate+. + # If not provided, will default to +ActiveRecord::Encryption.config.compressor+, + # which itself defaults to +Zlib+. + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:27 + def initialize(compress: T.unsafe(nil), compressor: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:86 + def binary?; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:90 + def compress?; end + + # The compressor to use for compressing the payload. + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:15 + def compressor; end + + # Decrypts an +encrypted_text+ and returns the result as clean text. + # + # ==== Options + # + # [+:key_provider+] + # Key provider to use for the encryption operation. It will default to + # +ActiveRecord::Encryption.key_provider+ when not provided. + # + # [+:cipher_options+] + # Cipher-specific options that will be passed to the Cipher configured in + # +ActiveRecord::Encryption.cipher+. + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:69 + def decrypt(encrypted_text, key_provider: T.unsafe(nil), cipher_options: T.unsafe(nil)); end + + # Encrypts +clean_text+ and returns the encrypted result. + # + # Internally, it will: + # + # 1. Create a new ActiveRecord::Encryption::Message. + # 2. Compress and encrypt +clean_text+ as the message payload. + # 3. Serialize it with +ActiveRecord::Encryption.message_serializer+ + # (+ActiveRecord::Encryption::SafeMarshal+ by default). + # 4. Encode the result with Base64. + # + # ==== Options + # + # [+:key_provider+] + # Key provider to use for the encryption operation. It will default to + # +ActiveRecord::Encryption.key_provider+ when not provided. + # + # [+:cipher_options+] + # Cipher-specific options that will be passed to the Cipher configured in + # +ActiveRecord::Encryption.cipher+. + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:51 + def encrypt(clear_text, key_provider: T.unsafe(nil), cipher_options: T.unsafe(nil)); end + + # Returns whether the text is encrypted or not. + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:79 + def encrypted?(text); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:125 + def build_encrypted_message(clear_text, key_provider:, cipher_options:); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:121 + def cipher; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:158 + def compress(data); end + + # Under certain threshold, ZIP compression is actually worse that not compressing + # + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:150 + def compress_if_worth_it(string); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:111 + def default_key_provider; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:139 + def deserialize_message(message); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:178 + def force_encoding_if_needed(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:186 + def forced_encoding_for_deterministic_encryption; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:135 + def serialize_message(message); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:145 + def serializer; end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:172 + def uncompress(data); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:164 + def uncompress_if_needed(data, compressed); end + + # pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:115 + def validate_payload_type(clear_text); end +end + +# pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:95 +ActiveRecord::Encryption::Encryptor::DECRYPT_ERRORS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:96 +ActiveRecord::Encryption::Encryptor::ENCODING_ERRORS = T.let(T.unsafe(nil), Array) + +# This threshold cannot be changed. +# +# Users can search for attributes encrypted with `deterministic: true`. +# That is possible because we are able to generate the message for the +# given clear text deterministically, and with that perform a regular +# string lookup in SQL. +# +# Problem is, messages may have a "c" header that is present or not +# depending on whether compression was applied on encryption. If this +# threshold was modified, the message generated for lookup could vary +# for the same clear text, and searches on exisiting data could fail. +# +# pkg:gem/activerecord#lib/active_record/encryption/encryptor.rb:109 +ActiveRecord::Encryption::Encryptor::THRESHOLD_TO_JUSTIFY_COMPRESSION = T.let(T.unsafe(nil), Integer) + +# Implements a simple envelope encryption approach where: +# +# * It generates a random data-encryption key for each encryption operation. +# * It stores the generated key along with the encrypted payload. It encrypts this key +# with the master key provided in the +active_record_encryption.primary_key+ credential. +# +# This provider can work with multiple master keys. It will use the last one for encrypting. +# +# When +config.active_record.encryption.store_key_references+ is true, it will also store a reference to +# the specific master key that was used to encrypt the data-encryption key. When not set, +# it will try all the configured master keys looking for the right one, in order to +# return the right decryption key. +# +# pkg:gem/activerecord#lib/active_record/encryption/envelope_encryption_key_provider.rb:17 +class ActiveRecord::Encryption::EnvelopeEncryptionKeyProvider + # pkg:gem/activerecord#lib/active_record/encryption/envelope_encryption_key_provider.rb:31 + def active_primary_key; end + + # pkg:gem/activerecord#lib/active_record/encryption/envelope_encryption_key_provider.rb:26 + def decryption_keys(encrypted_message); end + + # pkg:gem/activerecord#lib/active_record/encryption/envelope_encryption_key_provider.rb:18 + def encryption_key; end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/envelope_encryption_key_provider.rb:40 + def decrypt_data_key(encrypted_message); end + + # pkg:gem/activerecord#lib/active_record/encryption/envelope_encryption_key_provider.rb:36 + def encrypt_data_key(random_secret); end + + # pkg:gem/activerecord#lib/active_record/encryption/envelope_encryption_key_provider.rb:50 + def generate_random_secret; end + + # pkg:gem/activerecord#lib/active_record/encryption/envelope_encryption_key_provider.rb:46 + def primary_key_provider; end +end + +# pkg:gem/activerecord#lib/active_record/encryption/errors.rb:5 +module ActiveRecord::Encryption::Errors; end + +# pkg:gem/activerecord#lib/active_record/encryption/errors.rb:6 +class ActiveRecord::Encryption::Errors::Base < ::StandardError; end + +# pkg:gem/activerecord#lib/active_record/encryption/errors.rb:10 +class ActiveRecord::Encryption::Errors::Configuration < ::ActiveRecord::Encryption::Errors::Base; end + +# pkg:gem/activerecord#lib/active_record/encryption/errors.rb:8 +class ActiveRecord::Encryption::Errors::Decryption < ::ActiveRecord::Encryption::Errors::Base; end + +# pkg:gem/activerecord#lib/active_record/encryption/errors.rb:7 +class ActiveRecord::Encryption::Errors::Encoding < ::ActiveRecord::Encryption::Errors::Base; end + +# pkg:gem/activerecord#lib/active_record/encryption/errors.rb:12 +class ActiveRecord::Encryption::Errors::EncryptedContentIntegrity < ::ActiveRecord::Encryption::Errors::Base; end + +# pkg:gem/activerecord#lib/active_record/encryption/errors.rb:9 +class ActiveRecord::Encryption::Errors::Encryption < ::ActiveRecord::Encryption::Errors::Base; end + +# pkg:gem/activerecord#lib/active_record/encryption/errors.rb:11 +class ActiveRecord::Encryption::Errors::ForbiddenClass < ::ActiveRecord::Encryption::Errors::Base; end + +# Automatically expand encrypted arguments to support querying both encrypted and unencrypted data +# +# Active Record \Encryption supports querying the db using deterministic attributes. For example: +# +# Contact.find_by(email_address: "jorge@hey.com") +# +# The value "jorge@hey.com" will get encrypted automatically to perform the query. But there is +# a problem while the data is being encrypted. This won't work. During that time, you need these +# queries to be: +# +# Contact.find_by(email_address: [ "jorge@hey.com", "" ]) +# +# This patches ActiveRecord to support this automatically. It addresses both: +# +# * ActiveRecord::Base - Used in Contact.find_by_email_address(...) +# * ActiveRecord::Relation - Used in Contact.internal.find_by_email_address(...) +# +# This module is included if `config.active_record.encryption.extend_queries` is `true`. +# +# pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:23 +module ActiveRecord::Encryption::ExtendedDeterministicQueries + class << self + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:24 + def install_support; end + end +end + +# pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:134 +class ActiveRecord::Encryption::ExtendedDeterministicQueries::AdditionalValue + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:137 + def initialize(value, type); end + + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:135 + def type; end + + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:135 + def value; end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:143 + def process(value); end +end + +# pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:124 +module ActiveRecord::Encryption::ExtendedDeterministicQueries::CoreQueries + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Encryption::ExtendedDeterministicQueries::CoreQueries::ClassMethods +end + +# pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:127 +module ActiveRecord::Encryption::ExtendedDeterministicQueries::CoreQueries::ClassMethods + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:128 + def find_by(*args); end +end + +# When modifying this file run performance tests in +# +activerecord/test/cases/encryption/performance/extended_deterministic_queries_performance_test.rb+ +# to make sure performance overhead is acceptable. +# +# @TODO We will extend this to support previous "encryption context" versions in future iterations +# @TODO Experimental. Support for every kind of query is pending +# @TODO It should not patch anything if not needed (no previous schemes or no support for previous encryption schemes) +# +# pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:41 +module ActiveRecord::Encryption::ExtendedDeterministicQueries::EncryptedQuery + class << self + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:43 + def process_arguments(owner, args, check_for_additional_values); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:89 + def additional_values_for(value, type); end + + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:71 + def process_encrypted_query_argument(value, check_for_additional_values, type); end + end +end + +# pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:148 +module ActiveRecord::Encryption::ExtendedDeterministicQueries::ExtendedEncryptableType + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:149 + def serialize(data); end +end + +# pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:97 +module ActiveRecord::Encryption::ExtendedDeterministicQueries::RelationQueries + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:102 + def exists?(*args); end + + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:106 + def scope_for_create; end + + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_queries.rb:98 + def where(*args); end +end + +# pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb:5 +module ActiveRecord::Encryption::ExtendedDeterministicUniquenessValidator + class << self + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb:6 + def install_support; end + end +end + +# pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb:10 +module ActiveRecord::Encryption::ExtendedDeterministicUniquenessValidator::EncryptedUniquenessValidator + # pkg:gem/activerecord#lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb:11 + def validate_each(record, attribute, value); end +end + +# A key is a container for a given +secret+ +# +# Optionally, it can include +public_tags+. These tags are meant to be stored +# in clean (public) and can be used, for example, to include information that +# references the key for a future retrieval operation. +# +# pkg:gem/activerecord#lib/active_record/encryption/key.rb:10 +class ActiveRecord::Encryption::Key + # pkg:gem/activerecord#lib/active_record/encryption/key.rb:13 + def initialize(secret); end + + # pkg:gem/activerecord#lib/active_record/encryption/key.rb:23 + def id; end + + # pkg:gem/activerecord#lib/active_record/encryption/key.rb:11 + def public_tags; end + + # pkg:gem/activerecord#lib/active_record/encryption/key.rb:11 + def secret; end + + class << self + # pkg:gem/activerecord#lib/active_record/encryption/key.rb:18 + def derive_from(password); end + end +end + +# Utility for generating and deriving random keys. +# +# pkg:gem/activerecord#lib/active_record/encryption/key_generator.rb:8 +class ActiveRecord::Encryption::KeyGenerator + # pkg:gem/activerecord#lib/active_record/encryption/key_generator.rb:11 + def initialize(hash_digest_class: T.unsafe(nil)); end + + # Derives a key from the given password. The key will have a size in bytes of +:length+ (configured +Cipher+'s length + # by default) + # + # The generated key will be salted with the value of +ActiveRecord::Encryption.key_derivation_salt+ + # + # pkg:gem/activerecord#lib/active_record/encryption/key_generator.rb:38 + def derive_key_from(password, length: T.unsafe(nil)); end + + # Returns a random key in hexadecimal format. The key will have a size in bytes of +:length+ (configured +Cipher+'s + # length by default) + # + # Hexadecimal format is handy for representing keys as printable text. To maximize the space of characters used, it is + # good practice including not printable characters. Hexadecimal format ensures that generated keys are representable with + # plain text + # + # To convert back to the original string with the desired length: + # + # [ value ].pack("H*") + # + # pkg:gem/activerecord#lib/active_record/encryption/key_generator.rb:30 + def generate_random_hex_key(length: T.unsafe(nil)); end + + # Returns a random key. The key will have a size in bytes of +:length+ (configured +Cipher+'s length by default) + # + # pkg:gem/activerecord#lib/active_record/encryption/key_generator.rb:16 + def generate_random_key(length: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/key_generator.rb:9 + def hash_digest_class; end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/key_generator.rb:44 + def key_derivation_salt; end + + # pkg:gem/activerecord#lib/active_record/encryption/key_generator.rb:48 + def key_length; end +end + +# A +KeyProvider+ serves keys: +# +# * An encryption key +# * A list of potential decryption keys. Serving multiple decryption keys supports rotation-schemes +# where new keys are added but old keys need to continue working +# +# pkg:gem/activerecord#lib/active_record/encryption/key_provider.rb:10 +class ActiveRecord::Encryption::KeyProvider + # pkg:gem/activerecord#lib/active_record/encryption/key_provider.rb:11 + def initialize(keys); end + + # Returns the list of decryption keys + # + # When the message holds a reference to its encryption key, it will return an array + # with that key. If not, it will return the list of keys. + # + # pkg:gem/activerecord#lib/active_record/encryption/key_provider.rb:32 + def decryption_keys(encrypted_message); end + + # Returns the last key in the list as the active key to perform encryptions + # + # When +ActiveRecord::Encryption.config.store_key_references+ is true, the key will include + # a public tag referencing the key itself. That key will be stored in the public + # headers of the encrypted message + # + # pkg:gem/activerecord#lib/active_record/encryption/key_provider.rb:20 + def encryption_key; end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/key_provider.rb:41 + def keys_grouped_by_id; end +end + +# A message defines the structure of the data we store in encrypted attributes. It contains: +# +# * An encrypted payload +# * A list of unencrypted headers +# +# See Encryptor#encrypt +# +# pkg:gem/activerecord#lib/active_record/encryption/message.rb:11 +class ActiveRecord::Encryption::Message + # pkg:gem/activerecord#lib/active_record/encryption/message.rb:14 + def initialize(payload: T.unsafe(nil), headers: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/message.rb:21 + def ==(other_message); end + + # pkg:gem/activerecord#lib/active_record/encryption/message.rb:12 + def headers; end + + # pkg:gem/activerecord#lib/active_record/encryption/message.rb:12 + def headers=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/message.rb:12 + def payload; end + + # pkg:gem/activerecord#lib/active_record/encryption/message.rb:12 + def payload=(_arg0); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/message.rb:26 + def validate_payload_type(payload); end +end + +# A message serializer that serializes +Messages+ with JSON. +# +# The generated structure is pretty simple: +# +# { +# p: , +# h: { +# header1: value1, +# header2: value2, +# ... +# } +# } +# +# Both the payload and the header values are encoded with Base64 +# to prevent JSON parsing errors and encoding issues when +# storing the resulting serialized data. +# +# pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:23 +class ActiveRecord::Encryption::MessageSerializer + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:36 + def binary?; end + + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:31 + def dump(message); end + + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:24 + def load(serialized_content); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:85 + def decode_if_needed(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:77 + def encode_if_needed(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:71 + def headers_to_json(headers); end + + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:64 + def message_to_json(message); end + + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:41 + def parse_message(data, level); end + + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:56 + def parse_properties(headers, level); end + + # pkg:gem/activerecord#lib/active_record/encryption/message_serializer.rb:46 + def validate_message_data_format(data, level); end +end + +# An encryptor that won't decrypt or encrypt. It will just return the passed +# values +# +# pkg:gem/activerecord#lib/active_record/encryption/null_encryptor.rb:7 +class ActiveRecord::Encryption::NullEncryptor + # pkg:gem/activerecord#lib/active_record/encryption/null_encryptor.rb:20 + def binary?; end + + # pkg:gem/activerecord#lib/active_record/encryption/null_encryptor.rb:12 + def decrypt(encrypted_text, key_provider: T.unsafe(nil), cipher_options: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/null_encryptor.rb:8 + def encrypt(clean_text, key_provider: T.unsafe(nil), cipher_options: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/null_encryptor.rb:16 + def encrypted?(text); end +end + +# This is a wrapper for a hash of encryption properties. It is used by +# +Key+ (public tags) and +Message+ (headers). +# +# Since properties are serialized in messages, it is important for storage +# efficiency to keep their keys as short as possible. It defines accessors +# for common properties that will keep these keys very short while exposing +# a readable name. +# +# message.headers.encrypted_data_key # instead of message.headers[:k] +# +# See +Properties::DEFAULT_PROPERTIES+, Key, Message +# +# pkg:gem/activerecord#lib/active_record/encryption/properties.rb:16 +class ActiveRecord::Encryption::Properties + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:42 + def initialize(initial_properties = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:20 + def ==(arg); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:20 + def [](*, **, &); end + + # Set a value for a given key + # + # It will raise an +EncryptedContentIntegrity+ if the value exists + # + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:50 + def []=(key, value); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:62 + def add(other_properties); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:33 + def auth_tag; end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:37 + def auth_tag=(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:33 + def compressed; end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:37 + def compressed=(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:20 + def each(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:33 + def encoding; end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:37 + def encoding=(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:33 + def encrypted_data_key; end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:37 + def encrypted_data_key=(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:33 + def encrypted_data_key_id; end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:37 + def encrypted_data_key_id=(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:33 + def iv; end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:37 + def iv=(value); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:20 + def key?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:19 + def method_missing(method, *, **, &); end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:68 + def to_h; end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:56 + def validate_value_type(value); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:73 + def data; end + + # pkg:gem/activerecord#lib/active_record/encryption/properties.rb:19 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/encryption/properties.rb:17 +ActiveRecord::Encryption::Properties::ALLOWED_VALUE_CLASSES = T.let(T.unsafe(nil), Array) + +# For each entry it generates an accessor exposing the full name +# +# pkg:gem/activerecord#lib/active_record/encryption/properties.rb:23 +ActiveRecord::Encryption::Properties::DEFAULT_PROPERTIES = T.let(T.unsafe(nil), Hash) + +# A +NullEncryptor+ that will raise an error when trying to encrypt data +# +# This is useful when you want to reveal ciphertexts for debugging purposes +# and you want to make sure you won't overwrite any encryptable attribute with +# the wrong content. +# +# pkg:gem/activerecord#lib/active_record/encryption/read_only_null_encryptor.rb:10 +class ActiveRecord::Encryption::ReadOnlyNullEncryptor + # pkg:gem/activerecord#lib/active_record/encryption/read_only_null_encryptor.rb:23 + def binary?; end + + # pkg:gem/activerecord#lib/active_record/encryption/read_only_null_encryptor.rb:15 + def decrypt(encrypted_text, key_provider: T.unsafe(nil), cipher_options: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/read_only_null_encryptor.rb:11 + def encrypt(clean_text, key_provider: T.unsafe(nil), cipher_options: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/encryption/read_only_null_encryptor.rb:19 + def encrypted?(text); end +end + +# A container of attribute encryption options. +# +# It validates and serves attribute encryption options. +# +# See EncryptedAttributeType, Context +# +# pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:10 +class ActiveRecord::Encryption::Scheme + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:13 + def initialize(key_provider: T.unsafe(nil), key: T.unsafe(nil), deterministic: T.unsafe(nil), support_unencrypted_data: T.unsafe(nil), downcase: T.unsafe(nil), ignore_case: T.unsafe(nil), previous_schemes: T.unsafe(nil), compress: T.unsafe(nil), compressor: T.unsafe(nil), **context_properties); end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:78 + def compatible_with?(other_scheme); end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:44 + def deterministic?; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:40 + def downcase?; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:52 + def fixed?; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:36 + def ignore_case?; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:57 + def key_provider; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:61 + def merge(other_scheme); end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:11 + def previous_schemes; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:11 + def previous_schemes=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:48 + def support_unencrypted_data?; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:65 + def to_h; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:70 + def with_context(&block); end + + private + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:102 + def default_key_provider; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:96 + def deterministic_key_provider; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:90 + def key_provider_from_key; end + + # pkg:gem/activerecord#lib/active_record/encryption/scheme.rb:83 + def validate_config!; end +end + +# Declare an enum attribute where the values map to integers in the database, +# but can be queried by name. Example: +# +# class Conversation < ActiveRecord::Base +# enum :status, [ :active, :archived ] +# end +# +# # conversation.update! status: 0 +# conversation.active! +# conversation.active? # => true +# conversation.status # => "active" +# +# # conversation.update! status: 1 +# conversation.archived! +# conversation.archived? # => true +# conversation.status # => "archived" +# +# # conversation.status = 1 +# conversation.status = "archived" +# +# conversation.status = nil +# conversation.status.nil? # => true +# conversation.status # => nil +# +# Scopes based on the allowed values of the enum field will be provided +# as well. With the above example: +# +# Conversation.active +# Conversation.not_active +# Conversation.archived +# Conversation.not_archived +# +# Of course, you can also query them directly if the scopes don't fit your +# needs: +# +# Conversation.where(status: [:active, :archived]) +# Conversation.where.not(status: :active) +# +# Defining scopes can be disabled by setting +:scopes+ to +false+. +# +# class Conversation < ActiveRecord::Base +# enum :status, [ :active, :archived ], scopes: false +# end +# +# You can set the default enum value by setting +:default+, like: +# +# class Conversation < ActiveRecord::Base +# enum :status, [ :active, :archived ], default: :active +# end +# +# conversation = Conversation.new +# conversation.status # => "active" +# +# It's possible to explicitly map the relation between attribute and +# database integer with a hash: +# +# class Conversation < ActiveRecord::Base +# enum :status, active: 0, archived: 1 +# end +# +# Finally it's also possible to use a string column to persist the enumerated value. +# Note that this will likely lead to slower database queries: +# +# class Conversation < ActiveRecord::Base +# enum :status, active: "active", archived: "archived" +# end +# +# Note that when an array is used, the implicit mapping from the values to database +# integers is derived from the order the values appear in the array. In the example, +# :active is mapped to +0+ as it's the first element, and :archived +# is mapped to +1+. In general, the +i+-th element is mapped to i-1 in the +# database. +# +# Therefore, once a value is added to the enum array, its position in the array must +# be maintained, and new values should only be added to the end of the array. To +# remove unused values, the explicit hash syntax should be used. +# +# In rare circumstances you might need to access the mapping directly. +# The mappings are exposed through a class method with the pluralized attribute +# name, which return the mapping in a ActiveSupport::HashWithIndifferentAccess : +# +# Conversation.statuses[:active] # => 0 +# Conversation.statuses["archived"] # => 1 +# +# Use that class method when you need to know the ordinal value of an enum. +# For example, you can use that when manually building SQL strings: +# +# Conversation.where("status <> ?", Conversation.statuses[:archived]) +# +# You can use the +:prefix+ or +:suffix+ options when you need to define +# multiple enums with same values. If the passed value is +true+, the methods +# are prefixed/suffixed with the name of the enum. It is also possible to +# supply a custom value: +# +# class Conversation < ActiveRecord::Base +# enum :status, [ :active, :archived ], suffix: true +# enum :comments_status, [ :active, :inactive ], prefix: :comments +# end +# +# With the above example, the bang and predicate methods along with the +# associated scopes are now prefixed and/or suffixed accordingly: +# +# conversation.active_status! +# conversation.archived_status? # => false +# +# conversation.comments_inactive! +# conversation.comments_active? # => false +# +# If you want to disable the auto-generated methods on the model, you can do +# so by setting the +:instance_methods+ option to false: +# +# class Conversation < ActiveRecord::Base +# enum :status, [ :active, :archived ], instance_methods: false +# end +# +# By default, an +ArgumentError+ will be raised when assigning an invalid value: +# +# class Conversation < ActiveRecord::Base +# enum :status, [ :active, :archived ] +# end +# +# conversation = Conversation.new +# +# conversation.status = :unknown # 'unknown' is not a valid status (ArgumentError) +# +# If, instead, you want the enum value to be validated before saving, use the +# +:validate+ option: +# +# class Conversation < ActiveRecord::Base +# enum :status, [ :active, :archived ], validate: true +# end +# +# conversation = Conversation.new +# +# conversation.status = :unknown +# conversation.valid? # => false +# +# conversation.status = nil +# conversation.valid? # => false +# +# conversation.status = :active +# conversation.valid? # => true +# +# You may also pass additional validation options: +# +# class Conversation < ActiveRecord::Base +# enum :status, [ :active, :archived ], validate: { allow_nil: true } +# end +# +# conversation = Conversation.new +# +# conversation.status = :unknown +# conversation.valid? # => false +# +# conversation.status = nil +# conversation.valid? # => true +# +# conversation.status = :active +# conversation.valid? # => true +# +# pkg:gem/activerecord#lib/active_record/enum.rb:166 +module ActiveRecord::Enum + # pkg:gem/activerecord#lib/active_record/enum.rb:217 + def enum(name, values = T.unsafe(nil), **options); end + + private + + # pkg:gem/activerecord#lib/active_record/enum.rb:223 + def _enum(name, values, prefix: T.unsafe(nil), suffix: T.unsafe(nil), scopes: T.unsafe(nil), instance_methods: T.unsafe(nil), validate: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:327 + def _enum_methods_module; end + + # pkg:gem/activerecord#lib/active_record/enum.rb:335 + def assert_valid_enum_definition_values(values); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:378 + def assert_valid_enum_options(options); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:391 + def detect_enum_conflict!(enum_name, method_name, klass_method = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:415 + def detect_negative_enum_conditions!(method_names); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:290 + def inherited(base); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:405 + def raise_conflict_error(enum_name, method_name, type, source: T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/active_record/enum.rb:167 + def extended(base); end + end +end + +# pkg:gem/activerecord#lib/active_record/enum.rb:385 +ActiveRecord::Enum::ENUM_CONFLICT_MESSAGE = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/enum.rb:295 +class ActiveRecord::Enum::EnumMethods < ::Module + # pkg:gem/activerecord#lib/active_record/enum.rb:296 + def initialize(klass); end + + private + + # pkg:gem/activerecord#lib/active_record/enum.rb:303 + def define_enum_methods(name, value_method_name, value, scopes, instance_methods); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:301 + def klass; end +end + +# pkg:gem/activerecord#lib/active_record/enum.rb:171 +class ActiveRecord::Enum::EnumType < ::ActiveModel::Type::Value + # pkg:gem/activerecord#lib/active_record/enum.rb:174 + def initialize(name, mapping, subtype, raise_on_invalid_values: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:203 + def assert_valid_value(value); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:181 + def cast(value); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:191 + def deserialize(value); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:199 + def serializable?(value, &block); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:195 + def serialize(value); end + + # pkg:gem/activerecord#lib/active_record/enum.rb:211 + def subtype; end + + # pkg:gem/activerecord#lib/active_record/enum.rb:172 + def type(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/enum.rb:214 + def mapping; end + + # pkg:gem/activerecord#lib/active_record/enum.rb:214 + def name; end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:215 +class ActiveRecord::EnvironmentMismatchError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/migration.rb:216 + def initialize(current: T.unsafe(nil), stored: T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:229 +class ActiveRecord::EnvironmentStorageError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/migration.rb:230 + def initialize; end +end + +# Raised when a record cannot be inserted or updated because it would violate an exclusion constraint. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:300 +class ActiveRecord::ExclusionViolation < ::ActiveRecord::StatementInvalid; end + +# Raised when a pool was unable to get ahold of all its connections +# to perform a "group" action such as +# {ActiveRecord::Base.connection_pool.disconnect!}[rdoc-ref:ConnectionAdapters::ConnectionPool#disconnect!] +# or {ActiveRecord::Base.connection_handler.clear_reloadable_connections!}[rdoc-ref:ConnectionAdapters::ConnectionHandler#clear_reloadable_connections!]. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:127 +class ActiveRecord::ExclusiveConnectionTimeoutError < ::ActiveRecord::ConnectionTimeoutError; end + +# pkg:gem/activerecord#lib/active_record/explain.rb:6 +module ActiveRecord::Explain + # Executes the block with the collect flag enabled. Queries are collected + # asynchronously by the subscriber and returned. + # + # pkg:gem/activerecord#lib/active_record/explain.rb:9 + def collecting_queries_for_explain; end + + # Makes the adapter execute EXPLAIN for the tuples of queries and bindings. + # Returns a formatted string ready to be logged. + # + # pkg:gem/activerecord#lib/active_record/explain.rb:19 + def exec_explain(queries, options = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/explain.rb:55 + def build_explain_clause(connection, options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/explain.rb:40 + def render_bind(connection, attr); end +end + +# This is a thread locals registry for EXPLAIN. For example +# +# ActiveRecord::ExplainRegistry.queries +# +# returns the collected queries local to the current thread. +# +# pkg:gem/activerecord#lib/active_record/explain_registry.rb:10 +class ActiveRecord::ExplainRegistry + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:68 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:65 + def collect; end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:65 + def collect=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:77 + def collect?; end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:66 + def queries; end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:81 + def reset; end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:72 + def start; end + + class << self + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:57 + def collect(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:57 + def collect=(arg); end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:57 + def collect?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:57 + def queries(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:57 + def reset(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:57 + def start(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:60 + def instance; end + end +end + +# pkg:gem/activerecord#lib/active_record/explain_registry.rb:11 +class ActiveRecord::ExplainRegistry::Subscriber + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:31 + def finish(name, id, payload); end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:48 + def ignore_payload?(payload); end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:37 + def silenced?(_name); end + + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:27 + def start(name, id, payload); end + + class << self + # pkg:gem/activerecord#lib/active_record/explain_registry.rb:16 + def ensure_subscribed; end + end +end + +# pkg:gem/activerecord#lib/active_record/explain_registry.rb:47 +ActiveRecord::ExplainRegistry::Subscriber::EXPLAINED_SQLS = T.let(T.unsafe(nil), Regexp) + +# SCHEMA queries cannot be EXPLAINed, also we do not want to run EXPLAIN on +# our own EXPLAINs no matter how loopingly beautiful that would be. +# +# On the other hand, we want to monitor the performance of our real database +# queries, not the performance of the access to the query cache. +# +# pkg:gem/activerecord#lib/active_record/explain_registry.rb:46 +ActiveRecord::ExplainRegistry::Subscriber::IGNORED_PAYLOADS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/explain_registry.rb:12 +ActiveRecord::ExplainRegistry::Subscriber::MUTEX = T.let(T.unsafe(nil), Thread::Mutex) + +# pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:4 +class ActiveRecord::FilterAttributeHandler + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:18 + def initialize(app); end + + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:24 + def enable; end + + private + + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:32 + def app; end + + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:48 + def apply_collected_attributes; end + + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:63 + def apply_filter(klass, list); end + + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:40 + def attribute_was_declared(klass, list); end + + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:58 + def collect_for_later(klass, list); end + + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:54 + def collecting?; end + + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:34 + def install_collecting_hook; end + + class << self + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:6 + def on_sensitive_attribute_declared(&block); end + + # pkg:gem/activerecord#lib/active_record/filter_attribute_handler.rb:11 + def sensitive_attribute_was_declared(klass, list); end + end +end + +# pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:6 +module ActiveRecord::FinderMethods + # Returns true if a record exists in the table that matches the +id+ or + # conditions given, or false otherwise. The argument can take six forms: + # + # * Integer - Finds the record with this primary key. + # * String - Finds the record with a primary key corresponding to this + # string (such as '5'). + # * Array - Finds the record that matches these +where+-style conditions + # (such as ['name LIKE ?', "%#{query}%"]). + # * Hash - Finds the record that matches these +where+-style conditions + # (such as {name: 'David'}). + # * +false+ - Returns always +false+. + # * No args - Returns +false+ if the relation is empty, +true+ otherwise. + # + # For more information about specifying conditions as a hash or array, + # see the Conditions section in the introduction to ActiveRecord::Base. + # + # Note: You can't pass in a condition as a string (like name = + # 'Jamie'), since it would be sanitized and then queried against + # the primary key column, like id = 'name = \'Jamie\''. + # + # Person.exists?(5) + # Person.exists?('5') + # Person.exists?(['name LIKE ?', "%#{query}%"]) + # Person.exists?(id: [1, 4, 8]) + # Person.exists?(name: 'David') + # Person.exists?(false) + # Person.exists? + # Person.where(name: 'Spartacus', rating: 4).exists? + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:357 + def exists?(conditions = T.unsafe(nil)); end + + # Find the fifth record. + # If no order is defined it will order by primary key. + # + # Person.fifth # returns the fifth object fetched by SELECT * FROM people + # Person.offset(3).fifth # returns the fifth object from OFFSET 3 (which is OFFSET 7) + # Person.where(["user_name = :u", { u: user_name }]).fifth + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:271 + def fifth; end + + # Same as #fifth but raises ActiveRecord::RecordNotFound if no record + # is found. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:277 + def fifth!; end + + # Find by id - This can either be a specific id (ID), a list of ids (ID, ID, ID), or an array of ids ([ID, ID, ID]). + # `ID` refers to an "identifier". For models with a single-column primary key, `ID` will be a single value, + # and for models with a composite primary key, it will be an array of values. + # If one or more records cannot be found for the requested ids, then ActiveRecord::RecordNotFound will be raised. + # If the primary key is an integer, find by id coerces its arguments by using +to_i+. + # + # Person.find(1) # returns the object for ID = 1 + # Person.find("1") # returns the object for ID = 1 + # Person.find("31-sarah") # returns the object for ID = 31 + # Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6) + # Person.find([7, 17]) # returns an array for objects with IDs in (7, 17), or with composite primary key [7, 17] + # Person.find([1]) # returns an array for the object with ID = 1 + # Person.where("administrator = 1").order("created_on DESC").find(1) + # + # ==== Find a record for a composite primary key model + # TravelRoute.primary_key = [:origin, :destination] + # + # TravelRoute.find(["Ottawa", "London"]) + # # => # + # + # TravelRoute.find([["Paris", "Montreal"]]) + # # => [#] + # + # TravelRoute.find(["New York", "Las Vegas"], ["New York", "Portland"]) + # # => [ + # # #, + # # # + # # ] + # + # TravelRoute.find([["Berlin", "London"], ["Barcelona", "Lisbon"]]) + # # => [ + # # #, + # # # + # # ] + # + # NOTE: The returned records are in the same order as the ids you provide. + # If you want the results to be sorted by database, you can use ActiveRecord::QueryMethods#where + # method and provide an explicit ActiveRecord::QueryMethods#order option. + # But ActiveRecord::QueryMethods#where method doesn't raise ActiveRecord::RecordNotFound. + # + # ==== Find with lock + # + # Example for find with a lock: Imagine two concurrent transactions: + # each will read person.visits == 2, add 1 to it, and save, resulting + # in two saves of person.visits = 3. By locking the row, the second + # transaction has to wait until the first is finished; we get the + # expected person.visits == 4. + # + # Person.transaction do + # person = Person.lock(true).find(1) + # person.visits += 1 + # person.save! + # end + # + # ==== Variations of #find + # + # Person.where(name: 'Spartacus', rating: 4) + # # returns a chainable list (which can be empty). + # + # Person.find_by(name: 'Spartacus', rating: 4) + # # returns the first item or nil. + # + # Person.find_or_initialize_by(name: 'Spartacus', rating: 4) + # # returns the first item or returns a new instance (requires you call .save to persist against the database). + # + # Person.find_or_create_by(name: 'Spartacus', rating: 4) + # # returns the first item or creates it and returns it. + # + # ==== Alternatives for #find + # + # Person.where(name: 'Spartacus', rating: 4).exists?(conditions = :none) + # # returns a boolean indicating if any record with the given conditions exist. + # + # Person.where(name: 'Spartacus', rating: 4).select("field1, field2, field3") + # # returns a chainable list of instances with only the mentioned fields. + # + # Person.where(name: 'Spartacus', rating: 4).ids + # # returns an Array of ids. + # + # Person.where(name: 'Spartacus', rating: 4).pluck(:field1, :field2) + # # returns an Array of the required fields. + # + # ==== Edge Cases + # + # Person.find(37) # raises ActiveRecord::RecordNotFound exception if the record with the given ID does not exist. + # Person.find([37]) # raises ActiveRecord::RecordNotFound exception if the record with the given ID in the input array does not exist. + # Person.find(nil) # raises ActiveRecord::RecordNotFound exception if the argument is nil. + # Person.find([]) # returns an empty array if the argument is an empty array. + # Person.find # raises ActiveRecord::RecordNotFound exception if the argument is not provided. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:98 + def find(*args); end + + # Finds the first record matching the specified conditions. There + # is no implied ordering so if order matters, you should specify it + # yourself. + # + # If no record is found, returns nil. + # + # Post.find_by name: 'Spartacus', rating: 4 + # Post.find_by "published_at < ?", 2.weeks.ago + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:111 + def find_by(arg, *args); end + + # Like #find_by, except that if no record is found, raises + # an ActiveRecord::RecordNotFound error. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:117 + def find_by!(arg, *args); end + + # Finds the sole matching record. Raises ActiveRecord::RecordNotFound if no + # record is found. Raises ActiveRecord::SoleRecordExceeded if more than one + # record is found. + # + # Product.find_sole_by(["price = %?", price]) + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:160 + def find_sole_by(arg, *args); end + + # Find the first record (or first N records if a parameter is supplied). + # If no order is defined it will order by primary key. + # + # Person.first # returns the first object fetched by SELECT * FROM people ORDER BY people.id LIMIT 1 + # Person.where(["user_name = ?", user_name]).first + # Person.where(["user_name = :u", { u: user_name }]).first + # Person.order("created_on DESC").offset(5).first + # Person.first(3) # returns the first three objects fetched by SELECT * FROM people ORDER BY people.id LIMIT 3 + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:173 + def first(limit = T.unsafe(nil)); end + + # Same as #first but raises ActiveRecord::RecordNotFound if no record + # is found. Note that #first! accepts no arguments. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:183 + def first!; end + + # Find the forty-second record. Also known as accessing "the reddit". + # If no order is defined it will order by primary key. + # + # Person.forty_two # returns the forty-second object fetched by SELECT * FROM people + # Person.offset(3).forty_two # returns the forty-second object from OFFSET 3 (which is OFFSET 44) + # Person.where(["user_name = :u", { u: user_name }]).forty_two + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:287 + def forty_two; end + + # Same as #forty_two but raises ActiveRecord::RecordNotFound if no record + # is found. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:293 + def forty_two!; end + + # Find the fourth record. + # If no order is defined it will order by primary key. + # + # Person.fourth # returns the fourth object fetched by SELECT * FROM people + # Person.offset(3).fourth # returns the fourth object from OFFSET 3 (which is OFFSET 6) + # Person.where(["user_name = :u", { u: user_name }]).fourth + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:255 + def fourth; end + + # Same as #fourth but raises ActiveRecord::RecordNotFound if no record + # is found. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:261 + def fourth!; end + + # Returns true if the relation contains the given record or false otherwise. + # + # No query is performed if the relation is loaded; the given record is + # compared to the records in memory. If the relation is unloaded, an + # efficient existence query is performed, as in #exists?. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:389 + def include?(record); end + + # Find the last record (or last N records if a parameter is supplied). + # If no order is defined it will order by primary key. + # + # Person.last # returns the last object fetched by SELECT * FROM people + # Person.where(["user_name = ?", user_name]).last + # Person.order("created_on DESC").offset(5).last + # Person.last(3) # returns the last three objects fetched by SELECT * FROM people. + # + # Take note that in that last case, the results are sorted in ascending order: + # + # [#, #, #] + # + # and not: + # + # [#, #, #] + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:202 + def last(limit = T.unsafe(nil)); end + + # Same as #last but raises ActiveRecord::RecordNotFound if no record + # is found. Note that #last! accepts no arguments. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:213 + def last!; end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:407 + def member?(record); end + + # This method is called whenever no records are found with either a single + # id or multiple ids and raises an ActiveRecord::RecordNotFound exception. + # + # The error message is different depending on whether a single id or + # multiple ids are provided. If multiple ids are provided, then the number + # of results obtained should be provided in the +result_size+ argument and + # the expected number of results should be provided in the +expected_size+ + # argument. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:417 + def raise_record_not_found_exception!(ids = T.unsafe(nil), result_size = T.unsafe(nil), expected_size = T.unsafe(nil), key = T.unsafe(nil), not_found_ids = T.unsafe(nil)); end + + # Find the second record. + # If no order is defined it will order by primary key. + # + # Person.second # returns the second object fetched by SELECT * FROM people + # Person.offset(3).second # returns the second object from OFFSET 3 (which is OFFSET 4) + # Person.where(["user_name = :u", { u: user_name }]).second + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:223 + def second; end + + # Same as #second but raises ActiveRecord::RecordNotFound if no record + # is found. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:229 + def second!; end + + # Find the second-to-last record. + # If no order is defined it will order by primary key. + # + # Person.second_to_last # returns the second-to-last object fetched by SELECT * FROM people + # Person.offset(3).second_to_last # returns the second-to-last object from OFFSET 3 + # Person.where(["user_name = :u", { u: user_name }]).second_to_last + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:319 + def second_to_last; end + + # Same as #second_to_last but raises ActiveRecord::RecordNotFound if no record + # is found. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:325 + def second_to_last!; end + + # Finds the sole matching record. Raises ActiveRecord::RecordNotFound if no + # record is found. Raises ActiveRecord::SoleRecordExceeded if more than one + # record is found. + # + # Product.where(["price = %?", price]).sole + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:143 + def sole; end + + # Gives a record (or N records if a parameter is supplied) without any implied + # order. The order will depend on the database implementation. + # If an order is supplied it will be respected. + # + # Person.take # returns an object fetched by SELECT * FROM people LIMIT 1 + # Person.take(5) # returns 5 objects fetched by SELECT * FROM people LIMIT 5 + # Person.where(["name LIKE '%?'", name]).take + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:128 + def take(limit = T.unsafe(nil)); end + + # Same as #take but raises ActiveRecord::RecordNotFound if no record + # is found. Note that #take! accepts no arguments. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:134 + def take!; end + + # Find the third record. + # If no order is defined it will order by primary key. + # + # Person.third # returns the third object fetched by SELECT * FROM people + # Person.offset(3).third # returns the third object from OFFSET 3 (which is OFFSET 5) + # Person.where(["user_name = :u", { u: user_name }]).third + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:239 + def third; end + + # Same as #third but raises ActiveRecord::RecordNotFound if no record + # is found. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:245 + def third!; end + + # Find the third-to-last record. + # If no order is defined it will order by primary key. + # + # Person.third_to_last # returns the third-to-last object fetched by SELECT * FROM people + # Person.offset(3).third_to_last # returns the third-to-last object from OFFSET 3 + # Person.where(["user_name = :u", { u: user_name }]).third_to_last + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:303 + def third_to_last; end + + # Same as #third_to_last but raises ActiveRecord::RecordNotFound if no record + # is found. + # + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:309 + def third_to_last!; end + + private + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:682 + def _order_columns; end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:458 + def apply_join_dependency(eager_loading: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:589 + def cast_primary_key(id); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:439 + def construct_relation_for_exists(conditions); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:651 + def find_last(limit); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:613 + def find_nth(index); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:637 + def find_nth_from_last(index); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:618 + def find_nth_with_limit(index, limit); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:522 + def find_one(id); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:543 + def find_some(ids); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:573 + def find_some_ordered(ids); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:597 + def find_take; end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:605 + def find_take_with_limit(limit); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:492 + def find_with_ids(*ids); end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:655 + def ordered_relation; end + + # pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:488 + def using_limitable_reflections?(reflections); end +end + +# pkg:gem/activerecord#lib/active_record/relation/finder_methods.rb:7 +ActiveRecord::FinderMethods::ONE_AS_ONE = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/fixtures.rb:806 +class ActiveRecord::Fixture + include ::Enumerable + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:817 + def initialize(fixture, model_class); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:830 + def [](key); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:822 + def class_name; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:826 + def each(&block); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:836 + def find; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:815 + def fixture; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:815 + def model_class; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:834 + def to_hash; end +end + +# pkg:gem/activerecord#lib/active_record/fixtures.rb:809 +class ActiveRecord::Fixture::FixtureError < ::StandardError; end + +# pkg:gem/activerecord#lib/active_record/fixtures.rb:812 +class ActiveRecord::Fixture::FormatError < ::ActiveRecord::Fixture::FixtureError; end + +# pkg:gem/activerecord#lib/active_record/fixtures.rb:10 +class ActiveRecord::FixtureClassNotFound < ::ActiveRecord::ActiveRecordError; end + +# = Active Record \Fixtures +# +# \Fixtures are a way of organizing data that you want to test against; in short, sample data. +# +# They are stored in YAML files, one file per model, which are by default placed in either +# /test/fixtures/ or in the test/fixtures +# folder under any of your application's engines. +# +# The location can also be changed with ActiveSupport::TestCase.fixture_paths=, +# once you have require "rails/test_help" in your +test_helper.rb+. +# +# The fixture file ends with the +.yml+ file extension, for example: +# /test/fixtures/web_sites.yml). +# +# The format of a fixture file looks like this: +# +# rubyonrails: +# id: 1 +# name: Ruby on Rails +# url: http://www.rubyonrails.org +# +# google: +# id: 2 +# name: Google +# url: http://www.google.com +# +# This fixture file includes two fixtures. Each YAML fixture (i.e. record) is given a name and +# is followed by an indented list of key/value pairs in the "key: value" format. Records are +# separated by a blank line for your viewing pleasure. +# +# == Ordering +# +# Fixtures by default are unordered. This is because the maps in YAML are unordered. +# +# If you want ordered fixtures, use the omap YAML type. +# See https://yaml.org/type/omap.html for the specification. +# +# You will need ordered fixtures when you have foreign key constraints +# on keys in the same table. This is commonly needed for tree structures. +# +# For example: +# +# --- !omap +# - parent: +# id: 1 +# parent_id: NULL +# title: Parent +# - child: +# id: 2 +# parent_id: 1 +# title: Child +# +# == Using Fixtures in Test Cases +# +# Since fixtures are a testing construct, we use them in our unit and functional tests. There +# are two ways to use the fixtures, but first let's take a look at a sample unit test: +# +# require "test_helper" +# +# class WebSiteTest < ActiveSupport::TestCase +# test "web_site_count" do +# assert_equal 2, WebSite.count +# end +# end +# +# By default, +test_helper.rb+ will load all of your fixtures into your test +# database, so this test will succeed. +# +# The testing environment will automatically load all the fixtures into the database before each +# test. To ensure consistent data, the environment deletes the fixtures before running the load. +# +# In addition to being available in the database, the fixture's data may also be accessed by +# using a special dynamic method, which has the same name as the model. +# +# Passing in a fixture name to this dynamic method returns the fixture matching this name: +# +# test "find one" do +# assert_equal "Ruby on Rails", web_sites(:rubyonrails).name +# end +# +# Passing in multiple fixture names returns all fixtures matching these names: +# +# test "find all by name" do +# assert_equal 2, web_sites(:rubyonrails, :google).length +# end +# +# Passing in no arguments returns all fixtures: +# +# test "find all" do +# assert_equal 2, web_sites.length +# end +# +# Passing in any fixture name that does not exist will raise StandardError: +# +# test "find by name that does not exist" do +# assert_raise(StandardError) { web_sites(:reddit) } +# end +# +# If the model names conflicts with a +TestCase+ methods, you can use the generic +fixture+ accessor +# +# test "generic find" do +# assert_equal "Ruby on Rails", fixture(:web_sites, :rubyonrails).name +# end +# +# Alternatively, you may enable auto-instantiation of the fixture data. For instance, take the +# following tests: +# +# test "find_alt_method_1" do +# assert_equal "Ruby on Rails", @web_sites['rubyonrails']['name'] +# end +# +# test "find_alt_method_2" do +# assert_equal "Ruby on Rails", @rubyonrails.name +# end +# +# In order to use these methods to access fixtured data within your test cases, you must specify one of the +# following in your ActiveSupport::TestCase-derived class: +# +# - to fully enable instantiated fixtures (enable alternate methods #1 and #2 above) +# self.use_instantiated_fixtures = true +# +# - create only the hash for the fixtures, do not 'find' each instance (enable alternate method #1 only) +# self.use_instantiated_fixtures = :no_instances +# +# Using either of these alternate methods incurs a performance hit, as the fixtured data must be fully +# traversed in the database to create the fixture hash and/or instance variables. This is expensive for +# large sets of fixtured data. +# +# == Dynamic fixtures with \ERB +# +# Sometimes you don't care about the content of the fixtures as much as you care about the volume. +# In these cases, you can mix ERB in with your YAML fixtures to create a bunch of fixtures for load +# testing, like: +# +# <% 1.upto(1000) do |i| %> +# fix_<%= i %>: +# id: <%= i %> +# name: guy_<%= i %> +# <% end %> +# +# This will create 1000 very simple fixtures. +# +# Using ERB, you can also inject dynamic values into your fixtures with inserts like +# <%= Date.today.strftime("%Y-%m-%d") %>. +# This is however a feature to be used with some caution. The point of fixtures are that they're +# stable units of predictable sample data. If you feel that you need to inject dynamic values, then +# perhaps you should reexamine whether your application is properly testable. Hence, dynamic values +# in fixtures are to be considered a code smell. +# +# Helper methods defined in a fixture will not be available in other fixtures, to prevent against +# unwanted inter-test dependencies. Methods used by multiple fixtures should be defined in a module +# that is included in ActiveRecord::FixtureSet.context_class. +# +# - define a helper method in test_helper.rb +# module FixtureFileHelpers +# def file_sha(path) +# OpenSSL::Digest::SHA256.hexdigest(File.read(Rails.root.join('test/fixtures', path))) +# end +# end +# ActiveRecord::FixtureSet.context_class.include FixtureFileHelpers +# +# - use the helper method in a fixture +# photo: +# name: kitten.png +# sha: <%= file_sha 'files/kitten.png' %> +# +# == Transactional Tests +# +# Test cases can use begin+rollback to isolate their changes to the database instead of having to +# delete+insert for every test case. +# +# class FooTest < ActiveSupport::TestCase +# self.use_transactional_tests = true +# +# test "godzilla" do +# assert_not_empty Foo.all +# Foo.destroy_all +# assert_empty Foo.all +# end +# +# test "godzilla aftermath" do +# assert_not_empty Foo.all +# end +# end +# +# If you preload your test database with all fixture data (probably by running bin/rails db:fixtures:load) +# and use transactional tests, then you may omit all fixtures declarations in your test cases since +# all the data's already there and every case rolls back its changes. +# +# In order to use instantiated fixtures with preloaded data, set +self.pre_loaded_fixtures+ to +# true. This will provide access to fixture data for every table that has been loaded through +# fixtures (depending on the value of +use_instantiated_fixtures+). +# +# When *not* to use transactional tests: +# +# 1. You're testing whether a transaction works correctly. Nested transactions don't commit until +# all parent transactions commit, particularly, the fixtures transaction which is begun in setup +# and rolled back in teardown. Thus, you won't be able to verify +# the results of your transaction until Active Record supports nested transactions or savepoints (in progress). +# 2. Your database does not support transactions. Every Active Record database supports transactions except MySQL MyISAM. +# Use InnoDB, MaxDB, or NDB instead. +# +# == Advanced Fixtures +# +# Fixtures that don't specify an ID get some extra features: +# +# * Stable, autogenerated IDs +# * Label references for associations (belongs_to, has_one, has_many) +# * HABTM associations as inline lists +# +# There are some more advanced features available even if the id is specified: +# +# * Autofilled timestamp columns +# * Fixture label interpolation +# * Support for YAML defaults +# +# === Stable, Autogenerated IDs +# +# Here, have a monkey fixture: +# +# george: +# id: 1 +# name: George the Monkey +# +# reginald: +# id: 2 +# name: Reginald the Pirate +# +# Each of these fixtures has two unique identifiers: one for the database +# and one for the humans. Why don't we generate the primary key instead? +# Hashing each fixture's label yields a consistent ID: +# +# george: # generated id: 380982691 +# name: George the Monkey +# +# reginald: # generated id: 41001176 +# name: Reginald the Pirate +# +# Active Record looks at the fixture's model class, discovers the correct +# primary key, and generates it right before inserting the fixture +# into the database. +# +# The generated ID for a given label is constant, so we can discover +# any fixture's ID without loading anything, as long as we know the label. +# +# === Label references for associations (+belongs_to+, +has_one+, +has_many+) +# +# Specifying foreign keys in fixtures can be very fragile, not to +# mention difficult to read. Since Active Record can figure out the ID of +# any fixture from its label, you can specify FK's by label instead of ID. +# +# ==== +belongs_to+ +# +# Let's break out some more monkeys and pirates. +# +# ### in pirates.yml +# +# reginald: +# id: 1 +# name: Reginald the Pirate +# monkey_id: 1 +# +# +# +# ### in monkeys.yml +# +# george: +# id: 1 +# name: George the Monkey +# pirate_id: 1 +# +# Add a few more monkeys and pirates and break this into multiple files, +# and it gets pretty hard to keep track of what's going on. Let's +# use labels instead of IDs: +# +# ### in pirates.yml +# +# reginald: +# name: Reginald the Pirate +# monkey: george +# +# +# +# ### in monkeys.yml +# +# george: +# name: George the Monkey +# pirate: reginald +# +# Pow! All is made clear. Active Record reflects on the fixture's model class, +# finds all the +belongs_to+ associations, and allows you to specify +# a target *label* for the *association* (monkey: george) rather than +# a target *id* for the *FK* (monkey_id: 1). +# +# ==== Polymorphic +belongs_to+ +# +# Supporting polymorphic relationships is a little bit more complicated, since +# Active Record needs to know what type your association is pointing at. Something +# like this should look familiar: +# +# ### in fruit.rb +# +# belongs_to :eater, polymorphic: true +# +# +# +# ### in fruits.yml +# +# apple: +# id: 1 +# name: apple +# eater_id: 1 +# eater_type: Monkey +# +# Can we do better? You bet! +# +# apple: +# eater: george (Monkey) +# +# Just provide the polymorphic target type and Active Record will take care of the rest. +# +# ==== +has_and_belongs_to_many+ or has_many :through +# +# \Time to give our monkey some fruit. +# +# ### in monkeys.yml +# +# george: +# id: 1 +# name: George the Monkey +# +# +# +# ### in fruits.yml +# +# apple: +# id: 1 +# name: apple +# +# orange: +# id: 2 +# name: orange +# +# grape: +# id: 3 +# name: grape +# +# +# +# ### in fruits_monkeys.yml +# +# apple_george: +# fruit_id: 1 +# monkey_id: 1 +# +# orange_george: +# fruit_id: 2 +# monkey_id: 1 +# +# grape_george: +# fruit_id: 3 +# monkey_id: 1 +# +# Let's make the HABTM fixture go away. +# +# ### in monkeys.yml +# +# george: +# id: 1 +# name: George the Monkey +# fruits: apple, orange, grape +# +# +# +# ### in fruits.yml +# +# apple: +# name: apple +# +# orange: +# name: orange +# +# grape: +# name: grape +# +# Zap! No more fruits_monkeys.yml file. We've specified the list of fruits +# on George's fixture, but we could've just as easily specified a list +# of monkeys on each fruit. As with +belongs_to+, Active Record reflects on +# the fixture's model class and discovers the +has_and_belongs_to_many+ +# associations. +# +# === Autofilled \Timestamp Columns +# +# If your table/model specifies any of Active Record's +# standard timestamp columns (+created_at+, +created_on+, +updated_at+, +updated_on+), +# they will automatically be set to Time.now. +# +# If you've set specific values, they'll be left alone. +# +# === Fixture label interpolation +# +# The label of the current fixture is always available as a column value: +# +# geeksomnia: +# name: Geeksomnia's Account +# subdomain: $LABEL +# email: $LABEL@email.com +# +# Also, sometimes (like when porting older join table fixtures) you'll need +# to be able to get a hold of the identifier for a given label. ERB +# to the rescue: +# +# george_reginald: +# monkey_id: <%= ActiveRecord::FixtureSet.identify(:reginald) %> +# pirate_id: <%= ActiveRecord::FixtureSet.identify(:george) %> +# +# If the model uses UUID values for identifiers, add the +:uuid+ argument: +# +# ActiveRecord::FixtureSet.identify(:boaty_mcboatface, :uuid) +# +# === Support for YAML defaults +# +# You can set and reuse defaults in your fixtures YAML file. +# This is the same technique used in the +database.yml+ file to specify +# defaults: +# +# DEFAULTS: &DEFAULTS +# created_on: <%= 3.weeks.ago.to_fs(:db) %> +# +# first: +# name: Smurf +# <<: *DEFAULTS +# +# second: +# name: Fraggle +# <<: *DEFAULTS +# +# Any fixture labeled "DEFAULTS" is safely ignored. +# +# Besides using "DEFAULTS", you can also specify what fixtures will +# be ignored by setting "ignore" in "_fixture" section. +# +# # users.yml +# _fixture: +# ignore: +# - base +# # or use "ignore: base" when there is only one fixture that needs to be ignored. +# +# base: &base +# admin: false +# introduction: "This is a default description" +# +# admin: +# <<: *base +# admin: true +# +# visitor: +# <<: *base +# +# In the above example, 'base' will be ignored when creating fixtures. +# This can be used for common attributes inheriting. +# +# == Composite Primary Key Fixtures +# +# Fixtures for composite primary key tables are fairly similar to normal tables. +# When using an id column, the column may be omitted as usual: +# +# # app/models/book.rb +# class Book < ApplicationRecord +# self.primary_key = [:author_id, :id] +# belongs_to :author +# end +# +# +# +# # books.yml +# alices_adventure_in_wonderland: +# author_id: <%= ActiveRecord::FixtureSet.identify(:lewis_carroll) %> +# title: "Alice's Adventures in Wonderland" +# +# However, in order to support composite primary key relationships, +# you must use the `composite_identify` method: +# +# # app/models/book_orders.rb +# class BookOrder < ApplicationRecord +# self.primary_key = [:shop_id, :id] +# belongs_to :order, foreign_key: [:shop_id, :order_id] +# belongs_to :book, foreign_key: [:author_id, :book_id] +# end +# +# +# +# # book_orders.yml +# alices_adventure_in_wonderland_in_books: +# author: lewis_carroll +# book_id: <%= ActiveRecord::FixtureSet.composite_identify( +# :alices_adventure_in_wonderland, Book.primary_key)[:id] %> +# shop: book_store +# order_id: <%= ActiveRecord::FixtureSet.composite_identify( +# :books, Order.primary_key)[:id] %> +# +# == Configure the fixture model class +# +# It's possible to set the fixture's model class directly in the YAML file. +# This is helpful when fixtures are loaded outside tests and +# +set_fixture_class+ is not available (e.g. +# when running bin/rails db:fixtures:load). +# +# _fixture: +# model_class: User +# david: +# name: David +# +# Any fixtures labeled "_fixture" are safely ignored. +# +# pkg:gem/activerecord#lib/active_record/fixtures.rb:527 +class ActiveRecord::FixtureSet + # pkg:gem/activerecord#lib/active_record/fixtures.rb:713 + def initialize(_, name, class_name, path, config = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:724 + def [](x); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:728 + def []=(k, v); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:541 + def all_loaded_fixtures; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:541 + def all_loaded_fixtures=(val); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:711 + def config; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:732 + def each(&block); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:711 + def fixtures; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:711 + def ignored_fixtures; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:711 + def model_class; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:711 + def name; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:736 + def size; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:711 + def table_name; end + + # Returns a hash of rows to be inserted. The key is the table, the value is + # a list of rows to insert to that table. + # + # pkg:gem/activerecord#lib/active_record/fixtures.rb:742 + def table_rows; end + + private + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:800 + def default_fixture_model_class; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:762 + def ignored_fixtures=(base); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:754 + def model_class=(class_name); end + + # Loads the fixtures from the YAML file at +path+. + # If the file sets the +model_class+ and current instance value is not set, + # it uses the file value. + # + # pkg:gem/activerecord#lib/active_record/fixtures.rb:781 + def read_fixture_files(path); end + + class << self + # pkg:gem/activerecord#lib/active_record/fixtures.rb:541 + def all_loaded_fixtures; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:541 + def all_loaded_fixtures=(val); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:576 + def cache_fixtures(connection_pool, fixtures_map); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:560 + def cache_for_connection_pool(connection_pool); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:568 + def cached_fixtures(connection_pool, keys_to_fetch = T.unsafe(nil)); end + + # Returns a consistent, platform-independent hash representing a mapping + # between the label and the subcomponents of the provided composite key. + # + # Example: + # + # composite_identify("label", [:a, :b, :c]) # => { a: hash_1, b: hash_2, c: hash_3 } + # + # pkg:gem/activerecord#lib/active_record/fixtures.rb:633 + def composite_identify(label, key); end + + # Superclass for the evaluation contexts used by \ERB fixtures. + # + # pkg:gem/activerecord#lib/active_record/fixtures.rb:641 + def context_class; end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:595 + def create_fixtures(fixtures_directories, fixture_set_names, class_names = T.unsafe(nil), config = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:544 + def default_fixture_model_name(fixture_set_name, config = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:550 + def default_fixture_table_name(fixture_set_name, config = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:564 + def fixture_is_cached?(connection_pool, table_name); end + + # Returns a consistent, platform-independent identifier for +label+. + # + # \Integer identifiers are values less than 2^30. UUIDs are RFC 4122 version 5 SHA-1 hashes. + # + # pkg:gem/activerecord#lib/active_record/fixtures.rb:619 + def identify(label, column_type = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:589 + def instantiate_all_loaded_fixtures(object, load_instances = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:580 + def instantiate_fixtures(object, fixture_set, load_instances = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:556 + def reset_cache; end + + private + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:696 + def check_all_foreign_keys_valid!(conn); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:665 + def insert(fixture_sets, connection_pool); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:646 + def read_and_insert(fixtures_directories, fixture_files, class_names, connection_pool); end + + # pkg:gem/activerecord#lib/active_record/fixtures.rb:706 + def update_all_loaded_fixtures(fixtures_map); end + end +end + +# pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:7 +class ActiveRecord::FixtureSet::File + include ::Enumerable + + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:19 + def initialize(file); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:23 + def each(&block); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:31 + def ignored_fixtures; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:27 + def model_class; end + + private + + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:40 + def config_row; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:51 + def raw_rows; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:36 + def rows; end + + # Validate our unmarshalled data. + # + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:76 + def validate(data); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:61 + def validate_config_row(data); end + + class << self + # Open a fixture file named +file+. When called with a block, the block + # is called with the filehandle and the filehandle is automatically closed + # when the block finishes. + # + # pkg:gem/activerecord#lib/active_record/fixture_set/file.rb:14 + def open(file); end + end +end + +# -- +# An instance of FixtureSet is normally stored in a single YAML file and +# possibly in a folder with the same name. +# ++ +# +# pkg:gem/activerecord#lib/active_record/fixtures.rb:537 +ActiveRecord::FixtureSet::MAX_ID = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activerecord#lib/active_record/fixture_set/model_metadata.rb:5 +class ActiveRecord::FixtureSet::ModelMetadata + # pkg:gem/activerecord#lib/active_record/fixture_set/model_metadata.rb:6 + def initialize(model_class); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/model_metadata.rb:29 + def column_names; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/model_metadata.rb:18 + def column_type(column_name); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/model_metadata.rb:25 + def has_column?(column_name); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/model_metadata.rb:37 + def inheritance_column_name; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/model_metadata.rb:10 + def primary_key_name; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/model_metadata.rb:14 + def primary_key_type; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/model_metadata.rb:33 + def timestamp_column_names; end +end + +# NOTE: This class has to be defined in compact style in +# order for rendering context subclassing to work correctly. +# +# pkg:gem/activerecord#lib/active_record/fixture_set/render_context.rb:7 +class ActiveRecord::FixtureSet::RenderContext + class << self + # pkg:gem/activerecord#lib/active_record/fixture_set/render_context.rb:8 + def create_subclass; end + end +end + +# pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:5 +class ActiveRecord::FixtureSet::TableRow + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:65 + def initialize(fixture, table_rows:, label:, now:); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:73 + def to_hash; end + + private + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:186 + def add_join_records(association); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:136 + def column_defined?(col); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:86 + def fill_row_model_attributes; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:103 + def fill_timestamps; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:127 + def generate_composite_primary_key; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:119 + def generate_primary_key; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:112 + def interpolate_label; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:82 + def model_class; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:78 + def model_metadata; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:95 + def reflection_class; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:140 + def resolve_enums; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:148 + def resolve_sti_reflections; end +end + +# pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:24 +class ActiveRecord::FixtureSet::TableRow::HasManyThroughProxy < ::ActiveRecord::FixtureSet::TableRow::ReflectionProxy + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:33 + def join_table; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:29 + def lhs_key; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:25 + def rhs_key; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:37 + def timestamp_column_names; end +end + +# pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:42 +class ActiveRecord::FixtureSet::TableRow::PrimaryKeyError < ::StandardError + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:43 + def initialize(label, association, value); end +end + +# pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:6 +class ActiveRecord::FixtureSet::TableRow::ReflectionProxy + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:7 + def initialize(association); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:11 + def join_table; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:15 + def name; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_row.rb:19 + def primary_key_type; end +end + +# pkg:gem/activerecord#lib/active_record/fixture_set/table_rows.rb:8 +class ActiveRecord::FixtureSet::TableRows + # pkg:gem/activerecord#lib/active_record/fixture_set/table_rows.rb:9 + def initialize(table_name, model_class:, fixtures:); end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_rows.rb:21 + def model_class; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_rows.rb:27 + def model_metadata; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_rows.rb:21 + def tables; end + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_rows.rb:23 + def to_hash; end + + private + + # pkg:gem/activerecord#lib/active_record/fixture_set/table_rows.rb:32 + def build_table_rows_from(table_name, fixtures); end +end + +# pkg:gem/activerecord#lib/active_record/future_result.rb:4 +class ActiveRecord::FutureResult + # pkg:gem/activerecord#lib/active_record/future_result.rb:66 + def initialize(pool, *args, **kwargs); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:94 + def cancel; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:141 + def canceled?; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:62 + def empty?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:90 + def execute!(connection); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:100 + def execute_or_skip; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:64 + def lock_wait; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:137 + def pending?; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:124 + def result; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:85 + def schedule!(session); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:81 + def then(&block); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:62 + def to_a(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/future_result.rb:171 + def exec_query(connection, *args, **kwargs); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:146 + def execute_or_wait; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:163 + def execute_query(connection, async: T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/active_record/future_result.rb:53 + def wrap(result); end + end +end + +# pkg:gem/activerecord#lib/active_record/future_result.rb:51 +class ActiveRecord::FutureResult::Canceled < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/future_result.rb:5 +class ActiveRecord::FutureResult::Complete + # pkg:gem/activerecord#lib/active_record/future_result.rb:9 + def initialize(result); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:17 + def canceled?; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:7 + def empty?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:13 + def pending?; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:6 + def result; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:21 + def then(&block); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:7 + def to_a(*, **, &); end +end + +# pkg:gem/activerecord#lib/active_record/future_result.rb:26 +class ActiveRecord::FutureResult::EventBuffer + # pkg:gem/activerecord#lib/active_record/future_result.rb:27 + def initialize(future_result, instrumenter); end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:42 + def flush; end + + # pkg:gem/activerecord#lib/active_record/future_result.rb:33 + def instrument(name, payload = T.unsafe(nil), &block); end +end + +# pkg:gem/activerecord#lib/active_record/future_result.rb:175 +class ActiveRecord::FutureResult::SelectAll < ::ActiveRecord::FutureResult + private + + # pkg:gem/activerecord#lib/active_record/future_result.rb:177 + def exec_query(*, **); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:74 +class ActiveRecord::HasManyThroughAssociationNotFoundError < ::ActiveRecord::ActiveRecordError + include ::DidYouMean::Correctable + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:77 + def initialize(owner_class = T.unsafe(nil), reflection = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:90 + def corrections; end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:75 + def owner_class; end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:75 + def reflection; end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:124 +class ActiveRecord::HasManyThroughAssociationPointlessSourceTypeError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:125 + def initialize(owner_class_name = T.unsafe(nil), reflection = T.unsafe(nil), source_reflection = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:104 +class ActiveRecord::HasManyThroughAssociationPolymorphicSourceError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:105 + def initialize(owner_class_name = T.unsafe(nil), reflection = T.unsafe(nil), source_reflection = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:114 +class ActiveRecord::HasManyThroughAssociationPolymorphicThroughError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:115 + def initialize(owner_class_name = T.unsafe(nil), reflection = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:218 +class ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection < ::ActiveRecord::ThroughCantAssociateThroughHasOneOrManyReflection; end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:234 +class ActiveRecord::HasManyThroughNestedAssociationsAreReadonly < ::ActiveRecord::ThroughNestedAssociationsAreReadonly; end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:167 +class ActiveRecord::HasManyThroughOrderError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:168 + def initialize(owner_class_name = T.unsafe(nil), reflection = T.unsafe(nil), through_reflection = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:154 +class ActiveRecord::HasManyThroughSourceAssociationNotFoundError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:155 + def initialize(reflection = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:144 +class ActiveRecord::HasOneAssociationPolymorphicThroughError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:145 + def initialize(owner_class_name = T.unsafe(nil), reflection = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:134 +class ActiveRecord::HasOneThroughCantAssociateThroughCollection < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:135 + def initialize(owner_class_name = T.unsafe(nil), reflection = T.unsafe(nil), through_reflection = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:221 +class ActiveRecord::HasOneThroughCantAssociateThroughHasOneOrManyReflection < ::ActiveRecord::ThroughCantAssociateThroughHasOneOrManyReflection; end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:237 +class ActiveRecord::HasOneThroughNestedAssociationsAreReadonly < ::ActiveRecord::ThroughNestedAssociationsAreReadonly; end + +# pkg:gem/activerecord#lib/active_record/migration.rb:121 +class ActiveRecord::IllegalMigrationNameError < ::ActiveRecord::MigrationError + # pkg:gem/activerecord#lib/active_record/migration.rb:122 + def initialize(name = T.unsafe(nil)); end +end + +# = Single table inheritance +# +# Active Record allows inheritance by storing the name of the class in a column that by +# default is named "type" (can be changed by overwriting Base.inheritance_column). +# This means that an inheritance looking like this: +# +# class Company < ActiveRecord::Base; end +# class Firm < Company; end +# class Client < Company; end +# class PriorityClient < Client; end +# +# When you do Firm.create(name: "37signals"), this record will be saved in +# the companies table with type = "Firm". You can then fetch this row again using +# Company.where(name: '37signals').first and it will return a Firm object. +# +# Be aware that because the type column is an attribute on the record every new +# subclass will instantly be marked as dirty and the type column will be included +# in the list of changed attributes on the record. This is different from non +# Single Table Inheritance(STI) classes: +# +# Company.new.changed? # => false +# Firm.new.changed? # => true +# Firm.new.changes # => {"type"=>["","Firm"]} +# +# If you don't have a type column defined in your table, single-table inheritance won't +# be triggered. In that case, it'll work just like normal subclasses with no special magic +# for differentiating between them or reloading the right type with find. +# +# All subclasses share the same database table. See the +# {Single Table Inheritance pattern}[https://www.martinfowler.com/eaaCatalog/singleTableInheritance.html] +# for more background. +# +# pkg:gem/activerecord#lib/active_record/inheritance.rb:39 +module ActiveRecord::Inheritance + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + + private + + # Sets the attribute used for single table inheritance to this class name if this is not the + # ActiveRecord::Base descendant. + # Considering the hierarchy Reply < Message < ActiveRecord::Base, this makes it possible to + # do Reply.new without having to set Reply[Reply.inheritance_column] = "Reply" yourself. + # No such attribute would be set for objects of the Message class in that example. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:364 + def ensure_proper_type; end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:348 + def initialize_dup(other); end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:354 + def initialize_internals_callback; end + + module GeneratedClassMethods + def store_full_class_name; end + def store_full_class_name=(value); end + def store_full_class_name?; end + def store_full_sti_class; end + def store_full_sti_class=(value); end + def store_full_sti_class?; end + end + + module GeneratedInstanceMethods + def store_full_class_name; end + def store_full_class_name?; end + def store_full_sti_class; end + def store_full_sti_class?; end + end +end + +# pkg:gem/activerecord#lib/active_record/inheritance.rb:52 +module ActiveRecord::Inheritance::ClassMethods + # Set this to +true+ if this is an abstract class (see + # abstract_class?). + # If you are using inheritance with Active Record and don't want a class + # to be considered as part of the STI hierarchy, you must set this to + # true. + # +ApplicationRecord+, for example, is generated as an abstract class. + # + # Consider the following default behavior: + # + # Shape = Class.new(ActiveRecord::Base) + # Polygon = Class.new(Shape) + # Square = Class.new(Polygon) + # + # Shape.table_name # => "shapes" + # Polygon.table_name # => "shapes" + # Square.table_name # => "shapes" + # Shape.create! # => # + # Polygon.create! # => # + # Square.create! # => # + # + # However, when using abstract_class, +Shape+ is omitted from + # the hierarchy: + # + # class Shape < ActiveRecord::Base + # self.abstract_class = true + # end + # Polygon = Class.new(Shape) + # Square = Class.new(Polygon) + # + # Shape.table_name # => nil + # Polygon.table_name # => "polygons" + # Square.table_name # => "polygons" + # Shape.create! # => NotImplementedError: Shape is an abstract class and cannot be instantiated. + # Polygon.create! # => # + # Square.create! # => # + # + # Note that in the above example, to disallow the creation of a plain + # +Polygon+, you should use validates :type, presence: true, + # instead of setting it as an abstract class. This way, +Polygon+ will + # stay in the hierarchy, and Active Record will continue to correctly + # derive the table name. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:164 + def abstract_class; end + + # Set this to +true+ if this is an abstract class (see + # abstract_class?). + # If you are using inheritance with Active Record and don't want a class + # to be considered as part of the STI hierarchy, you must set this to + # true. + # +ApplicationRecord+, for example, is generated as an abstract class. + # + # Consider the following default behavior: + # + # Shape = Class.new(ActiveRecord::Base) + # Polygon = Class.new(Shape) + # Square = Class.new(Polygon) + # + # Shape.table_name # => "shapes" + # Polygon.table_name # => "shapes" + # Square.table_name # => "shapes" + # Shape.create! # => # + # Polygon.create! # => # + # Square.create! # => # + # + # However, when using abstract_class, +Shape+ is omitted from + # the hierarchy: + # + # class Shape < ActiveRecord::Base + # self.abstract_class = true + # end + # Polygon = Class.new(Shape) + # Square = Class.new(Polygon) + # + # Shape.table_name # => nil + # Polygon.table_name # => "polygons" + # Square.table_name # => "polygons" + # Shape.create! # => NotImplementedError: Shape is an abstract class and cannot be instantiated. + # Polygon.create! # => # + # Square.create! # => # + # + # Note that in the above example, to disallow the creation of a plain + # +Polygon+, you should use validates :type, presence: true, + # instead of setting it as an abstract class. This way, +Polygon+ will + # stay in the hierarchy, and Active Record will continue to correctly + # derive the table name. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:164 + def abstract_class=(_arg0); end + + # Returns whether this class is an abstract class or not. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:167 + def abstract_class?; end + + # Returns the first class in the inheritance hierarchy that descends from either an + # abstract class or from ActiveRecord::Base. + # + # Consider the following behavior: + # + # class ApplicationRecord < ActiveRecord::Base + # self.abstract_class = true + # end + # class Shape < ApplicationRecord + # self.abstract_class = true + # end + # Polygon = Class.new(Shape) + # Square = Class.new(Polygon) + # + # ApplicationRecord.base_class # => ApplicationRecord + # Shape.base_class # => Shape + # Polygon.base_class # => Polygon + # Square.base_class # => Polygon + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:115 + def base_class; end + + # Returns whether the class is a base class. + # See #base_class for more information. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:119 + def base_class?; end + + # Returns +true+ if this does not need STI type condition. Returns + # +false+ if STI type condition needs to be applied. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:82 + def descends_from_active_record?; end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:226 + def dup; end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:92 + def finder_needs_type_condition?; end + + # Determines if one of the attributes passed in is the inheritance column, + # and if the inheritance column is attr accessible, it initializes an + # instance of the given subclass instead of the base class. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:56 + def new(attributes = T.unsafe(nil), &block); end + + # Returns the class for the provided +name+. + # + # It is used to find the class correspondent to the value stored in the polymorphic type column. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:218 + def polymorphic_class_for(name); end + + # Returns the value to be stored in the polymorphic type column for Polymorphic Associations. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:211 + def polymorphic_name; end + + # Sets the application record class for Active Record + # + # This is useful if your application uses a different class than + # ApplicationRecord for your primary abstract class. This class + # will share a database connection with Active Record. It is the class + # that connects to your primary database. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:177 + def primary_abstract_class; end + + # Returns the class for the provided +type_name+. + # + # It is used to find the class correspondent to the value stored in the inheritance column. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:194 + def sti_class_for(type_name); end + + # Returns the value to be stored in the inheritance column for STI. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:187 + def sti_name; end + + protected + + # Returns the class type of the record using the current module as a prefix. So descendants of + # MyApp::Business::Account would appear as MyApp::Business::AccountSubclass. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:247 + def compute_type(type_name); end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:240 + def reload_schema_from_cache(*); end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:275 + def set_base_class; end + + private + + # Called by +instantiate+ to decide which class to use for a new + # record instance. For single-table inheritance, we check the record + # for a +type+ column and return the corresponding class. + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:304 + def discriminate_class_for_record(record); end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:316 + def find_sti_class(type_name); end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:292 + def inherited(subclass); end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:234 + def initialize_clone(other); end + + # Detect the subclass from the inheritance column of attrs. If the inheritance column value + # is not self or a valid subclass, raises ActiveRecord::SubclassNotFound + # + # pkg:gem/activerecord#lib/active_record/inheritance.rb:336 + def subclass_from_attributes(attrs); end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:327 + def type_condition(table = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/inheritance.rb:312 + def using_single_table_inheritance?(record); end +end + +# pkg:gem/activerecord#lib/active_record/insert_all.rb:6 +class ActiveRecord::InsertAll + # pkg:gem/activerecord#lib/active_record/insert_all.rb:18 + def initialize(relation, connection, inserts, on_duplicate:, update_only: T.unsafe(nil), returning: T.unsafe(nil), unique_by: T.unsafe(nil), record_timestamps: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:7 + def connection; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:48 + def execute; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:7 + def inserts; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:7 + def keys; end + + # TODO: Consider renaming this method, as it only conditionally extends keys, not always + # + # pkg:gem/activerecord#lib/active_record/insert_all.rb:92 + def keys_including_timestamps; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:73 + def map_key_with_value; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:7 + def model; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:8 + def on_duplicate; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:61 + def primary_keys; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:87 + def record_timestamps?; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:8 + def returning; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:65 + def skip_duplicates?; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:8 + def unique_by; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:57 + def updatable_columns; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:69 + def update_duplicates?; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:8 + def update_only; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:8 + def update_sql; end + + private + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:129 + def configure_on_duplicate_update_logic; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:145 + def custom_update_sql_provided?; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:212 + def disallow_raw_sql!(value); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:173 + def ensure_valid_options_for_connection!; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:149 + def find_unique_index_for(unique_by); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:101 + def has_attribute_aliases?(attributes); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:197 + def readonly_columns; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:125 + def resolve_attribute_alias(attribute); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:114 + def resolve_attribute_aliases; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:105 + def resolve_sti; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:221 + def timestamps_for_create; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:192 + def to_sql; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:201 + def unique_by_columns; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:169 + def unique_indexes; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:206 + def verify_attributes(attributes); end + + class << self + # pkg:gem/activerecord#lib/active_record/insert_all.rb:11 + def execute(relation, *, **, &); end + end +end + +# pkg:gem/activerecord#lib/active_record/insert_all.rb:225 +class ActiveRecord::InsertAll::Builder + # pkg:gem/activerecord#lib/active_record/insert_all.rb:230 + def initialize(insert_all); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:270 + def conflict_target; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:234 + def into; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:228 + def keys(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:228 + def keys_including_timestamps(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:226 + def model; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:228 + def primary_keys(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:294 + def raw_update_sql; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:298 + def raw_update_sql?; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:228 + def record_timestamps?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:254 + def returning; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:228 + def skip_duplicates?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:284 + def touch_model_timestamps_unless(&block); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:280 + def updatable_columns; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:228 + def update_duplicates?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:238 + def values_list; end + + private + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:307 + def columns_list; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:301 + def connection; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:311 + def extract_types_for(keys); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:320 + def format_columns(columns); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:301 + def insert_all; end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:328 + def quote_column(column); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:324 + def quote_columns(columns); end + + # pkg:gem/activerecord#lib/active_record/insert_all.rb:303 + def touch_timestamp_attribute?(column_name); end +end + +# pkg:gem/activerecord#lib/active_record/integration.rb:6 +module ActiveRecord::Integration + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::Integration::ClassMethods + + # Returns a stable cache key that can be used to identify this record. + # + # Product.new.cache_key # => "products/new" + # Product.find(5).cache_key # => "products/5" + # + # If ActiveRecord::Base.cache_versioning is turned off, as it was in \Rails 5.1 and earlier, + # the cache key will also include a version. + # + # Product.cache_versioning = false + # Product.find(5).cache_key # => "products/5-20071224150000" (updated_at available) + # + # pkg:gem/activerecord#lib/active_record/integration.rb:72 + def cache_key; end + + # Returns a cache key along with the version. + # + # pkg:gem/activerecord#lib/active_record/integration.rb:114 + def cache_key_with_version; end + + # Returns a cache version that can be used together with the cache key to form + # a recyclable caching scheme. By default, the #updated_at column is used for the + # cache_version, but this method can be overwritten to return something else. + # + # Note, this method will return nil if ActiveRecord::Base.cache_versioning is set to + # +false+. + # + # pkg:gem/activerecord#lib/active_record/integration.rb:97 + def cache_version; end + + # Returns a +String+, which Action Pack uses for constructing a URL to this + # object. The default implementation returns this record's id as a +String+, + # or +nil+ if this record's unsaved. + # + # For example, suppose that you have a User model, and that you have a + # resources :users route. Normally, +user_path+ will + # construct a path with the user object's 'id' in it: + # + # user = User.find_by(name: 'Phusion') + # user_path(user) # => "/users/1" + # + # You can override +to_param+ in your model to make +user_path+ construct + # a path using the user's name instead of the user's id: + # + # class User < ActiveRecord::Base + # def to_param # overridden + # name + # end + # end + # + # user = User.find_by(name: 'Phusion') + # user_path(user) # => "/users/Phusion" + # + # pkg:gem/activerecord#lib/active_record/integration.rb:57 + def to_param; end + + private + + # Detects if the value before type cast + # can be used to generate a cache_version. + # + # The fast cache version only works with a + # string value directly from the database. + # + # We also must check if the timestamp format has been changed + # or if the timezone is not set to UTC then + # we cannot apply our transformations correctly. + # + # pkg:gem/activerecord#lib/active_record/integration.rb:178 + def can_use_fast_cache_version?(timestamp); end + + # Converts a raw database string to `:usec` + # format. + # + # Example: + # + # timestamp = "2018-10-15 20:02:15.266505" + # raw_timestamp_to_cache_version(timestamp) + # # => "20181015200215266505" + # + # PostgreSQL truncates trailing zeros, + # https://github.com/postgres/postgres/commit/3e1beda2cde3495f41290e1ece5d544525810214 + # to account for this we pad the output with zeros + # + # pkg:gem/activerecord#lib/active_record/integration.rb:200 + def raw_timestamp_to_cache_version(timestamp); end + + module GeneratedClassMethods + def cache_timestamp_format; end + def cache_timestamp_format=(value); end + def cache_timestamp_format?; end + def cache_versioning; end + def cache_versioning=(value); end + def cache_versioning?; end + def collection_cache_versioning; end + def collection_cache_versioning=(value); end + def collection_cache_versioning?; end + end + + module GeneratedInstanceMethods + def cache_timestamp_format; end + def cache_timestamp_format?; end + def cache_versioning; end + def cache_versioning?; end + def collection_cache_versioning; end + def collection_cache_versioning?; end + end +end + +# pkg:gem/activerecord#lib/active_record/integration.rb:122 +module ActiveRecord::Integration::ClassMethods + # pkg:gem/activerecord#lib/active_record/integration.rb:163 + def collection_cache_key(collection = T.unsafe(nil), timestamp_column = T.unsafe(nil)); end + + # Defines your model's +to_param+ method to generate "pretty" URLs + # using +method_name+, which can be any attribute or method that + # responds to +to_s+. + # + # class User < ActiveRecord::Base + # to_param :name + # end + # + # user = User.find_by(name: 'Fancy Pants') + # user.id # => 123 + # user_path(user) # => "/users/123-fancy-pants" + # + # Values longer than 20 characters will be truncated. The value + # is truncated word by word. + # + # user = User.find_by(name: 'David Heinemeier Hansson') + # user.id # => 125 + # user_path(user) # => "/users/125-david-heinemeier" + # + # Because the generated param begins with the record's +id+, it is + # suitable for passing to +find+. In a controller, for example: + # + # params[:id] # => "123-fancy-pants" + # User.find(params[:id]).id # => 123 + # + # pkg:gem/activerecord#lib/active_record/integration.rb:147 + def to_param(method_name = T.unsafe(nil)); end +end + +# This class is used to create a table that keeps track of values and keys such +# as which environment migrations were run in. +# +# This is enabled by default. To disable this functionality set +# `use_metadata_table` to false in your database configuration. +# +# pkg:gem/activerecord#lib/active_record/internal_metadata.rb:12 +class ActiveRecord::InternalMetadata + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:18 + def initialize(pool); end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:47 + def [](key); end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:39 + def []=(key, value); end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:16 + def arel_table; end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:65 + def count; end + + # Creates an internal metadata table with columns +key+ and +value+ + # + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:85 + def create_table; end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:74 + def create_table_and_set_flags(environment, schema_sha1 = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:57 + def delete_all_entries; end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:99 + def drop_table; end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:35 + def enabled?; end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:23 + def primary_key; end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:107 + def table_exists?; end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:31 + def table_name; end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:27 + def value_key; end + + private + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:130 + def create_entry(connection, key, value); end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:126 + def current_time(connection); end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:154 + def select_entry(connection, key); end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:142 + def update_entry(connection, key, new_value); end + + # pkg:gem/activerecord#lib/active_record/internal_metadata.rb:112 + def update_or_create_entry(connection, key, value); end +end + +# pkg:gem/activerecord#lib/active_record/internal_metadata.rb:13 +class ActiveRecord::InternalMetadata::NullInternalMetadata; end + +# Raised when a record cannot be inserted or updated because it references a non-existent record, +# or when a record cannot be deleted because a parent record references it. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:233 +class ActiveRecord::InvalidForeignKey < ::ActiveRecord::WrappedDatabaseException; end + +# pkg:gem/activerecord#lib/active_record/migration.rb:131 +class ActiveRecord::InvalidMigrationTimestampError < ::ActiveRecord::MigrationError + # pkg:gem/activerecord#lib/active_record/migration.rb:132 + def initialize(version = T.unsafe(nil), name = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:33 +class ActiveRecord::InverseOfAssociationNotFoundError < ::ActiveRecord::ActiveRecordError + include ::DidYouMean::Correctable + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:36 + def initialize(reflection = T.unsafe(nil), associated_class = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:34 + def associated_class; end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:49 + def corrections; end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:34 + def reflection; end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:62 +class ActiveRecord::InverseOfAssociationRecursiveError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:64 + def initialize(reflection = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:63 + def reflection; end +end + +# Exception that can be raised to stop migrations from being rolled back. +# For example the following migration is not reversible. +# Rolling back this migration will raise an ActiveRecord::IrreversibleMigration error. +# +# class IrreversibleMigrationExample < ActiveRecord::Migration[8.1] +# def change +# create_table :distributors do |t| +# t.string :zipcode +# end +# +# execute <<~SQL +# ALTER TABLE distributors +# ADD CONSTRAINT zipchk +# CHECK (char_length(zipcode) = 5) NO INHERIT; +# SQL +# end +# end +# +# There are two ways to mitigate this problem. +# +# 1. Define #up and #down methods instead of #change: +# +# class ReversibleMigrationExample < ActiveRecord::Migration[8.1] +# def up +# create_table :distributors do |t| +# t.string :zipcode +# end +# +# execute <<~SQL +# ALTER TABLE distributors +# ADD CONSTRAINT zipchk +# CHECK (char_length(zipcode) = 5) NO INHERIT; +# SQL +# end +# +# def down +# execute <<~SQL +# ALTER TABLE distributors +# DROP CONSTRAINT zipchk +# SQL +# +# drop_table :distributors +# end +# end +# +# 2. Use the #reversible method in #change method: +# +# class ReversibleMigrationExample < ActiveRecord::Migration[8.1] +# def change +# create_table :distributors do |t| +# t.string :zipcode +# end +# +# reversible do |dir| +# dir.up do +# execute <<~SQL +# ALTER TABLE distributors +# ADD CONSTRAINT zipchk +# CHECK (char_length(zipcode) = 5) NO INHERIT; +# SQL +# end +# +# dir.down do +# execute <<~SQL +# ALTER TABLE distributors +# DROP CONSTRAINT zipchk +# SQL +# end +# end +# end +# end +# +# pkg:gem/activerecord#lib/active_record/migration.rb:88 +class ActiveRecord::IrreversibleMigration < ::ActiveRecord::MigrationError; end + +# IrreversibleOrderError is raised when a relation's order is too complex for +# +reverse_order+ to automatically reverse. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:570 +class ActiveRecord::IrreversibleOrderError < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/legacy_yaml_adapter.rb:4 +module ActiveRecord::LegacyYamlAdapter + class << self + # pkg:gem/activerecord#lib/active_record/legacy_yaml_adapter.rb:5 + def convert(coder); end + end +end + +# LockWaitTimeout will be raised when lock wait timeout exceeded. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:578 +class ActiveRecord::LockWaitTimeout < ::ActiveRecord::StatementInvalid; end + +# pkg:gem/activerecord#lib/active_record.rb:149 +module ActiveRecord::Locking + extend ::ActiveSupport::Autoload +end + +# In de/serialize we change `nil` to 0, so that we can allow passing +# `nil` values to `lock_version`, and not result in `ActiveRecord::StaleObjectError` +# during update record. +# +# pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:213 +class ActiveRecord::Locking::LockingType + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:218 + def deserialize(value); end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:230 + def encode_with(coder); end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:226 + def init_with(coder); end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:222 + def serialize(value); end + + class << self + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:214 + def new(subtype); end + end +end + +# == What is \Optimistic \Locking +# +# Optimistic locking allows multiple users to access the same record for edits, and assumes a minimum of +# conflicts with the data. It does this by checking whether another process has made changes to a record since +# it was opened, an ActiveRecord::StaleObjectError exception is thrown if that has occurred +# and the update is ignored. +# +# Check out ActiveRecord::Locking::Pessimistic for an alternative. +# +# == Usage +# +# Active Record supports optimistic locking if the +lock_version+ field is present. Each update to the +# record increments the integer column +lock_version+ and the locking facilities ensure that records instantiated twice +# will let the last one saved raise a +StaleObjectError+ if the first was also updated. Example: +# +# p1 = Person.find(1) +# p2 = Person.find(1) +# +# p1.first_name = "Michael" +# p1.save +# +# p2.first_name = "should fail" +# p2.save # Raises an ActiveRecord::StaleObjectError +# +# Optimistic locking will also check for stale data when objects are destroyed. Example: +# +# p1 = Person.find(1) +# p2 = Person.find(1) +# +# p1.first_name = "Michael" +# p1.save +# +# p2.destroy # Raises an ActiveRecord::StaleObjectError +# +# You're then responsible for dealing with the conflict by rescuing the exception and either rolling back, merging, +# or otherwise apply the business logic needed to resolve the conflict. +# +# This locking mechanism will function inside a single Ruby process. To make it work across all +# web requests, the recommended approach is to add +lock_version+ as a hidden field to your form. +# +# This behavior can be turned off by setting ActiveRecord::Base.lock_optimistically = false. +# To override the name of the +lock_version+ column, set the locking_column class attribute: +# +# class Person < ActiveRecord::Base +# self.locking_column = :lock_person +# end +# +# pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:52 +module ActiveRecord::Locking::Optimistic + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::Locking::Optimistic::ClassMethods + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:63 + def increment!(*, **); end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:59 + def locking_enabled?; end + + private + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:149 + def _clear_locking_column; end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:78 + def _create_record(attribute_names = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:141 + def _lock_value_for_database(locking_column); end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:154 + def _query_constraints_hash; end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:87 + def _touch_row(attribute_names, time); end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:92 + def _update_row(attribute_names, attempted_action = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:131 + def destroy_row; end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:72 + def initialize_dup(other); end + + module GeneratedClassMethods + def lock_optimistically; end + def lock_optimistically=(value); end + def lock_optimistically?; end + end + + module GeneratedInstanceMethods + def lock_optimistically; end + def lock_optimistically?; end + end +end + +# pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:161 +module ActiveRecord::Locking::Optimistic::ClassMethods + # The version column used for optimistic locking. Defaults to +lock_version+. + # + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:178 + def locking_column; end + + # Set the column to use for optimistic locking. Defaults to +lock_version+. + # + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:172 + def locking_column=(value); end + + # Returns true if the +lock_optimistically+ flag is set to true + # (which it is, by default) and the table includes the + # +locking_column+ column (defaults to +lock_version+). + # + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:167 + def locking_enabled?; end + + # Reset the column used for optimistic locking back to the +lock_version+ default. + # + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:181 + def reset_locking_column; end + + # Make sure the lock version column gets updated when counters are + # updated. + # + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:187 + def update_counters(id, counters); end + + private + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:193 + def hook_attribute_type(name, cast_type); end + + # pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:201 + def inherited(base); end +end + +# pkg:gem/activerecord#lib/active_record/locking/optimistic.rb:162 +ActiveRecord::Locking::Optimistic::ClassMethods::DEFAULT_LOCKING_COLUMN = T.let(T.unsafe(nil), String) + +# = \Pessimistic \Locking +# +# Locking::Pessimistic provides support for row-level locking using +# SELECT ... FOR UPDATE and other lock types. +# +# Chain ActiveRecord::Base#find to ActiveRecord::QueryMethods#lock to obtain an exclusive +# lock on the selected rows: +# # select * from accounts where id=1 for update +# Account.lock.find(1) +# +# Call lock('some locking clause') to use a database-specific locking clause +# of your own such as 'LOCK IN SHARE MODE' or 'FOR UPDATE NOWAIT'. Example: +# +# Account.transaction do +# # select * from accounts where name = 'shugo' limit 1 for update nowait +# shugo = Account.lock("FOR UPDATE NOWAIT").find_by(name: "shugo") +# yuko = Account.lock("FOR UPDATE NOWAIT").find_by(name: "yuko") +# shugo.balance -= 100 +# shugo.save! +# yuko.balance += 100 +# yuko.save! +# end +# +# You can also use ActiveRecord::Base#lock! method to lock one record by id. +# This may be better if you don't need to lock every row. Example: +# +# Account.transaction do +# # select * from accounts where ... +# accounts = Account.where(...) +# account1 = accounts.detect { |account| ... } +# account2 = accounts.detect { |account| ... } +# # select * from accounts where id=? for update +# account1.lock! +# account2.lock! +# account1.balance -= 100 +# account1.save! +# account2.balance += 100 +# account2.save! +# end +# +# You can start a transaction and acquire the lock in one go by calling +# with_lock with a block. The block is called from within +# a transaction, the object is already locked. Example: +# +# account = Account.first +# account.with_lock do +# # This block is called within a transaction, +# # account is already locked. +# account.balance -= 100 +# account.save! +# end +# +# Database-specific information on row locking: +# +# [MySQL] +# https://dev.mysql.com/doc/refman/en/innodb-locking-reads.html +# +# [PostgreSQL] +# https://www.postgresql.org/docs/current/interactive/sql-select.html#SQL-FOR-UPDATE-SHARE +# +# pkg:gem/activerecord#lib/active_record/locking/pessimistic.rb:64 +module ActiveRecord::Locking::Pessimistic + # Obtain a row lock on this record. Reloads the record to obtain the requested + # lock. Pass an SQL locking clause to append the end of the SELECT statement + # or pass true for "FOR UPDATE" (the default, an exclusive row lock). Returns + # the locked record. + # + # pkg:gem/activerecord#lib/active_record/locking/pessimistic.rb:69 + def lock!(lock = T.unsafe(nil)); end + + # Wraps the passed block in a transaction, reloading the object with a + # lock before yielding. You can pass the SQL locking clause + # as an optional argument (see #lock!). + # + # You can also pass options like requires_new:, isolation:, + # and joinable: to the wrapping transaction (see + # ActiveRecord::ConnectionAdapters::DatabaseStatements#transaction). + # + # pkg:gem/activerecord#lib/active_record/locking/pessimistic.rb:97 + def with_lock(*args); end +end + +# pkg:gem/activerecord#lib/active_record/log_subscriber.rb:4 +class ActiveRecord::LogSubscriber < ::ActiveSupport::LogSubscriber + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:7 + def backtrace_cleaner; end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:7 + def backtrace_cleaner=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:7 + def backtrace_cleaner?; end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:18 + def sql(event); end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:9 + def strict_loading_violation(event); end + + private + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:80 + def colorize_payload_name(name, payload_name); end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:125 + def debug(progname = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:145 + def filter(name, value); end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:133 + def log_query_source; end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:121 + def logger; end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:141 + def query_source_location; end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:65 + def render_bind(attr, value); end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:88 + def sql_color(sql); end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:61 + def type_casted_binds(casted_binds); end + + class << self + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:7 + def backtrace_cleaner; end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:7 + def backtrace_cleaner=(value); end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:7 + def backtrace_cleaner?; end + + private + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:7 + def __class_attr_backtrace_cleaner; end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:7 + def __class_attr_backtrace_cleaner=(new_value); end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:16 + def __class_attr_log_levels; end + + # pkg:gem/activerecord#lib/active_record/log_subscriber.rb:16 + def __class_attr_log_levels=(new_value); end + end +end + +# pkg:gem/activerecord#lib/active_record/log_subscriber.rb:5 +ActiveRecord::LogSubscriber::IGNORE_PAYLOAD_NAMES = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/marshalling.rb:4 +module ActiveRecord::Marshalling + class << self + # pkg:gem/activerecord#lib/active_record/marshalling.rb:8 + def format_version; end + + # pkg:gem/activerecord#lib/active_record/marshalling.rb:10 + def format_version=(version); end + end +end + +# pkg:gem/activerecord#lib/active_record/marshalling.rb:23 +module ActiveRecord::Marshalling::Methods + # pkg:gem/activerecord#lib/active_record/marshalling.rb:24 + def _marshal_dump_7_1; end + + # pkg:gem/activerecord#lib/active_record/marshalling.rb:43 + def marshal_load(state); end +end + +# pkg:gem/activerecord#lib/active_record.rb:167 +module ActiveRecord::Middleware + extend ::ActiveSupport::Autoload +end + +# = Database Selector \Middleware +# +# The DatabaseSelector Middleware provides a framework for automatically +# swapping from the primary to the replica database connection. \Rails +# provides a basic framework to determine when to swap and allows for +# applications to write custom strategy classes to override the default +# behavior. +# +# The resolver class defines when the application should switch (i.e. read +# from the primary if a write occurred less than 2 seconds ago) and a +# resolver context class that sets a value that helps the resolver class +# decide when to switch. +# +# \Rails default middleware uses the request's session to set a timestamp +# that informs the application when to read from a primary or read from a +# replica. +# +# To use the DatabaseSelector in your application with default settings, +# run the provided generator. +# +# $ bin/rails g active_record:multi_db +# +# This will create a file named +config/initializers/multi_db.rb+ with the +# following contents: +# +# Rails.application.configure do +# config.active_record.database_selector = { delay: 2.seconds } +# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver +# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session +# end +# +# Alternatively you can set the options in your environment config or +# any other config file loaded on boot. +# +# The default behavior can be changed by setting the config options to a +# custom class: +# +# config.active_record.database_selector = { delay: 2.seconds } +# config.active_record.database_resolver = MyResolver +# config.active_record.database_resolver_context = MyResolver::MySession +# +# Note: If you are using rails new my_app --minimal you will need +# to call require "active_support/core_ext/integer/time" to load +# the core extension in order to use +2.seconds+ +# +# pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:5 +class ActiveRecord::Middleware::DatabaseSelector + # pkg:gem/activerecord#lib/active_record/middleware/database_selector.rb:52 + def initialize(app, resolver_klass = T.unsafe(nil), context_klass = T.unsafe(nil), options = T.unsafe(nil)); end + + # Middleware that determines which database connection to use in a multiple + # database application. + # + # pkg:gem/activerecord#lib/active_record/middleware/database_selector.rb:63 + def call(env); end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector.rb:59 + def context_klass; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector.rb:59 + def options; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector.rb:59 + def resolver_klass; end + + private + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector.rb:72 + def select_database(request, &blk); end +end + +# The Resolver class is used by the DatabaseSelector middleware to +# determine which database the request should use. +# +# To change the behavior of the Resolver class in your application, +# create a custom resolver class that inherits from +# DatabaseSelector::Resolver and implements the methods that need to +# be changed. +# +# By default the Resolver class will send read traffic to the replica +# if it's been 2 seconds since the last write. +# +# pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:6 +class ActiveRecord::Middleware::DatabaseSelector::Resolver + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:26 + def initialize(context, options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:33 + def context; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:33 + def delay; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:33 + def instrumenter; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:35 + def read(&blk); end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:51 + def reading_request?(request); end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:47 + def update_context(response); end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:43 + def write(&blk); end + + private + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:56 + def read_from_primary(&blk); end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:78 + def read_from_primary?; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:62 + def read_from_replica(&blk); end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:82 + def send_to_replica_delay; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:86 + def time_since_last_write_ok?; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:68 + def write_to_primary; end + + class << self + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:22 + def call(context, options = T.unsafe(nil)); end + end +end + +# pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver.rb:20 +ActiveRecord::Middleware::DatabaseSelector::Resolver::SEND_TO_REPLICA_DELAY = T.let(T.unsafe(nil), ActiveSupport::Duration) + +# The session class is used by the DatabaseSelector::Resolver to save +# timestamps of the last write in the session. +# +# The last_write is used to determine whether it's safe to read +# from the replica or the request needs to be sent to the primary. +# +# pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:12 +class ActiveRecord::Middleware::DatabaseSelector::Resolver::Session + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:28 + def initialize(session); end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:34 + def last_write_timestamp; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:42 + def save(response); end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:32 + def session; end + + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:38 + def update_last_write_timestamp; end + + class << self + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:13 + def call(request); end + + # Converts time to a timestamp that represents milliseconds since + # epoch. + # + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:19 + def convert_time_to_timestamp(time); end + + # Converts milliseconds since epoch timestamp into a time object. + # + # pkg:gem/activerecord#lib/active_record/middleware/database_selector/resolver/session.rb:24 + def convert_timestamp_to_time(timestamp); end + end +end + +# = Shard Selector \Middleware +# +# The ShardSelector Middleware provides a framework for automatically +# swapping shards. \Rails provides a basic framework to determine which +# shard to switch to and allows for applications to write custom strategies +# for swapping if needed. +# +# == Setup +# +# Applications must provide a resolver that will provide application-specific logic for +# selecting the appropriate shard. Setting +config.active_record.shard_resolver+ will cause +# Rails to add ShardSelector to the default middleware stack. +# +# The resolver, along with any configuration options, can be set in the application +# configuration using an initializer like so: +# +# Rails.application.configure do +# config.active_record.shard_selector = { lock: false, class_name: "AnimalsRecord" } +# config.active_record.shard_resolver = ->(request) { +# subdomain = request.subdomain +# tenant = Tenant.find_by_subdomain!(subdomain) +# tenant.shard +# } +# end +# +# == Configuration +# +# The behavior of ShardSelector can be altered through some configuration options. +# +# [+lock:+] +# +lock+ is true by default and will prohibit the request from switching shards once inside +# the block. If +lock+ is false, then shard switching will be allowed. For tenant based +# sharding, +lock+ should always be true to prevent application code from mistakenly switching +# between tenants. +# +# [+class_name:+] +# +class_name+ is the name of the abstract connection class to switch. By +# default, the ShardSelector will use ActiveRecord::Base, but if the +# application has multiple databases, then this option should be set to +# the name of the sharded database's abstract connection class. +# +# pkg:gem/activerecord#lib/active_record/middleware/shard_selector.rb:46 +class ActiveRecord::Middleware::ShardSelector + # pkg:gem/activerecord#lib/active_record/middleware/shard_selector.rb:47 + def initialize(app, resolver, options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/middleware/shard_selector.rb:55 + def call(env); end + + # pkg:gem/activerecord#lib/active_record/middleware/shard_selector.rb:53 + def options; end + + # pkg:gem/activerecord#lib/active_record/middleware/shard_selector.rb:53 + def resolver; end + + private + + # pkg:gem/activerecord#lib/active_record/middleware/shard_selector.rb:66 + def selected_shard(request); end + + # pkg:gem/activerecord#lib/active_record/middleware/shard_selector.rb:70 + def set_shard(shard, &block); end +end + +# = Active Record Migrations +# +# Migrations can manage the evolution of a schema used by several physical +# databases. It's a solution to the common problem of adding a field to make +# a new feature work in your local database, but being unsure of how to +# push that change to other developers and to the production server. With +# migrations, you can describe the transformations in self-contained classes +# that can be checked into version control systems and executed against +# another database that might be one, two, or five versions behind. +# +# Example of a simple migration: +# +# class AddSsl < ActiveRecord::Migration[8.1] +# def up +# add_column :accounts, :ssl_enabled, :boolean, default: true +# end +# +# def down +# remove_column :accounts, :ssl_enabled +# end +# end +# +# This migration will add a boolean flag to the accounts table and remove it +# if you're backing out of the migration. It shows how all migrations have +# two methods +up+ and +down+ that describes the transformations +# required to implement or remove the migration. These methods can consist +# of both the migration specific methods like +add_column+ and +remove_column+, +# but may also contain regular Ruby code for generating data needed for the +# transformations. +# +# Example of a more complex migration that also needs to initialize data: +# +# class AddSystemSettings < ActiveRecord::Migration[8.1] +# def up +# create_table :system_settings do |t| +# t.string :name +# t.string :label +# t.text :value +# t.string :type +# t.integer :position +# end +# +# SystemSetting.create name: 'notice', +# label: 'Use notice?', +# value: 1 +# end +# +# def down +# drop_table :system_settings +# end +# end +# +# This migration first adds the +system_settings+ table, then creates the very +# first row in it using the Active Record model that relies on the table. It +# also uses the more advanced +create_table+ syntax where you can specify a +# complete table schema in one block call. +# +# == Available transformations +# +# === Creation +# +# * create_join_table(table_1, table_2, options): Creates a join +# table having its name as the lexical order of the first two +# arguments. See +# ActiveRecord::ConnectionAdapters::SchemaStatements#create_join_table for +# details. +# * create_table(name, options): Creates a table called +name+ and +# makes the table object available to a block that can then add columns to it, +# following the same format as +add_column+. See example above. The options hash +# is for fragments like "DEFAULT CHARSET=UTF-8" that are appended to the create +# table definition. +# * add_column(table_name, column_name, type, options): Adds a new column +# to the table called +table_name+ +# named +column_name+ specified to be one of the following types: +# :string, :text, :integer, :float, +# :decimal, :datetime, :timestamp, :time, +# :date, :binary, :boolean. A default value can be +# specified by passing an +options+ hash like { default: 11 }. +# Other options include :limit and :null (e.g. +# { limit: 50, null: false }) -- see +# ActiveRecord::ConnectionAdapters::TableDefinition#column for details. +# * add_foreign_key(from_table, to_table, options): Adds a new +# foreign key. +from_table+ is the table with the key column, +to_table+ contains +# the referenced primary key. +# * add_index(table_name, column_names, options): Adds a new index +# with the name of the column. Other options include +# :name, :unique (e.g. +# { name: 'users_name_index', unique: true }) and :order +# (e.g. { order: { name: :desc } }). +# * add_reference(:table_name, :reference_name): Adds a new column +# +reference_name_id+ by default an integer. See +# ActiveRecord::ConnectionAdapters::SchemaStatements#add_reference for details. +# * add_timestamps(table_name, options): Adds timestamps (+created_at+ +# and +updated_at+) columns to +table_name+. +# +# === Modification +# +# * change_column(table_name, column_name, type, options): Changes +# the column to a different type using the same parameters as add_column. +# * change_column_default(table_name, column_name, default_or_changes): +# Sets a default value for +column_name+ defined by +default_or_changes+ on +# +table_name+. Passing a hash containing :from and :to +# as +default_or_changes+ will make this change reversible in the migration. +# * change_column_null(table_name, column_name, null, default = nil): +# Sets or removes a NOT NULL constraint on +column_name+. The +null+ flag +# indicates whether the value can be +NULL+. See +# ActiveRecord::ConnectionAdapters::SchemaStatements#change_column_null for +# details. +# * change_table(name, options): Allows to make column alterations to +# the table called +name+. It makes the table object available to a block that +# can then add/remove columns, indexes, or foreign keys to it. +# * rename_column(table_name, column_name, new_column_name): Renames +# a column but keeps the type and content. +# * rename_index(table_name, old_name, new_name): Renames an index. +# * rename_table(old_name, new_name): Renames the table called +old_name+ +# to +new_name+. +# +# === Deletion +# +# * drop_table(*names): Drops the given tables. +# * drop_join_table(table_1, table_2, options): Drops the join table +# specified by the given arguments. +# * remove_column(table_name, column_name, type, options): Removes the column +# named +column_name+ from the table called +table_name+. +# * remove_columns(table_name, *column_names): Removes the given +# columns from the table definition. +# * remove_foreign_key(from_table, to_table = nil, **options): Removes the +# given foreign key from the table called +table_name+. +# * remove_index(table_name, column: column_names): Removes the index +# specified by +column_names+. +# * remove_index(table_name, name: index_name): Removes the index +# specified by +index_name+. +# * remove_reference(table_name, ref_name, options): Removes the +# reference(s) on +table_name+ specified by +ref_name+. +# * remove_timestamps(table_name, options): Removes the timestamp +# columns (+created_at+ and +updated_at+) from the table definition. +# +# == Irreversible transformations +# +# Some transformations are destructive in a manner that cannot be reversed. +# Migrations of that kind should raise an ActiveRecord::IrreversibleMigration +# exception in their +down+ method. +# +# == Running migrations from within \Rails +# +# The \Rails package has several tools to help create and apply migrations. +# +# To generate a new migration, you can use +# +# $ bin/rails generate migration MyNewMigration +# +# where MyNewMigration is the name of your migration. The generator will +# create an empty migration file timestamp_my_new_migration.rb +# in the db/migrate/ directory where timestamp is the +# UTC formatted date and time that the migration was generated. +# +# There is a special syntactic shortcut to generate migrations that add fields to a table. +# +# $ bin/rails generate migration add_fieldname_to_tablename fieldname:string +# +# This will generate the file timestamp_add_fieldname_to_tablename.rb, which will look like this: +# class AddFieldnameToTablename < ActiveRecord::Migration[8.1] +# def change +# add_column :tablenames, :fieldname, :string +# end +# end +# +# To run migrations against the currently configured database, use +# bin/rails db:migrate. This will update the database by running all of the +# pending migrations, creating the schema_migrations table +# (see "About the schema_migrations table" section below) if missing. It will also +# invoke the db:schema:dump command, which will update your db/schema.rb file +# to match the structure of your database. +# +# To roll the database back to a previous migration version, use +# bin/rails db:rollback VERSION=X where X is the version to which +# you wish to downgrade. Alternatively, you can also use the STEP option if you +# wish to rollback last few migrations. bin/rails db:rollback STEP=2 will rollback +# the latest two migrations. +# +# If any of the migrations throw an ActiveRecord::IrreversibleMigration exception, +# that step will fail and you'll have some manual work to do. +# +# == More examples +# +# Not all migrations change the schema. Some just fix the data: +# +# class RemoveEmptyTags < ActiveRecord::Migration[8.1] +# def up +# Tag.all.each { |tag| tag.destroy if tag.pages.empty? } +# end +# +# def down +# # not much we can do to restore deleted data +# raise ActiveRecord::IrreversibleMigration, "Can't recover the deleted tags" +# end +# end +# +# Others remove columns when they migrate up instead of down: +# +# class RemoveUnnecessaryItemAttributes < ActiveRecord::Migration[8.1] +# def up +# remove_column :items, :incomplete_items_count +# remove_column :items, :completed_items_count +# end +# +# def down +# add_column :items, :incomplete_items_count +# add_column :items, :completed_items_count +# end +# end +# +# And sometimes you need to do something in SQL not abstracted directly by migrations: +# +# class MakeJoinUnique < ActiveRecord::Migration[8.1] +# def up +# execute "ALTER TABLE `pages_linked_pages` ADD UNIQUE `page_id_linked_page_id` (`page_id`,`linked_page_id`)" +# end +# +# def down +# execute "ALTER TABLE `pages_linked_pages` DROP INDEX `page_id_linked_page_id`" +# end +# end +# +# == Using a model after changing its table +# +# Sometimes you'll want to add a column in a migration and populate it +# immediately after. In that case, you'll need to make a call to +# Base#reset_column_information in order to ensure that the model has the +# latest column data from after the new column was added. Example: +# +# class AddPeopleSalary < ActiveRecord::Migration[8.1] +# def up +# add_column :people, :salary, :integer +# Person.reset_column_information +# Person.all.each do |p| +# p.update_attribute :salary, SalaryCalculator.compute(p) +# end +# end +# end +# +# == Controlling verbosity +# +# By default, migrations will describe the actions they are taking, writing +# them to the console as they happen, along with benchmarks describing how +# long each step took. +# +# You can quiet them down by setting ActiveRecord::Migration.verbose = false. +# +# You can also insert your own messages and benchmarks by using the +say_with_time+ +# method: +# +# def up +# ... +# say_with_time "Updating salaries..." do +# Person.all.each do |p| +# p.update_attribute :salary, SalaryCalculator.compute(p) +# end +# end +# ... +# end +# +# The phrase "Updating salaries..." would then be printed, along with the +# benchmark for the block when the block completes. +# +# == Timestamped Migrations +# +# By default, \Rails generates migrations that look like: +# +# 20080717013526_your_migration_name.rb +# +# The prefix is a generation timestamp (in UTC). Timestamps should not be +# modified manually. To validate that migration timestamps adhere to the +# format Active Record expects, you can use the following configuration option: +# +# config.active_record.validate_migration_timestamps = true +# +# If you'd prefer to use numeric prefixes, you can turn timestamped migrations +# off by setting: +# +# config.active_record.timestamped_migrations = false +# +# In application.rb. +# +# == Reversible Migrations +# +# Reversible migrations are migrations that know how to go +down+ for you. +# You simply supply the +up+ logic, and the Migration system figures out +# how to execute the down commands for you. +# +# To define a reversible migration, define the +change+ method in your +# migration like this: +# +# class TenderloveMigration < ActiveRecord::Migration[8.1] +# def change +# create_table(:horses) do |t| +# t.column :content, :text +# t.column :remind_at, :datetime +# end +# end +# end +# +# This migration will create the horses table for you on the way up, and +# automatically figure out how to drop the table on the way down. +# +# Some commands cannot be reversed. If you care to define how to move up +# and down in these cases, you should define the +up+ and +down+ methods +# as before. +# +# If a command cannot be reversed, an +# ActiveRecord::IrreversibleMigration exception will be raised when +# the migration is moving down. +# +# For a list of commands that are reversible, please see +# +ActiveRecord::Migration::CommandRecorder+. +# +# == Transactional Migrations +# +# If the database adapter supports DDL transactions, all migrations will +# automatically be wrapped in a transaction. There are queries that you +# can't execute inside a transaction though, and for these situations +# you can turn the automatic transactions off. +# +# class ChangeEnum < ActiveRecord::Migration[8.1] +# disable_ddl_transaction! +# +# def up +# execute "ALTER TYPE model_size ADD VALUE 'new_value'" +# end +# end +# +# Remember that you can still open your own transactions, even if you +# are in a Migration with self.disable_ddl_transaction!. +# +# pkg:gem/activerecord#lib/active_record/migration.rb:570 +class ActiveRecord::Migration + # pkg:gem/activerecord#lib/active_record/migration.rb:805 + def initialize(name = T.unsafe(nil), version = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1010 + def announce(message); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1041 + def connection; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1045 + def connection_pool; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1066 + def copy(destination, sources, options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:792 + def disable_ddl_transaction; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:962 + def down; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:990 + def exec_migration(conn, direction); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:812 + def execution_strategy; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1049 + def method_missing(method, *arguments, **, &block); end + + # Execute this migration in the named direction + # + # pkg:gem/activerecord#lib/active_record/migration.rb:969 + def migrate(direction); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:803 + def name; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:803 + def name=(_arg0); end + + # Determines the version number of the next migration. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1133 + def next_migration_number(number); end + + # Finds the correct table name given an Active Record object. + # Uses the Active Record object's own table_name, or pre/suffix from the + # options passed in. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1124 + def proper_table_name(name, options = T.unsafe(nil)); end + + # Used to specify an operation that can be run in one direction or another. + # Call the methods +up+ and +down+ of the yielded object to run a block + # only in one given direction. + # The whole block will be called in the right order within the migration. + # + # In the following example, the looping on users will always be done + # when the three columns 'first_name', 'last_name' and 'full_name' exist, + # even when migrating down: + # + # class SplitNameMigration < ActiveRecord::Migration[8.1] + # def change + # add_column :users, :first_name, :string + # add_column :users, :last_name, :string + # + # reversible do |dir| + # User.reset_column_information + # User.all.each do |u| + # dir.up { u.first_name, u.last_name = u.full_name.split(' ') } + # dir.down { u.full_name = "#{u.first_name} #{u.last_name}" } + # u.save + # end + # end + # + # revert { add_column :users, :full_name, :string } + # end + # end + # + # pkg:gem/activerecord#lib/active_record/migration.rb:914 + def reversible; end + + # Reverses the migration commands for the given block and + # the given migrations. + # + # The following migration will remove the table 'horses' + # and create the table 'apples' on the way up, and the reverse + # on the way down. + # + # class FixTLMigration < ActiveRecord::Migration[8.1] + # def change + # revert do + # create_table(:horses) do |t| + # t.text :content + # t.datetime :remind_at + # end + # end + # create_table(:apples) do |t| + # t.string :variety + # end + # end + # end + # + # Or equivalently, if +TenderloveMigration+ is defined as in the + # documentation for Migration: + # + # require_relative "20121212123456_tenderlove_migration" + # + # class FixupTLMigration < ActiveRecord::Migration[8.1] + # def change + # revert TenderloveMigration + # + # create_table(:apples) do |t| + # t.string :variety + # end + # end + # end + # + # This command can be nested. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:857 + def revert(*migration_classes, &block); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:874 + def reverting?; end + + # Runs the given migration classes. + # Last argument can specify options: + # + # - +:direction+ - Default is +:up+. + # - +:revert+ - Default is +false+. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:942 + def run(*migration_classes); end + + # Takes a message argument and outputs it as is. + # A second boolean argument can be passed to specify whether to indent or not. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1018 + def say(message, subitem = T.unsafe(nil)); end + + # Outputs text along with how long it took to run its block. + # If the block returns an integer it assumes it is the number of rows affected. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1024 + def say_with_time(message); end + + # Takes a block as an argument and suppresses any output generated by the block. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1034 + def suppress_messages; end + + # Builds a hash for use in ActiveRecord::Migration#proper_table_name using + # the Active Record object's table_name prefix and suffix + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1143 + def table_name_options(config = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:956 + def up; end + + # Used to specify an operation that is only run when migrating up + # (for example, populating a new column with its initial values). + # + # In the following example, the new column +published+ will be given + # the value +true+ for all existing records. + # + # class AddPublishedToPosts < ActiveRecord::Migration[8.1] + # def change + # add_column :posts, :published, :boolean, default: false + # up_only do + # execute "update posts set published = 'true'" + # end + # end + # end + # + # pkg:gem/activerecord#lib/active_record/migration.rb:933 + def up_only(&block); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:802 + def verbose; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:802 + def verbose=(val); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:803 + def version; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:803 + def version=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1006 + def write(text = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/migration.rb:1175 + def command_recorder; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1151 + def execute_block; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1159 + def format_arguments(arguments); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1171 + def internal_option?(option_name); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1179 + def respond_to_missing?(method, include_private = T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/active_record/migration.rb:629 + def [](version); end + + # Raises ActiveRecord::PendingMigrationError error if any migrations are pending + # for all database configurations in an environment. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:693 + def check_all_pending!; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:739 + def check_pending_migrations; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:633 + def current_version; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:684 + def delegate; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:684 + def delegate=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:685 + def disable_ddl_transaction; end + + # Disable the transaction wrapping this migration. + # You can still create your own transactions even after calling #disable_ddl_transaction! + # + # For more details read the {"Transactional Migrations" section above}[rdoc-ref:Migration]. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:735 + def disable_ddl_transaction!; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:685 + def disable_ddl_transaction=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:617 + def inherited(subclass); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:709 + def load_schema_if_pending!; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:717 + def maintain_test_schema!; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:723 + def method_missing(name, *, **, &); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:727 + def migrate(direction); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:687 + def nearest_delegate; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:639 + def valid_version_format?(version_string); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:802 + def verbose; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:802 + def verbose=(val); end + + private + + # pkg:gem/activerecord#lib/active_record/migration.rb:748 + def any_schema_needs_update?; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:754 + def db_configs_in_current_env; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:772 + def env; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:776 + def load_schema!; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:758 + def pending_migrations; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:786 + def respond_to_missing?(method, include_private = T.unsafe(nil)); end + end +end + +# This class is used to verify that all migrations have been run before +# loading a web page if config.active_record.migration_error is set to +:page_load+. +# +# pkg:gem/activerecord#lib/active_record/migration.rb:648 +class ActiveRecord::Migration::CheckPending + # pkg:gem/activerecord#lib/active_record/migration.rb:649 + def initialize(app, file_watcher: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:656 + def call(env); end + + private + + # pkg:gem/activerecord#lib/active_record/migration.rb:675 + def build_watcher(&block); end +end + +# = \Migration Command Recorder +# +# +ActiveRecord::Migration::CommandRecorder+ records commands done during +# a migration and knows how to reverse those commands. The CommandRecorder +# knows how to invert the following commands: +# +# * add_column +# * add_foreign_key +# * add_check_constraint +# * add_exclusion_constraint +# * add_unique_constraint +# * add_index +# * add_reference +# * add_timestamps +# * change_column_default (must supply a +:from+ and +:to+ option) +# * change_column_null +# * change_column_comment (must supply a +:from+ and +:to+ option) +# * change_table_comment (must supply a +:from+ and +:to+ option) +# * create_enum +# * create_join_table +# * create_virtual_table +# * create_table +# * disable_extension +# * drop_enum (must supply a list of values) +# * drop_join_table +# * drop_virtual_table (must supply options) +# * drop_table (must supply a block) +# * enable_extension +# * remove_column (must supply a type) +# * remove_columns (must supply a +:type+ option) +# * remove_foreign_key (must supply a second table) +# * remove_check_constraint +# * remove_exclusion_constraint +# * remove_unique_constraint +# * remove_index +# * remove_reference +# * remove_timestamps +# * rename_column +# * rename_enum +# * rename_enum_value (must supply a +:from+ and +:to+ option) +# * rename_index +# * rename_table +# * enable_index +# * disable_index +# +# pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:49 +class ActiveRecord::Migration::CommandRecorder + include ::ActiveRecord::Migration::JoinTable + include ::ActiveRecord::Migration::CommandRecorder::StraightReversions + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:70 + def initialize(delegate = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:136 + def add_belongs_to(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def add_check_constraint(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def add_column(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def add_enum_value(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def add_exclusion_constraint(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def add_foreign_key(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def add_index(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def add_reference(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def add_timestamps(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def add_unique_constraint(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def change_column(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def change_column_comment(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def change_column_default(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def change_column_null(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:139 + def change_table(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def change_table_comment(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:68 + def commands; end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:68 + def commands=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def create_enum(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def create_join_table(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def create_schema(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def create_table(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def create_virtual_table(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:68 + def delegate; end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:68 + def delegate=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def disable_extension(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def disable_index(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def drop_enum(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def drop_join_table(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def drop_schema(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def drop_table(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def drop_virtual_table(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def enable_extension(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def enable_index(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def execute(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def execute_block(*args, **, &block); end + + # Returns the inverse of the given command. For example: + # + # recorder.inverse_of(:rename_table, [:old, :new]) + # # => [:rename_table, [:new, :old]] + # + # If the inverse of a command requires several commands, returns array of commands. + # + # recorder.inverse_of(:remove_columns, [:some_table, :foo, :bar, type: :string]) + # # => [[:add_column, :some_table, :foo, :string], [:add_column, :some_table, :bar, :string]] + # + # This method will raise an +IrreversibleMigration+ exception if it cannot + # invert the +command+. + # + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:117 + def inverse_of(command, args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:284 + def invert_add_belongs_to(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:285 + def invert_remove_belongs_to(args, &block); end + + # Record +command+. +command+ should be a method name and arguments. + # For example: + # + # recorder.record(:method_name, [:arg1, :arg2]) + # + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:97 + def record(*command, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:137 + def remove_belongs_to(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def remove_check_constraint(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def remove_column(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def remove_columns(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def remove_exclusion_constraint(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def remove_foreign_key(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def remove_index(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def remove_reference(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def remove_timestamps(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def remove_unique_constraint(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def rename_column(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def rename_enum(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def rename_enum_value(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def rename_index(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def rename_table(*args, **, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:151 + def replay(migration); end + + # While executing the given block, the recorded will be in reverting mode. + # All commands recorded will end up being recorded reverted + # and in reverse order. + # For example: + # + # recorder.revert{ recorder.record(:rename_table, [:old, :new]) } + # # same effect as recorder.record(:rename_table, [:new, :old]) + # + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:83 + def revert; end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:68 + def reverting; end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:68 + def reverting=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:129 + def transaction(*args, **, &block); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:349 + def invert_add_check_constraint(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:302 + def invert_add_column(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:309 + def invert_add_foreign_key(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:371 + def invert_add_unique_constraint(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:329 + def invert_change_column_comment(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:287 + def invert_change_column_default(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:297 + def invert_change_column_null(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:339 + def invert_change_table_comment(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:210 + def invert_create_table(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:194 + def invert_disable_index(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:385 + def invert_drop_enum(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:217 + def invert_drop_table(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:412 + def invert_drop_virtual_table(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:189 + def invert_enable_index(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:357 + def invert_remove_check_constraint(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:241 + def invert_remove_column(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:248 + def invert_remove_columns(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:366 + def invert_remove_exclusion_constraint(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:314 + def invert_remove_foreign_key(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:266 + def invert_remove_index(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:378 + def invert_remove_unique_constraint(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:261 + def invert_rename_column(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:391 + def invert_rename_enum(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:401 + def invert_rename_enum_value(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:256 + def invert_rename_index(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:234 + def invert_rename_table(args); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:199 + def invert_transaction(args, &block); end + + # Forwards any missing method call to the \target. + # + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:423 + def method_missing(method, *, **, &); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:418 + def respond_to_missing?(method, _); end +end + +# pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:50 +ActiveRecord::Migration::CommandRecorder::ReversibleAndIrreversibleMethods = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:158 +module ActiveRecord::Migration::CommandRecorder::StraightReversions + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_add_check_constraint(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_add_column(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_add_exclusion_constraint(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_add_foreign_key(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_add_index(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_add_reference(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_add_timestamps(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_add_unique_constraint(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_create_enum(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_create_join_table(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_create_schema(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_create_table(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_create_virtual_table(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_disable_extension(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_drop_enum(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_drop_join_table(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_drop_schema(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_drop_table(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_drop_virtual_table(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_enable_extension(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_execute_block(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_remove_check_constraint(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_remove_column(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_remove_exclusion_constraint(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_remove_foreign_key(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_remove_index(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_remove_reference(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_remove_timestamps(args, &block); end + + # pkg:gem/activerecord#lib/active_record/migration/command_recorder.rb:178 + def invert_remove_unique_constraint(args, &block); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:5 +module ActiveRecord::Migration::Compatibility + class << self + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:6 + def find(version); end + end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:428 +class ActiveRecord::Migration::Compatibility::V4_2 < ::ActiveRecord::Migration::Compatibility::V5_0 + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:450 + def add_belongs_to(table_name, ref_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:446 + def add_reference(table_name, ref_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:452 + def add_timestamps(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:457 + def index_exists?(table_name, column_name = T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:468 + def remove_index(table_name, column_name = T.unsafe(nil), **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:474 + def compatible_table_definition(t); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:479 + def index_name_for_remove(table_name, column_name, options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:429 +module ActiveRecord::Migration::Compatibility::V4_2::TableDefinition + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:434 + def belongs_to(*, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:430 + def references(*, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:436 + def timestamps(**options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:442 + def raise_on_if_exist_options(options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:361 +class ActiveRecord::Migration::Compatibility::V5_0 < ::ActiveRecord::Migration::Compatibility::V5_1 + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:419 + def add_belongs_to(table_name, ref_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:406 + def add_column(table_name, column_name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:416 + def add_reference(table_name, ref_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:401 + def create_join_table(table_1, table_2, column_options: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:378 + def create_table(table_name, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:422 + def compatible_table_definition(t); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:362 +module ActiveRecord::Migration::Compatibility::V5_0::TableDefinition + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:371 + def belongs_to(*args, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:363 + def primary_key(name, type = T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:368 + def references(*args, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:374 + def raise_on_if_exist_options(options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:340 +class ActiveRecord::Migration::Compatibility::V5_1 < ::ActiveRecord::Migration::Compatibility::V5_2 + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:341 + def change_column(table_name, column_name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:352 + def create_table(table_name, **options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:288 +class ActiveRecord::Migration::Compatibility::V5_2 < ::ActiveRecord::Migration::Compatibility::V6_0 + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:322 + def add_timestamps(table_name, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:333 + def command_recorder; end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:328 + def compatible_table_definition(t); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:308 +module ActiveRecord::Migration::Compatibility::V5_2::CommandRecorder + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:313 + def invert_change_column_comment(args); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:317 + def invert_change_table_comment(args); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:309 + def invert_transaction(args, &block); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:289 +module ActiveRecord::Migration::Compatibility::V5_2::TableDefinition + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:295 + def column(name, type, index: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:290 + def timestamps(**options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:304 + def raise_on_duplicate_column(name); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:301 + def raise_on_if_exist_options(options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:247 +class ActiveRecord::Migration::Compatibility::V6_0 < ::ActiveRecord::Migration::Compatibility::V6_1 + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:279 + def add_belongs_to(table_name, ref_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:271 + def add_reference(table_name, ref_name, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:282 + def compatible_table_definition(t); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:248 +class ActiveRecord::Migration::Compatibility::V6_0::ReferenceDefinition < ::ActiveRecord::ConnectionAdapters::ReferenceDefinition + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:249 + def index_options(table_name); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:254 +module ActiveRecord::Migration::Compatibility::V6_0::TableDefinition + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:259 + def belongs_to(*args, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:261 + def column(name, type, index: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:255 + def references(*args, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:267 + def raise_on_if_exist_options(options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:186 +class ActiveRecord::Migration::Compatibility::V6_1 < ::ActiveRecord::Migration::Compatibility::V7_0 + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:201 + def add_column(table_name, column_name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:210 + def change_column(table_name, column_name, type, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:241 + def compatible_table_definition(t); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:187 +class ActiveRecord::Migration::Compatibility::V6_1::PostgreSQLCompat + class << self + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:188 + def compatible_timestamp_type(type, connection); end + end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:219 +module ActiveRecord::Migration::Compatibility::V6_1::TableDefinition + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:225 + def change(name, type, index: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:230 + def column(name, type, index: T.unsafe(nil), **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:220 + def new_column_definition(name, type, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:236 + def raise_on_if_exist_options(options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:64 +class ActiveRecord::Migration::Compatibility::V7_0 < ::ActiveRecord::Migration::Compatibility::V7_1 + include ::ActiveRecord::Migration::Compatibility::V7_0::LegacyIndexName + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:138 + def add_belongs_to(table_name, ref_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:124 + def add_column(table_name, column_name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:172 + def add_foreign_key(from_table, to_table, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:129 + def add_index(table_name, column_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:134 + def add_reference(table_name, ref_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:153 + def change_column(table_name, column_name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:161 + def change_column_null(table_name, column_name, null, default = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:140 + def create_table(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:165 + def disable_extension(name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:147 + def rename_table(table_name, new_name, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:180 + def compatible_table_definition(t); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:65 +module ActiveRecord::Migration::Compatibility::V7_0::LegacyIndexName + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:89 + def expression_column_name?(column_name); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:81 + def index_name_options(column_names); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:67 + def legacy_index_name(table_name, options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:94 +module ActiveRecord::Migration::Compatibility::V7_0::TableDefinition + include ::ActiveRecord::Migration::Compatibility::V7_0::LegacyIndexName + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:102 + def change(name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:97 + def column(name, type, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:107 + def index(column_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:112 + def references(*args, **options); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:118 + def raise_on_if_exist_options(options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:61 +class ActiveRecord::Migration::Compatibility::V7_1 < ::ActiveRecord::Migration::Compatibility::V7_2; end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:58 +class ActiveRecord::Migration::Compatibility::V7_2 < ::ActiveRecord::Migration::Compatibility::V8_0; end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:34 +class ActiveRecord::Migration::Compatibility::V8_0 < ::ActiveRecord::Migration::Current + include ::ActiveRecord::Migration::Compatibility::V8_0::RemoveForeignKeyColumnMatch + + private + + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:52 + def compatible_table_definition(t); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:35 +module ActiveRecord::Migration::Compatibility::V8_0::RemoveForeignKeyColumnMatch + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:36 + def remove_foreign_key(*args, **options); end +end + +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:42 +module ActiveRecord::Migration::Compatibility::V8_0::TableDefinition + # pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:43 + def remove_foreign_key(to_table = T.unsafe(nil), **options); end +end + +# This file exists to ensure that old migrations run the same way they did before a Rails upgrade. +# e.g. if you write a migration on Rails 6.1, then upgrade to Rails 7, the migration should do the same thing to your +# database as it did when you were running Rails 6.1 +# +# "Current" is an alias for `ActiveRecord::Migration`, it represents the current Rails version. +# New migration functionality that will never be backward compatible should be added directly to `ActiveRecord::Migration`. +# +# There are classes for each prior Rails version. Each class descends from the *next* Rails version, so: +# 5.2 < 6.0 < 6.1 < 7.0 < 7.1 < 7.2 < 8.0 < 8.1 +# +# If you are introducing new migration functionality that should only apply from Rails 7 onward, then you should +# find the class that immediately precedes it (6.1), and override the relevant migration methods to undo your changes. +# +# For example, Rails 6 added a default value for the `precision` option on datetime columns. So in this file, the `V5_2` +# class sets the value of `precision` to `nil` if it's not explicitly provided. This way, the default value will not apply +# for migrations written for 5.2, but will for migrations written for 6.0. +# +# pkg:gem/activerecord#lib/active_record/migration/compatibility.rb:32 +ActiveRecord::Migration::Compatibility::V8_1 = ActiveRecord::Migration::Current + +# This must be defined before the inherited hook, below +# +# pkg:gem/activerecord#lib/active_record/migration.rb:579 +class ActiveRecord::Migration::Current < ::ActiveRecord::Migration + # pkg:gem/activerecord#lib/active_record/migration.rb:588 + def change_table(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:612 + def compatible_table_definition(t); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:596 + def create_join_table(table_1, table_2, **options); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:580 + def create_table(table_name, **options); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:604 + def drop_table(*table_names, **options); end +end + +# This class is used by the schema dumper to format versions information. +# +# The class receives the current +connection+ when initialized. +# +# pkg:gem/activerecord#lib/active_record/migration/default_schema_versions_formatter.rb:8 +class ActiveRecord::Migration::DefaultSchemaVersionsFormatter + # pkg:gem/activerecord#lib/active_record/migration/default_schema_versions_formatter.rb:9 + def initialize(connection); end + + # pkg:gem/activerecord#lib/active_record/migration/default_schema_versions_formatter.rb:13 + def format(versions); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/default_schema_versions_formatter.rb:27 + def connection; end +end + +# The default strategy for executing migrations. Delegates method calls +# to the connection adapter. +# +# pkg:gem/activerecord#lib/active_record/migration/default_strategy.rb:7 +class ActiveRecord::Migration::DefaultStrategy < ::ActiveRecord::Migration::ExecutionStrategy + private + + # pkg:gem/activerecord#lib/active_record/migration/default_strategy.rb:17 + def connection; end + + # pkg:gem/activerecord#lib/active_record/migration/default_strategy.rb:9 + def method_missing(method, *, **, &); end + + # pkg:gem/activerecord#lib/active_record/migration/default_strategy.rb:13 + def respond_to_missing?(method, include_private = T.unsafe(nil)); end +end + +# ExecutionStrategy is used by the migration to respond to any method calls +# that the migration class does not implement directly. This is the base strategy. +# All strategies should inherit from this class. +# +# The ExecutionStrategy receives the current +migration+ when initialized. +# +# pkg:gem/activerecord#lib/active_record/migration/execution_strategy.rb:10 +class ActiveRecord::Migration::ExecutionStrategy + # pkg:gem/activerecord#lib/active_record/migration/execution_strategy.rb:11 + def initialize(migration); end + + private + + # pkg:gem/activerecord#lib/active_record/migration/execution_strategy.rb:16 + def migration; end +end + +# pkg:gem/activerecord#lib/active_record/migration/join_table.rb:5 +module ActiveRecord::Migration::JoinTable + private + + # pkg:gem/activerecord#lib/active_record/migration/join_table.rb:7 + def find_join_table_name(table_1, table_2, options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration/join_table.rb:11 + def join_table_name(table_1, table_2); end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:637 +ActiveRecord::Migration::MigrationFilenameRegexp = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activerecord#lib/active_record/migration.rb:878 +class ActiveRecord::Migration::ReversibleBlockHelper < ::Struct + # pkg:gem/activerecord#lib/active_record/migration.rb:883 + def down; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:878 + def reverting; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:878 + def reverting=(_); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:879 + def up; end + + class << self + # pkg:gem/activerecord#lib/active_record/migration.rb:878 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:878 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:878 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:878 + def members; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:878 + def new(*_arg0); end + end +end + +# = \Migration \Context +# +# MigrationContext sets the context in which a migration is run. +# +# A migration context requires the path to the migrations is set +# in the +migrations_paths+ parameter. Optionally a +schema_migration+ +# class can be provided. Multiple database applications will instantiate +# a +SchemaMigration+ object per database. From the Rake tasks, \Rails will +# handle this for you. +# +# pkg:gem/activerecord#lib/active_record/migration.rb:1220 +class ActiveRecord::MigrationContext + # pkg:gem/activerecord#lib/active_record/migration.rb:1223 + def initialize(migrations_paths, schema_migration = T.unsafe(nil), internal_metadata = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1349 + def current_environment; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1299 + def current_version; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1273 + def down(target_version = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1259 + def forward(steps = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1291 + def get_all_versions; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1221 + def internal_metadata; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1357 + def last_stored_environment; end + + # Runs the migrations in the +migrations_path+. + # + # If +target_version+ is +nil+, +migrate+ will run +up+. + # + # If the +current_version+ and +target_version+ are both + # 0 then an empty array will be returned and no migrations + # will be run. + # + # If the +current_version+ in the schema is greater than + # the +target_version+, then +down+ will be run. + # + # If none of the conditions are met, +up+ will be run with + # the +target_version+. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1242 + def migrate(target_version = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1312 + def migrations; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1221 + def migrations_paths; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1328 + def migrations_status; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1304 + def needs_migration?; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1287 + def open; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1308 + def pending_migration_versions; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1353 + def protected_environment?; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1255 + def rollback(steps = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1283 + def run(direction, target_version); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1221 + def schema_migration; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1263 + def up(target_version = T.unsafe(nil), &block); end + + private + + # pkg:gem/activerecord#lib/active_record/migration.rb:1369 + def connection; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1373 + def connection_pool; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1377 + def migration_files; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1394 + def move(direction, steps); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1382 + def parse_migration_filename(filename); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1390 + def valid_migration_timestamp?(version); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1386 + def validate_timestamp?; end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:10 +class ActiveRecord::MigrationError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/migration.rb:11 + def initialize(message = T.unsafe(nil)); end +end + +# MigrationProxy is used to defer loading of the actual migration classes +# until they are needed +# +# pkg:gem/activerecord#lib/active_record/migration.rb:1186 +class ActiveRecord::MigrationProxy < ::Struct + # pkg:gem/activerecord#lib/active_record/migration.rb:1187 + def initialize(name, version, filename, scope); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1196 + def announce(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1192 + def basename; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1196 + def disable_ddl_transaction(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def filename; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def filename=(_); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1196 + def migrate(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def name; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def name=(_); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def scope; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def scope=(_); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def version; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def version=(_); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1196 + def write(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/migration.rb:1203 + def load_migration; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1199 + def migration; end + + class << self + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def members; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1186 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:1414 +class ActiveRecord::Migrator + # pkg:gem/activerecord#lib/active_record/migration.rb:1430 + def initialize(direction, migrations, schema_migration, internal_metadata, target_version = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1451 + def current; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1448 + def current_migration; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1444 + def current_version; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1493 + def load_migrated; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1461 + def migrate; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1489 + def migrated; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1480 + def migrations; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1484 + def pending_migrations; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1453 + def run; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1469 + def runnable; end + + private + + # pkg:gem/activerecord#lib/active_record/migration.rb:1498 + def connection; end + + # Wrap the migration in a transaction only if supported by the adapter. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1594 + def ddl_transaction(migration, &block); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1589 + def down?; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1537 + def execute_migration_in_transaction(migration); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1559 + def finish; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1626 + def generate_migrator_advisory_lock_id; end + + # Return true if a valid version is not provided. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1533 + def invalid_target?; end + + # Used for running multiple migrations up to or down to a certain value. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1512 + def migrate_without_lock; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1528 + def ran?(migration); end + + # Stores the current environment in the database. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1522 + def record_environment; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1575 + def record_version_state_after_migrating(version); end + + # Used for running a specific migration. + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1503 + def run_without_lock; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1563 + def start; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1555 + def target; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1585 + def up?; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1606 + def use_advisory_lock?; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1602 + def use_transaction?(migration); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1567 + def validate(migrations); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1610 + def with_advisory_lock; end + + class << self + # For cases where a table doesn't exist like loading from schema cache + # + # pkg:gem/activerecord#lib/active_record/migration.rb:1419 + def current_version; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1416 + def migrations_paths; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:1416 + def migrations_paths=(_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:1625 +ActiveRecord::Migrator::MIGRATOR_SALT = T.let(T.unsafe(nil), Integer) + +# Raised when a foreign key constraint cannot be added because the column type does not match the referenced column type. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:237 +class ActiveRecord::MismatchedForeignKey < ::ActiveRecord::StatementInvalid + # pkg:gem/activerecord#lib/active_record/errors.rb:238 + def initialize(message: T.unsafe(nil), sql: T.unsafe(nil), binds: T.unsafe(nil), table: T.unsafe(nil), foreign_key: T.unsafe(nil), target_table: T.unsafe(nil), primary_key: T.unsafe(nil), primary_key_column: T.unsafe(nil), query_parser: T.unsafe(nil), connection_pool: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:274 + def set_query(sql, binds); end +end + +# MissingRequiredOrderError is raised when a relation requires ordering but +# lacks any +order+ values in scope or any model order columns to use. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:565 +class ActiveRecord::MissingRequiredOrderError < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/model_schema.rb:6 +module ActiveRecord::ModelSchema + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::ModelSchema::ClassMethods + + class << self + # Derives the join table name for +first_table+ and +second_table+. The + # table names appear in alphabetical order. A common prefix is removed + # (useful for namespaced models like Music::Artist and Music::Record): + # + # artists, records => artists_records + # records, artists => artists_records + # music_artists, music_records => music_artists_records + # music.artists, music.records => music.artists_records + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:199 + def derive_join_table_name(first_table, second_table); end + end + + module GeneratedClassMethods + def immutable_strings_by_default; end + def immutable_strings_by_default=(value); end + def immutable_strings_by_default?; end + def implicit_order_column; end + def implicit_order_column=(value); end + def implicit_order_column?; end + def inheritance_column; end + def inheritance_column=(value); end + def inheritance_column?; end + def internal_metadata_table_name; end + def internal_metadata_table_name=(value); end + def internal_metadata_table_name?; end + def pluralize_table_names; end + def pluralize_table_names=(value); end + def pluralize_table_names?; end + def primary_key_prefix_type; end + def primary_key_prefix_type=(value); end + def primary_key_prefix_type?; end + def schema_migrations_table_name; end + def schema_migrations_table_name=(value); end + def schema_migrations_table_name?; end + def table_name_prefix; end + def table_name_prefix=(value); end + def table_name_prefix?; end + def table_name_suffix; end + def table_name_suffix=(value); end + def table_name_suffix?; end + end + + module GeneratedInstanceMethods + def pluralize_table_names; end + def pluralize_table_names?; end + def primary_key_prefix_type; end + def primary_key_prefix_type?; end + def table_name_prefix; end + def table_name_prefix?; end + def table_name_suffix; end + def table_name_suffix?; end + end +end + +# pkg:gem/activerecord#lib/active_record/model_schema.rb:203 +module ActiveRecord::ModelSchema::ClassMethods + # pkg:gem/activerecord#lib/active_record/model_schema.rb:452 + def _returning_columns_for_insert(connection); end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:436 + def attributes_builder; end + + # Returns a hash where the keys are column names and the values are + # default values when instantiating the Active Record object for this table. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:488 + def column_defaults; end + + # Returns the column object for the named attribute. + # Returns an ActiveRecord::ConnectionAdapters::NullColumn if the + # named attribute does not exist. + # + # class Person < ActiveRecord::Base + # end + # + # person = Person.new + # person.column_for_attribute(:name) # the result depends on the ConnectionAdapter + # # => # + # + # person.column_for_attribute(:nothing) + # # => #, ...> + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:479 + def column_for_attribute(name); end + + # Returns an array of column names as strings. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:494 + def column_names; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:448 + def columns; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:443 + def columns_hash; end + + # Returns an array of column objects where the primary id, all columns ending in "_id" or "_count", + # and columns used for single table inheritance have been removed. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:505 + def content_columns; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:305 + def full_table_name_prefix; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:309 + def full_table_name_suffix; end + + # The list of columns names the model should ignore. Ignored columns won't have attribute + # accessors defined, and won't be referenced in SQL queries. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:334 + def ignored_columns; end + + # Sets the columns names the model should ignore. Ignored columns won't have attribute + # accessors defined, and won't be referenced in SQL queries. + # + # A common usage pattern for this method is to ensure all references to an attribute + # have been removed and deployed, before a migration to drop the column from the database + # has been deployed and run. Using this two step approach to dropping columns ensures there + # is no code that raises errors due to having a cached schema in memory at the time the + # schema migration is run. + # + # For example, given a model where you want to drop the "category" attribute, first mark it + # as ignored: + # + # class Project < ActiveRecord::Base + # # schema: + # # id :bigint + # # name :string, limit: 255 + # # category :string, limit: 255 + # + # self.ignored_columns += [:category] + # end + # + # The schema still contains "category", but now the model omits it, so any meta-driven code or + # schema caching will not attempt to use the column: + # + # Project.columns_hash["category"] => nil + # + # You will get an error if accessing that attribute directly, so ensure all usages of the + # column are removed (automated tests can help you find any usages). + # + # user = Project.create!(name: "First Project") + # user.category # => raises NoMethodError + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:375 + def ignored_columns=(columns); end + + # Load the model's schema information either from the schema cache + # or directly from the database. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:550 + def load_schema; end + + # Returns the next value that will be used as the primary key on + # an insert statement. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:427 + def next_sequence_value; end + + # The list of columns names the model should allow. Only columns are used to define + # attribute accessors, and are referenced in SQL queries. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:340 + def only_columns; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:381 + def only_columns=(columns); end + + # Determines if the primary key values should be selected from their + # corresponding sequence before the insert statement. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:421 + def prefetch_primary_key?; end + + # The array of names of environments where destructive actions should be prohibited. By default, + # the value is ["production"]. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:315 + def protected_environments; end + + # Sets an array of names of environments where destructive actions should be prohibited. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:324 + def protected_environments=(environments); end + + # Returns a quoted version of the table name. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:288 + def quoted_table_name; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:328 + def real_inheritance_column=(value); end + + # Resets all the cached information about columns, which will cause them + # to be reloaded on the next request. + # + # The most common usage pattern for this method is probably in a migration, + # when just after creating a table you want to populate it with some default + # values, e.g.: + # + # class CreateJobLevels < ActiveRecord::Migration[8.1] + # def up + # create_table :job_levels do |t| + # t.integer :id + # t.string :name + # + # t.timestamps + # end + # + # JobLevel.reset_column_information + # %w{assistant executive manager director}.each do |type| + # JobLevel.create(name: type) + # end + # end + # + # def down + # drop_table :job_levels + # end + # end + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:539 + def reset_column_information; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:395 + def reset_sequence_name; end + + # Computes the table name, (re)sets it internally, and returns it. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:293 + def reset_table_name; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:387 + def sequence_name; end + + # Sets the name of the sequence to use when generating ids to the given + # value, or (if the value is +nil+ or +false+) to the value returned by the + # given block. This is required for Oracle and is useful for any + # database which relies on sequences for primary key generation. + # + # If a sequence name is not explicitly set when using Oracle, + # it will default to the commonly used pattern of: #{table_name}_seq + # + # If a sequence name is not explicitly set when using PostgreSQL, it + # will discover the sequence corresponding to your primary key for you. + # + # class Project < ActiveRecord::Base + # self.sequence_name = "projectseq" # default would have been "project_seq" + # end + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:414 + def sequence_name=(value); end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:498 + def symbol_column_to_string(name_symbol); end + + # Indicates whether the table associated with this class exists + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:432 + def table_exists?; end + + # Guesses the table name (in forced lower-case) based on the name of the class in the + # inheritance hierarchy descending directly from ActiveRecord::Base. So if the hierarchy + # looks like: Reply < Message < ActiveRecord::Base, then Message is used + # to guess the table name even when called on Reply. The rules used to do the guess + # are handled by the Inflector class in Active Support, which knows almost all common + # English inflections. You can add new inflections in config/initializers/inflections.rb. + # + # Nested classes are given table names prefixed by the singular form of + # the parent's table name. Enclosing modules are not considered. + # + # ==== Examples + # + # class Invoice < ActiveRecord::Base + # end + # + # file class table_name + # invoice.rb Invoice invoices + # + # class Invoice < ActiveRecord::Base + # class Lineitem < ActiveRecord::Base + # end + # end + # + # file class table_name + # invoice.rb Invoice::Lineitem invoice_lineitems + # + # module Invoice + # class Lineitem < ActiveRecord::Base + # end + # end + # + # file class table_name + # invoice/lineitem.rb Invoice::Lineitem lineitems + # + # Additionally, the class-level +table_name_prefix+ is prepended and the + # +table_name_suffix+ is appended. So if you have "myapp_" as a prefix, + # the table name guess for an Invoice class becomes "myapp_invoices". + # Invoice::Lineitem becomes "myapp_invoice_lineitems". + # + # Active Model Naming's +model_name+ is the base name used to guess the + # table name. In case a custom Active Model Name is defined, it will be + # used for the table name as well: + # + # class PostRecord < ActiveRecord::Base + # class << self + # def model_name + # ActiveModel::Name.new(self, nil, "Post") + # end + # end + # end + # + # PostRecord.table_name + # # => "posts" + # + # You can also set your own table name explicitly: + # + # class Mouse < ActiveRecord::Base + # self.table_name = "mice" + # end + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:263 + def table_name; end + + # Sets the table name explicitly. Example: + # + # class Project < ActiveRecord::Base + # self.table_name = "project" + # end + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:273 + def table_name=(value); end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:462 + def yaml_encoder; end + + protected + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:565 + def initialize_load_schema_monitor; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:569 + def reload_schema_from_cache(recursive = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:654 + def check_model_columns(columns_present); end + + # Computes and returns a table name according to default conventions. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:627 + def compute_table_name; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:590 + def inherited(child_class); end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:604 + def load_schema!; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:600 + def schema_loaded?; end + + # pkg:gem/activerecord#lib/active_record/model_schema.rb:643 + def type_for_column(connection, column); end + + # Guesses the table name, but does not decorate it with prefix and suffix information. + # + # pkg:gem/activerecord#lib/active_record/model_schema.rb:621 + def undecorated_table_name(model_name); end +end + +# Raised when there are multiple errors while doing a mass assignment through the +# {ActiveRecord::Base#attributes=}[rdoc-ref:ActiveModel::AttributeAssignment#attributes=] +# method. The exception has an +errors+ property that contains an array of AttributeAssignmentError +# objects, each corresponding to the error while assigning to an attribute. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:470 +class ActiveRecord::MultiparameterAssignmentErrors < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/errors.rb:473 + def initialize(errors = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:471 + def errors; end +end + +# pkg:gem/activerecord#lib/active_record/nested_attributes.rb:8 +module ActiveRecord::NestedAttributes + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::NestedAttributes::ClassMethods + + # Returns ActiveRecord::AutosaveAssociation#marked_for_destruction? It's + # used in conjunction with fields_for to build a form element for the + # destruction of this association. + # + # See ActionView::Helpers::FormHelper#fields_for for more info. + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:405 + def _destroy; end + + private + + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:618 + def allow_destroy?(association_name); end + + # Assigns the given attributes to the collection association. + # + # Hashes with an :id value matching an existing associated record + # will update that record. Hashes without an :id value will build + # a new record for the association. Hashes with a matching :id + # value and a :_destroy key set to a truthy value will mark the + # matched record for destruction. + # + # For example: + # + # assign_nested_attributes_for_collection_association(:people, { + # '1' => { id: '1', name: 'Peter' }, + # '2' => { name: 'John' }, + # '3' => { id: '2', _destroy: true } + # }) + # + # Will update the name of the Person with ID 1, build a new associated + # person with the name 'John', and mark the associated Person with ID 2 + # for destruction. + # + # Also accepts an Array of attribute hashes: + # + # assign_nested_attributes_for_collection_association(:people, [ + # { id: '1', name: 'Peter' }, + # { name: 'John' }, + # { id: '2', _destroy: true } + # ]) + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:491 + def assign_nested_attributes_for_collection_association(association_name, attributes_collection); end + + # Assigns the given attributes to the association. + # + # If an associated record does not yet exist, one will be instantiated. If + # an associated record already exists, the method's behavior depends on + # the value of the update_only option. If update_only is +false+ and the + # given attributes include an :id that matches the existing record's + # id, then the existing record will be modified. If no :id is provided + # it will be replaced with a new record. If update_only is +true+ the existing + # record will be modified regardless of whether an :id is provided. + # + # If the given attributes include a matching :id attribute, or + # update_only is true, and a :_destroy key set to a truthy value, + # then the existing record will be marked for destruction. + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:427 + def assign_nested_attributes_for_one_to_one_association(association_name, attributes); end + + # Updates a record with the +attributes+ or marks it for destruction if + # +allow_destroy+ is +true+ and has_destroy_flag? returns +true+. + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:580 + def assign_to_or_mark_for_destruction(record, attributes, allow_destroy); end + + # Determines if a record with the particular +attributes+ should be + # rejected by calling the reject_if Symbol or Proc (if defined). + # The reject_if option is defined by +accepts_nested_attributes_for+. + # + # Returns false if there is a +destroy_flag+ on the attributes. + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:602 + def call_reject_if(association_name, attributes); end + + # Takes in a limit and checks if the attributes_collection has too many + # records. It accepts limit in the form of symbol, proc, or + # number-like object (anything that can be compared with an integer). + # + # Raises TooManyRecords error if the attributes_collection is + # larger than the limit. + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:560 + def check_record_limit!(limit, attributes_collection); end + + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:628 + def find_record_by_id(klass, records, id); end + + # Determines if a hash contains a truthy _destroy key. + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:586 + def has_destroy_flag?(hash); end + + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:622 + def raise_nested_attributes_record_not_found!(association_name, record_id); end + + # Determines if a new record should be rejected by checking + # has_destroy_flag? or if a :reject_if proc exists for this + # association and evaluates to +true+. + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:593 + def reject_new_record?(association_name, attributes); end + + # Only take into account the destroy flag if :allow_destroy is true + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:614 + def will_be_destroyed?(association_name, attributes); end + + module GeneratedClassMethods + def nested_attributes_options; end + def nested_attributes_options=(value); end + def nested_attributes_options?; end + end + + module GeneratedInstanceMethods + def nested_attributes_options; end + def nested_attributes_options?; end + end +end + +# = Active Record Nested \Attributes +# +# Nested attributes allow you to save attributes on associated records +# through the parent. By default nested attribute updating is turned off +# and you can enable it using the accepts_nested_attributes_for class +# method. When you enable nested attributes an attribute writer is +# defined on the model. +# +# The attribute writer is named after the association, which means that +# in the following example, two new methods are added to your model: +# +# author_attributes=(attributes) and +# pages_attributes=(attributes). +# +# class Book < ActiveRecord::Base +# has_one :author +# has_many :pages +# +# accepts_nested_attributes_for :author, :pages +# end +# +# Note that the :autosave option is automatically enabled on every +# association that accepts_nested_attributes_for is used for. +# +# === One-to-one +# +# Consider a Member model that has one Avatar: +# +# class Member < ActiveRecord::Base +# has_one :avatar +# accepts_nested_attributes_for :avatar +# end +# +# Enabling nested attributes on a one-to-one association allows you to +# create the member and avatar in one go: +# +# params = { member: { name: 'Jack', avatar_attributes: { icon: 'smiling' } } } +# member = Member.create(params[:member]) +# member.avatar.id # => 2 +# member.avatar.icon # => 'smiling' +# +# It also allows you to update the avatar through the member: +# +# params = { member: { avatar_attributes: { id: '2', icon: 'sad' } } } +# member.update params[:member] +# member.avatar.icon # => 'sad' +# +# If you want to update the current avatar without providing the id, you must add :update_only option. +# +# class Member < ActiveRecord::Base +# has_one :avatar +# accepts_nested_attributes_for :avatar, update_only: true +# end +# +# params = { member: { avatar_attributes: { icon: 'sad' } } } +# member.update params[:member] +# member.avatar.id # => 2 +# member.avatar.icon # => 'sad' +# +# By default you will only be able to set and update attributes on the +# associated model. If you want to destroy the associated model through the +# attributes hash, you have to enable it first using the +# :allow_destroy option. +# +# class Member < ActiveRecord::Base +# has_one :avatar +# accepts_nested_attributes_for :avatar, allow_destroy: true +# end +# +# Now, when you add the _destroy key to the attributes hash, with a +# value that evaluates to +true+, you will destroy the associated model: +# +# member.avatar_attributes = { id: '2', _destroy: '1' } +# member.avatar.marked_for_destruction? # => true +# member.save +# member.reload.avatar # => nil +# +# Note that the model will _not_ be destroyed until the parent is saved. +# +# Also note that the model will not be destroyed unless you also specify +# its id in the updated hash. +# +# === One-to-many +# +# Consider a member that has a number of posts: +# +# class Member < ActiveRecord::Base +# has_many :posts +# accepts_nested_attributes_for :posts, allow_destroy: true +# end +# +# You can now set or update attributes on the associated posts through +# an attribute hash for a member: include the key +:posts_attributes+ +# with an array of hashes of post attributes as a value. +# +# For each hash that does _not_ have an id key a new record will +# be instantiated, unless the hash also contains a _destroy key +# that evaluates to +true+ and the :allow_destroy option is +# enabled. +# +# params = { member: { +# name: 'joe', posts_attributes: [ +# { title: 'Kari, the awesome Ruby documentation browser!' }, +# { title: 'The egalitarian assumption of the modern citizen' }, +# { title: '', _destroy: '1' } # this will be ignored +# ] +# }} +# +# member = Member.create(params[:member]) +# member.posts.length # => 2 +# member.posts.first.title # => 'Kari, the awesome Ruby documentation browser!' +# member.posts.second.title # => 'The egalitarian assumption of the modern citizen' +# +# You may also set a +:reject_if+ proc to silently ignore any new record +# hashes if they fail to pass your criteria. For example, the previous +# example could be rewritten as: +# +# class Member < ActiveRecord::Base +# has_many :posts +# accepts_nested_attributes_for :posts, reject_if: proc { |attributes| attributes['title'].blank? } +# end +# +# params = { member: { +# name: 'joe', posts_attributes: [ +# { title: 'Kari, the awesome Ruby documentation browser!' }, +# { title: 'The egalitarian assumption of the modern citizen' }, +# { title: '' } # this will be ignored because of the :reject_if proc +# ] +# }} +# +# member = Member.create(params[:member]) +# member.posts.length # => 2 +# member.posts.first.title # => 'Kari, the awesome Ruby documentation browser!' +# member.posts.second.title # => 'The egalitarian assumption of the modern citizen' +# +# Alternatively, +:reject_if+ also accepts a symbol for using methods: +# +# class Member < ActiveRecord::Base +# has_many :posts +# accepts_nested_attributes_for :posts, reject_if: :new_record? +# end +# +# class Member < ActiveRecord::Base +# has_many :posts +# accepts_nested_attributes_for :posts, reject_if: :reject_posts +# +# def reject_posts(attributes) +# attributes['title'].blank? +# end +# end +# +# If the hash contains an id key that matches an already +# associated record, the matching record will be modified: +# +# member.attributes = { +# name: 'Joe', +# posts_attributes: [ +# { id: 1, title: '[UPDATED] An, as of yet, undisclosed awesome Ruby documentation browser!' }, +# { id: 2, title: '[UPDATED] other post' } +# ] +# } +# +# member.posts.first.title # => '[UPDATED] An, as of yet, undisclosed awesome Ruby documentation browser!' +# member.posts.second.title # => '[UPDATED] other post' +# +# However, the above applies if the parent model is being updated as well. +# For example, if you wanted to create a +member+ named _joe_ and wanted to +# update the +posts+ at the same time, that would give an +# ActiveRecord::RecordNotFound error. +# +# By default the associated records are protected from being destroyed. If +# you want to destroy any of the associated records through the attributes +# hash, you have to enable it first using the :allow_destroy +# option. This will allow you to also use the _destroy key to +# destroy existing records: +# +# class Member < ActiveRecord::Base +# has_many :posts +# accepts_nested_attributes_for :posts, allow_destroy: true +# end +# +# params = { member: { +# posts_attributes: [{ id: '2', _destroy: '1' }] +# }} +# +# member.attributes = params[:member] +# member.posts.detect { |p| p.id == 2 }.marked_for_destruction? # => true +# member.posts.length # => 2 +# member.save +# member.reload.posts.length # => 1 +# +# Nested attributes for an associated collection can also be passed in +# the form of a hash of hashes instead of an array of hashes: +# +# Member.create( +# name: 'joe', +# posts_attributes: { +# first: { title: 'Foo' }, +# second: { title: 'Bar' } +# } +# ) +# +# has the same effect as +# +# Member.create( +# name: 'joe', +# posts_attributes: [ +# { title: 'Foo' }, +# { title: 'Bar' } +# ] +# ) +# +# The keys of the hash which is the value for +:posts_attributes+ are +# ignored in this case. +# However, it is not allowed to use 'id' or :id for one of +# such keys, otherwise the hash will be wrapped in an array and +# interpreted as an attribute hash for a single post. +# +# Passing attributes for an associated collection in the form of a hash +# of hashes can be used with hashes generated from HTTP/HTML parameters, +# where there may be no natural way to submit an array of hashes. +# +# === Saving +# +# All changes to models, including the destruction of those marked for +# destruction, are saved and destroyed automatically and atomically when +# the parent model is saved. This happens inside the transaction initiated +# by the parent's save method. See ActiveRecord::AutosaveAssociation. +# +# === Validating the presence of a parent model +# +# The +belongs_to+ association validates the presence of the parent model +# by default. You can disable this behavior by specifying optional: true. +# This can be used, for example, when conditionally validating the presence +# of the parent model: +# +# class Veterinarian < ActiveRecord::Base +# has_many :patients, inverse_of: :veterinarian +# accepts_nested_attributes_for :patients +# end +# +# class Patient < ActiveRecord::Base +# belongs_to :veterinarian, inverse_of: :patients, optional: true +# validates :veterinarian, presence: true, unless: -> { awaiting_intake } +# end +# +# Note that if you do not specify the +:inverse_of+ option, then +# Active Record will try to automatically guess the inverse association +# based on heuristics. +# +# For one-to-one nested associations, if you build the new (in-memory) +# child object yourself before assignment, then this module will not +# overwrite it, e.g.: +# +# class Member < ActiveRecord::Base +# has_one :avatar +# accepts_nested_attributes_for :avatar +# +# def avatar +# super || build_avatar(width: 200) +# end +# end +# +# member = Member.new +# member.avatar_attributes = {icon: 'sad'} +# member.avatar.width # => 200 +# +# === Creating forms with nested attributes +# +# Use ActionView::Helpers::FormHelper#fields_for to create form elements for +# nested attributes. +# +# Integration test params should reflect the structure of the form. For +# example: +# +# post members_path, params: { +# member: { +# name: 'joe', +# posts_attributes: { +# '0' => { title: 'Foo' }, +# '1' => { title: 'Bar' } +# } +# } +# } +# +# pkg:gem/activerecord#lib/active_record/nested_attributes.rb:302 +module ActiveRecord::NestedAttributes::ClassMethods + # Defines an attributes writer for the specified association(s). + # + # Supported options: + # [:allow_destroy] + # If true, destroys any members from the attributes hash with a + # _destroy key and a value that evaluates to +true+ + # (e.g. 1, '1', true, or 'true'). This option is false by default. + # [:reject_if] + # Allows you to specify a Proc or a Symbol pointing to a method + # that checks whether a record should be built for a certain attribute + # hash. The hash is passed to the supplied Proc or the method + # and it should return either +true+ or +false+. When no +:reject_if+ + # is specified, a record will be built for all attribute hashes, unless + # the :allow_destroy option is enabled and the hash has a + # _destroy value that evaluates to true. + # Passing :all_blank instead of a Proc will create a proc + # that will reject a record where all the attributes are blank excluding + # any value for +_destroy+. + # [:limit] + # Allows you to specify the maximum number of associated records that + # can be processed with the nested attributes. Limit also can be specified + # as a Proc or a Symbol pointing to a method that should return a number. + # If the size of the nested attributes array exceeds the specified limit, + # NestedAttributes::TooManyRecords exception is raised. If omitted, any + # number of associations can be processed. + # Note that the +:limit+ option is only applicable to one-to-many + # associations. + # [:update_only] + # For a one-to-one association, this option allows you to specify how + # nested attributes are going to be used when an associated record already + # exists. In general, an existing record may either be updated with the + # new set of attribute values or be replaced by a wholly new record + # containing those values. By default the +:update_only+ option is false + # and the nested attributes are used to update the existing record only + # if they include the record's :id value. Otherwise a new + # record will be instantiated and used to replace the existing one. + # However if the +:update_only+ option is true, the nested attributes + # are used to update the record's attributes always, regardless of + # whether the :id is present. The option is ignored for collection + # associations. + # + # Examples: + # # creates avatar_attributes= + # accepts_nested_attributes_for :avatar, reject_if: proc { |attributes| attributes['name'].blank? } + # # creates avatar_attributes= + # accepts_nested_attributes_for :avatar, reject_if: :all_blank + # # creates avatar_attributes= and posts_attributes= + # accepts_nested_attributes_for :avatar, :posts, allow_destroy: true + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:353 + def accepts_nested_attributes_for(*attr_names); end + + private + + # Generates a writer method for this association. Serves as a point for + # accessing the objects in the association. For example, this method + # could generate the following: + # + # def pirate_attributes=(attributes) + # assign_nested_attributes_for_one_to_one_association(:pirate, attributes) + # end + # + # This redirects the attempts to write objects in an association through + # the helper methods defined below. Makes it seem like the nested + # associations are just regular associations. + # + # pkg:gem/activerecord#lib/active_record/nested_attributes.rb:388 + def generate_association_writer(association_name, type); end +end + +# pkg:gem/activerecord#lib/active_record/nested_attributes.rb:303 +ActiveRecord::NestedAttributes::ClassMethods::REJECT_ALL_BLANK_PROC = T.let(T.unsafe(nil), Proc) + +# pkg:gem/activerecord#lib/active_record/nested_attributes.rb:9 +class ActiveRecord::NestedAttributes::TooManyRecords < ::ActiveRecord::ActiveRecordError; end + +# Attribute hash keys that should not be assigned as normal attributes. +# These hash keys are nested attributes implementation details. +# +# pkg:gem/activerecord#lib/active_record/nested_attributes.rb:412 +ActiveRecord::NestedAttributes::UNASSIGNABLE_KEYS = T.let(T.unsafe(nil), Array) + +# Raised when a given database does not exist. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:335 +class ActiveRecord::NoDatabaseError < ::ActiveRecord::StatementInvalid + include ::ActiveSupport::ActionableError + extend ::ActiveSupport::ActionableError::ClassMethods + + # pkg:gem/activerecord#lib/active_record/errors.rb:342 + def initialize(message = T.unsafe(nil), connection_pool: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:336 + def _actions; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:336 + def _actions=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:336 + def _actions?; end + + class << self + # pkg:gem/activerecord#lib/active_record/errors.rb:336 + def _actions; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:336 + def _actions=(value); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:336 + def _actions?; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:347 + def db_error(db_name); end + + private + + # pkg:gem/activerecord#lib/active_record/errors.rb:336 + def __class_attr__actions; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:336 + def __class_attr__actions=(new_value); end + end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:195 +class ActiveRecord::NoEnvironmentInSchemaError < ::ActiveRecord::MigrationError + # pkg:gem/activerecord#lib/active_record/migration.rb:196 + def initialize; end +end + +# = Active Record No Touching +# +# pkg:gem/activerecord#lib/active_record/no_touching.rb:5 +module ActiveRecord::NoTouching + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::NoTouching::ClassMethods + + # Returns +true+ if the class has +no_touching+ set, +false+ otherwise. + # + # Project.no_touching do + # Project.first.no_touching? # true + # Message.first.no_touching? # false + # end + # + # pkg:gem/activerecord#lib/active_record/no_touching.rb:53 + def no_touching?; end + + # pkg:gem/activerecord#lib/active_record/no_touching.rb:61 + def touch(*, **); end + + # pkg:gem/activerecord#lib/active_record/no_touching.rb:57 + def touch_later(*); end + + class << self + # pkg:gem/activerecord#lib/active_record/no_touching.rb:36 + def applied_to?(klass); end + + # pkg:gem/activerecord#lib/active_record/no_touching.rb:29 + def apply_to(klass); end + + private + + # pkg:gem/activerecord#lib/active_record/no_touching.rb:41 + def klasses; end + end +end + +# pkg:gem/activerecord#lib/active_record/no_touching.rb:8 +module ActiveRecord::NoTouching::ClassMethods + # Lets you selectively disable calls to +touch+ for the + # duration of a block. + # + # ==== Examples + # ActiveRecord::Base.no_touching do + # Project.first.touch # does nothing + # Message.first.touch # does nothing + # end + # + # Project.no_touching do + # Project.first.touch # does nothing + # Message.first.touch # works, but does not touch the associated project + # end + # + # pkg:gem/activerecord#lib/active_record/no_touching.rb:23 + def no_touching(&block); end +end + +# Raised when a record cannot be inserted or updated because it would violate a not null constraint. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:292 +class ActiveRecord::NotNullViolation < ::ActiveRecord::StatementInvalid; end + +# pkg:gem/activerecord#lib/active_record/migration/pending_migration_connection.rb:4 +class ActiveRecord::PendingMigrationConnection + class << self + # pkg:gem/activerecord#lib/active_record/migration/pending_migration_connection.rb:17 + def current_preventing_writes; end + + # pkg:gem/activerecord#lib/active_record/migration/pending_migration_connection.rb:13 + def primary_class?; end + + # pkg:gem/activerecord#lib/active_record/migration/pending_migration_connection.rb:5 + def with_temporary_pool(db_config, &block); end + end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:147 +class ActiveRecord::PendingMigrationError < ::ActiveRecord::MigrationError + include ::ActiveSupport::ActionableError + extend ::ActiveSupport::ActionableError::ClassMethods + + # pkg:gem/activerecord#lib/active_record/migration.rb:158 + def initialize(message = T.unsafe(nil), pending_migrations: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:148 + def _actions; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:148 + def _actions=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:148 + def _actions?; end + + private + + # pkg:gem/activerecord#lib/active_record/migration.rb:181 + def connection_pool; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:167 + def detailed_migration_message(pending_migrations); end + + class << self + # pkg:gem/activerecord#lib/active_record/migration.rb:148 + def _actions; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:148 + def _actions=(value); end + + # pkg:gem/activerecord#lib/active_record/migration.rb:148 + def _actions?; end + + private + + # pkg:gem/activerecord#lib/active_record/migration.rb:148 + def __class_attr__actions; end + + # pkg:gem/activerecord#lib/active_record/migration.rb:148 + def __class_attr__actions=(new_value); end + end +end + +# = Active Record \Persistence +# +# pkg:gem/activerecord#lib/active_record/persistence.rb:7 +module ActiveRecord::Persistence + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Persistence::ClassMethods + + # Returns an instance of the specified +klass+ with the attributes of the + # current record. This is mostly useful in relation to single table + # inheritance (STI) structures where you want a subclass to appear as the + # superclass. This can be used along with record identification in + # Action Pack to allow, say, Client < Company to do something + # like render partial: @client.becomes(Company) to render that + # instance using the companies/company partial instead of clients/client. + # + # Note: The new instance will share a link to the same attributes as the original class. + # Therefore the STI column value will still be the same. + # Any change to the attributes on either instance will affect both instances. + # This includes any attribute initialization done by the new instance. + # + # If you want to change the STI column as well, use #becomes! instead. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:487 + def becomes(klass); end + + # Wrapper around #becomes that also changes the instance's STI column value. + # This is especially useful if you want to persist the changed class in your + # database. + # + # Note: The old instance's STI column value will be changed too, as both objects + # share the same set of attributes. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:510 + def becomes!(klass); end + + # Initializes +attribute+ to zero if +nil+ and subtracts the value passed as +by+ (default is 1). + # The decrement is performed directly on the underlying attribute, no setter is invoked. + # Only makes sense for number-based attributes. Returns +self+. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:687 + def decrement(attribute, by = T.unsafe(nil)); end + + # Wrapper around #decrement that writes the update to the database. + # Only +attribute+ is updated; the record itself is not saved. + # This means that any other modified attributes will still be dirty. + # Validations and callbacks are skipped. Supports the +touch+ option from + # +update_counters+, see that for more. + # Returns +self+. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:697 + def decrement!(attribute, by = T.unsafe(nil), touch: T.unsafe(nil)); end + + # Deletes the record in the database and freezes this instance to + # reflect that no changes should be made (since they can't be + # persisted). Returns the frozen instance. + # + # The row is simply removed with an SQL +DELETE+ statement on the + # record's primary key, and no callbacks are executed. + # + # Note that this will also delete records marked as {#readonly?}[rdoc-ref:Core#readonly?]. + # + # To enforce the object's +before_destroy+ and +after_destroy+ + # callbacks or any :dependent association + # options, use #destroy. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:439 + def delete; end + + # Deletes the record in the database and freezes this instance to reflect + # that no changes should be made (since they can't be persisted). + # + # There's a series of callbacks associated with #destroy. If the + # before_destroy callback throws +:abort+ the action is cancelled + # and #destroy returns +false+. + # See ActiveRecord::Callbacks for further details. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:453 + def destroy; end + + # Deletes the record in the database and freezes this instance to reflect + # that no changes should be made (since they can't be persisted). + # + # There's a series of callbacks associated with #destroy!. If the + # before_destroy callback throws +:abort+ the action is cancelled + # and #destroy! raises ActiveRecord::RecordNotDestroyed. + # See ActiveRecord::Callbacks for further details. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:469 + def destroy!; end + + # Returns true if this object has been destroyed, otherwise returns false. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:355 + def destroyed?; end + + # Initializes +attribute+ to zero if +nil+ and adds the value passed as +by+ (default is 1). + # The increment is performed directly on the underlying attribute, no setter is invoked. + # Only makes sense for number-based attributes. Returns +self+. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:657 + def increment(attribute, by = T.unsafe(nil)); end + + # Wrapper around #increment that writes the update to the database. + # Only +attribute+ is updated; the record itself is not saved. + # This means that any other modified attributes will still be dirty. + # Validations and callbacks are skipped. Supports the +touch+ option from + # +update_counters+, see that for more. + # + # This method raises an ActiveRecord::ActiveRecordError when called on new + # objects, or when at least one of the attributes is marked as readonly. + # + # Returns +self+. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:673 + def increment!(attribute, by = T.unsafe(nil), touch: T.unsafe(nil)); end + + # Returns true if this object hasn't been saved yet -- that is, a record + # for the object doesn't exist in the database yet; otherwise, returns false. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:338 + def new_record?; end + + # Returns true if the record is persisted, i.e. it's not a new record and it was + # not destroyed, otherwise returns false. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:361 + def persisted?; end + + # Returns true if this object was just created -- that is, prior to the last + # update or delete, the object didn't exist in the database and new_record? would have + # returned true. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:345 + def previously_new_record?; end + + # Returns true if this object was previously persisted but now it has been deleted. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:350 + def previously_persisted?; end + + # Reloads the record from the database. + # + # This method finds the record by its primary key (which could be assigned + # manually) and modifies the receiver in-place: + # + # account = Account.new + # # => # + # account.id = 1 + # account.reload + # # Account Load (1.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 1]] + # # => # + # + # Attributes are reloaded from the database, and caches busted, in + # particular the associations cache and the QueryCache. + # + # If the record no longer exists in the database ActiveRecord::RecordNotFound + # is raised. Otherwise, in addition to the in-place modification the method + # returns +self+ for convenience. + # + # The optional :lock flag option allows you to lock the reloaded record: + # + # reload(lock: true) # reload with pessimistic locking + # + # Reloading is commonly used in test suites to test something is actually + # written to the database, or when some action modifies the corresponding + # row in the database but not the object in memory: + # + # assert account.deposit!(25) + # assert_equal 25, account.credit # check it is updated in memory + # assert_equal 25, account.reload.credit # check it is also persisted + # + # Another common use case is optimistic locking handling: + # + # def with_optimistic_retry + # begin + # yield + # rescue ActiveRecord::StaleObjectError + # begin + # # Reload lock_version in particular. + # reload + # rescue ActiveRecord::RecordNotFound + # # If the record is gone there is nothing to do. + # else + # retry + # end + # end + # end + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:774 + def reload(options = T.unsafe(nil)); end + + # :call-seq: + # save(**options) + # + # Saves the model. + # + # If the model is new, a record gets created in the database, otherwise + # the existing record gets updated. + # + # By default, save always runs validations. If any of them fail the action + # is cancelled and #save returns +false+, and the record won't be saved. However, if you supply + # validate: false, validations are bypassed altogether. See + # ActiveRecord::Validations for more information. + # + # By default, #save also sets the +updated_at+/+updated_on+ attributes to + # the current time. However, if you supply touch: false, these + # timestamps will not be updated. + # + # There's a series of callbacks associated with #save. If any of the + # before_* callbacks throws +:abort+ the action is cancelled and + # #save returns +false+. See ActiveRecord::Callbacks for further + # details. + # + # Attributes marked as readonly are silently ignored if the record is + # being updated. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:390 + def save(**options, &block); end + + # :call-seq: + # save!(**options) + # + # Saves the model. + # + # If the model is new, a record gets created in the database, otherwise + # the existing record gets updated. + # + # By default, #save! always runs validations. If any of them fail + # ActiveRecord::RecordInvalid gets raised, and the record won't be saved. However, if you supply + # validate: false, validations are bypassed altogether. See + # ActiveRecord::Validations for more information. + # + # By default, #save! also sets the +updated_at+/+updated_on+ attributes to + # the current time. However, if you supply touch: false, these + # timestamps will not be updated. + # + # There's a series of callbacks associated with #save!. If any of + # the before_* callbacks throws +:abort+ the action is cancelled + # and #save! raises ActiveRecord::RecordNotSaved. See + # ActiveRecord::Callbacks for further details. + # + # Attributes marked as readonly are silently ignored if the record is + # being updated. + # + # Unless an error is raised, returns true. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:423 + def save!(**options, &block); end + + # Assigns to +attribute+ the boolean opposite of attribute?. So + # if the predicate returns +true+ the attribute will become +false+. This + # method toggles directly the underlying value without calling any setter. + # Returns +self+. + # + # Example: + # + # user = User.first + # user.banned? # => false + # user.toggle(:banned) + # user.banned? # => true + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:713 + def toggle(attribute); end + + # Wrapper around #toggle that saves the record. This method differs from + # its non-bang version in the sense that it passes through the attribute setter. + # Saving is not subjected to validation checks. Returns +true+ if the + # record could be saved. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:722 + def toggle!(attribute); end + + # Saves the record with the updated_at/on attributes set to the current time + # or the time specified. + # Please note that no validation is performed and only the +after_touch+, + # +after_commit+ and +after_rollback+ callbacks are executed. + # + # This method can be passed attribute names and an optional time argument. + # If attribute names are passed, they are updated along with updated_at/on + # attributes. If no time argument is passed, the current time is used as default. + # + # product.touch # updates updated_at/on with current time + # product.touch(time: Time.new(2015, 2, 16, 0, 0, 0)) # updates updated_at/on with specified time + # product.touch(:designed_at) # updates the designed_at attribute and updated_at/on + # product.touch(:started_at, :ended_at) # updates started_at, ended_at and updated_at/on attributes + # + # If used along with {belongs_to}[rdoc-ref:Associations::ClassMethods#belongs_to] + # then +touch+ will invoke +touch+ method on associated object. + # + # class Brake < ActiveRecord::Base + # belongs_to :car, touch: true + # end + # + # class Car < ActiveRecord::Base + # belongs_to :corporation, touch: true + # end + # + # # triggers @brake.car.touch and @brake.car.corporation.touch + # @brake.touch + # + # Note that +touch+ must be used on a persisted object, or else an + # ActiveRecordError will be thrown. For example: + # + # ball = Ball.new + # ball.touch(:updated_at) # => raises ActiveRecordError + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:825 + def touch(*names, time: T.unsafe(nil)); end + + # Updates the attributes of the model from the passed-in hash and saves the + # record, all wrapped in a transaction. If the object is invalid, the saving + # will fail and false will be returned. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:565 + def update(attributes); end + + # Updates its receiver just like #update but calls #save! instead + # of +save+, so an exception is raised if the record is invalid and saving will fail. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:576 + def update!(attributes); end + + # Updates a single attribute and saves the record. + # This is especially useful for boolean flags on existing records. Also note that + # + # * Validation is skipped. + # * \Callbacks are invoked. + # * updated_at/updated_on column is updated if that column is available. + # * Updates all the attributes that are dirty in this object. + # + # This method raises an ActiveRecord::ActiveRecordError if the + # attribute is marked as readonly. + # + # Also see #update_column. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:532 + def update_attribute(name, value); end + + # Updates a single attribute and saves the record. + # This is especially useful for boolean flags on existing records. Also note that + # + # * Validation is skipped. + # * \Callbacks are invoked. + # * updated_at/updated_on column is updated if that column is available. + # * Updates all the attributes that are dirty in this object. + # + # This method raises an ActiveRecord::ActiveRecordError if the + # attribute is marked as readonly. + # + # If any of the before_* callbacks throws +:abort+ the action is cancelled + # and #update_attribute! raises ActiveRecord::RecordNotSaved. See + # ActiveRecord::Callbacks for further details. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:554 + def update_attribute!(name, value); end + + # Equivalent to update_columns(name => value). + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:586 + def update_column(name, value, touch: T.unsafe(nil)); end + + # Updates the attributes directly in the database issuing an UPDATE SQL + # statement and sets them in the receiver: + # + # user.update_columns(last_request_at: Time.current) + # + # This is the fastest way to update attributes because it goes straight to + # the database, but take into account that in consequence the regular update + # procedures are totally bypassed. In particular: + # + # * \Validations are skipped. + # * \Callbacks are skipped. + # * +updated_at+/+updated_on+ are updated if the +touch+ option is set to +true+. + # * However, attributes are serialized with the same rules as ActiveRecord::Relation#update_all + # + # This method raises an ActiveRecord::ActiveRecordError when called on new + # objects, or when at least one of the attributes is marked as readonly. + # + # ==== Parameters + # + # * :touch option - Touch the timestamp columns when updating. + # * If attribute names are passed, they are updated along with +updated_at+/+updated_on+ attributes. + # + # ==== Examples + # + # # Update a single attribute. + # user.update_columns(last_request_at: Time.current) + # + # # Update with touch option. + # user.update_columns(last_request_at: Time.current, touch: true) + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:620 + def update_columns(attributes); end + + private + + # Creates a record with values matching those of the instance attributes + # and returns its id. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:952 + def _create_record(attribute_names = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:902 + def _delete_row; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:858 + def _find_record(options); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:869 + def _in_memory_query_constraints_hash; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:884 + def _query_constraints_hash; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:989 + def _raise_readonly_record_error; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:981 + def _raise_record_not_destroyed; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:993 + def _raise_record_not_touched_error; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:906 + def _touch_row(attribute_names, time); end + + # Updates the associated record with values matching those of the instance attributes. + # Returns the number of affected rows. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:932 + def _update_record(attribute_names = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:916 + def _update_row(attribute_names, attempted_action = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:879 + def apply_scoping?(options); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:923 + def create_or_update(**, &block); end + + # A hook to be overridden by association modules. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:895 + def destroy_associations; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:898 + def destroy_row; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:846 + def init_internals; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:852 + def strict_loaded_associations; end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:977 + def verify_readonly_attribute(name); end +end + +# pkg:gem/activerecord#lib/active_record/persistence.rb:10 +module ActiveRecord::Persistence::ClassMethods + # pkg:gem/activerecord#lib/active_record/persistence.rb:282 + def _delete_record(constraints); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:238 + def _insert_record(connection, values, returning); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:263 + def _update_record(values, constraints); end + + # Builds an object (or multiple objects) and returns either the built object or a list of built + # objects. + # + # The +attributes+ parameter can be either a Hash or an Array of Hashes. These Hashes describe the + # attributes on the objects that are to be built. + # + # ==== Examples + # # Build a single new object + # User.build(first_name: 'Jamie') + # + # # Build an Array of new objects + # User.build([{ first_name: 'Jamie' }, { first_name: 'Jeremy' }]) + # + # # Build a single object and pass it into a block to set other attributes. + # User.build(first_name: 'Jamie') do |u| + # u.is_admin = false + # end + # + # # Building an Array of new objects using a block, where the block is executed for each object: + # User.build([{ first_name: 'Jamie' }, { first_name: 'Jeremy' }]) do |u| + # u.is_admin = false + # end + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:82 + def build(attributes = T.unsafe(nil), &block); end + + # Returns an array of column names to be used in queries. The source of column + # names is derived from +query_constraints_list+ or +primary_key+. This method + # is for internal use when the primary key is to be treated as an array. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:234 + def composite_query_constraints_list; end + + # Creates an object (or multiple objects) and saves it to the database, if validations pass. + # The resulting object is returned whether the object was saved successfully to the database or not. + # + # The +attributes+ parameter can be either a Hash or an Array of Hashes. These Hashes describe the + # attributes on the objects that are to be created. + # + # ==== Examples + # # Create a single new object + # User.create(first_name: 'Jamie') + # + # # Create an Array of new objects + # User.create([{ first_name: 'Jamie' }, { first_name: 'Jeremy' }]) + # + # # Create a single object and pass it into a block to set other attributes. + # User.create(first_name: 'Jamie') do |u| + # u.is_admin = false + # end + # + # # Creating an Array of new objects using a block, where the block is executed for each object: + # User.create([{ first_name: 'Jamie' }, { first_name: 'Jeremy' }]) do |u| + # u.is_admin = false + # end + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:33 + def create(attributes = T.unsafe(nil), &block); end + + # Creates an object (or multiple objects) and saves it to the database, + # if validations pass. Raises a RecordInvalid error if validations fail, + # unlike Base#create. + # + # The +attributes+ parameter can be either a Hash or an Array of Hashes. + # These describe which attributes to be created on the object, or + # multiple objects when given an Array of Hashes. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:50 + def create!(attributes = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:219 + def has_query_constraints?; end + + # Given an attributes hash, +instantiate+ returns a new instance of + # the appropriate class. Accepts only keys as strings. + # + # For example, +Post.all+ may return Comments, Messages, and Emails + # by storing the record's subclass in a +type+ attribute. By calling + # +instantiate+ instead of +new+, finder methods ensure they get new + # instances of the appropriate class for each record. + # + # See ActiveRecord::Inheritance#discriminate_class_for_record to see + # how this "single-table" inheritance mapping is implemented. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:100 + def instantiate(attributes, column_types = T.unsafe(nil), &block); end + + # Accepts a list of attribute names to be used in the WHERE clause + # of SELECT / UPDATE / DELETE queries and in the ORDER BY clause for +#first+ and +#last+ finder methods. + # + # class Developer < ActiveRecord::Base + # query_constraints :company_id, :id + # end + # + # developer = Developer.first + # # SELECT "developers".* FROM "developers" ORDER BY "developers"."company_id" ASC, "developers"."id" ASC LIMIT 1 + # developer.inspect # => # + # + # developer.update!(name: "Nikita") + # # UPDATE "developers" SET "name" = 'Nikita' WHERE "developers"."company_id" = 1 AND "developers"."id" = 1 + # + # # It is possible to update an attribute used in the query_constraints clause: + # developer.update!(company_id: 2) + # # UPDATE "developers" SET "company_id" = 2 WHERE "developers"."company_id" = 1 AND "developers"."id" = 1 + # + # developer.name = "Bob" + # developer.save! + # # UPDATE "developers" SET "name" = 'Bob' WHERE "developers"."company_id" = 1 AND "developers"."id" = 1 + # + # developer.destroy! + # # DELETE FROM "developers" WHERE "developers"."company_id" = 1 AND "developers"."id" = 1 + # + # developer.delete + # # DELETE FROM "developers" WHERE "developers"."company_id" = 1 AND "developers"."id" = 1 + # + # developer.reload + # # SELECT "developers".* FROM "developers" WHERE "developers"."company_id" = 1 AND "developers"."id" = 1 LIMIT 1 + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:212 + def query_constraints(*columns_list); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:223 + def query_constraints_list; end + + # Updates an object (or multiple objects) and saves it to the database, if validations pass. + # The resulting object is returned whether the object was saved successfully to the database or not. + # + # ==== Parameters + # + # * +id+ - This should be the id or an array of ids to be updated. + # Optional argument, defaults to all records in the relation. + # * +attributes+ - This should be a hash of attributes or an array of hashes. + # + # ==== Examples + # + # # Updates one record + # Person.update(15, user_name: "Samuel", group: "expert") + # + # # Updates multiple records + # people = { 1 => { "first_name" => "David" }, 2 => { "first_name" => "Jeremy" } } + # Person.update(people.keys, people.values) + # + # # Updates multiple records from the result of a relation + # people = Person.where(group: "expert") + # people.update(group: "masters") + # + # Note: Updating a large number of records will run an UPDATE + # query for each record, which may cause a performance issue. + # When running callbacks is not needed for each record update, + # it is preferred to use {update_all}[rdoc-ref:Relation#update_all] + # for updating all records in a single query. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:132 + def update(id = T.unsafe(nil), attributes); end + + # Updates the object (or multiple objects) just like #update but calls #update! instead + # of +update+, so an exception is raised if the record is invalid and saving will fail. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:158 + def update!(id = T.unsafe(nil), attributes); end + + private + + # Called by +_update_record+ and +_delete_record+ + # to build `where` clause from default scopes. + # Skips empty scopes. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:328 + def build_default_constraint; end + + # Called by +instantiate+ to decide which class to use for a new + # record instance. + # + # See +ActiveRecord::Inheritance#discriminate_class_for_record+ for + # the single-table inheritance discriminator. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:321 + def discriminate_class_for_record(record); end + + # pkg:gem/activerecord#lib/active_record/persistence.rb:301 + def inherited(subclass); end + + # Given a class, an attributes hash, +instantiate_instance_of+ returns a + # new instance of the class. Accepts only keys as strings. + # + # pkg:gem/activerecord#lib/active_record/persistence.rb:311 + def instantiate_instance_of(klass, attributes, column_types = T.unsafe(nil), &block); end +end + +# pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:4 +class ActiveRecord::PredicateBuilder + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:12 + def initialize(table); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:53 + def [](attr_name, value, operator = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:57 + def build(attribute, value, operator = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:67 + def build_bind_attribute(column_name, value); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:23 + def build_from_hash(attributes, &block); end + + # Define how a class is converted to Arel nodes when passed to +where+. + # The handler can be any object that responds to +call+, and will be used + # for any value that === the class given. For example: + # + # MyCustomDateRange = Struct.new(:start, :end) + # handler = proc do |column, range| + # Arel::Nodes::Between.new(column, + # Arel::Nodes::And.new([range.start, range.end]) + # ) + # end + # ActiveRecord::PredicateBuilder.new("users").register_handler(MyCustomDateRange, handler) + # + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:49 + def register_handler(klass, handler); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:71 + def resolve_arel_attribute(table_name, column_name, &block); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:75 + def with(table); end + + protected + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:84 + def expand_from_hash(attributes, &block); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:82 + def table=(_arg0); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:165 + def convert_dot_notation_to_hash(attributes); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:155 + def grouping_queries(queries); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:187 + def handler_for(object); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:153 + def table; end + + class << self + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder.rb:28 + def references(attributes); end + end +end + +# pkg:gem/activerecord#lib/active_record/relation/predicate_builder/array_handler.rb:7 +class ActiveRecord::PredicateBuilder::ArrayHandler + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/array_handler.rb:8 + def initialize(predicate_builder); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/array_handler.rb:12 + def call(attribute, value); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/array_handler.rb:41 + def predicate_builder; end +end + +# pkg:gem/activerecord#lib/active_record/relation/predicate_builder/array_handler.rb:43 +module ActiveRecord::PredicateBuilder::ArrayHandler::NullPredicate + class << self + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/array_handler.rb:44 + def or(other); end + end +end + +# pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:5 +class ActiveRecord::PredicateBuilder::AssociationQueryValue + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:6 + def initialize(reflection, value); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:11 + def queries; end + + private + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:59 + def convert_to_id(value); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:25 + def ids; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:55 + def polymorphic_clause?; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:47 + def polymorphic_name; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:39 + def primary_key; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:43 + def primary_type; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:23 + def reflection; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:51 + def select_clause?; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/association_query_value.rb:23 + def value; end +end + +# pkg:gem/activerecord#lib/active_record/relation/predicate_builder/basic_object_handler.rb:5 +class ActiveRecord::PredicateBuilder::BasicObjectHandler + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/basic_object_handler.rb:6 + def initialize(predicate_builder); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/basic_object_handler.rb:10 + def call(attribute, value); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/basic_object_handler.rb:16 + def predicate_builder; end +end + +# pkg:gem/activerecord#lib/active_record/relation/predicate_builder/polymorphic_array_value.rb:5 +class ActiveRecord::PredicateBuilder::PolymorphicArrayValue + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/polymorphic_array_value.rb:6 + def initialize(reflection, values); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/polymorphic_array_value.rb:11 + def queries; end + + private + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/polymorphic_array_value.rb:44 + def convert_to_id(value); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/polymorphic_array_value.rb:36 + def klass(value); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/polymorphic_array_value.rb:32 + def primary_key(value); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/polymorphic_array_value.rb:23 + def reflection; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/polymorphic_array_value.rb:25 + def type_to_ids_mapping; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/polymorphic_array_value.rb:23 + def values; end +end + +# pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:5 +class ActiveRecord::PredicateBuilder::RangeHandler + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:8 + def initialize(predicate_builder); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:12 + def call(attribute, value); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:19 + def predicate_builder; end +end + +# pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 +class ActiveRecord::PredicateBuilder::RangeHandler::RangeWithBinds < ::Struct + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def begin; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def begin=(_); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def end; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def end=(_); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def exclude_end?; end + + class << self + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def members; end + + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/range_handler.rb:6 + def new(*_arg0); end + end +end + +# pkg:gem/activerecord#lib/active_record/relation/predicate_builder/relation_handler.rb:5 +class ActiveRecord::PredicateBuilder::RelationHandler + # pkg:gem/activerecord#lib/active_record/relation/predicate_builder/relation_handler.rb:6 + def call(attribute, value); end +end + +# Raised when PostgreSQL returns 'cached plan must not change result type' and +# we cannot retry gracefully (e.g. inside a transaction) +# +# pkg:gem/activerecord#lib/active_record/errors.rb:369 +class ActiveRecord::PreparedStatementCacheExpired < ::ActiveRecord::StatementInvalid; end + +# Raised when the number of placeholders in an SQL fragment passed to +# {ActiveRecord::Base.where}[rdoc-ref:QueryMethods#where] +# does not match the number of values supplied. +# +# For example, when there are two placeholders with only one value supplied: +# +# Location.where("lat = ? AND lng = ?", 53.7362) +# +# pkg:gem/activerecord#lib/active_record/errors.rb:331 +class ActiveRecord::PreparedStatementInvalid < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/promise.rb:4 +class ActiveRecord::Promise < ::BasicObject + # pkg:gem/activerecord#lib/active_record/promise.rb:7 + def initialize(future_result, block); end + + # pkg:gem/activerecord#lib/active_record/promise.rb:41 + def class; end + + # pkg:gem/activerecord#lib/active_record/promise.rb:44 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/promise.rb:41 + def is_a?(_arg0); end + + # Returns whether the associated query is still being executed or not. + # + # pkg:gem/activerecord#lib/active_record/promise.rb:13 + def pending?; end + + # pkg:gem/activerecord#lib/active_record/promise.rb:48 + def pretty_print(q); end + + # pkg:gem/activerecord#lib/active_record/promise.rb:41 + def respond_to?(*_arg0); end + + # Returns a new +ActiveRecord::Promise+ that will apply the passed block + # when the value is accessed: + # + # Post.async_pick(:title).then { |title| title.upcase }.value + # # => "POST TITLE" + # + # pkg:gem/activerecord#lib/active_record/promise.rb:36 + def then(&block); end + + # Returns the query result. + # If the query wasn't completed yet, accessing +#value+ will block until the query completes. + # If the query failed, +#value+ will raise the corresponding error. + # + # pkg:gem/activerecord#lib/active_record/promise.rb:20 + def value; end + + private + + # pkg:gem/activerecord#lib/active_record/promise.rb:53 + def status; end +end + +# pkg:gem/activerecord#lib/active_record/promise.rb:63 +class ActiveRecord::Promise::Complete < ::ActiveRecord::Promise + # pkg:gem/activerecord#lib/active_record/promise.rb:66 + def initialize(value); end + + # pkg:gem/activerecord#lib/active_record/promise.rb:74 + def pending?; end + + # pkg:gem/activerecord#lib/active_record/promise.rb:70 + def then; end + + # pkg:gem/activerecord#lib/active_record/promise.rb:64 + def value; end + + private + + # pkg:gem/activerecord#lib/active_record/promise.rb:79 + def status; end +end + +# pkg:gem/activerecord#lib/active_record/migration.rb:206 +class ActiveRecord::ProtectedEnvironmentError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/migration.rb:207 + def initialize(env = T.unsafe(nil)); end +end + +# Superclass for errors that have been aborted (either by client or server). +# +# pkg:gem/activerecord#lib/active_record/errors.rb:574 +class ActiveRecord::QueryAborted < ::ActiveRecord::StatementInvalid; end + +# = Active Record Query Cache +# +# pkg:gem/activerecord#lib/active_record/query_cache.rb:5 +class ActiveRecord::QueryCache + class << self + # pkg:gem/activerecord#lib/active_record/query_cache.rb:58 + def install_executor_hooks(executor = T.unsafe(nil)); end + end +end + +# ActiveRecord::Base extends this module, so these methods are available in models. +# +# pkg:gem/activerecord#lib/active_record/query_cache.rb:7 +module ActiveRecord::QueryCache::ClassMethods + # Enable the query cache within the block if Active Record is configured. + # If it's not, it will execute the given block. + # + # pkg:gem/activerecord#lib/active_record/query_cache.rb:10 + def cache(&block); end + + # Runs the block with the query cache disabled. + # + # If the query cache was enabled before the block was executed, it is + # enabled again after it. + # + # Set dirties: false to prevent query caches on all connections + # from being cleared by write operations. (By default, write operations + # dirty all connections' query caches in case they are replicas whose + # cache would now be outdated.) + # + # pkg:gem/activerecord#lib/active_record/query_cache.rb:33 + def uncached(dirties: T.unsafe(nil), &block); end +end + +# pkg:gem/activerecord#lib/active_record/query_cache.rb:42 +module ActiveRecord::QueryCache::ExecutorHooks + class << self + # pkg:gem/activerecord#lib/active_record/query_cache.rb:50 + def complete(pools); end + + # pkg:gem/activerecord#lib/active_record/query_cache.rb:43 + def run; end + end +end + +# QueryCanceled will be raised when canceling statement due to user request. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:586 +class ActiveRecord::QueryCanceled < ::ActiveRecord::QueryAborted; end + +# = Active Record Query Logs +# +# Automatically append comments to SQL queries with runtime information tags. This can be used to trace troublesome +# SQL statements back to the application code that generated these statements. +# +# Query logs can be enabled via \Rails configuration in config/application.rb or an initializer: +# +# config.active_record.query_log_tags_enabled = true +# +# By default the name of the application, the name and action of the controller, or the name of the job are logged. +# The default format is {SQLCommenter}[https://open-telemetry.github.io/opentelemetry-sqlcommenter/]. +# The tags shown in a query comment can be configured via \Rails configuration: +# +# config.active_record.query_log_tags = [ :application, :controller, :action, :job ] +# +# Active Record defines default tags available for use: +# +# * +application+ +# * +pid+ +# * +socket+ +# * +db_host+ +# * +database+ +# * +source_location+ +# +# WARNING: Calculating the +source_location+ of a query can be slow, so you should consider its impact if using it in a production environment. +# +# Also see {config.active_record.verbose_query_logs}[https://guides.rubyonrails.org/debugging_rails_applications.html#verbose-query-logs]. +# +# Action Controller adds default tags when loaded: +# +# * +controller+ +# * +action+ +# * +namespaced_controller+ +# +# Active Job adds default tags when loaded: +# +# * +job+ +# +# New comment tags can be defined by adding them in a +Hash+ to the tags +Array+. Tags can have dynamic content by +# setting a +Proc+ or lambda value in the +Hash+, and can reference any value stored by \Rails in the +context+ object. +# ActiveSupport::CurrentAttributes can be used to store application values. Tags with +nil+ values are +# omitted from the query comment. +# +# Escaping is performed on the string returned, however untrusted user input should not be used. +# +# Example: +# +# config.active_record.query_log_tags = [ +# :namespaced_controller, +# :action, +# :job, +# { +# request_id: ->(context) { context[:controller]&.request&.request_id }, +# job_id: ->(context) { context[:job]&.job_id }, +# tenant_id: -> { Current.tenant&.id }, +# static: "value", +# }, +# ] +# +# By default the name of the application, the name and action of the controller, or the name of the job are logged +# using the {SQLCommenter}[https://open-telemetry.github.io/opentelemetry-sqlcommenter/] format. This can be changed +# via {config.active_record.query_log_tags_format}[https://guides.rubyonrails.org/configuring.html#config-active-record-query-log-tags-format] +# +# Tag comments can be prepended to the query: +# +# config.active_record.query_log_tags_prepend_comment = true +# +# For applications where the content will not change during the lifetime of +# the request or job execution, the tags can be cached for reuse in every query: +# +# config.active_record.cache_query_log_tags = true +# +# pkg:gem/activerecord#lib/active_record/query_logs_formatter.rb:4 +module ActiveRecord::QueryLogs + class << self + # pkg:gem/activerecord#lib/active_record/query_logs.rb:119 + def cache_query_log_tags; end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:119 + def cache_query_log_tags=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:115 + def cached_comment; end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:115 + def cached_comment=(obj); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:143 + def call(sql, connection); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:155 + def clear_cache; end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:119 + def prepend_comment; end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:119 + def prepend_comment=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:159 + def query_source_location; end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:118 + def taggings; end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:121 + def taggings=(taggings); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:118 + def tags; end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:126 + def tags=(tags); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:118 + def tags_formatter; end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:131 + def tags_formatter=(format); end + + private + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:180 + def build_handler(name, handler = T.unsafe(nil)); end + + # Returns an SQL comment +String+ containing the query log tags. + # Sets and returns a cached comment if cache_query_log_tags is +true+. + # + # pkg:gem/activerecord#lib/active_record/query_logs.rb:197 + def comment(connection); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:213 + def escape_sql_comment(content); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:166 + def rebuild_handlers; end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:226 + def tag_content(connection); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:205 + def uncached_comment(connection); end + end +end + +# pkg:gem/activerecord#lib/active_record/query_logs.rb:79 +class ActiveRecord::QueryLogs::GetKeyHandler + # pkg:gem/activerecord#lib/active_record/query_logs.rb:80 + def initialize(name); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:84 + def call(context); end +end + +# pkg:gem/activerecord#lib/active_record/query_logs.rb:89 +class ActiveRecord::QueryLogs::IdentityHandler + # pkg:gem/activerecord#lib/active_record/query_logs.rb:90 + def initialize(value); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:94 + def call(_context); end +end + +# pkg:gem/activerecord#lib/active_record/query_logs_formatter.rb:5 +module ActiveRecord::QueryLogs::LegacyFormatter + class << self + # Formats the key value pairs into a string. + # + # pkg:gem/activerecord#lib/active_record/query_logs_formatter.rb:8 + def format(key, value); end + + # pkg:gem/activerecord#lib/active_record/query_logs_formatter.rb:12 + def join(pairs); end + end +end + +# pkg:gem/activerecord#lib/active_record/query_logs_formatter.rb:18 +class ActiveRecord::QueryLogs::SQLCommenter + class << self + # pkg:gem/activerecord#lib/active_record/query_logs_formatter.rb:20 + def format(key, value); end + + # pkg:gem/activerecord#lib/active_record/query_logs_formatter.rb:24 + def join(pairs); end + end +end + +# pkg:gem/activerecord#lib/active_record/query_logs.rb:99 +class ActiveRecord::QueryLogs::ZeroArityHandler + # pkg:gem/activerecord#lib/active_record/query_logs.rb:100 + def initialize(proc); end + + # pkg:gem/activerecord#lib/active_record/query_logs.rb:104 + def call(_context); end +end + +# pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:9 +module ActiveRecord::QueryMethods + include ::ActiveModel::ForbiddenAttributesProtection + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:428 + def _select!(*fields); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:260 + def all; end + + # Returns a new relation, which is the logical intersection of this relation and the one passed + # as an argument. + # + # The two relations must be structurally compatible: they must be scoping the same model, and + # they must differ only by #where (if no #group has been defined) or #having (if a #group is + # present). + # + # Post.where(id: [1, 2]).and(Post.where(id: [2, 3])) + # # SELECT `posts`.* FROM `posts` WHERE `posts`.`id` IN (1, 2) AND `posts`.`id` IN (2, 3) + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1163 + def and(other); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1171 + def and!(other); end + + # Adds an SQL comment to queries generated from this relation. For example: + # + # User.annotate("selecting user names").select(:name) + # # SELECT "users"."name" FROM "users" /* selecting user names */ + # + # User.annotate("selecting", "user", "names").select(:name) + # # SELECT "users"."name" FROM "users" /* selecting */ /* user */ /* names */ + # + # The SQL block comment delimiters, "/*" and "*/", will be added automatically. + # + # Some escaping is performed, however untrusted user input should not be used. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1558 + def annotate(*args); end + + # Like #annotate, but modifies relation in place. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1564 + def annotate!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def annotate_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def annotate_values=(value); end + + # Returns the Arel object associated with the relation. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1623 + def arel(aliases = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1627 + def construct_join_dependency(associations, join_type); end + + # Sets attributes to be used when creating new records from a + # relation object. + # + # users = User.where(name: 'Oscar') + # users.new.name # => 'Oscar' + # + # users = users.create_with(name: 'DHH') + # users.new.name # => 'DHH' + # + # You can pass +nil+ to #create_with to reset attributes: + # + # users = users.create_with(nil) + # users.new.name # => 'Oscar' + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1375 + def create_with(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1379 + def create_with!(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def create_with_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def create_with_value=(value); end + + # Specifies whether the records should be unique or not. For example: + # + # User.select(:name) + # # Might return two records with the same name + # + # User.select(:name).distinct + # # Returns 1 record per distinct name + # + # User.select(:name).distinct.distinct(false) + # # You can also remove the uniqueness + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1439 + def distinct(value = T.unsafe(nil)); end + + # Like #distinct, but modifies relation in place. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1444 + def distinct!(value = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def distinct_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def distinct_value=(value); end + + # Specify associations +args+ to be eager loaded using a LEFT OUTER JOIN. + # Performs a single query joining all specified associations. For example: + # + # users = User.eager_load(:address).limit(5) + # users.each do |user| + # user.address.city + # end + # + # # SELECT "users"."id" AS t0_r0, "users"."name" AS t0_r1, ... FROM "users" + # # LEFT OUTER JOIN "addresses" ON "addresses"."id" = "users"."address_id" + # # LIMIT 5 + # + # Instead of loading the 5 addresses with 5 separate queries, all addresses + # are loaded with a single joined query. + # + # Loading multiple and nested associations is possible using Hashes and Arrays, + # similar to #includes: + # + # User.eager_load(:address, friends: [:address, :followers]) + # # SELECT "users"."id" AS t0_r0, "users"."name" AS t0_r1, ... FROM "users" + # # LEFT OUTER JOIN "addresses" ON "addresses"."id" = "users"."address_id" + # # LEFT OUTER JOIN "friends" ON "friends"."user_id" = "users"."id" + # # ... + # + # NOTE: Loading the associations in a join can result in many rows that + # contain redundant data and it performs poorly at scale. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:290 + def eager_load(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:295 + def eager_load!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def eager_load_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def eager_load_values=(value); end + + # Excludes the specified record (or collection of records) from the resulting + # relation. For example: + # + # Post.excluding(post) + # # SELECT "posts".* FROM "posts" WHERE "posts"."id" != 1 + # + # Post.excluding(post_one, post_two) + # # SELECT "posts".* FROM "posts" WHERE "posts"."id" NOT IN (1, 2) + # + # Post.excluding(Post.drafts) + # # SELECT "posts".* FROM "posts" WHERE "posts"."id" NOT IN (3, 4, 5) + # + # This can also be called on associations. As with the above example, either + # a single record of collection thereof may be specified: + # + # post = Post.find(1) + # comment = Comment.find(2) + # post.comments.excluding(comment) + # # SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = 1 AND "comments"."id" != 2 + # + # This is short-hand for .where.not(id: post.id) and .where.not(id: [post_one.id, post_two.id]). + # + # An ArgumentError will be raised if either no records are + # specified, or if any of the records in the collection (if a collection + # is passed in) are not instances of the same model that the relation is + # scoping. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1603 + def excluding(*records); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1616 + def excluding!(records); end + + # Used to extend a scope with additional methods, either through + # a module or through a block provided. + # + # The object returned is a relation, which can be further extended. + # + # === Using a \Module + # + # module Pagination + # def page(number) + # # pagination code goes here + # end + # end + # + # scope = Model.all.extending(Pagination) + # scope.page(params[:page]) + # + # You can also pass a list of modules: + # + # scope = Model.all.extending(Pagination, SomethingElse) + # + # === Using a Block + # + # scope = Model.all.extending do + # def page(number) + # # pagination code goes here + # end + # end + # scope.page(params[:page]) + # + # You can also use a block and a module list: + # + # scope = Model.all.extending(Pagination) do + # def per_page(number) + # # pagination code goes here + # end + # end + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1485 + def extending(*modules, &block); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1493 + def extending!(*modules, &block); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def extending_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def extending_values=(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:185 + def extensions; end + + # Extracts a named +association+ from the relation. The named association is first preloaded, + # then the individual association records are collected from the relation. Like so: + # + # account.memberships.extract_associated(:user) + # # => Returns collection of User records + # + # This is short-hand for: + # + # account.memberships.preload(:user).collect(&:user) + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:341 + def extract_associated(association); end + + # Specifies the table from which the records will be fetched. For example: + # + # Topic.select('title').from('posts') + # # SELECT title FROM posts + # + # Can accept other relation objects. For example: + # + # Topic.select('title').from(Topic.approved) + # # SELECT title FROM (SELECT * FROM topics WHERE approved = 't') subquery + # + # Passing a second argument (string or symbol), creates the alias for the SQL from clause. Otherwise the alias "subquery" is used: + # + # Topic.select('a.title').from(Topic.approved, :a) + # # SELECT a.title FROM (SELECT * FROM topics WHERE approved = 't') a + # + # It does not add multiple arguments to the SQL from clause. The last +from+ chained is the one used: + # + # Topic.select('title').from(Topic.approved).from(Topic.inactive) + # # SELECT title FROM (SELECT topics.* FROM topics WHERE topics.active = 'f') subquery + # + # For multiple arguments for the SQL from clause, you can pass a string with the exact elements in the SQL from list: + # + # color = "red" + # Color + # .from("colors c, JSONB_ARRAY_ELEMENTS(colored_things) AS colorvalues(colorvalue)") + # .where("colorvalue->>'color' = ?", color) + # .select("c.*").to_a + # # SELECT c.* + # # FROM colors c, JSONB_ARRAY_ELEMENTS(colored_things) AS colorvalues(colorvalue) + # # WHERE (colorvalue->>'color' = 'red') + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1420 + def from(value, subquery_name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1424 + def from!(value, subquery_name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def from_clause; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def from_clause=(value); end + + # Allows to specify a group attribute: + # + # User.group(:name) + # # SELECT "users".* FROM "users" GROUP BY name + # + # Returns an array with distinct records based on the +group+ attribute: + # + # User.select([:id, :name]) + # # => [#, #, #] + # + # User.group(:name) + # # => [#, #] + # + # User.group('name AS grouped_name, age') + # # => [#, #, #] + # + # Passing in an array of attributes to group by is also supported. + # + # User.select([:id, :first_name]).group(:id, :first_name).first(3) + # # => [#, #, #] + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:573 + def group(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:578 + def group!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def group_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def group_values=(value); end + + # Allows to specify a HAVING clause. Note that you can't use HAVING + # without also specifying a GROUP clause. + # + # Order.having('SUM(price) > 30').group('user_id') + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1225 + def having(opts, *rest); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1229 + def having!(opts, *rest); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def having_clause; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def having_clause=(value); end + + # Applies an ORDER BY clause based on a given +column+, + # ordered and filtered by a specific set of +values+. + # + # User.in_order_of(:id, [1, 5, 3]) + # # SELECT "users".* FROM "users" + # # WHERE "users"."id" IN (1, 5, 3) + # # ORDER BY CASE + # # WHEN "users"."id" = 1 THEN 1 + # # WHEN "users"."id" = 5 THEN 2 + # # WHEN "users"."id" = 3 THEN 3 + # # END ASC + # + # +column+ can point to an enum column; the actual query generated may be different depending + # on the database adapter and the column definition. + # + # class Conversation < ActiveRecord::Base + # enum :status, [ :active, :archived ] + # end + # + # Conversation.in_order_of(:status, [:archived, :active]) + # # SELECT "conversations".* FROM "conversations" + # # WHERE "conversations"."status" IN (1, 0) + # # ORDER BY CASE + # # WHEN "conversations"."status" = 1 THEN 1 + # # WHEN "conversations"."status" = 0 THEN 2 + # # END ASC + # + # +values+ can also include +nil+. + # + # Conversation.in_order_of(:status, [nil, :archived, :active]) + # # SELECT "conversations".* FROM "conversations" + # # WHERE ("conversations"."status" IN (1, 0) OR "conversations"."status" IS NULL) + # # ORDER BY CASE + # # WHEN "conversations"."status" IS NULL THEN 1 + # # WHEN "conversations"."status" = 1 THEN 2 + # # WHEN "conversations"."status" = 0 THEN 3 + # # END ASC + # + # +filter+ can be set to +false+ to include all results instead of only the ones specified in +values+. + # + # Conversation.in_order_of(:status, [:archived, :active], filter: false) + # # SELECT "conversations".* FROM "conversations" + # # ORDER BY CASE + # # WHEN "conversations"."status" = 1 THEN 1 + # # WHEN "conversations"."status" = 0 THEN 2 + # # ELSE 3 + # # END ASC + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:717 + def in_order_of(column, values, filter: T.unsafe(nil)); end + + # Specify associations +args+ to be eager loaded to prevent N + 1 queries. + # A separate query is performed for each association, unless a join is + # required by conditions. + # + # For example: + # + # users = User.includes(:address).limit(5) + # users.each do |user| + # user.address.city + # end + # + # # SELECT "users".* FROM "users" LIMIT 5 + # # SELECT "addresses".* FROM "addresses" WHERE "addresses"."id" IN (1,2,3,4,5) + # + # Instead of loading the 5 addresses with 5 separate queries, all addresses + # are loaded with a single query. + # + # Loading the associations in a separate query will often result in a + # performance improvement over a simple join, as a join can result in many + # rows that contain redundant data and it performs poorly at scale. + # + # You can also specify multiple associations. Each association will result + # in an additional query: + # + # User.includes(:address, :friends).to_a + # # SELECT "users".* FROM "users" + # # SELECT "addresses".* FROM "addresses" WHERE "addresses"."id" IN (1,2,3,4,5) + # # SELECT "friends".* FROM "friends" WHERE "friends"."user_id" IN (1,2,3,4,5) + # + # Loading nested associations is possible using a Hash: + # + # User.includes(:address, friends: [:address, :followers]) + # + # === Conditions + # + # If you want to add string conditions to your included models, you'll have + # to explicitly reference them. For example: + # + # User.includes(:posts).where('posts.name = ?', 'example').to_a + # + # Will throw an error, but this will work: + # + # User.includes(:posts).where('posts.name = ?', 'example').references(:posts).to_a + # # SELECT "users"."id" AS t0_r0, ... FROM "users" + # # LEFT OUTER JOIN "posts" ON "posts"."user_id" = "users"."id" + # # WHERE "posts"."name" = ? [["name", "example"]] + # + # As the LEFT OUTER JOIN already contains the posts, the second query for + # the posts is no longer performed. + # + # Note that #includes works with association names while #references needs + # the actual table name. + # + # If you pass the conditions via a Hash, you don't need to call #references + # explicitly, as #where references the tables for you. For example, this + # will work correctly: + # + # User.includes(:posts).where(posts: { name: 'example' }) + # + # NOTE: Conditions affect both sides of an association. For example, the + # above code will return only users that have a post named "example", + # and will only include posts named "example", even when a + # matching user has other additional posts. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:250 + def includes(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:255 + def includes!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def includes_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def includes_values=(value); end + + # Allows you to invert an entire where clause instead of manually applying conditions. + # + # class User + # scope :active, -> { where(accepted: true, locked: false) } + # end + # + # User.where(accepted: true) + # # WHERE `accepted` = true + # + # User.where(accepted: true).invert_where + # # WHERE `accepted` != true + # + # User.active + # # WHERE `accepted` = true AND `locked` = false + # + # User.active.invert_where + # # WHERE NOT (`accepted` = true AND `locked` = false) + # + # Be careful because this inverts all conditions before +invert_where+ call. + # + # class User + # scope :active, -> { where(accepted: true, locked: false) } + # scope :inactive, -> { active.invert_where } # Do not attempt it + # end + # + # # It also inverts `where(role: 'admin')` unexpectedly. + # User.where(role: 'admin').inactive + # # WHERE NOT (`role` = 'admin' AND `accepted` = true AND `locked` = false) + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1129 + def invert_where; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1133 + def invert_where!; end + + # Performs JOINs on +args+. The given symbol(s) should match the name of + # the association(s). + # + # User.joins(:posts) + # # SELECT "users".* + # # FROM "users" + # # INNER JOIN "posts" ON "posts"."user_id" = "users"."id" + # + # Multiple joins: + # + # User.joins(:posts, :account) + # # SELECT "users".* + # # FROM "users" + # # INNER JOIN "posts" ON "posts"."user_id" = "users"."id" + # # INNER JOIN "accounts" ON "accounts"."id" = "users"."account_id" + # + # Nested joins: + # + # User.joins(posts: [:comments]) + # # SELECT "users".* + # # FROM "users" + # # INNER JOIN "posts" ON "posts"."user_id" = "users"."id" + # # INNER JOIN "comments" ON "comments"."post_id" = "posts"."id" + # + # You can use strings in order to customize your joins: + # + # User.joins("LEFT JOIN bookmarks ON bookmarks.bookmarkable_type = 'Post' AND bookmarks.user_id = users.id") + # # SELECT "users".* FROM "users" LEFT JOIN bookmarks ON bookmarks.bookmarkable_type = 'Post' AND bookmarks.user_id = users.id + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:896 + def joins(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:901 + def joins!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def joins_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def joins_values=(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:915 + def left_joins(*args); end + + # Performs LEFT OUTER JOINs on +args+: + # + # User.left_outer_joins(:posts) + # # SELECT "users".* FROM "users" LEFT OUTER JOIN "posts" ON "posts"."user_id" = "users"."id" + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:911 + def left_outer_joins(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:917 + def left_outer_joins!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def left_outer_joins_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def left_outer_joins_values=(value); end + + # Specifies a limit for the number of records to retrieve. + # + # User.limit(10) # generated SQL has 'LIMIT 10' + # + # User.limit(10).limit(20) # generated SQL has 'LIMIT 20' + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1239 + def limit(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1243 + def limit!(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def limit_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def limit_value=(value); end + + # Specifies locking settings (default to +true+). For more information + # on locking, please see ActiveRecord::Locking. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1267 + def lock(locks = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1271 + def lock!(locks = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def lock_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def lock_value=(value); end + + # Returns a chainable relation with zero records. + # + # The returned relation implements the Null Object pattern. It is an + # object with defined null behavior and always returns an empty array of + # records without querying the database. + # + # Any subsequent condition chained to the returned relation will continue + # generating an empty relation and will not fire any query to the database. + # + # Used in cases where a method or scope could return zero records but the + # result needs to be chainable. + # + # For example: + # + # @posts = current_user.visible_posts.where(name: params[:name]) + # # the visible_posts method is expected to return a chainable Relation + # + # def visible_posts + # case role + # when 'Country Manager' + # Post.where(country: country) + # when 'Reviewer' + # Post.published + # when 'Bad User' + # Post.none # It can't be chained if [] is returned. + # end + # end + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1310 + def none; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1314 + def none!; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1322 + def null_relation?; end + + # Specifies the number of rows to skip before returning rows. + # + # User.offset(10) # generated SQL has "OFFSET 10" + # + # Should be used with order. + # + # User.offset(10).order("name ASC") + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1256 + def offset(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1260 + def offset!(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def offset_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def offset_value=(value); end + + # Specify optimizer hints to be used in the SELECT statement. + # + # Example (for MySQL): + # + # Topic.optimizer_hints("MAX_EXECUTION_TIME(50000)", "NO_INDEX_MERGE(topics)") + # # SELECT /*+ MAX_EXECUTION_TIME(50000) NO_INDEX_MERGE(topics) */ `topics`.* FROM `topics` + # + # Example (for PostgreSQL with pg_hint_plan): + # + # Topic.optimizer_hints("SeqScan(topics)", "Parallel(topics 8)") + # # SELECT /*+ SeqScan(topics) Parallel(topics 8) */ "topics".* FROM "topics" + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1514 + def optimizer_hints(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1519 + def optimizer_hints!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def optimizer_hints_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def optimizer_hints_values=(value); end + + # Returns a new relation, which is the logical union of this relation and the one passed as an + # argument. + # + # The two relations must be structurally compatible: they must be scoping the same model, and + # they must differ only by #where (if no #group has been defined) or #having (if a #group is + # present). + # + # Post.where("id = 1").or(Post.where("author_id = 3")) + # # SELECT `posts`.* FROM `posts` WHERE ((id = 1) OR (author_id = 3)) + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1195 + def or(other); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1207 + def or!(other); end + + # Applies an ORDER BY clause to a query. + # + # #order accepts arguments in one of several formats. + # + # === symbols + # + # The symbol represents the name of the column you want to order the results by. + # + # User.order(:name) + # # SELECT "users".* FROM "users" ORDER BY "users"."name" ASC + # + # By default, the order is ascending. If you want descending order, you can + # map the column name symbol to +:desc+. + # + # User.order(email: :desc) + # # SELECT "users".* FROM "users" ORDER BY "users"."email" DESC + # + # Multiple columns can be passed this way, and they will be applied in the order specified. + # + # User.order(:name, email: :desc) + # # SELECT "users".* FROM "users" ORDER BY "users"."name" ASC, "users"."email" DESC + # + # === strings + # + # Strings are passed directly to the database, allowing you to specify + # simple SQL expressions. + # + # This could be a source of SQL injection, so only strings composed of plain + # column names and simple function(column_name) expressions + # with optional +ASC+/+DESC+ modifiers are allowed. + # + # User.order('name') + # # SELECT "users".* FROM "users" ORDER BY name + # + # User.order('name DESC') + # # SELECT "users".* FROM "users" ORDER BY name DESC + # + # User.order('name DESC, email') + # # SELECT "users".* FROM "users" ORDER BY name DESC, email + # + # === Arel + # + # If you need to pass in complicated expressions that you have verified + # are safe for the database, you can use Arel. + # + # User.order(Arel.sql('end_date - start_date')) + # # SELECT "users".* FROM "users" ORDER BY end_date - start_date + # + # Custom query syntax, like JSON columns for PostgreSQL, is supported in this way. + # + # User.order(Arel.sql("payload->>'kind'")) + # # SELECT "users".* FROM "users" ORDER BY payload->>'kind' + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:656 + def order(*args); end + + # Same as #order but operates on relation in-place instead of copying. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:664 + def order!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def order_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def order_values=(value); end + + # Specify associations +args+ to be eager loaded using separate queries. + # A separate query is performed for each association. + # + # users = User.preload(:address).limit(5) + # users.each do |user| + # user.address.city + # end + # + # # SELECT "users".* FROM "users" LIMIT 5 + # # SELECT "addresses".* FROM "addresses" WHERE "addresses"."id" IN (1,2,3,4,5) + # + # Instead of loading the 5 addresses with 5 separate queries, all addresses + # are loaded with a separate query. + # + # Loading multiple and nested associations is possible using Hashes and Arrays, + # similar to #includes: + # + # User.preload(:address, friends: [:address, :followers]) + # # SELECT "users".* FROM "users" + # # SELECT "addresses".* FROM "addresses" WHERE "addresses"."id" IN (1,2,3,4,5) + # # SELECT "friends".* FROM "friends" WHERE "friends"."user_id" IN (1,2,3,4,5) + # # SELECT ... + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:322 + def preload(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:327 + def preload!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def preload_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def preload_values=(value); end + + # Mark a relation as readonly. Attempting to update a record will result in + # an error. + # + # users = User.readonly + # users.first.save + # # => ActiveRecord::ReadOnlyRecord: User is marked as readonly + # + # To make a readonly relation writable, pass +false+. + # + # users.readonly(false) + # users.first.save + # # => true + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1338 + def readonly(value = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1342 + def readonly!(value = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def readonly_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def readonly_value=(value); end + + # Use to indicate that the given +table_names+ are referenced by an SQL string, + # and should therefore be +JOIN+ed in any query rather than loaded separately. + # This method only works in conjunction with #includes. + # See #includes for more details. + # + # User.includes(:posts).where("posts.name = 'foo'") + # # Doesn't JOIN the posts table, resulting in an error. + # + # User.includes(:posts).where("posts.name = 'foo'").references(:posts) + # # Query now knows the string references posts, so adds a JOIN + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:355 + def references(*table_names); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:360 + def references!(*table_names); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def references_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def references_values=(value); end + + # Allows you to change a previously set group statement. + # + # Post.group(:title, :body) + # # SELECT `posts`.`*` FROM `posts` GROUP BY `posts`.`title`, `posts`.`body` + # + # Post.group(:title, :body).regroup(:title) + # # SELECT `posts`.`*` FROM `posts` GROUP BY `posts`.`title` + # + # This is short-hand for unscope(:group).group(fields). + # Note that we're unscoping the entire group statement. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:593 + def regroup(*args); end + + # Same as #regroup but operates on relation in-place instead of copying. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:599 + def regroup!(*args); end + + # Replaces any existing order defined on the relation with the specified order. + # + # User.order('email DESC').reorder('id ASC') # generated SQL has 'ORDER BY id ASC' + # + # Subsequent calls to order on the same relation will be appended. For example: + # + # User.order('email DESC').reorder('id ASC').order('name ASC') + # + # generates a query with ORDER BY id ASC, name ASC. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:760 + def reorder(*args); end + + # Same as #reorder but operates on relation in-place instead of copying. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:768 + def reorder!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def reordering_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def reordering_value=(value); end + + # Allows you to change a previously set select statement. + # + # Post.select(:title, :body) + # # SELECT `posts`.`title`, `posts`.`body` FROM `posts` + # + # Post.select(:title, :body).reselect(:created_at) + # # SELECT `posts`.`created_at` FROM `posts` + # + # This is short-hand for unscope(:select).select(fields). + # Note that we're unscoping the entire select statement. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:541 + def reselect(*args); end + + # Same as #reselect but operates on relation in-place instead of copying. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:548 + def reselect!(*args); end + + # Reverse the existing order clause on the relation. + # + # User.order('name ASC').reverse_order # generated SQL has 'ORDER BY name DESC' + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1527 + def reverse_order; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1531 + def reverse_order!; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def reverse_order_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def reverse_order_value=(value); end + + # Allows you to change a previously set where condition for a given attribute, instead of appending to that condition. + # + # Post.where(trashed: true).where(trashed: false) + # # WHERE `trashed` = true AND `trashed` = false + # + # Post.where(trashed: true).rewhere(trashed: false) + # # WHERE `trashed` = false + # + # Post.where(active: true).where(trashed: true).rewhere(trashed: false) + # # WHERE `active` = true AND `trashed` = false + # + # This is short-hand for unscope(where: conditions.keys).where(conditions). + # Note that unlike reorder, we're only unscoping the named conditions -- not the entire where statement. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1089 + def rewhere(conditions); end + + # Works in two unique ways. + # + # First: takes a block so it can be used just like Array#select. + # + # Model.all.select { |m| m.field == value } + # + # This will build an array of objects from the database for the scope, + # converting them into an array and iterating through them using + # Array#select. + # + # Second: Modifies the SELECT statement for the query so that only certain + # fields are retrieved: + # + # Model.select(:field) + # # => [#] + # + # Although in the above example it looks as though this method returns an + # array, it actually returns a relation object and can have other query + # methods appended to it, such as the other methods in ActiveRecord::QueryMethods. + # + # The argument to the method can also be an array of fields. + # + # Model.select(:field, :other_field, :and_one_more) + # # => [#] + # + # The argument also can be a hash of fields and aliases. + # + # Model.select(models: { field: :alias, other_field: :other_alias }) + # # => [#] + # + # Model.select(models: [:field, :other_field]) + # # => [#] + # + # You can also use one or more strings, which will be used unchanged as SELECT fields. + # + # Model.select('field AS field_one', 'other_field AS field_two') + # # => [#] + # + # If an alias was specified, it will be accessible from the resulting objects: + # + # Model.select('field AS field_one').first.field_one + # # => "value" + # + # Accessing attributes of an object that do not have fields retrieved by a select + # except +id+ will throw ActiveModel::MissingAttributeError: + # + # Model.select(:field).first.other_field + # # => ActiveModel::MissingAttributeError: missing attribute 'other_field' for Model + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:413 + def select(*fields); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def select_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def select_values=(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1542 + def skip_preloading!; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1537 + def skip_query_cache!(value = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def skip_query_cache_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def skip_query_cache_value=(value); end + + # Sets the returned relation to strict_loading mode. This will raise an error + # if the record tries to lazily load an association. + # + # user = User.strict_loading.first + # user.comments.to_a + # # => ActiveRecord::StrictLoadingViolationError + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1353 + def strict_loading(value = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1357 + def strict_loading!(value = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def strict_loading_value; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def strict_loading_value=(value); end + + # Checks whether the given relation is structurally compatible with this relation, to determine + # if it's possible to use the #and and #or methods without raising an error. Structurally + # compatible is defined as: they must be scoping the same model, and they must differ only by + # #where (if no #group has been defined) or #having (if a #group is present). + # + # Post.where("id = 1").structurally_compatible?(Post.where("author_id = 3")) + # # => true + # + # Post.joins(:comments).structurally_compatible?(Post.where("id = 1")) + # # => false + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1149 + def structurally_compatible?(other); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:848 + def table_name_qualified_unscope_values; end + + # Deduplicate multiple values. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1570 + def uniq!(name); end + + # Removes an unwanted relation that is already defined on a chain of relations. + # This is useful when passing around chains of relations and would like to + # modify the relations without reconstructing the entire chain. + # + # User.order('email DESC').unscope(:order) == User.all + # + # The method arguments are symbols which correspond to the names of the methods + # which should be unscoped. The valid arguments are given in VALID_UNSCOPING_VALUES. + # The method can also be called with multiple arguments. For example: + # + # User.order('email DESC').select('id').where(name: "John") + # .unscope(:order, :select, :where) == User.all + # + # One can additionally pass a hash as an argument to unscope specific +:where+ values. + # This is done by passing a hash with a single key-value pair. The key should be + # +:where+ and the value should be the where value to unscope. For example: + # + # User.where(name: "John", active: true).unscope(where: :name) + # == User.where(active: true) + # + # This method is similar to #except, but unlike + # #except, it persists across merges: + # + # User.order('email').merge(User.except(:order)) + # == User.order('email') + # + # User.order('email').merge(User.unscope(:order)) + # == User.all + # + # This means it can be used in association definitions: + # + # has_many :comments, -> { unscope(where: :trashed) } + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:814 + def unscope(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:819 + def unscope!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def unscope_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def unscope_values=(value); end + + # Returns a new relation, which is the result of filtering the current relation + # according to the conditions in the arguments. + # + # #where accepts conditions in one of several formats. In the examples below, the resulting + # SQL is given as an illustration; the actual query generated may be different depending + # on the database adapter. + # + # === \String + # + # A single string, without additional arguments, is passed to the query + # constructor as an SQL fragment, and used in the where clause of the query. + # + # Client.where("orders_count = '2'") + # # SELECT * from clients where orders_count = '2'; + # + # Note that building your own string from user input may expose your application + # to injection attacks if not done properly. As an alternative, it is recommended + # to use one of the following methods. + # + # === \Array + # + # If an array is passed, then the first element of the array is treated as a template, and + # the remaining elements are inserted into the template to generate the condition. + # Active Record takes care of building the query to avoid injection attacks, and will + # convert from the ruby type to the database type where needed. Elements are inserted + # into the string in the order in which they appear. + # + # User.where(["name = ? and email = ?", "Joe", "joe@example.com"]) + # # SELECT * FROM users WHERE name = 'Joe' AND email = 'joe@example.com'; + # + # Alternatively, you can use named placeholders in the template, and pass a hash as the + # second element of the array. The names in the template are replaced with the corresponding + # values from the hash. + # + # User.where(["name = :name and email = :email", { name: "Joe", email: "joe@example.com" }]) + # # SELECT * FROM users WHERE name = 'Joe' AND email = 'joe@example.com'; + # + # This can make for more readable code in complex queries. + # + # Lastly, you can use sprintf-style % escapes in the template. This works slightly differently + # than the previous methods; you are responsible for ensuring that the values in the template + # are properly quoted. The values are passed to the connector for quoting, but the caller + # is responsible for ensuring they are enclosed in quotes in the resulting SQL. After quoting, + # the values are inserted using the same escapes as the Ruby core method +Kernel::sprintf+. + # + # User.where(["name = '%s' and email = '%s'", "Joe", "joe@example.com"]) + # # SELECT * FROM users WHERE name = 'Joe' AND email = 'joe@example.com'; + # + # If #where is called with multiple arguments, these are treated as if they were passed as + # the elements of a single array. + # + # User.where("name = :name and email = :email", { name: "Joe", email: "joe@example.com" }) + # # SELECT * FROM users WHERE name = 'Joe' AND email = 'joe@example.com'; + # + # When using strings to specify conditions, you can use any operator available from + # the database. While this provides the most flexibility, you can also unintentionally introduce + # dependencies on the underlying database. If your code is intended for general consumption, + # test with multiple database backends. + # + # === \Hash + # + # #where will also accept a hash condition, in which the keys are fields and the values + # are values to be searched for. + # + # Fields can be symbols or strings. Values can be single values, arrays, or ranges. + # + # User.where(name: "Joe", email: "joe@example.com") + # # SELECT * FROM users WHERE name = 'Joe' AND email = 'joe@example.com' + # + # User.where(name: ["Alice", "Bob"]) + # # SELECT * FROM users WHERE name IN ('Alice', 'Bob') + # + # User.where(created_at: (Time.now.midnight - 1.day)..Time.now.midnight) + # # SELECT * FROM users WHERE (created_at BETWEEN '2012-06-09 07:00:00.000000' AND '2012-06-10 07:00:00.000000') + # + # In the case of a belongs_to relationship, an association key can be used + # to specify the model if an ActiveRecord object is used as the value. + # + # author = Author.find(1) + # + # # The following queries will be equivalent: + # Post.where(author: author) + # Post.where(author_id: author) + # + # This also works with polymorphic belongs_to relationships: + # + # treasure = Treasure.create(name: 'gold coins') + # treasure.price_estimates << PriceEstimate.create(price: 125) + # + # # The following queries will be equivalent: + # PriceEstimate.where(estimate_of: treasure) + # PriceEstimate.where(estimate_of_type: 'Treasure', estimate_of_id: treasure) + # + # Hash conditions may also be specified in a tuple-like syntax. Hash keys may be + # an array of columns with an array of tuples as values. + # + # Article.where([:author_id, :id] => [[15, 1], [15, 2]]) + # # SELECT * FROM articles WHERE author_id = 15 AND id = 1 OR author_id = 15 AND id = 2 + # + # === Joins + # + # If the relation is the result of a join, you may create a condition which uses any of the + # tables in the join. For string and array conditions, use the table name in the condition. + # + # User.joins(:posts).where("posts.created_at < ?", Time.now) + # + # For hash conditions, you can either use the table name in the key, or use a sub-hash. + # + # User.joins(:posts).where("posts.published" => true) + # User.joins(:posts).where(posts: { published: true }) + # + # === No Argument + # + # If no argument is passed, #where returns a new instance of WhereChain, that + # can be chained with WhereChain#not, WhereChain#missing, or WhereChain#associated. + # + # Chaining with WhereChain#not: + # + # User.where.not(name: "Jon") + # # SELECT * FROM users WHERE name != 'Jon' + # + # Chaining with WhereChain#associated: + # + # Post.where.associated(:author) + # # SELECT "posts".* FROM "posts" + # # INNER JOIN "authors" ON "authors"."id" = "posts"."author_id" + # # WHERE "authors"."id" IS NOT NULL + # + # Chaining with WhereChain#missing: + # + # Post.where.missing(:author) + # # SELECT "posts".* FROM "posts" + # # LEFT OUTER JOIN "authors" ON "authors"."id" = "posts"."author_id" + # # WHERE "authors"."id" IS NULL + # + # === Blank Condition + # + # If the condition is any blank-ish object, then #where is a no-op and returns + # the current relation. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1061 + def where(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1071 + def where!(opts, *rest); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def where_clause; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def where_clause=(value); end + + # Add a Common Table Expression (CTE) that you can then reference within another SELECT statement. + # + # Note: CTE's are only supported in MySQL for versions 8.0 and above. You will not be able to + # use CTE's with MySQL 5.7. + # + # Post.with(posts_with_tags: Post.where("tags_count > ?", 0)) + # # => ActiveRecord::Relation + # # WITH posts_with_tags AS ( + # # SELECT * FROM posts WHERE (tags_count > 0) + # # ) + # # SELECT * FROM posts + # + # You can also pass an array of sub-queries to be joined in a +UNION ALL+. + # + # Post.with(posts_with_tags_or_comments: [Post.where("tags_count > ?", 0), Post.where("comments_count > ?", 0)]) + # # => ActiveRecord::Relation + # # WITH posts_with_tags_or_comments AS ( + # # (SELECT * FROM posts WHERE (tags_count > 0)) + # # UNION ALL + # # (SELECT * FROM posts WHERE (comments_count > 0)) + # # ) + # # SELECT * FROM posts + # + # Once you define Common Table Expression you can use custom +FROM+ value or +JOIN+ to reference it. + # + # Post.with(posts_with_tags: Post.where("tags_count > ?", 0)).from("posts_with_tags AS posts") + # # => ActiveRecord::Relation + # # WITH posts_with_tags AS ( + # # SELECT * FROM posts WHERE (tags_count > 0) + # # ) + # # SELECT * FROM posts_with_tags AS posts + # + # Post.with(posts_with_tags: Post.where("tags_count > ?", 0)).joins("JOIN posts_with_tags ON posts_with_tags.id = posts.id") + # # => ActiveRecord::Relation + # # WITH posts_with_tags AS ( + # # SELECT * FROM posts WHERE (tags_count > 0) + # # ) + # # SELECT * FROM posts JOIN posts_with_tags ON posts_with_tags.id = posts.id + # + # It is recommended to pass a query as ActiveRecord::Relation. If that is not possible + # and you have verified it is safe for the database, you can pass it as SQL literal + # using +Arel+. + # + # Post.with(popular_posts: Arel.sql("... complex sql to calculate posts popularity ...")) + # + # Great caution should be taken to avoid SQL injection vulnerabilities. This method should not + # be used with unsafe values that include unsanitized input. + # + # To add multiple CTEs just pass multiple key-value pairs + # + # Post.with( + # posts_with_comments: Post.where("comments_count > ?", 0), + # posts_with_tags: Post.where("tags_count > ?", 0) + # ) + # + # or chain multiple +.with+ calls + # + # Post + # .with(posts_with_comments: Post.where("comments_count > ?", 0)) + # .with(posts_with_tags: Post.where("tags_count > ?", 0)) + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:493 + def with(*args); end + + # Like #with, but modifies relation in place. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:500 + def with!(*args); end + + # Add a recursive Common Table Expression (CTE) that you can then reference within another SELECT statement. + # + # Post.with_recursive(post_and_replies: [Post.where(id: 42), Post.joins('JOIN post_and_replies ON posts.in_reply_to_id = post_and_replies.id')]) + # # => ActiveRecord::Relation + # # WITH RECURSIVE post_and_replies AS ( + # # (SELECT * FROM posts WHERE id = 42) + # # UNION ALL + # # (SELECT * FROM posts JOIN post_and_replies ON posts.in_reply_to_id = post_and_replies.id) + # # ) + # # SELECT * FROM posts + # + # See `#with` for more information. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:518 + def with_recursive(*args); end + + # Like #with_recursive but modifies the relation in place. + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:524 + def with_recursive!(*args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def with_values; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:173 + def with_values=(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1614 + def without(*records); end + + protected + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1690 + def arel_columns(columns); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1685 + def async!; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1683 + def build_having_clause(opts, rest = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1634 + def build_subquery(subquery_alias, select_value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1642 + def build_where_clause(opts, rest = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2076 + def _reverse_order_columns; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2014 + def arel_column(field); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2295 + def arel_column_aliases_from_hash(fields); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2002 + def arel_column_with_table(table_name, column_name); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1986 + def arel_columns_from_hash(fields); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1774 + def assert_modifiable!; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1706 + def async; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1778 + def build_arel(aliases); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1730 + def build_bound_sql_literal(statement, values); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2202 + def build_case_for_value_position(column, values, filter: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1802 + def build_cast_value(name, value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1806 + def build_from; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1848 + def build_join_buckets; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1763 + def build_join_dependencies; end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1904 + def build_joins(join_sources, aliases = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1710 + def build_named_bound_sql_literal(statement, values); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2094 + def build_order(arel); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1926 + def build_select(arel); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1936 + def build_with(arel); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1952 + def build_with_expression_from_value(value, nested = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1978 + def build_with_join_node(name, kind = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1946 + def build_with_value_from_hash(hash); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2277 + def cast_values_for_in_order_of(values, type_caster); end + + # Checks to make sure that the arguments are not blank. Note that if some + # blank-like object were initially passed into the query method, then this + # method will not raise an error. + # + # Example: + # + # Post.references() # raises an error + # Post.references([]) # does not raise an error + # + # This particular method should be called with a method_name (__callee__) and the args + # passed into that method as an input. For example: + # + # def references(*args) + # check_if_method_has_arguments!(__callee__, args) + # ... + # end + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2256 + def check_if_method_has_arguments!(method_name, args, message = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2163 + def column_references(order_args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2083 + def does_not_support_reverse?(order); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1757 + def each_join_dependencies(join_dependencies = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2188 + def extract_table_name_from(string); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2116 + def flattened_args(args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1750 + def lookup_table_klass_from_join_dependencies(table_name); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2192 + def order_column(field); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2120 + def preprocess_order_args(order_args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2267 + def process_select_args(fields); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2315 + def process_with_args(args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2236 + def qualify_attribute_with_table_name(attr); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2212 + def resolve_arel_attributes(attrs); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2041 + def reverse_sql_order(order_query); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2157 + def sanitize_order_arguments(order_args); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1833 + def select_association_list(associations, stashed_joins = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:1821 + def select_named_joins(join_names, stashed_joins = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2327 + def structurally_incompatible_values_for(other); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2035 + def table_name_matches?(from); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2102 + def validate_order_args(args); end +end + +# A wrapper to distinguish CTE joins from other nodes. +# +# pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:151 +class ActiveRecord::QueryMethods::CTEJoin + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:154 + def initialize(name); end + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:152 + def name; end +end + +# pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:159 +ActiveRecord::QueryMethods::FROZEN_EMPTY_ARRAY = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:160 +ActiveRecord::QueryMethods::FROZEN_EMPTY_HASH = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2322 +ActiveRecord::QueryMethods::STRUCTURAL_VALUE_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:2099 +ActiveRecord::QueryMethods::VALID_DIRECTIONS = T.let(T.unsafe(nil), Set) + +# pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:776 +ActiveRecord::QueryMethods::VALID_UNSCOPING_VALUES = T.let(T.unsafe(nil), Set) + +# +WhereChain+ objects act as placeholder for queries in which +where+ does not have any parameter. +# In this case, +where+ can be chained to return a new relation. +# +# pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:14 +class ActiveRecord::QueryMethods::WhereChain + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:15 + def initialize(scope); end + + # Returns a new relation with joins and where clause to identify + # associated relations. + # + # For example, posts that are associated to a related author: + # + # Post.where.associated(:author) + # # SELECT "posts".* FROM "posts" + # # INNER JOIN "authors" ON "authors"."id" = "posts"."author_id" + # # WHERE "authors"."id" IS NOT NULL + # + # Additionally, multiple relations can be combined. This will return posts + # associated to both an author and any comments: + # + # Post.where.associated(:author, :comments) + # # SELECT "posts".* FROM "posts" + # # INNER JOIN "authors" ON "authors"."id" = "posts"."author_id" + # # INNER JOIN "comments" ON "comments"."post_id" = "posts"."id" + # # WHERE "authors"."id" IS NOT NULL AND "comments"."id" IS NOT NULL + # + # You can define join type in the scope and +associated+ will not use `JOIN` by default. + # + # Post.left_joins(:author).where.associated(:author) + # # SELECT "posts".* FROM "posts" + # # LEFT OUTER JOIN "authors" "authors"."id" = "posts"."author_id" + # # WHERE "authors"."id" IS NOT NULL + # + # Post.left_joins(:comments).where.associated(:author) + # # SELECT "posts".* FROM "posts" + # # INNER JOIN "authors" ON "authors"."id" = "posts"."author_id" + # # LEFT OUTER JOIN "comments" ON "comments"."post_id" = "posts"."id" + # # WHERE "author"."id" IS NOT NULL + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:88 + def associated(*associations); end + + # Returns a new relation with left outer joins and where clause to identify + # missing relations. + # + # For example, posts that are missing a related author: + # + # Post.where.missing(:author) + # # SELECT "posts".* FROM "posts" + # # LEFT OUTER JOIN "authors" ON "authors"."id" = "posts"."author_id" + # # WHERE "authors"."id" IS NULL + # + # Additionally, multiple relations can be combined. This will return posts + # that are missing both an author and any comments: + # + # Post.where.missing(:author, :comments) + # # SELECT "posts".* FROM "posts" + # # LEFT OUTER JOIN "authors" ON "authors"."id" = "posts"."author_id" + # # LEFT OUTER JOIN "comments" ON "comments"."post_id" = "posts"."id" + # # WHERE "authors"."id" IS NULL AND "comments"."id" IS NULL + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:124 + def missing(*associations); end + + # Returns a new relation expressing WHERE + NOT condition according to + # the conditions in the arguments. + # + # #not accepts conditions as a string, array, or hash. See QueryMethods#where for + # more details on each format. + # + # User.where.not("name = 'Jon'") + # # SELECT * FROM users WHERE NOT (name = 'Jon') + # + # User.where.not(["name = ?", "Jon"]) + # # SELECT * FROM users WHERE NOT (name = 'Jon') + # + # User.where.not(name: "Jon") + # # SELECT * FROM users WHERE name != 'Jon' + # + # User.where.not(name: nil) + # # SELECT * FROM users WHERE name IS NOT NULL + # + # User.where.not(name: %w(Ko1 Nobu)) + # # SELECT * FROM users WHERE name NOT IN ('Ko1', 'Nobu') + # + # User.where.not(name: "Jon", role: "admin") + # # SELECT * FROM users WHERE NOT (name = 'Jon' AND role = 'admin') + # + # If there is a non-nil condition on a nullable column in the hash condition, the records that have + # nil values on the nullable column won't be returned. + # User.create!(nullable_country: nil) + # User.where.not(nullable_country: "UK") + # # SELECT * FROM users WHERE NOT (nullable_country = 'UK') + # # => [] + # + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:49 + def not(opts, *rest); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/query_methods.rb:140 + def scope_association_reflection(association); end +end + +# pkg:gem/activerecord#lib/active_record/querying.rb:4 +module ActiveRecord::Querying + # pkg:gem/activerecord#lib/active_record/querying.rb:83 + def _load_from_sql(result_set, &block); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:79 + def _query_by_sql(connection, sql, binds = T.unsafe(nil), preparable: T.unsafe(nil), async: T.unsafe(nil), allow_retry: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def and(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def annotate(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def any?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def async_average(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def async_count(*, **, &); end + + # Same as #count_by_sql but perform the query asynchronously and returns an ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/querying.rb:128 + def async_count_by_sql(sql); end + + # Same as #find_by_sql but perform the query asynchronously and returns an ActiveRecord::Promise. + # + # pkg:gem/activerecord#lib/active_record/querying.rb:71 + def async_find_by_sql(sql, binds = T.unsafe(nil), preparable: T.unsafe(nil), allow_retry: T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def async_ids(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def async_maximum(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def async_minimum(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def async_pick(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def async_pluck(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def async_sum(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def average(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def calculate(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def count(*, **, &); end + + # Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part. + # The use of this method should be restricted to complicated SQL queries that can't be executed + # using the ActiveRecord::Calculations class methods. Look into those before using this method, + # as it could lock you into a specific database engine or require a code change to switch + # database engines. + # + # Product.count_by_sql "SELECT COUNT(*) FROM sales s, customers c WHERE s.customer_id = c.id" + # # => 12 + # + # ==== Parameters + # + # * +sql+ - An SQL statement which should return a count query from the database, see the example above. + # + # pkg:gem/activerecord#lib/active_record/querying.rb:121 + def count_by_sql(sql); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def create_or_find_by(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def create_or_find_by!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def create_with(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def delete(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def delete_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def delete_by(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def destroy(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def destroy_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def destroy_by(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def distinct(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def eager_load(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def except(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def excluding(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def exists?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def extending(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def extract_associated(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def fifth(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def fifth!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def find(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def find_by(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def find_by!(*, **, &); end + + # Executes a custom SQL query against your database and returns all the results. The results will + # be returned as an array, with the requested columns encapsulated as attributes of the model you call + # this method from. For example, if you call Product.find_by_sql, then the results will be returned in + # a +Product+ object with the attributes you specified in the SQL query. + # + # If you call a complicated SQL query which spans multiple tables, the columns specified by the + # SELECT will be attributes of the model, whether or not they are columns of the corresponding + # table. + # + # The +sql+ parameter is a full SQL query as a string. It will be called as is; there will be + # no database agnostic conversions performed. This should be a last resort because using + # database-specific terms will lock you into using that particular database engine, or require you to + # change your call if you switch engines. + # + # # A simple SQL query spanning multiple tables + # Post.find_by_sql "SELECT p.title, c.author FROM posts p, comments c WHERE p.id = c.post_id" + # # => [#"Ruby Meetup", "author"=>"Quentin"}>, ...] + # + # You can use the same string replacement techniques as you can with ActiveRecord::QueryMethods#where : + # + # Post.find_by_sql ["SELECT title FROM posts WHERE author = ? AND created > ?", author_id, start_date] + # Post.find_by_sql ["SELECT body FROM comments WHERE author = :user_id OR approved_by = :user_id", { :user_id => user_id }] + # + # Note that building your own SQL query string from user input {may expose your application to + # injection attacks}[https://guides.rubyonrails.org/security.html#sql-injection]. + # + # pkg:gem/activerecord#lib/active_record/querying.rb:63 + def find_by_sql(sql, binds = T.unsafe(nil), preparable: T.unsafe(nil), allow_retry: T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def find_each(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def find_in_batches(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def find_or_create_by(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def find_or_create_by!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def find_or_initialize_by(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def find_sole_by(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def first(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def first!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def first_or_create(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def first_or_create!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def first_or_initialize(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def forty_two(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def forty_two!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def fourth(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def fourth!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def from(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def group(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def having(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def ids(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def in_batches(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def in_order_of(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def includes(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def insert(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def insert!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def insert_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def insert_all!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def invert_where(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def joins(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def last(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def last!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def left_joins(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def left_outer_joins(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def limit(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def lock(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def many?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def maximum(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def merge(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def minimum(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def none(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def none?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def offset(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def one?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def only(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def optimizer_hints(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def or(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def order(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def pick(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def pluck(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def preload(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def readonly(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def references(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def regroup(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def reorder(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def reselect(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def rewhere(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def second(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def second!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def second_to_last(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def second_to_last!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def select(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def sole(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def strict_loading(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def sum(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def take(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def take!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def third(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def third!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def third_to_last(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def third_to_last!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def touch_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def unscope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def update_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def upsert(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def upsert_all(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def where(*, **, &); end + + # Add a Common Table Expression (CTE) that you can then reference within another SELECT statement. + # + # See ActiveRecord::QueryMethods#with for more information. + # + # When given a block, and the Object#with core extension is loaded, this + # delegates to it instead, temporarily setting the given attributes on the + # class for the duration of the block and restoring them afterwards. + # + # pkg:gem/activerecord#lib/active_record/querying.rb:33 + def with(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def with_recursive(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/querying.rb:24 + def without(*, **, &); end +end + +# pkg:gem/activerecord#lib/active_record/querying.rb:5 +ActiveRecord::Querying::QUERYING_METHODS = T.let(T.unsafe(nil), Array) + +# = Active Record Railtie +# +# pkg:gem/activerecord#lib/active_record/railtie.rb:16 +class ActiveRecord::Railtie < ::Rails::Railtie; end + +# Raised when values that executed are out of range. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:308 +class ActiveRecord::RangeError < ::ActiveRecord::StatementInvalid; end + +# Raised when a write to the database is attempted on a read only connection. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:131 +class ActiveRecord::ReadOnlyError < ::ActiveRecord::ActiveRecordError; end + +# Raised on attempt to update record that is instantiated as read only. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:401 +class ActiveRecord::ReadOnlyRecord < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/readonly_attributes.rb:4 +class ActiveRecord::ReadonlyAttributeError < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/readonly_attributes.rb:7 +module ActiveRecord::ReadonlyAttributes + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::ReadonlyAttributes::ClassMethods + + module GeneratedClassMethods + def _attr_readonly; end + def _attr_readonly=(value); end + def _attr_readonly?; end + end + + module GeneratedInstanceMethods; end +end + +# pkg:gem/activerecord#lib/active_record/readonly_attributes.rb:14 +module ActiveRecord::ReadonlyAttributes::ClassMethods + # Attributes listed as readonly will be used to create a new record. + # Assigning a new value to a readonly attribute on a persisted record raises an error. + # + # By setting +config.active_record.raise_on_assign_to_attr_readonly+ to +false+, it will + # not raise. The value will change in memory, but will not be persisted on +save+. + # + # ==== Examples + # + # class Post < ActiveRecord::Base + # attr_readonly :title + # end + # + # post = Post.create!(title: "Introducing Ruby on Rails!") + # post.title = "a different title" # raises ActiveRecord::ReadonlyAttributeError + # post.update(title: "a different title") # raises ActiveRecord::ReadonlyAttributeError + # + # pkg:gem/activerecord#lib/active_record/readonly_attributes.rb:30 + def attr_readonly(*attributes); end + + # pkg:gem/activerecord#lib/active_record/readonly_attributes.rb:43 + def readonly_attribute?(name); end + + # Returns an array of all the attributes that have been specified as readonly. + # + # pkg:gem/activerecord#lib/active_record/readonly_attributes.rb:39 + def readonly_attributes; end +end + +# pkg:gem/activerecord#lib/active_record/readonly_attributes.rb:48 +module ActiveRecord::ReadonlyAttributes::HasReadonlyAttributes + # pkg:gem/activerecord#lib/active_record/readonly_attributes.rb:57 + def _write_attribute(attr_name, value); end + + # pkg:gem/activerecord#lib/active_record/readonly_attributes.rb:49 + def write_attribute(attr_name, value); end +end + +# = Active Record \RecordInvalid +# +# Raised by {ActiveRecord::Base#save!}[rdoc-ref:Persistence#save!] and +# {ActiveRecord::Base#create!}[rdoc-ref:Persistence::ClassMethods#create!] when the record is invalid. +# Use the #record method to retrieve the record which did not validate. +# +# begin +# complex_operation_that_internally_calls_save! +# rescue ActiveRecord::RecordInvalid => invalid +# puts invalid.record.errors +# end +# +# pkg:gem/activerecord#lib/active_record/validations.rb:15 +class ActiveRecord::RecordInvalid < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/validations.rb:18 + def initialize(record = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/validations.rb:16 + def record; end +end + +# Raised by {ActiveRecord::Base#destroy!}[rdoc-ref:Persistence#destroy!] +# when a record cannot be destroyed due to any of the +# before_destroy callbacks throwing +:abort+. See +# ActiveRecord::Callbacks for further details. +# +# class User < ActiveRecord::Base +# before_destroy do +# throw :abort if still_active? +# end +# end +# +# User.first.destroy! # => raises an ActiveRecord::RecordNotDestroyed +# +# pkg:gem/activerecord#lib/active_record/errors.rb:181 +class ActiveRecord::RecordNotDestroyed < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/errors.rb:184 + def initialize(message = T.unsafe(nil), record = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:182 + def record; end +end + +# Raised when Active Record cannot find a record by given id or set of ids. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:135 +class ActiveRecord::RecordNotFound < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/errors.rb:138 + def initialize(message = T.unsafe(nil), model = T.unsafe(nil), primary_key = T.unsafe(nil), id = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:136 + def id; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:136 + def model; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:136 + def primary_key; end +end + +# Raised by {ActiveRecord::Base#save!}[rdoc-ref:Persistence#save!] and +# {ActiveRecord::Base.update_attribute!}[rdoc-ref:Persistence#update_attribute!] +# methods when a record failed to validate or cannot be saved due to any of the +# before_* callbacks throwing +:abort+. See +# ActiveRecord::Callbacks for further details. +# +# class Product < ActiveRecord::Base +# before_save do +# throw :abort if price < 0 +# end +# end +# +# Product.create! # => raises an ActiveRecord::RecordNotSaved +# +# pkg:gem/activerecord#lib/active_record/errors.rb:160 +class ActiveRecord::RecordNotSaved < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/errors.rb:163 + def initialize(message = T.unsafe(nil), record = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:161 + def record; end +end + +# Raised when a record cannot be inserted or updated because it would violate a uniqueness constraint. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:228 +class ActiveRecord::RecordNotUnique < ::ActiveRecord::WrappedDatabaseException; end + +# = Active Record Reflection +# +# pkg:gem/activerecord#lib/active_record/reflection.rb:7 +module ActiveRecord::Reflection + extend ::ActiveSupport::Concern + extend ::ActiveStorage::Reflection::ReflectionExtension + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::Reflection::ClassMethods + + class << self + # pkg:gem/activerecord#lib/active_record/reflection.rb:29 + def add_aggregate_reflection(ar, name, reflection); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:23 + def add_reflection(ar, name, reflection); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:18 + def create(macro, name, scope, options, ar); end + + private + + # pkg:gem/activerecord#lib/active_record/reflection.rb:34 + def reflection_class_for(macro); end + end + + module GeneratedClassMethods + def _reflections; end + def _reflections=(value); end + def _reflections?; end + def aggregate_reflections; end + def aggregate_reflections=(value); end + def aggregate_reflections?; end + def automatic_scope_inversing; end + def automatic_scope_inversing=(value); end + def automatic_scope_inversing?; end + def automatically_invert_plural_associations; end + def automatically_invert_plural_associations=(value); end + def automatically_invert_plural_associations?; end + end + + module GeneratedInstanceMethods + def _reflections; end + def _reflections?; end + def aggregate_reflections; end + def aggregate_reflections?; end + def automatic_scope_inversing; end + def automatic_scope_inversing?; end + def automatically_invert_plural_associations; end + def automatically_invert_plural_associations?; end + end +end + +# Holds all the methods that are shared between MacroReflection and ThroughReflection. +# +# AbstractReflection +# MacroReflection +# AggregateReflection +# AssociationReflection +# HasManyReflection +# HasOneReflection +# BelongsToReflection +# HasAndBelongsToManyReflection +# ThroughReflection +# PolymorphicReflection +# RuntimeReflection +# +# pkg:gem/activerecord#lib/active_record/reflection.rb:163 +class ActiveRecord::Reflection::AbstractReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:164 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:328 + def alias_candidate(name); end + + # Returns a new, unsaved instance of the associated class. +attributes+ will + # be passed to the class's constructor. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:182 + def build_association(attributes, &block); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:336 + def build_scope(table, predicate_builder = T.unsafe(nil), klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:332 + def chain; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:264 + def check_validity_of_inverse!; end + + # Returns the class name for the macro. + # + # composed_of :balance, class_name: 'Money' returns 'Money' + # has_many :clients returns 'Client' + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:190 + def class_name; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:240 + def constraints; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:244 + def counter_cache_column; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:324 + def counter_must_be_updated_by_has_many?; end + + # Returns whether this association has a counter cache and its column values were backfilled + # (and so it is used internally by methods like +size+/+any?+/etc). + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:315 + def has_active_cached_counter?; end + + # Returns whether this association has a counter cache. + # + # The counter_cache option must be given on either the owner or inverse + # association, and the column must be present on the owner. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:307 + def has_cached_counter?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:258 + def inverse_of; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:297 + def inverse_updates_counter_cache?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:299 + def inverse_updates_counter_in_memory?; end + + # We need to avoid the following situation: + # + # * An associated record is deleted via record.destroy + # * Hence the callbacks run, and they find a belongs_to on the record with a + # :counter_cache options which points back at our owner. So they update the + # counter cache. + # * In which case, we must make sure to *not* update the counter cache, or else + # it will be decremented twice. + # + # Hence this method. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:285 + def inverse_which_updates_counter_cache; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:200 + def join_scope(table, foreign_table, foreign_klass); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:227 + def join_scopes(table, predicate_builder = T.unsafe(nil), klass = T.unsafe(nil), record = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:235 + def klass_join_scope(table, predicate_builder = T.unsafe(nil)); end + + # Returns a list of scopes that should be applied for this Reflection + # object when querying the database. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:196 + def scopes; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:340 + def strict_loading?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:344 + def strict_loading_violation_message(owner); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:176 + def table_name; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:172 + def through_reflection?; end + + protected + + # pkg:gem/activerecord#lib/active_record/reflection.rb:351 + def actual_source_reflection; end + + private + + # pkg:gem/activerecord#lib/active_record/reflection.rb:360 + def ensure_option_not_given_as_class!(option_name); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:356 + def primary_key(klass); end +end + +# Holds all the metadata about an aggregation as it was specified in the +# Active Record class. +# +# pkg:gem/activerecord#lib/active_record/reflection.rb:480 +class ActiveRecord::Reflection::AggregateReflection < ::ActiveRecord::Reflection::MacroReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:481 + def mapping; end +end + +# Holds all the metadata about an association as it was specified in the +# Active Record class. +# +# pkg:gem/activerecord#lib/active_record/reflection.rb:489 +class ActiveRecord::Reflection::AssociationReflection < ::ActiveRecord::Reflection::MacroReflection + # Reflection + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:517 + def initialize(name, scope, options, active_record); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:591 + def active_record_primary_key; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:741 + def add_as_polymorphic_through(reflection, seed); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:737 + def add_as_source(seed); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:745 + def add_as_through(seed); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:727 + def association_class; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:583 + def association_foreign_key; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:587 + def association_primary_key(klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:544 + def association_scope_cache(klass, owner, &block); end + + # Returns +true+ if +self+ is a +belongs_to+ reflection. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:722 + def belongs_to?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:638 + def check_eager_loadable!; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:622 + def check_validity!; end + + # This is for clearing cache on the reflection. Useful for tests that need to compare + # SQL queries on associations. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:670 + def clear_association_scope_cache; end + + # A chain of reflections from this one back to the owner. For more see the explanation in + # ThroughReflection. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:664 + def collect_join_chain; end + + # Returns whether or not this association reflection is for a collection + # association. Returns +true+ if the +macro+ is either +has_many+ or + # +has_and_belongs_to_many+, +false+ otherwise. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:704 + def collection?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:490 + def compute_class(name); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:753 + def deprecated?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:749 + def extensions; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:558 + def foreign_key(infer_from_inverse_of: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:514 + def foreign_type; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:682 + def has_inverse?; end + + # Returns +true+ if +self+ is a +has_one+ reflection. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:725 + def has_one?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:678 + def has_scope?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:618 + def join_foreign_key; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:650 + def join_id_for(owner); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:610 + def join_primary_key(klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:614 + def join_primary_type; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:554 + def join_table; end + + # Returns the macro type. + # + # has_many :clients returns :has_many + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:699 + def macro; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:674 + def nested?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:515 + def parent_reflection; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:515 + def parent_reflection=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:729 + def polymorphic?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:686 + def polymorphic_inverse_of(associated_class); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:733 + def polymorphic_name; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:658 + def source_reflection; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:654 + def through_reflection; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:514 + def type; end + + # Returns whether or not the association should be validated as part of + # the parent's validation. + # + # Unless you explicitly disable validation with + # validate: false, validation will take place when: + # + # * you explicitly enable validation; validate: true + # * you use autosave; autosave: true + # * the association is a +has_many+ association + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:717 + def validate?; end + + private + + # returns either +nil+ or the inverse association name that it finds. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:770 + def automatic_inverse_of; end + + # Checks to see if the reflection doesn't have any options that prevent + # us from being able to guess the inverse automatically. First, the + # inverse_of option cannot be set to false. Second, we must + # have has_many, has_one, belongs_to associations. + # Third, we must not have options such as :foreign_key + # which prevent us from correctly guessing the inverse association. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:812 + def can_find_inverse_of_automatically?(reflection, inverse_reflection = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:833 + def derive_class_name; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:851 + def derive_fk_query_constraints(foreign_key); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:839 + def derive_foreign_key(infer_from_inverse_of: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:891 + def derive_join_table; end + + # Attempts to find the inverse association name automatically. + # If it cannot find a suitable inverse association name, it returns + # +nil+. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:761 + def inverse_name; end + + # Scopes on the potential inverse reflection prevent automatic + # inverse_of, since the scope could exclude the owner record + # we would inverse from. Scopes on the reflection itself allow for + # automatic inverse_of as long as + # config.active_record.automatic_scope_inversing is set to + # +true+ (the default for new applications). + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:825 + def scope_allows_automatic_inverse_of?(reflection, inverse_reflection); end + + # Checks if the inverse reflection that is returned from the + # +automatic_inverse_of+ method is a valid reflection. We must + # make sure that the reflection's active_record name matches up + # with the current reflection's klass name. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:798 + def valid_inverse_reflection?(reflection); end +end + +# pkg:gem/activerecord#lib/active_record/reflection.rb:924 +class ActiveRecord::Reflection::BelongsToReflection < ::ActiveRecord::Reflection::AssociationReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:929 + def association_class; end + + # klass option is necessary to support loading polymorphic associations + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:938 + def association_primary_key(klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:927 + def belongs_to?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:960 + def join_foreign_key; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:964 + def join_foreign_type; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:956 + def join_primary_key(klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:925 + def macro; end + + private + + # pkg:gem/activerecord#lib/active_record/reflection.rb:969 + def can_find_inverse_of_automatically?(*); end +end + +# = Active Record Reflection +# +# \Reflection enables the ability to examine the associations and aggregations of +# Active Record classes and objects. This information, for example, +# can be used in a form builder that takes an Active Record object +# and creates input fields for all of the attributes depending on their type +# and displays the associations to other objects. +# +# MacroReflection class has info for AggregateReflection and AssociationReflection +# classes. +# +# pkg:gem/activerecord#lib/active_record/reflection.rb:60 +module ActiveRecord::Reflection::ClassMethods + # pkg:gem/activerecord#lib/active_record/reflection.rb:126 + def _reflect_on_association(association); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:137 + def clear_reflections_cache; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:82 + def normalized_reflections; end + + # Returns the AggregateReflection object for the named +aggregation+ (use the symbol). + # + # Account.reflect_on_aggregation(:balance) # => the balance AggregateReflection + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:70 + def reflect_on_aggregation(aggregation); end + + # Returns an array of AggregateReflection objects for all the aggregations in the class. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:62 + def reflect_on_all_aggregations; end + + # Returns an array of AssociationReflection objects for all the + # associations in the class. If you only want to reflect on a certain + # association type, pass in the symbol (:has_many, :has_one, + # :belongs_to) as the first parameter. + # + # Example: + # + # Account.reflect_on_all_associations # returns an array of all associations + # Account.reflect_on_all_associations(:has_many) # returns an array of all has_many associations + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:111 + def reflect_on_all_associations(macro = T.unsafe(nil)); end + + # Returns an array of AssociationReflection objects for all associations which have :autosave enabled. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:131 + def reflect_on_all_autosave_associations; end + + # Returns the AssociationReflection object for the +association+ (use the symbol). + # + # Account.reflect_on_association(:owner) # returns the owner AssociationReflection + # Invoice.reflect_on_association(:line_items).macro # returns :has_many + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:122 + def reflect_on_association(association); end + + # Returns a Hash of name of the reflection as the key and an AssociationReflection as the value. + # + # Account.reflections # => {"balance" => AggregateReflection} + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:78 + def reflections; end + + private + + # pkg:gem/activerecord#lib/active_record/reflection.rb:142 + def inherited(subclass); end +end + +# pkg:gem/activerecord#lib/active_record/reflection.rb:974 +class ActiveRecord::Reflection::HasAndBelongsToManyReflection < ::ActiveRecord::Reflection::AssociationReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:977 + def collection?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:975 + def macro; end +end + +# pkg:gem/activerecord#lib/active_record/reflection.rb:896 +class ActiveRecord::Reflection::HasManyReflection < ::ActiveRecord::Reflection::AssociationReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:901 + def association_class; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:899 + def collection?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:897 + def macro; end +end + +# pkg:gem/activerecord#lib/active_record/reflection.rb:910 +class ActiveRecord::Reflection::HasOneReflection < ::ActiveRecord::Reflection::AssociationReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:915 + def association_class; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:913 + def has_one?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:911 + def macro; end +end + +# Base class for AggregateReflection and AssociationReflection. Objects of +# AggregateReflection and AssociationReflection are returned by the Reflection::ClassMethods. +# +# pkg:gem/activerecord#lib/active_record/reflection.rb:369 +class ActiveRecord::Reflection::MacroReflection < ::ActiveRecord::Reflection::AbstractReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:388 + def initialize(name, scope, options, active_record); end + + # Returns +true+ if +self+ and +other_aggregation+ have the same +name+ attribute, +active_record+ attribute, + # and +other_aggregation+ has an options hash assigned to it. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:440 + def ==(other_aggregation); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:426 + def _klass(class_name); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:384 + def active_record; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:399 + def autosave=(autosave); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:434 + def compute_class(name); end + + # Returns the class for the macro. + # + # composed_of :balance, class_name: 'Money' returns the Money class + # has_many :clients returns the Client class + # + # class Company < ActiveRecord::Base + # has_many :clients + # end + # + # Company.reflect_on_association(:clients).klass + # # => Client + # + # Note: Do not call +klass.new+ or +klass.create+ to instantiate + # a new association object. Use +build_association+ or +create_association+ + # instead. This allows plugins to hook into association object creation. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:422 + def klass; end + + # Returns the name of the macro. + # + # composed_of :balance, class_name: 'Money' returns :balance + # has_many :clients returns :clients + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:374 + def name; end + + # Returns the hash of options used for the macro. + # + # composed_of :balance, class_name: 'Money' returns { class_name: "Money" } + # has_many :clients returns {} + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:382 + def options; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:386 + def plural_name; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:376 + def scope; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:448 + def scope_for(relation, owner = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/reflection.rb:453 + def derive_class_name; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:457 + def normalize_options(options); end +end + +# pkg:gem/activerecord#lib/active_record/reflection.rb:1263 +class ActiveRecord::Reflection::PolymorphicReflection < ::ActiveRecord::Reflection::AbstractReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:1267 + def initialize(reflection, previous_reflection); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1281 + def constraints; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1264 + def join_foreign_key(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1264 + def join_primary_key(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1273 + def join_scopes(table, predicate_builder = T.unsafe(nil), klass = T.unsafe(nil), record = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1264 + def klass(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1264 + def name(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1264 + def plural_name(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1264 + def scope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1264 + def scope_for(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1264 + def type(*, **, &); end + + private + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1286 + def source_type_scope; end +end + +# pkg:gem/activerecord#lib/active_record/reflection.rb:1293 +class ActiveRecord::Reflection::RuntimeReflection < ::ActiveRecord::Reflection::AbstractReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:1296 + def initialize(reflection, association); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1306 + def aliased_table; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1314 + def all_includes; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1294 + def constraints(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1294 + def join_foreign_key(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1310 + def join_primary_key(klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1302 + def klass; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1294 + def scope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1294 + def type(*, **, &); end +end + +# Holds all the metadata about a :through association as it was specified +# in the Active Record class. +# +# pkg:gem/activerecord#lib/active_record/reflection.rb:984 +class ActiveRecord::Reflection::ThroughReflection < ::ActiveRecord::Reflection::AbstractReflection + # pkg:gem/activerecord#lib/active_record/reflection.rb:988 + def initialize(delegate_reflection); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def _klass(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def active_record(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:985 + def active_record_primary_key(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1208 + def add_as_polymorphic_through(reflection, seed); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1204 + def add_as_source(seed); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1212 + def add_as_through(seed); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def association_class(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:985 + def association_foreign_key(*, **, &); end + + # We want to use the klass from this reflection, rather than just delegate straight to + # the source_reflection, because the source_reflection may be polymorphic. We still + # need to respect the source_reflection's :primary_key option, though. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:1097 + def association_primary_key(klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def association_scope_cache(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def autosave=(arg); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def belongs_to?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def check_eager_loadable!(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1154 + def check_validity!; end + + # This is for clearing cache on the reflection. Useful for tests that need to compare + # SQL queries on associations. + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:1069 + def clear_association_scope_cache; end + + # Returns an array of reflections which are involved in this association. Each item in the + # array corresponds to a table which will be part of the query for this association. + # + # The chain is built by recursively calling #chain on the source reflection and the through + # reflection. The base case for the recursion is a normal association, which just returns + # [self] as its #chain. + # + # class Post < ActiveRecord::Base + # has_many :taggings + # has_many :tags, through: :taggings + # end + # + # tags_reflection = Post.reflect_on_association(:tags) + # tags_reflection.chain + # # => [, + # ] + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:1063 + def collect_join_chain; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def collection?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def compute_class(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1198 + def constraints; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def deprecated?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1216 + def deprecated_nested_reflections; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def extensions(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:985 + def foreign_key(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:985 + def foreign_type(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def has_inverse?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def has_one?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1083 + def has_scope?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:985 + def join_foreign_key(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:985 + def join_id_for(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1107 + def join_primary_key(klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def join_primary_type(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1079 + def join_scopes(table, predicate_builder = T.unsafe(nil), klass = T.unsafe(nil), record = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def join_table(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1003 + def klass; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def macro(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def name(*, **, &); end + + # A through association is nested if there would be more than one join table + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:1090 + def nested?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def options(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def parent_reflection(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def parent_reflection=(arg); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def plural_name(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def polymorphic?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def polymorphic_inverse_of(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def polymorphic_name(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def scope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def scope_for(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1075 + def scopes; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1146 + def source_options; end + + # Returns the source of the through reflection. It checks both a singularized + # and pluralized form for :belongs_to or :has_many. + # + # class Post < ActiveRecord::Base + # has_many :taggings + # has_many :tags, through: :taggings + # end + # + # class Tagging < ActiveRecord::Base + # belongs_to :post + # belongs_to :tag + # end + # + # tags_reflection = Post.reflect_on_association(:tags) + # tags_reflection.source_reflection + # # => + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:1024 + def source_reflection; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1126 + def source_reflection_name; end + + # Gets an array of possible :through source reflection names in both singular and plural form. + # + # class Post < ActiveRecord::Base + # has_many :taggings + # has_many :tags, through: :taggings + # end + # + # tags_reflection = Post.reflect_on_association(:tags) + # tags_reflection.source_reflection_names + # # => [:tag, :tags] + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:1122 + def source_reflection_names; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1150 + def through_options; end + + # Returns the AssociationReflection object specified in the :through option + # of a HasManyThrough or HasOneThrough association. + # + # class Post < ActiveRecord::Base + # has_many :taggings + # has_many :tags, through: :taggings + # end + # + # tags_reflection = Post.reflect_on_association(:tags) + # tags_reflection.through_reflection + # # => + # + # pkg:gem/activerecord#lib/active_record/reflection.rb:1042 + def through_reflection; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:999 + def through_reflection?; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:985 + def type(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1260 + def validate?(*, **, &); end + + protected + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1221 + def actual_source_reflection; end + + private + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1244 + def collect_deprecated_nested_reflections; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1228 + def collect_join_reflections(seed); end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1226 + def delegate_reflection; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1239 + def derive_class_name; end + + # pkg:gem/activerecord#lib/active_record/reflection.rb:1237 + def inverse_name; end +end + +# = Active Record \Relation +# +# pkg:gem/activerecord#lib/active_record/relation.rb:5 +class ActiveRecord::Relation + include ::Enumerable + include ::ActiveRecord::Delegation + include ::ActiveRecord::Explain + include ::ActiveRecord::Batches + include ::ActiveModel::ForbiddenAttributesProtection + include ::ActiveRecord::QueryMethods + include ::ActiveRecord::SpawnMethods + include ::ActiveRecord::Calculations + include ::ActiveRecord::FinderMethods + include ::ActiveRecord::TokenFor::RelationMethods + include ::ActiveRecord::SignedId::RelationMethods + extend ::ActiveRecord::Delegation::ClassMethods + + # pkg:gem/activerecord#lib/active_record/relation.rb:77 + def initialize(model, table: T.unsafe(nil), predicate_builder: T.unsafe(nil), values: T.unsafe(nil)); end + + # Compares two relations for equality. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1281 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:566 + def _exec_scope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1335 + def alias_tracker(joins = T.unsafe(nil), aliases = T.unsafe(nil)); end + + # Returns true if there are any records. + # + # + # When an argument is given, returns true if at least one records matches + # the argument via the case-equality operator (===). + # + # posts.any?(Post) # => true if at least one record + # posts.any?(Comment) # => false + # + # pkg:gem/activerecord#lib/active_record/relation.rb:404 + def any?(*args); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:102 + def bind_attribute(name, value); end + + # Returns true if relation is blank. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1302 + def blank?; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:133 + def build(attributes = T.unsafe(nil), &block); end + + # Returns a stable cache key that can be used to identify this query. + # The cache key is built with a fingerprint of the SQL query. + # + # Product.where("name like ?", "%Cosmic Encounter%").cache_key + # # => "products/query-1850ab3d302391b85b8693e941286659" + # + # If ActiveRecord::Base.collection_cache_versioning is turned off, as it was + # in \Rails 6.0 and earlier, the cache key will also include a version. + # + # ActiveRecord::Base.collection_cache_versioning = false + # Product.where("name like ?", "%Cosmic Encounter%").cache_key + # # => "products/query-1850ab3d302391b85b8693e941286659-1-20150714212553907087000" + # + # You can also pass a custom timestamp column to fetch the timestamp of the + # last updated record. + # + # Product.where("name like ?", "%Game%").cache_key(:last_reviewed_at) + # + # pkg:gem/activerecord#lib/active_record/relation.rb:452 + def cache_key(timestamp_column = T.unsafe(nil)); end + + # Returns a cache key along with the version. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:533 + def cache_key_with_version; end + + # Returns a cache version that can be used together with the cache key to form + # a recyclable caching scheme. The cache version is built with the number of records + # matching the query, and the timestamp of the last updated record. When a new record + # comes to match the query, or any of the existing records is updated or deleted, + # the cache version changes. + # + # If the collection is loaded, the method will iterate through the records + # to generate the timestamp, otherwise it will trigger one SQL query like: + # + # SELECT COUNT(*), MAX("products"."updated_at") FROM "products" WHERE (name like '%Cosmic Encounter%') + # + # pkg:gem/activerecord#lib/active_record/relation.rb:479 + def cache_version(timestamp_column = T.unsafe(nil)); end + + # Tries to create a new record with the same scoped attributes + # defined in the relation. Returns the initialized object if validation fails. + # + # Expects arguments in the same format as + # {ActiveRecord::Base.create}[rdoc-ref:Persistence::ClassMethods#create]. + # + # ==== Examples + # + # users = User.where(name: 'Oscar') + # users.create # => # + # + # users.create(name: 'fxn') + # users.create # => # + # + # users.create { |user| user.name = 'tenderlove' } + # # => # + # + # users.create(name: nil) # validation on name + # # => # + # + # pkg:gem/activerecord#lib/active_record/relation.rb:154 + def create(attributes = T.unsafe(nil), &block); end + + # Similar to #create, but calls + # {create!}[rdoc-ref:Persistence::ClassMethods#create!] + # on the base class. Raises an exception if a validation error occurs. + # + # Expects arguments in the same format as + # {ActiveRecord::Base.create!}[rdoc-ref:Persistence::ClassMethods#create!]. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:169 + def create!(attributes = T.unsafe(nil), &block); end + + # Attempts to create a record with the given attributes in a table that has a unique database constraint + # on one or several of its columns. If a row already exists with one or several of these + # unique constraints, the exception such an insertion would normally raise is caught, + # and the existing record with those attributes is found using #find_by!. + # + # This is similar to #find_or_create_by, but tries to create the record first. As such it is + # better suited for cases where the record is most likely not to exist yet. + # + # There are several drawbacks to #create_or_find_by, though: + # + # * The underlying table must have the relevant columns defined with unique database constraints. + # * A unique constraint violation may be triggered by only one, or at least less than all, + # of the given attributes. This means that the subsequent #find_by! may fail to find a + # matching record, which will then raise an ActiveRecord::RecordNotFound exception, + # rather than a record with the given attributes. + # * While we avoid the race condition between SELECT -> INSERT from #find_or_create_by, + # we actually have another race condition between INSERT -> SELECT, which can be triggered + # if a DELETE between those two statements is run by another client. But for most applications, + # that's a significantly less likely condition to hit. + # * It relies on exception handling to handle control flow, which may be marginally slower. + # * The primary key may auto-increment on each create, even if it fails. This can accelerate + # the problem of running out of integers, if the underlying table is still stuck on a primary + # key of type int (note: All \Rails apps since 5.1+ have defaulted to bigint, which is not liable + # to this problem). + # * Columns with unique database constraints should not have uniqueness validations defined, + # otherwise #create will fail due to validation errors and #find_by will never be called. + # + # This method will return a record if all given attributes are covered by unique constraints + # (unless the INSERT -> DELETE -> SELECT race condition is triggered), but if creation was attempted + # and failed due to validation errors it won't be persisted, you get what #create returns in + # such situation. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:273 + def create_or_find_by(attributes, &block); end + + # Like #create_or_find_by, but calls + # {create!}[rdoc-ref:Persistence::ClassMethods#create!] so an exception + # is raised if the created record is invalid. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:293 + def create_or_find_by!(attributes, &block); end + + # Deletes the row with a primary key matching the +id+ argument, using an + # SQL +DELETE+ statement, and returns the number of rows deleted. Active + # Record objects are not instantiated, so the object's callbacks are not + # executed, including any :dependent association options. + # + # You can delete multiple rows at once by passing an Array of ids. + # + # Note: Although it is often much faster than the alternative, #destroy, + # skipping callbacks might bypass business logic in your application + # that ensures referential integrity or performs other essential jobs. + # + # ==== Examples + # + # # Delete a single row + # Todo.delete(1) + # + # # Delete multiple rows + # Todo.delete([2,3,4]) + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1081 + def delete(id_or_array); end + + # Deletes the records without instantiating the records + # first, and hence not calling the {#destroy}[rdoc-ref:Persistence#destroy] + # method nor invoking callbacks. + # This is a single SQL DELETE statement that goes straight to the database, much more + # efficient than #destroy_all. Be careful with relations though, in particular + # :dependent rules defined on associations are not honored. Returns the + # number of rows affected. + # + # Post.where(person_id: 5).where(category: ['Something', 'Else']).delete_all + # + # This call deletes the affected posts all at once with a single DELETE statement. + # If you need to destroy dependent associations or call your before_* or + # +after_destroy+ callbacks, use the #destroy_all method instead. + # + # If an invalid method is supplied, #delete_all raises an ActiveRecordError: + # + # Post.distinct.delete_all + # # => ActiveRecord::ActiveRecordError: delete_all doesn't support distinct + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1037 + def delete_all; end + + # Finds and deletes all records matching the specified conditions. + # This is short-hand for relation.where(condition).delete_all. + # Returns the number of rows affected. + # + # If no record is found, returns 0 as zero rows were affected. + # + # Person.delete_by(id: 13) + # Person.delete_by(name: 'Spartacus', rating: 4) + # Person.delete_by("published_at < ?", 2.weeks.ago) + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1147 + def delete_by(*args); end + + # Destroy an object (or multiple objects) that has the given id. The object is instantiated first, + # therefore all callbacks and filters are fired off before the object is deleted. This method is + # less efficient than #delete but allows cleanup methods and other actions to be run. + # + # This essentially finds the object (or multiple objects) with the given id, creates a new object + # from the attributes, and then calls destroy on it. + # + # ==== Parameters + # + # * +id+ - This should be the id or an array of ids to be destroyed. + # + # ==== Examples + # + # # Destroy a single object + # Todo.destroy(1) + # + # # Destroy multiple objects + # todos = [1,2,3] + # Todo.destroy(todos) + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1111 + def destroy(id); end + + # Destroys the records by instantiating each + # record and calling its {#destroy}[rdoc-ref:Persistence#destroy] method. + # Each object's callbacks are executed (including :dependent association options). + # Returns the collection of objects that were destroyed; each will be frozen, to + # reflect that no changes should be made (since they can't be persisted). + # + # Note: Instantiation, callback execution, and deletion of each + # record can be time consuming when you're removing many records at + # once. It generates at least one SQL +DELETE+ query per record (or + # possibly more, to enforce your callbacks). If you want to delete many + # rows quickly, without concern for their associations or callbacks, use + # #delete_all instead. + # + # ==== Examples + # + # Person.where(age: 0..18).destroy_all + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1015 + def destroy_all; end + + # Finds and destroys all records matching the specified conditions. + # This is short-hand for relation.where(condition).destroy_all. + # Returns the collection of objects that were destroyed. + # + # If no record is found, returns empty array. + # + # Person.destroy_by(id: 13) + # Person.destroy_by(name: 'Spartacus', rating: 4) + # Person.destroy_by("published_at < ?", 2.weeks.ago) + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1134 + def destroy_by(*args); end + + # Returns true if relation needs eager loading. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1266 + def eager_loading?; end + + # Returns true if there are no records. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:372 + def empty?; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1327 + def empty_scope?; end + + # Serializes the relation objects Array. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:358 + def encode_with(coder); end + + # Runs EXPLAIN on the query or queries triggered by this relation and + # returns the result as a string. The string is formatted imitating the + # ones printed by the database shell. + # + # User.all.explain + # # EXPLAIN SELECT `users`.* FROM `users` + # # ... + # + # Note that this method actually runs the queries, since the results of some + # are needed by the next ones when eager loading is going on. + # + # To run EXPLAIN on queries created by +first+, +pluck+ and +count+, call + # these methods on +explain+: + # + # User.all.explain.count + # # EXPLAIN SELECT COUNT(*) FROM `users` + # # ... + # + # The column name can be passed if required: + # + # User.all.explain.maximum(:id) + # # EXPLAIN SELECT MAX(`users`.`id`) FROM `users` + # # ... + # + # Please see further details in the + # {Active Record Query Interface guide}[https://guides.rubyonrails.org/active_record_querying.html#running-explain]. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:342 + def explain(*options); end + + # Finds the first record with the given attributes, or creates a record + # with the attributes if one is not found: + # + # # Find the first user named "Penélope" or create a new one. + # User.find_or_create_by(first_name: 'Penélope') + # # => # + # + # # Find the first user named "Penélope" or create a new one. + # # We already have one so the existing record will be returned. + # User.find_or_create_by(first_name: 'Penélope') + # # => # + # + # # Find the first user named "Scarlett" or create a new one with + # # a particular last name. + # User.create_with(last_name: 'Johansson').find_or_create_by(first_name: 'Scarlett') + # # => # + # + # This method accepts a block, which is passed down to #create. The last example + # above can be alternatively written this way: + # + # # Find the first user named "Scarlett" or create a new one with a + # # particular last name. + # User.find_or_create_by(first_name: 'Scarlett') do |user| + # user.last_name = 'Johansson' + # end + # # => # + # + # This method always returns a record, but if creation was attempted and + # failed due to validation errors it won't be persisted, you get what + # #create returns in such situation. + # + # If creation failed because of a unique constraint, this method will + # assume it encountered a race condition and will try finding the record + # once more. If somehow the second find still does not find a record + # because a concurrent DELETE happened, it will then raise an + # ActiveRecord::RecordNotFound exception. + # + # Please note this method is not atomic, it runs first a SELECT, + # and if there are no results an INSERT is attempted. So if the table + # doesn't have a relevant unique constraint it could be the case that + # you end up with two or more similar records. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:231 + def find_or_create_by(attributes, &block); end + + # Like #find_or_create_by, but calls + # {create!}[rdoc-ref:Persistence::ClassMethods#create!] so an exception + # is raised if the created record is invalid. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:238 + def find_or_create_by!(attributes, &block); end + + # Like #find_or_create_by, but calls {new}[rdoc-ref:Core.new] + # instead of {create}[rdoc-ref:Persistence::ClassMethods#create]. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:312 + def find_or_initialize_by(attributes, &block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:178 + def first_or_create(attributes = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:182 + def first_or_create!(attributes = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:186 + def first_or_initialize(attributes = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1331 + def has_limit_or_offset?; end + + # Inserts a single record into the database in a single SQL INSERT + # statement. It does not instantiate any models nor does it trigger + # Active Record callbacks or validations. Though passed values + # go through Active Record's type casting and serialization. + # + # See #insert_all for documentation. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:668 + def insert(attributes, returning: T.unsafe(nil), unique_by: T.unsafe(nil), record_timestamps: T.unsafe(nil)); end + + # Inserts a single record into the database in a single SQL INSERT + # statement. It does not instantiate any models nor does it trigger + # Active Record callbacks or validations. Though passed values + # go through Active Record's type casting and serialization. + # + # See #insert_all! for more. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:757 + def insert!(attributes, returning: T.unsafe(nil), record_timestamps: T.unsafe(nil)); end + + # Inserts multiple records into the database in a single SQL INSERT + # statement. It does not instantiate any models nor does it trigger + # Active Record callbacks or validations. Though passed values + # go through Active Record's type casting and serialization. + # + # The +attributes+ parameter is an Array of Hashes. Every Hash determines + # the attributes for a single row and must have the same keys. + # + # Rows are considered to be unique by every unique index on the table. Any + # duplicate rows are skipped. + # Override with :unique_by (see below). + # + # Returns an ActiveRecord::Result with its contents based on + # :returning (see below). + # + # ==== Options + # + # [:returning] + # (PostgreSQL, SQLite3, and MariaDB only) An array of attributes to return for all successfully + # inserted records, which by default is the primary key. + # Pass returning: %w[ id name ] for both id and name + # or returning: false to omit the underlying RETURNING SQL + # clause entirely. + # + # You can also pass an SQL string if you need more control on the return values + # (for example, returning: Arel.sql("id, name as new_name")). + # + # [:unique_by] + # (PostgreSQL and SQLite only) By default rows are considered to be unique + # by every unique index on the table. Any duplicate rows are skipped. + # + # To skip rows according to just one unique index pass :unique_by. + # + # Consider a Book model where no duplicate ISBNs make sense, but if any + # row has an existing id, or is not unique by another unique index, + # ActiveRecord::RecordNotUnique is raised. + # + # Unique indexes can be identified by columns or name: + # + # unique_by: :isbn + # unique_by: %i[ author_id name ] + # unique_by: :index_books_on_isbn + # + # [:record_timestamps] + # By default, automatic setting of timestamp columns is controlled by + # the model's record_timestamps config, matching typical + # behavior. + # + # To override this and force automatic setting of timestamp columns one + # way or the other, pass :record_timestamps: + # + # record_timestamps: true # Always set timestamps automatically + # record_timestamps: false # Never set timestamps automatically + # + # Because it relies on the index information from the database + # :unique_by is recommended to be paired with + # Active Record's schema_cache. + # + # ==== Example + # + # # Insert records and skip inserting any duplicates. + # # Here "Eloquent Ruby" is skipped because its id is not unique. + # + # Book.insert_all([ + # { id: 1, title: "Rework", author: "David" }, + # { id: 1, title: "Eloquent Ruby", author: "Russ" } + # ]) + # + # # insert_all works on chained scopes, and you can use create_with + # # to set default attributes for all inserted records. + # + # author.books.create_with(created_at: Time.now).insert_all([ + # { id: 1, title: "Rework" }, + # { id: 2, title: "Eloquent Ruby" } + # ]) + # + # pkg:gem/activerecord#lib/active_record/relation.rb:747 + def insert_all(attributes, returning: T.unsafe(nil), unique_by: T.unsafe(nil), record_timestamps: T.unsafe(nil)); end + + # Inserts multiple records into the database in a single SQL INSERT + # statement. It does not instantiate any models nor does it trigger + # Active Record callbacks or validations. Though passed values + # go through Active Record's type casting and serialization. + # + # The +attributes+ parameter is an Array of Hashes. Every Hash determines + # the attributes for a single row and must have the same keys. + # + # Raises ActiveRecord::RecordNotUnique if any rows violate a + # unique index on the table. In that case, no rows are inserted. + # + # To skip duplicate rows, see #insert_all. To replace them, see #upsert_all. + # + # Returns an ActiveRecord::Result with its contents based on + # :returning (see below). + # + # ==== Options + # + # [:returning] + # (PostgreSQL, SQLite3, and MariaDB only) An array of attributes to return for all successfully + # inserted records, which by default is the primary key. + # Pass returning: %w[ id name ] for both id and name + # or returning: false to omit the underlying RETURNING SQL + # clause entirely. + # + # You can also pass an SQL string if you need more control on the return values + # (for example, returning: Arel.sql("id, name as new_name")). + # + # [:record_timestamps] + # By default, automatic setting of timestamp columns is controlled by + # the model's record_timestamps config, matching typical + # behavior. + # + # To override this and force automatic setting of timestamp columns one + # way or the other, pass :record_timestamps: + # + # record_timestamps: true # Always set timestamps automatically + # record_timestamps: false # Never set timestamps automatically + # + # ==== Examples + # + # # Insert multiple records + # Book.insert_all!([ + # { title: "Rework", author: "David" }, + # { title: "Eloquent Ruby", author: "Russ" } + # ]) + # + # # Raises ActiveRecord::RecordNotUnique because "Eloquent Ruby" + # # does not have a unique id. + # Book.insert_all!([ + # { id: 1, title: "Rework", author: "David" }, + # { id: 1, title: "Eloquent Ruby", author: "Russ" } + # ]) + # + # pkg:gem/activerecord#lib/active_record/relation.rb:814 + def insert_all!(attributes, returning: T.unsafe(nil), record_timestamps: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1318 + def inspect; end + + # Joins that are also marked for preloading. In which case we should just eager load them. + # Note that this is a naive implementation because we could have strings and symbols which + # represent the same association, but that aren't matched by this. Also, we could have + # nested hashes which partially match, e.g. { a: :b } & { a: [:b, :c] } + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1276 + def joined_includes_values; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:73 + def klass; end + + # Causes the records to be loaded from the database if they have not + # been loaded already. You can use this if for some reason you need + # to explicitly load some records before actually using them. The + # return value is the relation itself, not the records. + # + # Post.where(published: true).load # => # + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1207 + def load(&block); end + + # Schedule the query to be performed from a background thread pool. + # + # Post.where(published: true).load_async # => # + # + # When the +Relation+ is iterated, if the background query wasn't executed yet, + # it will be performed by the foreground thread. + # + # Note that {config.active_record.async_query_executor}[https://guides.rubyonrails.org/configuring.html#config-active-record-async-query-executor] must be configured + # for queries to actually be executed concurrently. Otherwise it defaults to + # executing them in the foreground. + # + # If the query was actually executed in the background, the Active Record logs will show + # it by prefixing the log line with ASYNC: + # + # ASYNC Post Load (0.0ms) (db time 2ms) SELECT "posts".* FROM "posts" LIMIT 100 + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1166 + def load_async; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:71 + def loaded; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:74 + def loaded?; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:75 + def locked?; end + + # Returns true if there is more than one record. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:427 + def many?; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:71 + def model; end + + # Initializes new record from relation while maintaining the current + # scope. + # + # Expects arguments in the same format as {ActiveRecord::Base.new}[rdoc-ref:Core.new]. + # + # users = User.where(name: 'DHH') + # user = users.new # => # + # + # You can also pass a block to new with the new record as argument: + # + # user = users.new { |user| user.name = 'Oscar' } + # user.name # => Oscar + # + # pkg:gem/activerecord#lib/active_record/relation.rb:125 + def new(attributes = T.unsafe(nil), &block); end + + # Returns true if there are no records. + # + # When an argument is given, returns true if no records match the argument + # via the case-equality operator (===). + # + # posts.none?(Post) # => true if posts is empty + # posts.none?(Comment) # => true + # + # pkg:gem/activerecord#lib/active_record/relation.rb:389 + def none?(*args); end + + # Returns true if there is exactly one record. + # + # When an argument is given, returns true if exactly one records matches the + # argument via the case-equality operator (===). + # + # posts.one?(Post) # => true if exactly one record + # posts.any?(Comment) # => false + # + # pkg:gem/activerecord#lib/active_record/relation.rb:418 + def one?(*args); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:71 + def predicate_builder; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1349 + def preload_associations(records); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1292 + def pretty_print(pp); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1306 + def readonly?; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:352 + def records; end + + # Forces reloading of relation. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1217 + def reload; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1222 + def reset; end + + # Returns true if the relation was scheduled on the background + # thread pool. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1197 + def scheduled?; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1259 + def scope_for_create; end + + # Scope all queries to the current scope. + # + # Comment.where(post_id: 1).scoping do + # Comment.first + # end + # # SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = 1 ORDER BY "comments"."id" ASC LIMIT 1 + # + # If all_queries: true is passed, scoping will apply to all queries + # for the relation including +update+ and +delete+ on instances. + # Once +all_queries+ is set to true it cannot be set to false in a + # nested block. + # + # Please check unscoped if you want to remove all previous scopes (including + # the default_scope) during the execution of a block. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:555 + def scoping(all_queries: T.unsafe(nil), &block); end + + # Returns size of the records. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:363 + def size; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:72 + def skip_preloading_value; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:72 + def skip_preloading_value=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:71 + def table; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1185 + def then(&block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:350 + def to_a; end + + # Converts relation objects to Array. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:347 + def to_ary; end + + # Returns sql statement for the relation. + # + # User.where(name: 'Oscar').to_sql + # # SELECT "users".* FROM "users" WHERE "users"."name" = 'Oscar' + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1238 + def to_sql; end + + # Touches all records in the current relation, setting the +updated_at+/+updated_on+ attributes to the current time or the time specified. + # It does not instantiate the involved models, and it does not trigger Active Record callbacks or validations. + # This method can be passed attribute names and an optional time argument. + # If attribute names are passed, they are updated along with +updated_at+/+updated_on+ attributes. + # If no time argument is passed, the current time is used as default. + # + # ==== Examples + # + # # Touch all records + # Person.all.touch_all + # # => "UPDATE \"people\" SET \"updated_at\" = '2018-01-04 22:55:23.132670'" + # + # # Touch multiple records with a custom attribute + # Person.all.touch_all(:created_at) + # # => "UPDATE \"people\" SET \"updated_at\" = '2018-01-04 22:55:23.132670', \"created_at\" = '2018-01-04 22:55:23.132670'" + # + # # Touch multiple records with a specified time + # Person.all.touch_all(time: Time.new(2020, 5, 16, 0, 0, 0)) + # # => "UPDATE \"people\" SET \"updated_at\" = '2020-05-16 00:00:00'" + # + # # Touch records with scope + # Person.where(name: 'David').touch_all + # # => "UPDATE \"people\" SET \"updated_at\" = '2018-01-04 22:55:23.132670' WHERE \"people\".\"name\" = 'David'" + # + # pkg:gem/activerecord#lib/active_record/relation.rb:995 + def touch_all(*names, time: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:645 + def update(id = T.unsafe(nil), attributes); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:653 + def update!(id = T.unsafe(nil), attributes); end + + # Updates all records in the current relation with details given. This method constructs a single SQL UPDATE + # statement and sends it straight to the database. It does not instantiate the involved models and it does not + # trigger Active Record callbacks or validations. However, values passed to #update_all will still go through + # Active Record's normal type casting and serialization. Returns the number of rows affected. + # + # Note: As Active Record callbacks are not triggered, this method will not automatically update +updated_at+/+updated_on+ columns. + # + # ==== Parameters + # + # * +updates+ - A string, array, or hash representing the SET part of an SQL statement. Any strings provided will + # be type cast, unless you use +Arel.sql+. (Don't pass user-provided values to +Arel.sql+.) + # + # ==== Examples + # + # # Update all customers with the given attributes + # Customer.update_all wants_email: true + # + # # Update all books with 'Rails' in their title + # Book.where('title LIKE ?', '%Rails%').update_all(author: 'David') + # + # # Update all books that match conditions, but limit it to 5 ordered by date + # Book.where('title LIKE ?', '%Rails%').order(:created_at).limit(5).update_all(author: 'David') + # + # # Update all invoices and set the number column to its id value. + # Invoice.update_all('number = id') + # + # # Update all books with 'Rails' in their title + # Book.where('title LIKE ?', '%Rails%').update_all(title: Arel.sql("title + ' - volume 1'")) + # + # pkg:gem/activerecord#lib/active_record/relation.rb:602 + def update_all(updates); end + + # Updates the counters of the records in the current relation. + # + # ==== Parameters + # + # * +counter+ - A Hash containing the names of the fields to update as keys and the amount to update as values. + # * :touch option - Touch the timestamp columns when updating. + # * If attributes names are passed, they are updated along with update_at/on attributes. + # + # ==== Examples + # + # # For Posts by a given author increment the comment_count by 1. + # Post.where(author_id: author.id).update_counters(comment_count: 1) + # + # pkg:gem/activerecord#lib/active_record/relation.rb:952 + def update_counters(counters); end + + # Updates or inserts (upserts) a single record into the database in a + # single SQL INSERT statement. It does not instantiate any models nor does + # it trigger Active Record callbacks or validations. Though passed values + # go through Active Record's type casting and serialization. + # + # See #upsert_all for documentation. + # + # pkg:gem/activerecord#lib/active_record/relation.rb:824 + def upsert(attributes, **kwargs); end + + # Updates or inserts (upserts) multiple records into the database in a + # single SQL INSERT statement. It does not instantiate any models nor does + # it trigger Active Record callbacks or validations. Though passed values + # go through Active Record's type casting and serialization. + # + # The +attributes+ parameter is an Array of Hashes. Every Hash determines + # the attributes for a single row and must have the same keys. + # + # Returns an ActiveRecord::Result with its contents based on + # :returning (see below). + # + # By default, +upsert_all+ will update all the columns that can be updated when + # there is a conflict. These are all the columns except primary keys, read-only + # columns, and columns covered by the optional +unique_by+. + # + # ==== Options + # + # [:returning] + # (PostgreSQL, SQLite3, and MariaDB only) An array of attributes to return for all successfully + # upserted records, which by default is the primary key. + # Pass returning: %w[ id name ] for both id and name + # or returning: false to omit the underlying RETURNING SQL + # clause entirely. + # + # You can also pass an SQL string if you need more control on the return values + # (for example, returning: Arel.sql("id, name as new_name")). + # + # [:unique_by] + # (PostgreSQL and SQLite only) By default rows are considered to be unique + # by every unique index on the table. Any duplicate rows are skipped. + # + # To skip rows according to just one unique index pass :unique_by. + # + # Consider a Book model where no duplicate ISBNs make sense, but if any + # row has an existing id, or is not unique by another unique index, + # ActiveRecord::RecordNotUnique is raised. + # + # Unique indexes can be identified by columns or name: + # + # unique_by: :isbn + # unique_by: %i[ author_id name ] + # unique_by: :index_books_on_isbn + # + # Because it relies on the index information from the database + # :unique_by is recommended to be paired with + # Active Record's schema_cache. + # + # [:on_duplicate] + # Configure the behavior that will be used in case of conflict. Use `:skip` + # to ignore any conflicts or provide a safe SQL fragment wrapped with + # `Arel.sql`. + # + # NOTE: If you use this option you must provide all the columns you want to update + # by yourself. + # + # Example: + # + # Commodity.upsert_all( + # [ + # { id: 2, name: "Copper", price: 4.84 }, + # { id: 4, name: "Gold", price: 1380.87 }, + # { id: 6, name: "Aluminium", price: 0.35 } + # ], + # on_duplicate: Arel.sql("price = GREATEST(commodities.price, EXCLUDED.price)") + # ) + # + # See the related +:update_only+ option. Both options can't be used at the same time. + # + # [:update_only] + # Provide a list of column names that will be updated in case of conflict. If not provided, + # +upsert_all+ will update all the columns that can be updated. These are all the columns + # except primary keys, read-only columns, and columns covered by the optional +unique_by+ + # + # Example: + # + # Commodity.upsert_all( + # [ + # { id: 2, name: "Copper", price: 4.84 }, + # { id: 4, name: "Gold", price: 1380.87 }, + # { id: 6, name: "Aluminium", price: 0.35 } + # ], + # update_only: [:price] # Only prices will be updated + # ) + # + # See the related +:on_duplicate+ option. Both options can't be used at the same time. + # + # [:record_timestamps] + # By default, automatic setting of timestamp columns is controlled by + # the model's record_timestamps config, matching typical + # behavior. + # + # To override this and force automatic setting of timestamp columns one + # way or the other, pass :record_timestamps: + # + # record_timestamps: true # Always set timestamps automatically + # record_timestamps: false # Never set timestamps automatically + # + # ==== Examples + # + # # Inserts multiple records, performing an upsert when records have duplicate ISBNs. + # # Here "Eloquent Ruby" overwrites "Rework" because its ISBN is duplicate. + # + # Book.upsert_all([ + # { title: "Rework", author: "David", isbn: "1" }, + # { title: "Eloquent Ruby", author: "Russ", isbn: "1" } + # ], unique_by: :isbn) + # + # Book.find_by(isbn: "1").title # => "Eloquent Ruby" + # + # pkg:gem/activerecord#lib/active_record/relation.rb:936 + def upsert_all(attributes, on_duplicate: T.unsafe(nil), update_only: T.unsafe(nil), returning: T.unsafe(nil), unique_by: T.unsafe(nil), record_timestamps: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1310 + def values; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1314 + def values_for_queries; end + + # Returns a hash of where conditions. + # + # User.where(name: 'Oscar').where_values_hash + # # => {name: "Oscar"} + # + # pkg:gem/activerecord#lib/active_record/relation.rb:1255 + def where_values_hash(relation_table_name = T.unsafe(nil)); end + + protected + + # pkg:gem/activerecord#lib/active_record/relation.rb:1359 + def load_records(records); end + + private + + # pkg:gem/activerecord#lib/active_record/relation.rb:1385 + def _create(attributes, &block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1389 + def _create!(attributes, &block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1424 + def _increment_attribute(attribute, value = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1381 + def _new(attributes, &block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1393 + def _scoping(scope, registry, all_queries = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1409 + def _substitute_values(values); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1365 + def already_in_scope?(registry); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:457 + def compute_cache_key(timestamp_column = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:486 + def compute_cache_version(timestamp_column); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1373 + def current_scope_restoring_block(&block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1455 + def exec_main_query(async: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1431 + def exec_queries(&block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1369 + def global_scope?(registry); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:97 + def initialize_copy(other); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1487 + def instantiate_records(rows, &block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1530 + def limited_count; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1506 + def references_eager_loaded_tables?; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1498 + def skip_query_cache_if_necessary(&block); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1523 + def tables_in_string(string); end +end + +# pkg:gem/activerecord#lib/active_record/relation.rb:62 +ActiveRecord::Relation::CLAUSE_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/relation.rb:6 +class ActiveRecord::Relation::ExplainProxy + # pkg:gem/activerecord#lib/active_record/relation.rb:7 + def initialize(relation, options); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:16 + def average(column_name); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:20 + def count(column_name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:24 + def first(limit = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:12 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:28 + def last(limit = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:32 + def maximum(column_name); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:36 + def minimum(column_name); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:40 + def pluck(*column_names); end + + # pkg:gem/activerecord#lib/active_record/relation.rb:44 + def sum(identity_or_column = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/relation.rb:49 + def exec_explain(&block); end +end + +# pkg:gem/activerecord#lib/active_record/relation/from_clause.rb:5 +class ActiveRecord::Relation::FromClause + # pkg:gem/activerecord#lib/active_record/relation/from_clause.rb:8 + def initialize(value, name); end + + # pkg:gem/activerecord#lib/active_record/relation/from_clause.rb:21 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/relation/from_clause.rb:17 + def empty?; end + + # pkg:gem/activerecord#lib/active_record/relation/from_clause.rb:13 + def merge(other); end + + # pkg:gem/activerecord#lib/active_record/relation/from_clause.rb:6 + def name; end + + # pkg:gem/activerecord#lib/active_record/relation/from_clause.rb:6 + def value; end + + class << self + # pkg:gem/activerecord#lib/active_record/relation/from_clause.rb:25 + def empty; end + end +end + +# pkg:gem/activerecord#lib/active_record/relation/merger.rb:7 +class ActiveRecord::Relation::HashMerger + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:10 + def initialize(relation, hash); end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:8 + def hash; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:17 + def merge; end + + # Applying values to a relation has some side effects. E.g. + # interpolation might take place for where values. So we should + # build a relation to merge in rather than directly merging + # the values. + # + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:25 + def other; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:8 + def relation; end +end + +# pkg:gem/activerecord#lib/active_record/relation.rb:63 +ActiveRecord::Relation::INVALID_METHODS_FOR_UPDATE_AND_DELETE_ALL = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/relation.rb:54 +ActiveRecord::Relation::MULTI_VALUE_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/relation/merger.rb:43 +class ActiveRecord::Relation::Merger + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:46 + def initialize(relation, other); end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:58 + def merge; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:44 + def other; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:44 + def relation; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:44 + def values; end + + private + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:178 + def merge_clauses; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:117 + def merge_joins; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:155 + def merge_multi_values; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:136 + def merge_outer_joins; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:96 + def merge_preloads; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:84 + def merge_select_values; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:170 + def merge_single_values; end + + # pkg:gem/activerecord#lib/active_record/relation/merger.rb:188 + def replace_from_clause?; end +end + +# pkg:gem/activerecord#lib/active_record/relation/merger.rb:52 +ActiveRecord::Relation::Merger::NORMAL_VALUES = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:7 +class ActiveRecord::Relation::QueryAttribute < ::ActiveModel::Attribute + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:8 + def initialize(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:55 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:58 + def eql?(other); end + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:60 + def hash; end + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:44 + def infinite?; end + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:37 + def nil?; end + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:24 + def type_cast(value); end + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:48 + def unboundable?; end + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:28 + def value_for_database; end + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:33 + def with_cast_value(value); end + + private + + # pkg:gem/activerecord#lib/active_record/relation/query_attribute.rb:65 + def infinity?(value); end +end + +# pkg:gem/activerecord#lib/active_record/relation.rb:59 +ActiveRecord::Relation::SINGLE_VALUE_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/relation.rb:1339 +class ActiveRecord::Relation::StrictLoadingScope + class << self + # pkg:gem/activerecord#lib/active_record/relation.rb:1340 + def empty_scope?; end + + # pkg:gem/activerecord#lib/active_record/relation.rb:1344 + def strict_loading_value; end + end +end + +# pkg:gem/activerecord#lib/active_record/relation.rb:65 +ActiveRecord::Relation::VALUE_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:7 +class ActiveRecord::Relation::WhereClause + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:10 + def initialize(predicates); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:14 + def +(other); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:18 + def -(other); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:75 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:8 + def any?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:70 + def ast; end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:99 + def contradiction?; end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:8 + def empty?(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:79 + def eql?(other); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:32 + def except(*columns); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:110 + def extract_attributes; end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:81 + def hash; end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:85 + def invert; end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:26 + def merge(other); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:36 + def or(other); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:61 + def to_h(table_name = T.unsafe(nil), equality_only: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:22 + def |(other); end + + protected + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:117 + def predicates; end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:119 + def referenced_columns; end + + private + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:126 + def each_attributes; end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:149 + def equalities(predicates, equality_only); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:163 + def equality_node?(node); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:178 + def except_predicates(columns); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:136 + def extract_attribute(node); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:208 + def extract_node_value(node); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:167 + def invert_predicate(node); end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:204 + def non_empty_predicates; end + + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:193 + def predicates_with_wrapped_sql_literals; end + + class << self + # pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:95 + def empty; end + end +end + +# pkg:gem/activerecord#lib/active_record/relation/where_clause.rb:203 +ActiveRecord::Relation::WhereClause::ARRAY_WITH_EMPTY_STRING = T.let(T.unsafe(nil), Array) + +# = Active Record \Result +# +# This class encapsulates a result returned from calling +# {#exec_query}[rdoc-ref:ConnectionAdapters::DatabaseStatements#exec_query] +# on any database connection adapter. For example: +# +# result = ActiveRecord::Base.lease_connection.exec_query('SELECT id, title, body FROM posts') +# result # => # +# +# # Get the column names of the result: +# result.columns +# # => ["id", "title", "body"] +# +# # Get the record values of the result: +# result.rows +# # => [[1, "title_1", "body_1"], +# [2, "title_2", "body_2"], +# ... +# ] +# +# # Get an array of hashes representing the result (column => value): +# result.to_a +# # => [{"id" => 1, "title" => "title_1", "body" => "body_1"}, +# {"id" => 2, "title" => "title_2", "body" => "body_2"}, +# ... +# ] +# +# # Get the number of rows affected by the query: +# result = ActiveRecord::Base.lease_connection.exec_query('INSERT INTO posts (title, body) VALUES ("title_3", "body_3"), ("title_4", "body_4")') +# result.affected_rows +# # => 2 +# +# # ActiveRecord::Result also includes Enumerable. +# result.each do |row| +# puts row['title'] + " " + row['body'] +# end +# +# pkg:gem/activerecord#lib/active_record/result.rb:41 +class ActiveRecord::Result + include ::Enumerable + + # pkg:gem/activerecord#lib/active_record/result.rb:107 + def initialize(columns, rows, column_types = T.unsafe(nil), affected_rows: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/result.rb:155 + def [](idx); end + + # pkg:gem/activerecord#lib/active_record/result.rb:97 + def affected_rows; end + + # pkg:gem/activerecord#lib/active_record/result.rb:186 + def cancel; end + + # pkg:gem/activerecord#lib/active_record/result.rb:190 + def cast_values(type_overrides = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/result.rb:228 + def column_indexes; end + + # Returns the +ActiveRecord::Type+ type of all columns. + # Note that not all database adapters return the result types, + # so the hash may be empty. + # + # pkg:gem/activerecord#lib/active_record/result.rb:167 + def column_types; end + + # pkg:gem/activerecord#lib/active_record/result.rb:97 + def columns; end + + # Calls the given block once for each element in row collection, passing + # row as parameter. Each row is a Hash-like, read only object. + # + # To get real hashes, use +.to_a.each+. + # + # Returns an +Enumerator+ if no block is given. + # + # pkg:gem/activerecord#lib/active_record/result.rb:135 + def each(&block); end + + # Returns true if there are no records, otherwise false. + # + # pkg:gem/activerecord#lib/active_record/result.rb:144 + def empty?; end + + # pkg:gem/activerecord#lib/active_record/result.rb:221 + def freeze; end + + # Returns true if this result set includes the column named +name+ + # + # pkg:gem/activerecord#lib/active_record/result.rb:120 + def includes_column?(name); end + + # pkg:gem/activerecord#lib/active_record/result.rb:241 + def indexed_rows; end + + # Returns the last record from the rows collection. + # + # pkg:gem/activerecord#lib/active_record/result.rb:160 + def last(n = T.unsafe(nil)); end + + # Returns the number of elements in the rows array. + # + # pkg:gem/activerecord#lib/active_record/result.rb:125 + def length; end + + # pkg:gem/activerecord#lib/active_record/result.rb:182 + def result; end + + # pkg:gem/activerecord#lib/active_record/result.rb:97 + def rows; end + + # pkg:gem/activerecord#lib/active_record/result.rb:153 + def to_a; end + + # Returns an array of hashes representing each row record. + # + # pkg:gem/activerecord#lib/active_record/result.rb:149 + def to_ary; end + + private + + # pkg:gem/activerecord#lib/active_record/result.rb:249 + def column_type(name, index, type_overrides); end + + # pkg:gem/activerecord#lib/active_record/result.rb:261 + def hash_rows; end + + # pkg:gem/activerecord#lib/active_record/result.rb:216 + def initialize_copy(other); end + + class << self + # pkg:gem/activerecord#lib/active_record/result.rb:99 + def empty(async: T.unsafe(nil), affected_rows: T.unsafe(nil)); end + end +end + +# pkg:gem/activerecord#lib/active_record/result.rb:269 +ActiveRecord::Result::EMPTY_ARRAY = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/result.rb:270 +ActiveRecord::Result::EMPTY_HASH = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activerecord#lib/active_record/result.rb:44 +class ActiveRecord::Result::IndexedRow + # pkg:gem/activerecord#lib/active_record/result.rb:45 + def initialize(column_indexes, row); end + + # pkg:gem/activerecord#lib/active_record/result.rb:63 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/result.rb:85 + def [](column); end + + # pkg:gem/activerecord#lib/active_record/result.rb:55 + def each_key(&block); end + + # pkg:gem/activerecord#lib/active_record/result.rb:75 + def fetch(column); end + + # pkg:gem/activerecord#lib/active_record/result.rb:71 + def key?(column); end + + # pkg:gem/activerecord#lib/active_record/result.rb:59 + def keys; end + + # pkg:gem/activerecord#lib/active_record/result.rb:53 + def length; end + + # pkg:gem/activerecord#lib/active_record/result.rb:50 + def size; end + + # pkg:gem/activerecord#lib/active_record/result.rb:91 + def to_h; end + + # pkg:gem/activerecord#lib/active_record/result.rb:94 + def to_hash; end +end + +# {ActiveRecord::Base.transaction}[rdoc-ref:Transactions::ClassMethods#transaction] +# uses this exception to distinguish a deliberate rollback from other exceptional situations. +# Normally, raising an exception will cause the +# {.transaction}[rdoc-ref:Transactions::ClassMethods#transaction] method to rollback +# the database transaction *and* pass on the exception. But if you raise an +# ActiveRecord::Rollback exception, then the database transaction will be rolled back, +# without passing on the exception. +# +# For example, you could do this in your controller to rollback a transaction: +# +# class BooksController < ActionController::Base +# def create +# Book.transaction do +# book = Book.new(params[:book]) +# book.save! +# if today_is_friday? +# # The system must fail on Friday so that our support department +# # won't be out of job. We silently rollback this transaction +# # without telling the user. +# raise ActiveRecord::Rollback +# end +# end +# # ActiveRecord::Rollback is the only exception that won't be passed on +# # by ActiveRecord::Base.transaction, so this line will still be reached +# # even on Friday. +# redirect_to root_url +# end +# end +# +# pkg:gem/activerecord#lib/active_record/errors.rb:442 +class ActiveRecord::Rollback < ::ActiveRecord::ActiveRecordError; end + +# This is a thread locals registry for Active Record. For example: +# +# ActiveRecord::RuntimeRegistry.stats.sql_runtime +# +# returns the connection handler local to the current unit of execution (either thread of fiber). +# +# pkg:gem/activerecord#lib/active_record/runtime_registry.rb:9 +module ActiveRecord::RuntimeRegistry + extend ::ActiveRecord::RuntimeRegistry + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:32 + def call(name, start, finish, id, payload); end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:42 + def record(query_name, runtime, cached: T.unsafe(nil), async: T.unsafe(nil), lock_wait: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:60 + def reset; end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:56 + def stats; end +end + +# pkg:gem/activerecord#lib/active_record/runtime_registry.rb:10 +class ActiveRecord::RuntimeRegistry::Stats + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:13 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:11 + def async_sql_runtime; end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:11 + def async_sql_runtime=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:11 + def cached_queries_count; end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:11 + def cached_queries_count=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:11 + def queries_count; end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:11 + def queries_count=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:27 + def reset; end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:20 + def reset_runtimes; end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:11 + def sql_runtime; end + + # pkg:gem/activerecord#lib/active_record/runtime_registry.rb:11 + def sql_runtime=(_arg0); end +end + +# Raised when a statement produces an SQL warning. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:312 +class ActiveRecord::SQLWarning < ::ActiveRecord::AdapterError + # pkg:gem/activerecord#lib/active_record/errors.rb:316 + def initialize(message = T.unsafe(nil), code = T.unsafe(nil), level = T.unsafe(nil), sql = T.unsafe(nil), connection_pool = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:313 + def code; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:313 + def level; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:314 + def sql; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:314 + def sql=(_arg0); end +end + +# pkg:gem/activerecord#lib/active_record/sanitization.rb:4 +module ActiveRecord::Sanitization + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Sanitization::ClassMethods +end + +# pkg:gem/activerecord#lib/active_record/sanitization.rb:7 +module ActiveRecord::Sanitization::ClassMethods + # pkg:gem/activerecord#lib/active_record/sanitization.rb:185 + def disallow_raw_sql!(args, permit: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/sanitization.rb:41 + def sanitize_sql(condition); end + + # Accepts an array of conditions. The array has each value + # sanitized and interpolated into the SQL statement. If using named bind + # variables in SQL statements where a colon is required verbatim use a + # backslash to escape. + # + # sanitize_sql_array(["name=? and group_id=?", "foo'bar", 4]) + # # => "name='foo''bar' and group_id=4" + # + # sanitize_sql_array(["name=:name and group_id=:group_id", name: "foo'bar", group_id: 4]) + # # => "name='foo''bar' and group_id=4" + # + # sanitize_sql_array(["TO_TIMESTAMP(:date, 'YYYY/MM/DD HH12\\:MI\\:SS')", date: "foo"]) + # # => "TO_TIMESTAMP('foo', 'YYYY/MM/DD HH12:MI:SS')" + # + # sanitize_sql_array(["name='%s' and group_id='%s'", "foo'bar", 4]) + # # => "name='foo''bar' and group_id='4'" + # + # Note that this sanitization method is not schema-aware, hence won't do any type casting + # and will directly use the database adapter's +quote+ method. + # For MySQL specifically this means that numeric parameters will be quoted as strings + # to prevent query manipulation attacks. + # + # sanitize_sql_array(["role = ?", 0]) + # # => "role = '0'" + # + # Before using this method, please consider if Arel.sql would be better for your use-case + # + # pkg:gem/activerecord#lib/active_record/sanitization.rb:166 + def sanitize_sql_array(ary); end + + # Accepts an array or hash of SQL conditions and sanitizes them into + # a valid SQL fragment for a SET clause. + # + # sanitize_sql_for_assignment(["name=? and group_id=?", nil, 4]) + # # => "name=NULL and group_id=4" + # + # sanitize_sql_for_assignment(["name=:name and group_id=:group_id", name: nil, group_id: 4]) + # # => "name=NULL and group_id=4" + # + # Post.sanitize_sql_for_assignment({ name: nil, group_id: 4 }) + # # => "`posts`.`name` = NULL, `posts`.`group_id` = 4" + # + # This method will NOT sanitize an SQL string since it won't contain + # any conditions in it and will return the string as is. + # + # sanitize_sql_for_assignment("name=NULL and group_id='4'") + # # => "name=NULL and group_id='4'" + # + # Note that this sanitization method is not schema-aware, hence won't do any type casting + # and will directly use the database adapter's +quote+ method. + # For MySQL specifically this means that numeric parameters will be quoted as strings + # to prevent query manipulation attacks. + # + # sanitize_sql_for_assignment(["role = ?", 0]) + # # => "role = '0'" + # + # pkg:gem/activerecord#lib/active_record/sanitization.rb:68 + def sanitize_sql_for_assignment(assignments, default_table_name = T.unsafe(nil)); end + + # Accepts an array of SQL conditions and sanitizes them into a valid + # SQL fragment for a WHERE clause. + # + # sanitize_sql_for_conditions(["name=? and group_id=?", "foo'bar", 4]) + # # => "name='foo''bar' and group_id=4" + # + # sanitize_sql_for_conditions(["name=:name and group_id=:group_id", name: "foo'bar", group_id: 4]) + # # => "name='foo''bar' and group_id='4'" + # + # sanitize_sql_for_conditions(["name='%s' and group_id='%s'", "foo'bar", 4]) + # # => "name='foo''bar' and group_id='4'" + # + # This method will NOT sanitize an SQL string since it won't contain + # any conditions in it and will return the string as is. + # + # sanitize_sql_for_conditions("name='foo''bar' and group_id='4'") + # # => "name='foo''bar' and group_id='4'" + # + # Note that this sanitization method is not schema-aware, hence won't do any type casting + # and will directly use the database adapter's +quote+ method. + # For MySQL specifically this means that numeric parameters will be quoted as strings + # to prevent query manipulation attacks. + # + # sanitize_sql_for_conditions(["role = ?", 0]) + # # => "role = '0'" + # + # pkg:gem/activerecord#lib/active_record/sanitization.rb:33 + def sanitize_sql_for_conditions(condition); end + + # Accepts an array, or string of SQL conditions and sanitizes + # them into a valid SQL fragment for an ORDER clause. + # + # sanitize_sql_for_order([Arel.sql("field(id, ?)"), [1,3,2]]) + # # => "field(id, 1,3,2)" + # + # sanitize_sql_for_order("id ASC") + # # => "id ASC" + # + # pkg:gem/activerecord#lib/active_record/sanitization.rb:84 + def sanitize_sql_for_order(condition); end + + # Sanitizes a hash of attribute/value pairs into SQL conditions for a SET clause. + # + # sanitize_sql_hash_for_assignment({ status: nil, group_id: 1 }, "posts") + # # => "`posts`.`status` = NULL, `posts`.`group_id` = 1" + # + # pkg:gem/activerecord#lib/active_record/sanitization.rb:107 + def sanitize_sql_hash_for_assignment(attrs, table); end + + # Sanitizes a +string+ so that it is safe to use within an SQL + # LIKE statement. This method uses +escape_character+ to escape all + # occurrences of itself, "_" and "%". + # + # sanitize_sql_like("100% true!") + # # => "100\\% true!" + # + # sanitize_sql_like("snake_cased_string") + # # => "snake\\_cased\\_string" + # + # sanitize_sql_like("100% true!", "!") + # # => "100!% true!!" + # + # sanitize_sql_like("snake_cased_string", "!") + # # => "snake!_cased!_string" + # + # pkg:gem/activerecord#lib/active_record/sanitization.rb:132 + def sanitize_sql_like(string, escape_character = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/sanitization.rb:235 + def quote_bound_value(connection, value); end + + # pkg:gem/activerecord#lib/active_record/sanitization.rb:249 + def raise_if_bind_arity_mismatch(statement, expected, provided); end + + # pkg:gem/activerecord#lib/active_record/sanitization.rb:213 + def replace_bind_variable(connection, value); end + + # pkg:gem/activerecord#lib/active_record/sanitization.rb:205 + def replace_bind_variables(connection, statement, values); end + + # pkg:gem/activerecord#lib/active_record/sanitization.rb:221 + def replace_named_bind_variables(connection, statement, bind_vars); end +end + +# = Active Record \Schema +# +# Allows programmers to programmatically define a schema in a portable +# DSL. This means you can define tables, indexes, etc. without using SQL +# directly, so your applications can more easily support multiple +# databases. +# +# Usage: +# +# ActiveRecord::Schema[7.0].define do +# create_table :authors do |t| +# t.string :name, null: false +# end +# +# add_index :authors, :name, unique: true +# +# create_table :posts do |t| +# t.integer :author_id, null: false +# t.string :subject +# t.text :body +# t.boolean :private, default: false +# end +# +# add_index :posts, :author_id +# end +# +# ActiveRecord::Schema is only supported by database adapters that also +# support migrations, the two features being very similar. +# +# pkg:gem/activerecord#lib/active_record/schema.rb:32 +class ActiveRecord::Schema < ::ActiveRecord::Migration::Current + include ::ActiveRecord::Schema::Definition + extend ::ActiveRecord::Schema::Definition::ClassMethods + + class << self + # pkg:gem/activerecord#lib/active_record/schema.rb:70 + def [](version); end + end +end + +# pkg:gem/activerecord#lib/active_record/schema.rb:33 +module ActiveRecord::Schema::Definition + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Schema::Definition::ClassMethods + + # pkg:gem/activerecord#lib/active_record/schema.rb:54 + def define(info, &block); end +end + +# pkg:gem/activerecord#lib/active_record/schema.rb:36 +module ActiveRecord::Schema::Definition::ClassMethods + # Eval the given block. All methods available to the current connection + # adapter are available within the block, so you can easily use the + # database definition DSL to build up your schema ( + # {create_table}[rdoc-ref:ConnectionAdapters::SchemaStatements#create_table], + # {add_index}[rdoc-ref:ConnectionAdapters::SchemaStatements#add_index], etc.). + # + # The +info+ hash is optional, and if given is used to define metadata + # about the current schema (currently, only the schema's version): + # + # ActiveRecord::Schema[7.0].define(version: 2038_01_19_000001) do + # ... + # end + # + # pkg:gem/activerecord#lib/active_record/schema.rb:49 + def define(info = T.unsafe(nil), &block); end +end + +# = Active Record Schema Dumper +# +# This class is used to dump the database schema for some connection to some +# output format (i.e., ActiveRecord::Schema). +# +# pkg:gem/activerecord#lib/active_record/schema_dumper.rb:10 +class ActiveRecord::SchemaDumper + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:74 + def initialize(connection, options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:29 + def chk_ignore_pattern; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:29 + def chk_ignore_pattern=(val); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:60 + def dump(stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:35 + def excl_ignore_pattern; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:35 + def excl_ignore_pattern=(val); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:23 + def fk_ignore_pattern; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:23 + def fk_ignore_pattern=(val); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:17 + def ignore_tables; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:17 + def ignore_tables=(val); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:41 + def unique_ignore_pattern; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:41 + def unique_ignore_pattern=(val); end + + private + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:284 + def check_constraints_in_create(table, stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:310 + def check_parts(check); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:92 + def define_params; end + + # extensions are only supported by PostgreSQL + # + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:119 + def extensions(stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:317 + def foreign_keys(table, stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:346 + def format_colspec(colspec); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:356 + def format_index_parts(options); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:352 + def format_options(options); end + + # turns 20170404131909 into "2017_04_04_131909" + # + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:86 + def formatted_version; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:96 + def header(stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:378 + def ignored?(table_name); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:265 + def index_parts(index); end + + # Keep it for indexing materialized views + # + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:232 + def indexes(table, stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:244 + def indexes_in_create(table, stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:364 + def relation_name(name); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:368 + def remove_prefix_and_suffix(table); end + + # schemas are only supported by PostgreSQL + # + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:127 + def schemas(stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:158 + def table(table, stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:72 + def table_name; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:72 + def table_name=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:134 + def tables(stream); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:114 + def trailer(stream); end + + # (enum) types are only supported by PostgreSQL + # + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:123 + def types(stream); end + + # virtual tables are only supported by SQLite + # + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:131 + def virtual_tables(stream); end + + class << self + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:29 + def chk_ignore_pattern; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:29 + def chk_ignore_pattern=(val); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:44 + def dump(pool = T.unsafe(nil), stream = T.unsafe(nil), config = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:35 + def excl_ignore_pattern; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:35 + def excl_ignore_pattern=(val); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:23 + def fk_ignore_pattern; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:23 + def fk_ignore_pattern=(val); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:17 + def ignore_tables; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:17 + def ignore_tables=(val); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:41 + def unique_ignore_pattern; end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:41 + def unique_ignore_pattern=(val); end + + private + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:52 + def generate_options(config); end + + # pkg:gem/activerecord#lib/active_record/schema_dumper.rb:11 + def new(*_arg0); end + end +end + +# This class is used to create a table that keeps track of which migrations +# have been applied to a given database. When a migration is run, its schema +# number is inserted in to the schema migrations table so it doesn't need +# to be executed the next time. +# +# pkg:gem/activerecord#lib/active_record/schema_migration.rb:8 +class ActiveRecord::SchemaMigration + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:14 + def initialize(pool); end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:12 + def arel_table; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:91 + def count; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:53 + def create_table; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:19 + def create_version(version); end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:36 + def delete_all_versions; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:27 + def delete_version(version); end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:63 + def drop_table; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:87 + def integer_versions; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:69 + def normalize_migration_number(number); end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:73 + def normalized_versions; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:45 + def primary_key; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:100 + def table_exists?; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:49 + def table_name; end + + # pkg:gem/activerecord#lib/active_record/schema_migration.rb:77 + def versions; end +end + +# pkg:gem/activerecord#lib/active_record/schema_migration.rb:9 +class ActiveRecord::SchemaMigration::NullSchemaMigration; end + +# = Active Record \Named \Scopes +# +# pkg:gem/activerecord#lib/active_record/scoping.rb:5 +module ActiveRecord::Scoping + extend ::ActiveSupport::Concern + extend ::ActiveSupport::Autoload + include GeneratedInstanceMethods + include ::ActiveRecord::Scoping::Default + include ::ActiveRecord::Scoping::Named + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::Scoping::ClassMethods + mixes_in_class_methods ::ActiveRecord::Scoping::Default::ClassMethods + mixes_in_class_methods ::ActiveRecord::Scoping::Named::ClassMethods + + # pkg:gem/activerecord#lib/active_record/scoping.rb:53 + def initialize_internals_callback; end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:46 + def populate_with_current_scope_attributes; end + + module GeneratedClassMethods + def default_scope_override; end + def default_scope_override=(value); end + def default_scopes; end + def default_scopes=(value); end + end + + module GeneratedInstanceMethods + def default_scope_override; end + def default_scopes; end + end +end + +# pkg:gem/activerecord#lib/active_record/scoping.rb:13 +module ActiveRecord::Scoping::ClassMethods + # pkg:gem/activerecord#lib/active_record/scoping.rb:25 + def current_scope(skip_inherited_scope = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:29 + def current_scope=(scope); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:33 + def global_current_scope(skip_inherited_scope = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:37 + def global_current_scope=(scope); end + + # Collects attributes from scopes that should be applied when creating + # an AR instance for the particular class this is called on. + # + # pkg:gem/activerecord#lib/active_record/scoping.rb:16 + def scope_attributes; end + + # Are there attributes associated with this scope? + # + # pkg:gem/activerecord#lib/active_record/scoping.rb:21 + def scope_attributes?; end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:41 + def scope_registry; end +end + +# pkg:gem/activerecord#lib/active_record/scoping/default.rb:14 +module ActiveRecord::Scoping::Default + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::Scoping::Default::ClassMethods + + module GeneratedClassMethods + def default_scope_override; end + def default_scope_override=(value); end + def default_scopes; end + def default_scopes=(value); end + end + + module GeneratedInstanceMethods + def default_scope_override; end + def default_scopes; end + end +end + +# pkg:gem/activerecord#lib/active_record/scoping/default.rb:23 +module ActiveRecord::Scoping::Default::ClassMethods + # Checks if the model has any default scopes. If all_queries + # is set to true, the method will check if there are any + # default_scopes for the model where +all_queries+ is true. + # + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:62 + def default_scopes?(all_queries: T.unsafe(nil)); end + + # Are there attributes associated with this scope? + # + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:55 + def scope_attributes?; end + + # Returns a scope for the model without the previously set scopes. + # + # class Post < ActiveRecord::Base + # belongs_to :user + # + # def self.default_scope + # where(published: true) + # end + # end + # + # class User < ActiveRecord::Base + # has_many :posts + # end + # + # Post.all # Fires "SELECT * FROM posts WHERE published = true" + # Post.unscoped.all # Fires "SELECT * FROM posts" + # Post.where(published: false).unscoped.all # Fires "SELECT * FROM posts" + # User.find(1).posts # Fires "SELECT * FROM posts WHERE published = true AND posts.user_id = 1" + # User.find(1).posts.unscoped # Fires "SELECT * FROM posts" + # + # This method also accepts a block. All queries inside the block will + # not use the previously set scopes. + # + # Post.unscoped { + # Post.limit(10) # Fires "SELECT * FROM posts LIMIT 10" + # } + # + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:50 + def unscoped(&block); end + + private + + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:145 + def build_default_scope(relation = T.unsafe(nil), all_queries: T.unsafe(nil)); end + + # Use this macro in your model to set a default scope for all operations on + # the model. + # + # class Article < ActiveRecord::Base + # default_scope { where(published: true) } + # end + # + # Article.all + # # SELECT * FROM articles WHERE published = true + # + # The #default_scope is also applied while creating/building a record. + # It is not applied while updating or deleting a record. + # + # Article.new.published # => true + # Article.create.published # => true + # + # To apply a #default_scope when updating or deleting a record, add + # all_queries: true: + # + # class Article < ActiveRecord::Base + # default_scope -> { where(blog_id: 1) }, all_queries: true + # end + # + # Applying a default scope to all queries will ensure that records + # are always queried by the additional conditions. Note that only + # where clauses apply, as it does not make sense to add order to + # queries that return a single object by primary key. + # + # Article.find(1).destroy + # # DELETE ... FROM `articles` where ID = 1 AND blog_id = 1; + # + # (You can also pass any object which responds to +call+ to the + # +default_scope+ macro, and it will be called when building the + # default scope.) + # + # If you use multiple #default_scope declarations in your model then + # they will be merged together: + # + # class Article < ActiveRecord::Base + # default_scope { where(published: true) } + # default_scope { where(rating: 'G') } + # end + # + # Article.all + # # SELECT * FROM articles WHERE published = true AND rating = 'G' + # + # This is also the case with inheritance and module includes where the + # parent or module defines a #default_scope and the child or including + # class defines a second one. + # + # If you need to do more complex things with a default scope, you can + # alternatively define it as a class method: + # + # class Article < ActiveRecord::Base + # def self.default_scope + # # Should return a scope, you can call 'super' here etc. + # end + # end + # + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:129 + def default_scope(scope = T.unsafe(nil), all_queries: T.unsafe(nil), &block); end + + # The ignore_default_scope flag is used to prevent an infinite recursion + # situation where a default scope references a scope which has a default + # scope which references a scope... + # + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:192 + def evaluate_default_scope; end + + # If all_queries is nil, only execute on select and insert queries. + # + # If all_queries is true, check if the default_scope object has + # all_queries set, then execute on all queries; select, insert, update, + # delete, and reload. + # + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:177 + def execute_scope?(all_queries, default_scope_obj); end + + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:185 + def ignore_default_scope=(ignore); end + + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:181 + def ignore_default_scope?; end +end + +# pkg:gem/activerecord#lib/active_record/scoping/default.rb:5 +class ActiveRecord::Scoping::DefaultScope + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:8 + def initialize(scope, all_queries = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:6 + def all_queries; end + + # pkg:gem/activerecord#lib/active_record/scoping/default.rb:6 + def scope; end +end + +# pkg:gem/activerecord#lib/active_record/scoping/named.rb:6 +module ActiveRecord::Scoping::Named + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Scoping::Named::ClassMethods +end + +# pkg:gem/activerecord#lib/active_record/scoping/named.rb:9 +module ActiveRecord::Scoping::Named::ClassMethods + # Returns an ActiveRecord::Relation scope object. + # + # posts = Post.all + # posts.size # Fires "select count(*) from posts" and returns the count + # posts.each {|p| puts p.name } # Fires "select * from posts" and loads post objects + # + # fruits = Fruit.all + # fruits = fruits.where(color: 'red') if options[:red_only] + # fruits = fruits.limit(10) if limited? + # + # You can define a scope that applies to all finders using + # {default_scope}[rdoc-ref:Scoping::Default::ClassMethods#default_scope]. + # + # pkg:gem/activerecord#lib/active_record/scoping/named.rb:22 + def all(all_queries: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/scoping/named.rb:49 + def default_extensions; end + + # Returns a scope for the model with default scopes. + # + # pkg:gem/activerecord#lib/active_record/scoping/named.rb:45 + def default_scoped(scope = T.unsafe(nil), all_queries: T.unsafe(nil)); end + + # Adds a class method for retrieving and querying objects. + # The method is intended to return an ActiveRecord::Relation + # object, which is composable with other scopes. + # If it returns +nil+ or +false+, an + # {all}[rdoc-ref:Scoping::Named::ClassMethods#all] scope is returned instead. + # + # A \scope represents a narrowing of a database query, such as + # where(color: :red).select('shirts.*').includes(:washing_instructions). + # + # class Shirt < ActiveRecord::Base + # scope :red, -> { where(color: 'red') } + # scope :dry_clean_only, -> { joins(:washing_instructions).where('washing_instructions.dry_clean_only = ?', true) } + # end + # + # The above calls to #scope define class methods Shirt.red and + # Shirt.dry_clean_only. Shirt.red, in effect, + # represents the query Shirt.where(color: 'red'). + # + # Note that this is simply 'syntactic sugar' for defining an actual + # class method: + # + # class Shirt < ActiveRecord::Base + # def self.red + # where(color: 'red') + # end + # end + # + # Unlike Shirt.find(...), however, the object returned by + # Shirt.red is not an Array but an ActiveRecord::Relation, + # which is composable with other scopes; it resembles the association object + # constructed by a {has_many}[rdoc-ref:Associations::ClassMethods#has_many] + # declaration. For instance, you can invoke Shirt.red.first, Shirt.red.count, + # Shirt.red.where(size: 'small'). Also, just as with the + # association objects, named \scopes act like an Array, implementing + # Enumerable; Shirt.red.each(&block), Shirt.red.first, + # and Shirt.red.inject(memo, &block) all behave as if + # Shirt.red really was an array. + # + # These named \scopes are composable. For instance, + # Shirt.red.dry_clean_only will produce all shirts that are + # both red and dry clean only. Nested finds and calculations also work + # with these compositions: Shirt.red.dry_clean_only.count + # returns the number of garments for which these criteria obtain. + # Similarly with Shirt.red.dry_clean_only.average(:thread_count). + # + # All scopes are available as class methods on the ActiveRecord::Base + # descendant upon which the \scopes were defined. But they are also + # available to {has_many}[rdoc-ref:Associations::ClassMethods#has_many] + # associations. If, + # + # class Person < ActiveRecord::Base + # has_many :shirts + # end + # + # then elton.shirts.red.dry_clean_only will return all of + # Elton's red, dry clean only shirts. + # + # \Named scopes can also have extensions, just as with + # {has_many}[rdoc-ref:Associations::ClassMethods#has_many] declarations: + # + # class Shirt < ActiveRecord::Base + # scope :red, -> { where(color: 'red') } do + # def dom_id + # 'red_shirts' + # end + # end + # end + # + # Scopes can also be used while creating/building a record. + # + # class Article < ActiveRecord::Base + # scope :published, -> { where(published: true) } + # end + # + # Article.published.new.published # => true + # Article.published.create.published # => true + # + # \Class methods on your model are automatically available + # on scopes. Assuming the following setup: + # + # class Article < ActiveRecord::Base + # scope :published, -> { where(published: true) } + # scope :featured, -> { where(featured: true) } + # + # def self.latest_article + # order('published_at desc').first + # end + # + # def self.titles + # pluck(:title) + # end + # end + # + # We are able to call the methods like this: + # + # Article.published.featured.latest_article + # Article.featured.titles + # + # pkg:gem/activerecord#lib/active_record/scoping/named.rb:154 + def scope(name, body, &block); end + + # pkg:gem/activerecord#lib/active_record/scoping/named.rb:36 + def scope_for_association(scope = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/scoping/named.rb:192 + def singleton_method_added(name); end +end + +# This class stores the +:current_scope+ and +:ignore_default_scope+ values +# for different classes. The registry is stored as either a thread or fiber +# local depending on the application configuration. +# +# This class allows you to store and get the scope values on different +# classes and different types of scopes. For example, if you are attempting +# to get the current_scope for the +Board+ model, then you would use the +# following code: +# +# registry = ActiveRecord::Scoping::ScopeRegistry +# registry.set_current_scope(Board, some_new_scope) +# +# Now when you run: +# +# registry.current_scope(Board) +# +# You will obtain whatever was defined in +some_new_scope+. +# +# pkg:gem/activerecord#lib/active_record/scoping.rb:75 +class ActiveRecord::Scoping::ScopeRegistry + # pkg:gem/activerecord#lib/active_record/scoping.rb:85 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:91 + def current_scope(model, skip_inherited_scope = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:107 + def global_current_scope(model, skip_inherited_scope = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:99 + def ignore_default_scope(model, skip_inherited_scope = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:95 + def set_current_scope(model, value); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:111 + def set_global_current_scope(model, value); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:103 + def set_ignore_default_scope(model, value); end + + private + + # Sets the +value+ for a given +scope_type+ and +model+. + # + # pkg:gem/activerecord#lib/active_record/scoping.rb:130 + def set_value_for(scope_type, model, value); end + + # Obtains the value for a given +scope_type+ and +model+. + # + # pkg:gem/activerecord#lib/active_record/scoping.rb:117 + def value_for(scope_type, model, skip_inherited_scope = T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/active_record/scoping.rb:77 + def current_scope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:77 + def global_current_scope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:77 + def ignore_default_scope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:80 + def instance; end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:77 + def set_current_scope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:77 + def set_global_current_scope(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/scoping.rb:77 + def set_ignore_default_scope(*, **, &); end + end +end + +# pkg:gem/activerecord#lib/active_record/secure_password.rb:4 +module ActiveRecord::SecurePassword + extend ::ActiveSupport::Concern + include ::ActiveModel::SecurePassword + + mixes_in_class_methods ::ActiveModel::SecurePassword::ClassMethods + mixes_in_class_methods ::ActiveRecord::SecurePassword::ClassMethods +end + +# pkg:gem/activerecord#lib/active_record/secure_password.rb:9 +module ActiveRecord::SecurePassword::ClassMethods + # Given a set of attributes, finds a record using the non-password + # attributes, and then authenticates that record using the password + # attributes. Returns the record if authentication succeeds; otherwise, + # returns +nil+. + # + # Regardless of whether a record is found, +authenticate_by+ will + # cryptographically digest the given password attributes. This behavior + # helps mitigate timing-based enumeration attacks, wherein an attacker can + # determine if a passworded record exists even without knowing the + # password. + # + # Raises an ArgumentError if the set of attributes doesn't contain at + # least one password and one non-password attribute. + # + # ==== Examples + # + # class User < ActiveRecord::Base + # has_secure_password + # end + # + # User.create(name: "John Doe", email: "jdoe@example.com", password: "abc123") + # + # User.authenticate_by(email: "jdoe@example.com", password: "abc123").name # => "John Doe" (in 373.4ms) + # User.authenticate_by(email: "jdoe@example.com", password: "wrong") # => nil (in 373.9ms) + # User.authenticate_by(email: "wrong@example.com", password: "abc123") # => nil (in 373.6ms) + # + # User.authenticate_by(email: "jdoe@example.com", password: nil) # => nil (no queries executed) + # User.authenticate_by(email: "jdoe@example.com", password: "") # => nil (no queries executed) + # + # User.authenticate_by(email: "jdoe@example.com") # => ArgumentError + # User.authenticate_by(password: "abc123") # => ArgumentError + # + # pkg:gem/activerecord#lib/active_record/secure_password.rb:41 + def authenticate_by(attributes); end +end + +# pkg:gem/activerecord#lib/active_record/secure_token.rb:4 +module ActiveRecord::SecureToken + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::SecureToken::ClassMethods +end + +# pkg:gem/activerecord#lib/active_record/secure_token.rb:11 +module ActiveRecord::SecureToken::ClassMethods + # pkg:gem/activerecord#lib/active_record/secure_token.rb:61 + def generate_unique_secure_token(length: T.unsafe(nil)); end + + # Example using #has_secure_token + # + # # Schema: User(token:string, auth_token:string) + # class User < ActiveRecord::Base + # has_secure_token + # has_secure_token :auth_token, length: 36 + # end + # + # user = User.new + # user.save + # user.token # => "pX27zsMN2ViQKta1bGfLmVJE" + # user.auth_token # => "tU9bLuZseefXQ4yQxQo8wjtBvsAfPc78os6R" + # user.regenerate_token # => true + # user.regenerate_auth_token # => true + # + # +SecureRandom::base58+ is used to generate at minimum a 24-character unique token, so collisions are highly unlikely. + # + # Note that it's still possible to generate a race condition in the database in the same way that + # {validates_uniqueness_of}[rdoc-ref:Validations::ClassMethods#validates_uniqueness_of] can. + # You're encouraged to add a unique index in the database to deal with this even more unlikely scenario. + # + # ==== Options + # + # [+:length+] + # Length of the Secure Random, with a minimum of 24 characters. It will + # default to 24. + # + # [+:on+] + # The callback when the value is generated. When called with on: + # :initialize, the value is generated in an + # after_initialize callback, otherwise the value will be used + # in a before_ callback. When not specified, +:on+ will use the value of + # config.active_record.generate_secure_token_on, which defaults to +:initialize+ + # starting in \Rails 7.1. + # + # pkg:gem/activerecord#lib/active_record/secure_token.rb:46 + def has_secure_token(attribute = T.unsafe(nil), length: T.unsafe(nil), on: T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/secure_token.rb:7 +ActiveRecord::SecureToken::MINIMUM_TOKEN_LENGTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activerecord#lib/active_record/secure_token.rb:5 +class ActiveRecord::SecureToken::MinimumLengthError < ::StandardError; end + +# = Active Record \Serialization +# +# pkg:gem/activerecord#lib/active_record/serialization.rb:5 +module ActiveRecord::Serialization + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActiveModel::Serializers::JSON + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveModel::Naming + + # pkg:gem/activerecord#lib/active_record/serialization.rb:13 + def serializable_hash(options = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/serialization.rb:25 + def attribute_names_for_serialization; end + + module GeneratedClassMethods + def include_root_in_json; end + def include_root_in_json=(value); end + def include_root_in_json?; end + end + + module GeneratedInstanceMethods + def include_root_in_json; end + def include_root_in_json?; end + end +end + +# SerializationFailure will be raised when a transaction is rolled +# back by the database due to a serialization failure. +# +# This is a subclass of TransactionRollbackError, please make sure to check +# its documentation to be aware of its caveats. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:552 +class ActiveRecord::SerializationFailure < ::ActiveRecord::TransactionRollbackError; end + +# Raised when unserialized object's type mismatches one specified for serializable field. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:36 +class ActiveRecord::SerializationTypeMismatch < ::ActiveRecord::ActiveRecordError; end + +# = Active Record Signed Id +# +# pkg:gem/activerecord#lib/active_record/signed_id.rb:5 +module ActiveRecord::SignedId + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::SignedId::ClassMethods + mixes_in_class_methods ::ActiveRecord::SignedId::DeprecateSignedIdVerifierSecret + + # Returns a signed id that's generated using a preconfigured +ActiveSupport::MessageVerifier+ instance. + # + # This signed id is tamper proof, so it's safe to send in an email or otherwise share with the outside world. + # However, as with any message signed with a +ActiveSupport::MessageVerifier+, + # {the signed id is not encrypted}[link:classes/ActiveSupport/MessageVerifier.html#class-ActiveSupport::MessageVerifier-label-Signing+is+not+encryption]. + # It's just encoded and protected against tampering. + # + # This means that the ID can be decoded by anyone; however, if tampered with (so to point to a different ID), + # the cryptographic signature will no longer match, and the signed id will be considered invalid and return nil + # when passed to +find_signed+ (or raise with +find_signed!+). + # + # It can furthermore be set to expire (the default is not to expire), and scoped down with a specific purpose. + # If the expiration date has been exceeded before +find_signed+ is called, the id won't find the designated + # record. If a purpose is set, this too must match. + # + # If you accidentally let a signed id out in the wild that you wish to retract sooner than its expiration date + # (or maybe you forgot to set an expiration date while meaning to!), you can use the purpose to essentially + # version the signed_id, like so: + # + # user.signed_id purpose: :v2 + # + # And you then change your +find_signed+ calls to require this new purpose. Any old signed ids that were not + # created with the purpose will no longer find the record. + # + # pkg:gem/activerecord#lib/active_record/signed_id.rb:160 + def signed_id(expires_in: T.unsafe(nil), expires_at: T.unsafe(nil), purpose: T.unsafe(nil)); end + + module GeneratedClassMethods + def _signed_id_verifier; end + def _signed_id_verifier=(value); end + def signed_id_verifier_secret; end + def signed_id_verifier_secret=(value); end + def signed_id_verifier_secret?; end + end + + module GeneratedInstanceMethods + def signed_id_verifier_secret; end + def signed_id_verifier_secret?; end + end +end + +# pkg:gem/activerecord#lib/active_record/signed_id.rb:42 +module ActiveRecord::SignedId::ClassMethods + # pkg:gem/activerecord#lib/active_record/signed_id.rb:131 + def combine_signed_id_purposes(purpose); end + + # Lets you find a record based on a signed id that's safe to put into the world without risk of tampering. + # This is particularly useful for things like password reset or email verification, where you want + # the bearer of the signed id to be able to interact with the underlying record, but usually only within + # a certain time period. + # + # You set the time period that the signed id is valid for during generation, using the instance method + # signed_id(expires_in: 15.minutes). If the time has elapsed before a signed find is attempted, + # the signed id will no longer be valid, and nil is returned. + # + # It's possible to further restrict the use of a signed id with a purpose. This helps when you have a + # general base model, like a User, which might have signed ids for several things, like password reset + # or email verification. The purpose that was set during generation must match the purpose set when + # finding. If there's a mismatch, nil is again returned. + # + # ==== Examples + # + # signed_id = User.first.signed_id expires_in: 15.minutes, purpose: :password_reset + # + # User.find_signed signed_id # => nil, since the purpose does not match + # + # travel 16.minutes + # User.find_signed signed_id, purpose: :password_reset # => nil, since the signed id has expired + # + # travel_back + # User.find_signed signed_id, purpose: :password_reset # => User.first + # + # pkg:gem/activerecord#lib/active_record/signed_id.rb:68 + def find_signed(signed_id, purpose: T.unsafe(nil), on_rotation: T.unsafe(nil)); end + + # Works like find_signed, but will raise an ActiveSupport::MessageVerifier::InvalidSignature + # exception if the +signed_id+ has either expired, has a purpose mismatch, is for another record, + # or has been tampered with. It will also raise an ActiveRecord::RecordNotFound exception if + # the valid signed id can't find a record. + # + # ==== Examples + # + # User.find_signed! "bad data" # => ActiveSupport::MessageVerifier::InvalidSignature + # + # signed_id = User.first.signed_id + # User.first.destroy + # User.find_signed! signed_id # => ActiveRecord::RecordNotFound + # + # pkg:gem/activerecord#lib/active_record/signed_id.rb:89 + def find_signed!(signed_id, purpose: T.unsafe(nil), on_rotation: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/signed_id.rb:96 + def signed_id_verifier; end + + # Allows you to pass in a custom verifier used for the signed ids. This also allows you to use different + # verifiers for different classes. This is also helpful if you need to rotate keys, as you can prepare + # your custom verifier for that in advance. See ActiveSupport::MessageVerifier for details. + # + # pkg:gem/activerecord#lib/active_record/signed_id.rb:122 + def signed_id_verifier=(verifier); end +end + +# pkg:gem/activerecord#lib/active_record/base.rb:329 +module ActiveRecord::SignedId::DeprecateSignedIdVerifierSecret + # pkg:gem/activerecord#lib/active_record/base.rb:329 + def signed_id_verifier_secret=(secret); end +end + +# pkg:gem/activerecord#lib/active_record/signed_id.rb:32 +module ActiveRecord::SignedId::RelationMethods + # pkg:gem/activerecord#lib/active_record/signed_id.rb:33 + def find_signed(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/signed_id.rb:37 + def find_signed!(*, **, &); end +end + +# Raised when Active Record finds multiple records but only expected one. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:191 +class ActiveRecord::SoleRecordExceeded < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/errors.rb:194 + def initialize(record = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:192 + def record; end +end + +# pkg:gem/activerecord#lib/active_record/relation/spawn_methods.rb:8 +module ActiveRecord::SpawnMethods + # Removes the condition(s) specified in +skips+ from the query. + # + # Post.order('id asc').except(:order) # removes the order condition + # Post.where('id > 10').order('id asc').except(:where) # removes the where condition but keeps the order + # + # pkg:gem/activerecord#lib/active_record/relation/spawn_methods.rb:59 + def except(*skips); end + + # Merges in the conditions from other, if other is an ActiveRecord::Relation. + # Returns an array representing the intersection of the resulting records with other, if other is an array. + # + # Post.where(published: true).joins(:comments).merge( Comment.where(spam: false) ) + # # Performs a single join query with both where conditions. + # + # recent_posts = Post.order('created_at DESC').first(5) + # Post.where(published: true).merge(recent_posts) + # # Returns the intersection of all published posts with the 5 most recently created posts. + # # (This is just an example. You'd probably want to do this with a single query!) + # + # Procs will be evaluated by merge: + # + # Post.where(published: true).merge(-> { joins(:comments) }) + # # => Post.where(published: true).joins(:comments) + # + # This is mainly intended for sharing common conditions between multiple associations. + # + # For conditions that exist in both relations, those from other will take precedence. + # To find the intersection of two relations, use QueryMethods#and. + # + # pkg:gem/activerecord#lib/active_record/relation/spawn_methods.rb:33 + def merge(other, *rest); end + + # pkg:gem/activerecord#lib/active_record/relation/spawn_methods.rb:43 + def merge!(other, *rest); end + + # Keeps only the condition(s) specified in +onlies+ in the query, removing all others. + # + # Post.order('id asc').only(:where) # keeps only the where condition, removes the order + # Post.order('id asc').only(:where, :order) # keeps only the where and order conditions + # + # pkg:gem/activerecord#lib/active_record/relation/spawn_methods.rb:67 + def only(*onlies); end + + # pkg:gem/activerecord#lib/active_record/relation/spawn_methods.rb:9 + def spawn; end + + private + + # pkg:gem/activerecord#lib/active_record/relation/spawn_methods.rb:72 + def relation_with(values); end +end + +# Raised on attempt to save stale record. Record is stale when it's being saved in another query after +# instantiation, for example, when two users edit the same wiki page and one starts editing and saves +# the page before the other. +# +# Read more about optimistic locking in ActiveRecord::Locking module +# documentation. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:378 +class ActiveRecord::StaleObjectError < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/errors.rb:381 + def initialize(record = T.unsafe(nil), attempted_action = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:379 + def attempted_action; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:379 + def record; end +end + +# Statement cache is used to cache a single statement in order to avoid creating the AST again. +# Initializing the cache is done by passing the statement in the create block: +# +# cache = StatementCache.create(ClothingItem.lease_connection) do |params| +# Book.where(name: "my book").where("author_id > 3") +# end +# +# The cached statement is executed by using the +# {connection.execute}[rdoc-ref:ConnectionAdapters::DatabaseStatements#execute] method: +# +# cache.execute([], ClothingItem.lease_connection) +# +# The relation returned by the block is cached, and for each +# {execute}[rdoc-ref:ConnectionAdapters::DatabaseStatements#execute] +# call the cached relation gets duped. Database is queried when +to_a+ is called on the relation. +# +# If you want to cache the statement without the values you can use the +bind+ method of the +# block parameter. +# +# cache = StatementCache.create(ClothingItem.lease_connection) do |params| +# Book.where(name: params.bind) +# end +# +# And pass the bind values as the first argument of +execute+ call. +# +# cache.execute(["my book"], ClothingItem.lease_connection) +# +# pkg:gem/activerecord#lib/active_record/statement_cache.rb:30 +class ActiveRecord::StatementCache + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:143 + def initialize(query_builder, bind_map, model); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:149 + def execute(params, connection, async: T.unsafe(nil), &block); end + + class << self + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:136 + def create(connection, callable = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:105 + def partial_query(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:109 + def partial_query_collector; end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:101 + def query(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:162 + def unsupported_value?(value); end + end +end + +# pkg:gem/activerecord#lib/active_record/statement_cache.rb:117 +class ActiveRecord::StatementCache::BindMap + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:118 + def initialize(bound_attributes); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:129 + def bind(values); end +end + +# pkg:gem/activerecord#lib/active_record/statement_cache.rb:113 +class ActiveRecord::StatementCache::Params + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:114 + def bind; end +end + +# pkg:gem/activerecord#lib/active_record/statement_cache.rb:46 +class ActiveRecord::StatementCache::PartialQuery < ::ActiveRecord::StatementCache::Query + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:47 + def initialize(values, retryable:); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:55 + def sql_for(binds, connection); end +end + +# pkg:gem/activerecord#lib/active_record/statement_cache.rb:68 +class ActiveRecord::StatementCache::PartialQueryCollector + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:71 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:76 + def <<(str); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:81 + def add_bind(obj, &); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:87 + def add_binds(binds, proc_for_binds = T.unsafe(nil), &); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:69 + def preparable; end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:69 + def preparable=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:69 + def retryable; end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:69 + def retryable=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:96 + def value; end +end + +# pkg:gem/activerecord#lib/active_record/statement_cache.rb:33 +class ActiveRecord::StatementCache::Query + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:36 + def initialize(sql, retryable:); end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:34 + def retryable; end + + # pkg:gem/activerecord#lib/active_record/statement_cache.rb:41 + def sql_for(binds, connection); end +end + +# pkg:gem/activerecord#lib/active_record/statement_cache.rb:31 +class ActiveRecord::StatementCache::Substitute; end + +# Superclass for all database execution errors. +# +# Wraps the underlying database error as +cause+. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:203 +class ActiveRecord::StatementInvalid < ::ActiveRecord::AdapterError + # pkg:gem/activerecord#lib/active_record/errors.rb:204 + def initialize(message = T.unsafe(nil), sql: T.unsafe(nil), binds: T.unsafe(nil), connection_pool: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:210 + def binds; end + + # pkg:gem/activerecord#lib/active_record/errors.rb:212 + def set_query(sql, binds); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:210 + def sql; end +end + +# StatementTimeout will be raised when statement timeout exceeded. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:582 +class ActiveRecord::StatementTimeout < ::ActiveRecord::QueryAborted; end + +# = Active Record \Store +# +# Store gives you a thin wrapper around serialize for the purpose of storing hashes in a single column. +# It's like a simple key/value store baked into your record when you don't care about being able to +# query that store outside the context of a single record. +# +# You can then declare accessors to this store that are then accessible just like any other attribute +# of the model. This is very helpful for easily exposing store keys to a form or elsewhere that's +# already built around just accessing attributes on the model. +# +# Every accessor comes with dirty tracking methods (+key_changed?+, +key_was+ and +key_change+) and +# methods to access the changes made during the last save (+saved_change_to_key?+, +saved_change_to_key+ and +# +key_before_last_save+). +# +# NOTE: There is no +key_will_change!+ method for accessors, use +store_will_change!+ instead. +# +# Make sure that you declare the database column used for the serialized store as a text, so there's +# plenty of room. +# +# You can set custom coder to encode/decode your serialized attributes to/from different formats. +# JSON, YAML, Marshal are supported out of the box. Generally it can be any wrapper that provides +load+ and +dump+. +# +# NOTE: If you are using structured database data types (e.g. PostgreSQL +hstore+/+json+, MySQL 5.7+ +# +json+, or SQLite 3.38+ +json+) there is no need for the serialization provided by {.store}[rdoc-ref:rdoc-ref:ClassMethods#store]. +# Simply use {.store_accessor}[rdoc-ref:ClassMethods#store_accessor] instead to generate +# the accessor methods. Be aware that these columns use a string keyed hash and do not allow access +# using a symbol. +# +# NOTE: The default validations with the exception of +uniqueness+ will work. +# For example, if you want to check for +uniqueness+ with +hstore+ you will +# need to use a custom validation to handle it. +# +# Examples: +# +# class User < ActiveRecord::Base +# store :settings, accessors: [ :color, :homepage ], coder: JSON +# store :parent, accessors: [ :name ], coder: JSON, prefix: true +# store :spouse, accessors: [ :name ], coder: JSON, prefix: :partner +# store :settings, accessors: [ :two_factor_auth ], suffix: true +# store :settings, accessors: [ :login_retry ], suffix: :config +# end +# +# u = User.new(color: 'black', homepage: '37signals.com', parent_name: 'Mary', partner_name: 'Lily') +# u.color # Accessor stored attribute +# u.parent_name # Accessor stored attribute with prefix +# u.partner_name # Accessor stored attribute with custom prefix +# u.two_factor_auth_settings # Accessor stored attribute with suffix +# u.login_retry_config # Accessor stored attribute with custom suffix +# u.settings[:country] = 'Denmark' # Any attribute, even if not specified with an accessor +# +# # There is no difference between strings and symbols for accessing custom attributes +# u.settings[:country] # => 'Denmark' +# u.settings['country'] # => 'Denmark' +# +# # Dirty tracking +# u.color = 'green' +# u.color_changed? # => true +# u.color_was # => 'black' +# u.color_change # => ['black', 'green'] +# +# # Add additional accessors to an existing store through store_accessor +# class SuperUser < User +# store_accessor :settings, :privileges, :servants +# store_accessor :parent, :birthday, prefix: true +# store_accessor :settings, :secret_question, suffix: :config +# end +# +# The stored attribute names can be retrieved using {.stored_attributes}[rdoc-ref:rdoc-ref:ClassMethods#stored_attributes]. +# +# User.stored_attributes[:settings] # => [:color, :homepage, :two_factor_auth, :login_retry] +# +# == Overwriting default accessors +# +# All stored values are automatically available through accessors on the Active Record +# object, but sometimes you want to specialize this behavior. This can be done by overwriting +# the default accessors (using the same name as the attribute) and calling super +# to actually change things. +# +# class Song < ActiveRecord::Base +# # Uses a stored integer to hold the volume adjustment of the song +# store :settings, accessors: [:volume_adjustment] +# +# def volume_adjustment=(decibels) +# super(decibels.to_i) +# end +# +# def volume_adjustment +# super.to_i +# end +# end +# +# pkg:gem/activerecord#lib/active_record/store.rb:96 +module ActiveRecord::Store + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Store::ClassMethods + + private + + # pkg:gem/activerecord#lib/active_record/store.rb:217 + def read_store_attribute(store_attribute, key); end + + # pkg:gem/activerecord#lib/active_record/store.rb:227 + def store_accessor_for(store_attribute); end + + # pkg:gem/activerecord#lib/active_record/store.rb:222 + def write_store_attribute(store_attribute, key, value); end +end + +# pkg:gem/activerecord#lib/active_record/store.rb:105 +module ActiveRecord::Store::ClassMethods + # pkg:gem/activerecord#lib/active_record/store.rb:199 + def _store_accessors_module; end + + # pkg:gem/activerecord#lib/active_record/store.rb:106 + def store(store_attribute, options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/store.rb:112 + def store_accessor(store_attribute, *keys, prefix: T.unsafe(nil), suffix: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/store.rb:207 + def stored_attributes; end +end + +# pkg:gem/activerecord#lib/active_record/store.rb:235 +class ActiveRecord::Store::HashAccessor + class << self + # pkg:gem/activerecord#lib/active_record/store.rb:236 + def get(store_object, key); end + + # pkg:gem/activerecord#lib/active_record/store.rb:252 + def prepare(object, attribute); end + + # pkg:gem/activerecord#lib/active_record/store.rb:242 + def read(object, attribute, key); end + + # pkg:gem/activerecord#lib/active_record/store.rb:247 + def write(object, attribute, key, value); end + end +end + +# pkg:gem/activerecord#lib/active_record/store.rb:291 +class ActiveRecord::Store::IndifferentCoder + # pkg:gem/activerecord#lib/active_record/store.rb:292 + def initialize(attr_name, coder_or_class_name); end + + # pkg:gem/activerecord#lib/active_record/store.rb:301 + def dump(obj); end + + # pkg:gem/activerecord#lib/active_record/store.rb:305 + def load(yaml); end + + private + + # pkg:gem/activerecord#lib/active_record/store.rb:321 + def as_regular_hash(obj); end + + class << self + # pkg:gem/activerecord#lib/active_record/store.rb:309 + def as_indifferent_hash(obj); end + end +end + +# pkg:gem/activerecord#lib/active_record/store.rb:278 +class ActiveRecord::Store::IndifferentHashAccessor < ::ActiveRecord::Store::HashAccessor + class << self + # pkg:gem/activerecord#lib/active_record/store.rb:279 + def prepare(object, attribute); end + end +end + +# pkg:gem/activerecord#lib/active_record/store.rb:264 +class ActiveRecord::Store::StringKeyedHashAccessor < ::ActiveRecord::Store::HashAccessor + class << self + # pkg:gem/activerecord#lib/active_record/store.rb:265 + def get(store_object, key); end + + # pkg:gem/activerecord#lib/active_record/store.rb:269 + def read(object, attribute, key); end + + # pkg:gem/activerecord#lib/active_record/store.rb:273 + def write(object, attribute, key, value); end + end +end + +# Raised on attempt to lazily load records that are marked as strict loading. +# +# You can resolve this error by eager loading marked records before accessing +# them. The +# {Eager Loading Associations}[https://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations] +# guide covers solutions, such as using +# {ActiveRecord::Base.includes}[rdoc-ref:QueryMethods#includes]. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:411 +class ActiveRecord::StrictLoadingViolationError < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/structured_event_subscriber.rb:6 +class ActiveRecord::StructuredEventSubscriber < ::ActiveSupport::StructuredEventSubscriber + # pkg:gem/activerecord#lib/active_record/structured_event_subscriber.rb:21 + def sql(event); end + + # pkg:gem/activerecord#lib/active_record/structured_event_subscriber.rb:9 + def strict_loading_violation(event); end + + private + + # pkg:gem/activerecord#lib/active_record/structured_event_subscriber.rb:79 + def filter(name, value); end + + # pkg:gem/activerecord#lib/active_record/structured_event_subscriber.rb:64 + def render_bind(attr, value); end + + # pkg:gem/activerecord#lib/active_record/structured_event_subscriber.rb:60 + def type_casted_binds(casted_binds); end + + class << self + private + + # pkg:gem/activerecord#lib/active_record/structured_event_subscriber.rb:19 + def __class_attr_debug_methods; end + + # pkg:gem/activerecord#lib/active_record/structured_event_subscriber.rb:19 + def __class_attr_debug_methods=(new_value); end + end +end + +# pkg:gem/activerecord#lib/active_record/structured_event_subscriber.rb:7 +ActiveRecord::StructuredEventSubscriber::IGNORE_PAYLOAD_NAMES = T.let(T.unsafe(nil), Array) + +# Raised when the single-table inheritance mechanism fails to locate the subclass +# (for example due to improper usage of column that +# {ActiveRecord::Base.inheritance_column}[rdoc-ref:ModelSchema.inheritance_column] +# points to). +# +# pkg:gem/activerecord#lib/active_record/errors.rb:17 +class ActiveRecord::SubclassNotFound < ::ActiveRecord::ActiveRecordError; end + +# = Active Record \Suppressor +# +# ActiveRecord::Suppressor prevents the receiver from being saved during +# a given block. +# +# For example, here's a pattern of creating notifications when new comments +# are posted. (The notification may in turn trigger an email, a push +# notification, or just appear in the UI somewhere): +# +# class Comment < ActiveRecord::Base +# belongs_to :commentable, polymorphic: true +# after_create -> { Notification.create! comment: self, +# recipients: commentable.recipients } +# end +# +# That's what you want the bulk of the time. New comment creates a new +# Notification. But there may well be off cases, like copying a commentable +# and its comments, where you don't want that. So you'd have a concern +# something like this: +# +# module Copyable +# def copy_to(destination) +# Notification.suppress do +# # Copy logic that creates new comments that we do not want +# # triggering notifications. +# end +# end +# end +# +# pkg:gem/activerecord#lib/active_record/suppressor.rb:32 +module ActiveRecord::Suppressor + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Suppressor::ClassMethods + + # pkg:gem/activerecord#lib/active_record/suppressor.rb:51 + def save(**); end + + # pkg:gem/activerecord#lib/active_record/suppressor.rb:55 + def save!(**); end + + class << self + # pkg:gem/activerecord#lib/active_record/suppressor.rb:36 + def registry; end + end +end + +# pkg:gem/activerecord#lib/active_record/suppressor.rb:41 +module ActiveRecord::Suppressor::ClassMethods + # pkg:gem/activerecord#lib/active_record/suppressor.rb:42 + def suppress(&block); end +end + +# pkg:gem/activerecord#lib/active_record/table_metadata.rb:4 +class ActiveRecord::TableMetadata + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:5 + def initialize(klass, arel_table); end + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:53 + def aggregated_with?(aggregation_name); end + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:63 + def arel_table; end + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:26 + def associated_table(table_name); end + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:22 + def associated_with(table_name); end + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:18 + def has_column?(column_name); end + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:55 + def predicate_builder; end + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:10 + def primary_key; end + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:50 + def reflect_on_aggregation(aggregation_name); end + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:14 + def type(column_name); end + + private + + # pkg:gem/activerecord#lib/active_record/table_metadata.rb:66 + def klass; end +end + +# Raised when a model makes a query but it has not specified an associated table. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:45 +class ActiveRecord::TableNotSpecified < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record.rb:174 +module ActiveRecord::Tasks + extend ::ActiveSupport::Autoload +end + +# pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:5 +class ActiveRecord::Tasks::AbstractTasks + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:10 + def initialize(db_config); end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:15 + def charset; end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:23 + def check_current_protected_environment!(db_config, migration_class); end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:19 + def collation; end + + private + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:41 + def configuration_hash; end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:51 + def configuration_hash_without_database; end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:43 + def connection; end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:41 + def db_config; end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:47 + def establish_connection(config = T.unsafe(nil)); end + + # The failed command is echoed back, so anything secret it was given has + # to be kept out of the message. + # + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:68 + def filter_sensitive_args(args); end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:55 + def run_cmd(cmd, *args, **opts); end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:59 + def run_cmd_error(cmd, args); end + + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:73 + def with_temporary_pool(db_config, migration_class, clobber: T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/active_record/tasks/abstract_tasks.rb:6 + def using_database_configurations?; end + end +end + +# pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:7 +class ActiveRecord::Tasks::DatabaseNotSupported < ::StandardError; end + +# = Active Record \DatabaseTasks +# +# ActiveRecord::Tasks::DatabaseTasks is a utility class, which encapsulates +# logic behind common tasks used to manage database and migrations. +# +# The tasks defined here are used with \Rails commands provided by Active Record. +# +# In order to use DatabaseTasks, a few config values need to be set. All the needed +# config values are set by \Rails already, so it's necessary to do it only if you +# want to change the defaults or when you want to use Active Record outside of \Rails +# (in such case after configuring the database tasks, you can also use the rake tasks +# defined in Active Record). +# +# The possible config values are: +# +# * +env+: current environment (like Rails.env). +# * +database_configuration+: configuration of your databases (as in +config/database.yml+). +# * +db_dir+: your +db+ directory. +# * +fixtures_path+: a path to fixtures directory. +# * +migrations_paths+: a list of paths to directories with migrations. +# * +seed_loader+: an object which will load seeds, it needs to respond to the +load_seed+ method. +# * +root+: a path to the root of the application. +# +# Example usage of DatabaseTasks outside \Rails could look as such: +# +# include ActiveRecord::Tasks +# DatabaseTasks.database_configuration = YAML.load_file('my_database_config.yml') +# DatabaseTasks.db_dir = 'db' +# # other settings... +# +# DatabaseTasks.create_current('production') +# +# pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:40 +module ActiveRecord::Tasks::DatabaseTasks + extend ::ActiveRecord::Tasks::DatabaseTasks + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:484 + def cache_dump_filename(db_config, schema_cache_path: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:330 + def charset(configuration, *arguments); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:325 + def charset_current(env_name = T.unsafe(nil), db_name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:65 + def check_protected_environments!(environment = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:498 + def check_schema_file(filename); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:315 + def check_target_version; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:524 + def clear_schema_cache(filename); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:340 + def collation(configuration, *arguments); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:335 + def collation_current(env_name = T.unsafe(nil), db_name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:115 + def create(configuration, *arguments); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:127 + def create_all; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:168 + def create_current(environment = T.unsafe(nil), name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:61 + def database_configuration; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:61 + def database_configuration=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:283 + def db_configs_with_versions(environment = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:83 + def db_dir; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:60 + def db_dir=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:208 + def drop(configuration, *arguments); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:220 + def drop_all; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:224 + def drop_current(environment = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:430 + def dump_all; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:443 + def dump_schema(db_config, format = T.unsafe(nil)); end + + # Dumps the schema cache in YAML format for the connection into the file + # + # ==== Examples + # ActiveRecord::Tasks::DatabaseTasks.dump_schema_cache(ActiveRecord::Base.lease_connection, "tmp/schema_dump.yaml") + # + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:520 + def dump_schema_cache(conn_or_pool, filename); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:103 + def env; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:60 + def env=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:91 + def fixtures_path; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:60 + def fixtures_path=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:141 + def for_each(databases); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:374 + def load_schema(db_config, format = T.unsafe(nil), file = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:490 + def load_schema_current(format = T.unsafe(nil), file = T.unsafe(nil), environment = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:506 + def load_seed; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:260 + def migrate(version = T.unsafe(nil), skip_initialize: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:241 + def migrate_all; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:300 + def migrate_status; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:545 + def migration_class; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:549 + def migration_connection; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:553 + def migration_connection_pool; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:87 + def migrations_paths; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:60 + def migrations_paths=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:107 + def name; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:174 + def prepare_all; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:345 + def purge(configuration); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:350 + def purge_all; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:354 + def purge_current(environment = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:154 + def raise_for_multi_db(environment = T.unsafe(nil), command:); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:412 + def reconstruct_from_schema(db_config, file = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:73 + def register_task(pattern, task); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:99 + def root; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:60 + def root=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:471 + def schema_dump_path(db_config, format = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:396 + def schema_up_to_date?(configuration, _ = T.unsafe(nil), file = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:111 + def seed_loader; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:60 + def seed_loader=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:135 + def setup_initial_database_yaml; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:360 + def structure_dump(configuration, *arguments); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:367 + def structure_load(configuration, *arguments); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:321 + def target_version; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:235 + def truncate_all(environment = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:539 + def with_temporary_connection(db_config, clobber: T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:528 + def with_temporary_pool_for_each(env: T.unsafe(nil), name: T.unsafe(nil), clobber: T.unsafe(nil), &block); end + + private + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:590 + def class_for_adapter(adapter); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:567 + def configs_for(**options); end + + # Create a new instance for the specified db configuration object + # For classes that have been converted to use db_config objects, pass a + # `DatabaseConfig`, otherwise pass a `Hash` + # + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:582 + def database_adapter_for(db_config, *arguments); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:598 + def each_current_configuration(environment, name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:608 + def each_current_environment(environment, &block); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:614 + def each_local_configuration; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:651 + def initialize_database(db_config); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:626 + def local_database?(db_config); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:571 + def resolve_configuration(configuration); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:631 + def schema_sha1(file); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:635 + def structure_dump_flags_for(adapter); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:643 + def structure_load_flags_for(adapter); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:228 + def truncate_tables(db_config); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:575 + def verbose?; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:558 + def with_temporary_pool(db_config, clobber: T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:50 + def structure_dump_flags; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:50 + def structure_dump_flags=(val); end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:56 + def structure_load_flags; end + + # pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:56 + def structure_load_flags=(val); end + end +end + +# pkg:gem/activerecord#lib/active_record/tasks/database_tasks.rb:63 +ActiveRecord::Tasks::DatabaseTasks::LOCAL_HOSTS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/active_record/tasks/mysql_database_tasks.rb:5 +class ActiveRecord::Tasks::MySQLDatabaseTasks < ::ActiveRecord::Tasks::AbstractTasks + # pkg:gem/activerecord#lib/active_record/tasks/mysql_database_tasks.rb:23 + def charset; end + + # pkg:gem/activerecord#lib/active_record/tasks/mysql_database_tasks.rb:6 + def create; end + + # pkg:gem/activerecord#lib/active_record/tasks/mysql_database_tasks.rb:12 + def drop; end + + # pkg:gem/activerecord#lib/active_record/tasks/mysql_database_tasks.rb:17 + def purge; end + + # pkg:gem/activerecord#lib/active_record/tasks/mysql_database_tasks.rb:27 + def structure_dump(filename, extra_flags); end + + # pkg:gem/activerecord#lib/active_record/tasks/mysql_database_tasks.rb:46 + def structure_load(filename, extra_flags); end + + private + + # pkg:gem/activerecord#lib/active_record/tasks/mysql_database_tasks.rb:56 + def creation_options; end + + # pkg:gem/activerecord#lib/active_record/tasks/mysql_database_tasks.rb:63 + def prepare_command_options; end +end + +# pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:7 +class ActiveRecord::Tasks::PostgreSQLDatabaseTasks < ::ActiveRecord::Tasks::AbstractTasks + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:12 + def create(connection_already_established = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:18 + def drop; end + + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:23 + def purge; end + + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:29 + def structure_dump(filename, extra_flags); end + + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:63 + def structure_load(filename, extra_flags); end + + private + + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:72 + def encoding; end + + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:80 + def psql_env; end + + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:76 + def public_schema_config; end + + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:97 + def remove_sql_header_comments(filename); end + + # pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:93 + def run_cmd(cmd, *args, **opts); end +end + +# pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:8 +ActiveRecord::Tasks::PostgreSQLDatabaseTasks::DEFAULT_ENCODING = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:9 +ActiveRecord::Tasks::PostgreSQLDatabaseTasks::ON_ERROR_STOP_1 = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/tasks/postgresql_database_tasks.rb:10 +ActiveRecord::Tasks::PostgreSQLDatabaseTasks::SQL_COMMENT_BEGIN = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:5 +class ActiveRecord::Tasks::SQLiteDatabaseTasks < ::ActiveRecord::Tasks::AbstractTasks + # pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:6 + def initialize(db_config, root = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:58 + def check_current_protected_environment!(db_config, migration_class); end + + # pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:11 + def create; end + + # pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:18 + def drop; end + + # pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:27 + def purge; end + + # pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:36 + def structure_dump(filename, extra_flags); end + + # pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:53 + def structure_load(filename, extra_flags); end + + private + + # pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:71 + def establish_connection(config = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/tasks/sqlite_database_tasks.rb:69 + def root; end +end + +# pkg:gem/activerecord#lib/active_record/test_databases.rb:6 +module ActiveRecord::TestDatabases + class << self + # pkg:gem/activerecord#lib/active_record/test_databases.rb:23 + def create_and_load_schema(i, env_name:); end + end +end + +# pkg:gem/activerecord#lib/active_record/test_fixtures.rb:6 +module ActiveRecord::TestFixtures + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::TestFixtures::ClassMethods + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:14 + def after_teardown; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:9 + def before_setup; end + + # Generic fixture accessor for fixture names that may conflict with other methods. + # + # assert_equal "Ruby on Rails", web_sites(:rubyonrails).name + # assert_equal "Ruby on Rails", fixture(:web_sites, :rubyonrails).name + # + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:118 + def fixture(fixture_set_name, *fixture_names); end + + private + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:334 + def access_fixture(fs_name, *fixture_names); end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:326 + def active_record_fixture(fixture_set_name, *fixture_names); end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:294 + def instantiate_fixtures; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:184 + def invalidate_already_loaded_fixtures; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:290 + def load_fixtures(config); end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:306 + def load_instances?; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:310 + def method_missing(method, *, **, &); end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:318 + def respond_to_missing?(method, include_private = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:123 + def run_in_transaction?; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:176 + def setup_asynchronous_queries_session; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:129 + def setup_fixtures(config = T.unsafe(nil)); end + + # Shares the writing connection pool with connections on + # other handlers. + # + # In an application with a primary and replica the test fixtures + # need to share a connection pool so that the reading connection + # can see data in the open transaction on the writing connection. + # + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:245 + def setup_shared_connection_pool; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:192 + def setup_transactional_fixtures; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:180 + def teardown_asynchronous_queries_session; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:162 + def teardown_fixtures; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:264 + def teardown_shared_connection_pool; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:227 + def teardown_transactional_fixtures; end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:188 + def transactional_tests_for_pool?(pool); end + + module GeneratedClassMethods + def database_transactions_config; end + def database_transactions_config=(value); end + def database_transactions_config?; end + def fixture_class_names; end + def fixture_class_names=(value); end + def fixture_class_names?; end + def fixture_paths; end + def fixture_paths=(value); end + def fixture_paths?; end + def fixture_sets; end + def fixture_sets=(value); end + def fixture_sets?; end + def fixture_table_names; end + def fixture_table_names=(value); end + def fixture_table_names?; end + def lock_threads; end + def lock_threads=(value); end + def lock_threads?; end + def pre_loaded_fixtures; end + def pre_loaded_fixtures=(value); end + def pre_loaded_fixtures?; end + def use_instantiated_fixtures; end + def use_instantiated_fixtures=(value); end + def use_instantiated_fixtures?; end + def use_transactional_tests; end + def use_transactional_tests=(value); end + def use_transactional_tests?; end + end + + module GeneratedInstanceMethods + def database_transactions_config; end + def database_transactions_config=(value); end + def database_transactions_config?; end + def fixture_class_names; end + def fixture_class_names=(value); end + def fixture_class_names?; end + def fixture_paths; end + def fixture_paths?; end + def fixture_sets; end + def fixture_sets=(value); end + def fixture_sets?; end + def fixture_table_names; end + def fixture_table_names=(value); end + def fixture_table_names?; end + def lock_threads; end + def lock_threads=(value); end + def lock_threads?; end + def pre_loaded_fixtures; end + def pre_loaded_fixtures=(value); end + def pre_loaded_fixtures?; end + def use_instantiated_fixtures; end + def use_instantiated_fixtures=(value); end + def use_instantiated_fixtures?; end + def use_transactional_tests; end + def use_transactional_tests=(value); end + def use_transactional_tests?; end + end +end + +# pkg:gem/activerecord#lib/active_record/test_fixtures.rb:44 +module ActiveRecord::TestFixtures::ClassMethods + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:71 + def fixtures(*fixture_set_names); end + + # Sets the model class for a fixture when the class name cannot be inferred from the fixture name. + # + # Examples: + # + # set_fixture_class some_fixture: SomeModel, + # 'namespaced/fixture' => Another::Model + # + # The keys must be the fixture names, that coincide with the short paths to the fixture files. + # + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:67 + def set_fixture_class(class_names = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:87 + def setup_fixture_accessors(fixture_set_names = T.unsafe(nil)); end + + # Do not use transactional tests for the given database. This overrides + # the default setting as defined by `use_transactional_tests`, which + # applies to all database connection pools not explicitly configured here. + # + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:48 + def skip_transactional_tests_for_database(database_name); end + + # Enable or disable transactions per database. This overrides the default + # setting as defined by `use_transactional_tests`, which applies to all + # database connection pools not explicitly configured here. + # + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:55 + def use_transactional_tests_for_database(database_name, enabled = T.unsafe(nil)); end + + # Prevents automatically wrapping each specified test in a transaction, + # to allow application logic transactions to be tested in a top-level + # (non-nested) context. + # + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:103 + def uses_transaction(*methods); end + + # pkg:gem/activerecord#lib/active_record/test_fixtures.rb:108 + def uses_transaction?(method); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:177 +class ActiveRecord::ThroughCantAssociateThroughHasOneOrManyReflection < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:178 + def initialize(owner = T.unsafe(nil), reflection = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/associations/errors.rb:224 +class ActiveRecord::ThroughNestedAssociationsAreReadonly < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/associations/errors.rb:225 + def initialize(owner = T.unsafe(nil), reflection = T.unsafe(nil)); end +end + +# = Active Record \Timestamp +# +# Active Record automatically timestamps create and update operations if the +# table has fields named created_at/created_on or +# updated_at/updated_on. +# +# Timestamping can be turned off by setting: +# +# config.active_record.record_timestamps = false +# +# Timestamps are in UTC by default but you can use the local timezone by setting: +# +# config.active_record.default_timezone = :local +# +# == Time Zone aware attributes +# +# Active Record keeps all the datetime and time columns +# timezone aware. By default, these values are stored in the database as UTC +# and converted back to the current Time.zone when pulled from the database. +# +# This feature can be turned off completely by setting: +# +# config.active_record.time_zone_aware_attributes = false +# +# You can also specify that only datetime columns should be time-zone +# aware (while time should not) by setting: +# +# ActiveRecord::Base.time_zone_aware_types = [:datetime] +# +# You can also add database-specific timezone aware types. For example, for PostgreSQL: +# +# ActiveRecord::Base.time_zone_aware_types += [:tsrange, :tstzrange] +# +# Finally, you can indicate specific attributes of a model for which time zone +# conversion should not applied, for instance by setting: +# +# class Topic < ActiveRecord::Base +# self.skip_time_zone_conversion_for_attributes = [:written_on] +# end +# +# pkg:gem/activerecord#lib/active_record/timestamp.rb:43 +module ActiveRecord::Timestamp + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::Timestamp::ClassMethods + + private + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:107 + def _create_record; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:119 + def _update_record; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:155 + def all_timestamp_attributes_in_model; end + + # Clear attributes and changed_attributes + # + # pkg:gem/activerecord#lib/active_record/timestamp.rb:170 + def clear_timestamp_attributes; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:125 + def create_or_update(touch: T.unsafe(nil), **); end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:159 + def current_time_from_proper_timezone; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:102 + def init_internals; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:50 + def initialize_dup(other); end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:163 + def max_updated_column_timestamp; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:130 + def record_update_timestamps; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:143 + def should_record_timestamps?; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:147 + def timestamp_attributes_for_create_in_model; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:151 + def timestamp_attributes_for_update_in_model; end + + module GeneratedClassMethods + def record_timestamps; end + def record_timestamps=(value); end + def record_timestamps?; end + end + + module GeneratedInstanceMethods + def record_timestamps; end + def record_timestamps=(value); end + def record_timestamps?; end + end +end + +# pkg:gem/activerecord#lib/active_record/timestamp.rb:55 +module ActiveRecord::Timestamp::ClassMethods + # pkg:gem/activerecord#lib/active_record/timestamp.rb:74 + def all_timestamp_attributes_in_model; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:79 + def current_time_from_proper_timezone; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:64 + def timestamp_attributes_for_create_in_model; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:69 + def timestamp_attributes_for_update_in_model; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:56 + def touch_attributes_with_time(*names, time: T.unsafe(nil)); end + + protected + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:84 + def reload_schema_from_cache(recursive = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:92 + def timestamp_attributes_for_create; end + + # pkg:gem/activerecord#lib/active_record/timestamp.rb:96 + def timestamp_attributes_for_update; end +end + +# pkg:gem/activerecord#lib/active_record/token_for.rb:6 +module ActiveRecord::TokenFor + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveRecord::TokenFor::ClassMethods + + # Generates a token for a predefined +purpose+. + # + # Use ClassMethods#generates_token_for to define a token purpose and + # behavior. + # + # pkg:gem/activerecord#lib/active_record/token_for.rb:119 + def generate_token_for(purpose); end + + module GeneratedClassMethods + def generated_token_verifier; end + def generated_token_verifier=(value); end + def token_definitions; end + def token_definitions=(value); end + end + + module GeneratedInstanceMethods; end +end + +# pkg:gem/activerecord#lib/active_record/token_for.rb:56 +module ActiveRecord::TokenFor::ClassMethods + # pkg:gem/activerecord#lib/active_record/token_for.rb:106 + def find_by_token_for(purpose, token); end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:110 + def find_by_token_for!(purpose, token); end + + # Defines the behavior of tokens generated for a specific +purpose+. + # A token can be generated by calling TokenFor#generate_token_for on a + # record. Later, that record can be fetched by calling #find_by_token_for + # (or #find_by_token_for!) with the same purpose and token. + # + # Tokens are signed so that they are tamper-proof. Thus they can be + # exposed to outside world as, for example, password reset tokens. + # + # By default, tokens do not expire. They can be configured to expire by + # specifying a duration via the +expires_in+ option. The duration becomes + # part of the token's signature, so changing the value of +expires_in+ + # will automatically invalidate previously generated tokens. + # + # A block may also be specified. When generating a token with + # TokenFor#generate_token_for, the block will be evaluated in the context + # of the record, and its return value will be embedded in the token as + # JSON. Later, when fetching the record with #find_by_token_for, the block + # will be evaluated again in the context of the fetched record. If the two + # JSON values do not match, the token will be treated as invalid. Note + # that the value returned by the block should not contain sensitive + # information because it will be embedded in the token as + # human-readable plaintext JSON. + # + # ==== Examples + # + # class User < ActiveRecord::Base + # has_secure_password + # + # generates_token_for :password_reset, expires_in: 15.minutes do + # # Last 10 characters of password salt, which changes when password is updated: + # password_salt&.last(10) + # end + # end + # + # user = User.first + # + # token = user.generate_token_for(:password_reset) + # User.find_by_token_for(:password_reset, token) # => user + # # 16 minutes later... + # User.find_by_token_for(:password_reset, token) # => nil + # + # token = user.generate_token_for(:password_reset) + # User.find_by_token_for(:password_reset, token) # => user + # user.update!(password: "new password") + # User.find_by_token_for(:password_reset, token) # => nil + # + # pkg:gem/activerecord#lib/active_record/token_for.rb:102 + def generates_token_for(purpose, expires_in: T.unsafe(nil), &block); end +end + +# pkg:gem/activerecord#lib/active_record/token_for.rb:38 +module ActiveRecord::TokenFor::RelationMethods + # Finds a record using a given +token+ for a predefined +purpose+. Returns + # +nil+ if the token is invalid or the record was not found. + # + # pkg:gem/activerecord#lib/active_record/token_for.rb:41 + def find_by_token_for(purpose, token); end + + # Finds a record using a given +token+ for a predefined +purpose+. Raises + # ActiveSupport::MessageVerifier::InvalidSignature if the token is invalid + # (e.g. expired, bad format, etc). Raises ActiveRecord::RecordNotFound if + # the token is valid but the record was not found. + # + # pkg:gem/activerecord#lib/active_record/token_for.rb:50 + def find_by_token_for!(purpose, token); end +end + +# pkg:gem/activerecord#lib/active_record/token_for.rb:14 +class ActiveRecord::TokenFor::TokenDefinition < ::Struct + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def block; end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def block=(_); end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def defining_class; end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def defining_class=(_); end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def expires_in; end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def expires_in=(_); end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:15 + def full_purpose; end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:27 + def generate_token(model); end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:19 + def message_verifier; end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:23 + def payload_for(model); end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def purpose; end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def purpose=(_); end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:31 + def resolve_token(token); end + + class << self + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def [](*_arg0); end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def keyword_init?; end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def members; end + + # pkg:gem/activerecord#lib/active_record/token_for.rb:14 + def new(*_arg0); end + end +end + +# = Active Record Touch Later +# +# pkg:gem/activerecord#lib/active_record/touch_later.rb:5 +module ActiveRecord::TouchLater + # pkg:gem/activerecord#lib/active_record/touch_later.rb:6 + def before_committed!; end + + # pkg:gem/activerecord#lib/active_record/touch_later.rb:38 + def touch(*names, time: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/touch_later.rb:11 + def touch_later(*names); end + + private + + # pkg:gem/activerecord#lib/active_record/touch_later.rb:66 + def has_defer_touch_attrs?; end + + # pkg:gem/activerecord#lib/active_record/touch_later.rb:49 + def init_internals; end + + # pkg:gem/activerecord#lib/active_record/touch_later.rb:54 + def surreptitiously_touch(attr_names); end + + # pkg:gem/activerecord#lib/active_record/touch_later.rb:61 + def touch_deferred_attributes; end +end + +# Class specifies the interface to interact with the current transaction state. +# +# It can either map to an actual transaction/savepoint, or represent the +# absence of a transaction. +# +# == State +# +# We say that a transaction is _finalized_ when it wraps a real transaction +# that has been either committed or rolled back. +# +# A transaction is _open_ if it wraps a real transaction that is not finalized. +# +# On the other hand, a transaction is _closed_ when it is not open. That is, +# when it represents absence of transaction, or it wraps a real but finalized +# one. +# +# You can check whether a transaction is open or closed with the +open?+ and +# +closed?+ predicates: +# +# if Article.current_transaction.open? +# # We are inside a real and not finalized transaction. +# end +# +# Closed transactions are +blank?+ too. +# +# == Callbacks +# +# After updating the database state, you may sometimes need to perform some extra work, or reflect these +# changes in a remote system like clearing or updating a cache: +# +# def publish_article(article) +# article.update!(published: true) +# NotificationService.article_published(article) +# end +# +# The above code works but has one important flaw, which is that it no longer works properly if called inside +# a transaction, as it will interact with the remote system before the changes are persisted: +# +# Article.transaction do +# article = create_article(article) +# publish_article(article) +# end +# +# The callbacks offered by ActiveRecord::Transaction allow to rewriting this method in a way that is compatible +# with transactions: +# +# def publish_article(article) +# article.update!(published: true) +# Article.current_transaction.after_commit do +# NotificationService.article_published(article) +# end +# end +# +# In the above example, if +publish_article+ is called inside a transaction, the callback will be invoked +# after the transaction is successfully committed, and if called outside a transaction, the callback will be invoked +# immediately. +# +# == Caveats +# +# When using after_commit callbacks, it is important to note that if the callback raises an error, the transaction +# won't be rolled back as it was already committed. Relying solely on these to synchronize state between multiple +# systems may lead to consistency issues. +# +# pkg:gem/activerecord#lib/active_record/transaction.rb:68 +class ActiveRecord::Transaction + # pkg:gem/activerecord#lib/active_record/transaction.rb:69 + def initialize(internal_transaction); end + + # Registers a block to be called after the transaction is fully committed. + # + # If there is no currently open transactions, the block is called + # immediately, unless the transaction is finalized, in which case attempting + # to register the callback raises ActiveRecord::ActiveRecordError. + # + # If the transaction has a parent transaction, the callback is transferred to + # the parent when the current transaction commits, or dropped when the current transaction + # is rolled back. This operation is repeated until the outermost transaction is reached. + # + # If the callback raises an error, the transaction remains committed. + # + # pkg:gem/activerecord#lib/active_record/transaction.rb:85 + def after_commit(&block); end + + # Registers a block to be called after the transaction is rolled back. + # + # If there is no currently open transactions, the block is not called. But + # if the transaction is finalized, attempting to register the callback + # raises ActiveRecord::ActiveRecordError. + # + # If the transaction is successfully committed but has a parent + # transaction, the callback is automatically added to the parent transaction. + # + # If the entire chain of nested transactions are all successfully committed, + # the block is never called. + # + # pkg:gem/activerecord#lib/active_record/transaction.rb:104 + def after_rollback(&block); end + + # pkg:gem/activerecord#lib/active_record/transaction.rb:118 + def blank?; end + + # Returns true if the transaction doesn't exist or is finalized. + # + # pkg:gem/activerecord#lib/active_record/transaction.rb:114 + def closed?; end + + # Returns true if the transaction exists and isn't finalized yet. + # + # pkg:gem/activerecord#lib/active_record/transaction.rb:109 + def open?; end + + # Returns a UUID for this transaction or +nil+ if no transaction is open. + # + # pkg:gem/activerecord#lib/active_record/transaction.rb:121 + def uuid; end +end + +# pkg:gem/activerecord#lib/active_record/transaction.rb:127 +ActiveRecord::Transaction::NULL_TRANSACTION = T.let(T.unsafe(nil), ActiveRecord::Transaction) + +# TransactionIsolationError will be raised under the following conditions: +# +# * The adapter does not support setting the isolation level +# * You are joining an existing open transaction +# * You are creating a nested (savepoint) transaction +# +# The mysql2, trilogy, and postgresql adapters support setting the transaction isolation level. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:516 +class ActiveRecord::TransactionIsolationError < ::ActiveRecord::ActiveRecordError; end + +# TransactionRollbackError will be raised when a transaction is rolled +# back by the database due to a serialization failure or a deadlock. +# +# These exceptions should not be generally rescued in nested transaction +# blocks, because they have side-effects in the actual enclosing transaction +# and internal Active Record state. They can be rescued if you are above the +# root transaction block, though. +# +# In that case, beware of transactional tests, however, because they run test +# cases in their own umbrella transaction. If you absolutely need to handle +# these exceptions in tests please consider disabling transactional tests in +# the affected test class (self.use_transactional_tests = false). +# +# Due to the aforementioned side-effects, this exception should not be raised +# manually by users. +# +# See the following: +# +# * https://www.postgresql.org/docs/current/static/transaction-iso.html +# * https://dev.mysql.com/doc/mysql-errors/en/server-error-reference.html#error_er_lock_deadlock +# +# pkg:gem/activerecord#lib/active_record/errors.rb:539 +class ActiveRecord::TransactionRollbackError < ::ActiveRecord::StatementInvalid; end + +# See ActiveRecord::Transactions::ClassMethods for documentation. +# +# pkg:gem/activerecord#lib/active_record/transactions.rb:5 +module ActiveRecord::Transactions + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Transactions::ClassMethods + + # pkg:gem/activerecord#lib/active_record/transactions.rb:16 + def _last_transaction_return_status; end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:16 + def _last_transaction_return_status=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:16 + def _new_record_before_last_commit; end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:16 + def _new_record_before_last_commit=(_arg0); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:395 + def before_committed!; end + + # Call the #after_commit callbacks. + # + # Ensure that it is not called if the object was never persisted (failed create), + # but call it after the commit of a destroyed object. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:403 + def committed!(should_run_callbacks: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:379 + def destroy; end + + # Call the #after_rollback callbacks. The +force_restore_state+ argument indicates if the record + # state should be rolled back to the beginning or just to the last savepoint. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:415 + def rolledback!(force_restore_state: T.unsafe(nil), should_run_callbacks: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:383 + def save(**); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:387 + def save!(**); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:391 + def touch(*, **); end + + # See ActiveRecord::Transactions::ClassMethods for detailed documentation. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:375 + def transaction(**options, &block); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:450 + def trigger_transactional_callbacks?; end + + # Executes a block within a transaction and captures its return value as a + # status flag. If the status is true, the transaction is committed, + # otherwise a ROLLBACK is issued. In any case, the status flag is returned. + # + # This method is available within the context of an ActiveRecord::Base + # instance. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:431 + def with_transaction_returning_status; end + + private + + # pkg:gem/activerecord#lib/active_record/transactions.rb:456 + def _committed_already_called; end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:456 + def _trigger_destroy_callback; end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:456 + def _trigger_update_callback; end + + # Add the record to the current transaction so that the #after_rollback and #after_commit + # callbacks can be called. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:539 + def add_to_transaction(ensure_finalize = T.unsafe(nil)); end + + # Clear the new record state and id of a record. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:487 + def clear_transaction_record_state; end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:545 + def has_transactional_callbacks?; end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:458 + def init_internals; end + + # Save the new record state and id of a record so it can be restored later if a transaction fails. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:467 + def remember_transaction_record_state; end + + # Restore the new record state and id of a record that was previously saved by a call to save_record_state. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:494 + def restore_transaction_record_state(force_restore_state = T.unsafe(nil)); end + + # Determine if a transaction included an action for :create, :update, or :destroy. Used in filtering callbacks. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:524 + def transaction_include_any_action?(actions); end +end + +# pkg:gem/activerecord#lib/active_record/transactions.rb:8 +ActiveRecord::Transactions::ACTIONS = T.let(T.unsafe(nil), Array) + +# = Active Record \Transactions +# +# \Transactions are protective blocks where SQL statements are only permanent +# if they can all succeed as one atomic action. The classic example is a +# transfer between two accounts where you can only have a deposit if the +# withdrawal succeeded and vice versa. \Transactions enforce the integrity of +# the database and guard the data against program errors or database +# break-downs. So basically you should use transaction blocks whenever you +# have a number of statements that must be executed together or not at all. +# +# For example: +# +# ActiveRecord::Base.transaction do +# david.withdrawal(100) +# mary.deposit(100) +# end +# +# This example will only take money from David and give it to Mary if neither +# +withdrawal+ nor +deposit+ raise an exception. Exceptions will force a +# ROLLBACK that returns the database to the state before the transaction +# began. Be aware, though, that the objects will _not_ have their instance +# data returned to their pre-transactional state. +# +# == Different Active Record classes in a single transaction +# +# Though the #transaction class method is called on some Active Record class, +# the objects within the transaction block need not all be instances of +# that class. This is because transactions are per-database connection, not +# per-model. +# +# In this example a +balance+ record is transactionally saved even +# though #transaction is called on the +Account+ class: +# +# Account.transaction do +# balance.save! +# account.save! +# end +# +# The #transaction method is also available as a model instance method. +# For example, you can also do this: +# +# balance.transaction do +# balance.save! +# account.save! +# end +# +# == Transactions are not distributed across database connections +# +# A transaction acts on a single database connection. If you have +# multiple class-specific databases, the transaction will not protect +# interaction among them. One workaround is to begin a transaction +# on each class whose models you alter: +# +# Student.transaction do +# Course.transaction do +# course.enroll(student) +# student.units += course.units +# end +# end +# +# This is a poor solution, but fully distributed transactions are beyond +# the scope of Active Record. +# +# == +save+ and +destroy+ are automatically wrapped in a transaction +# +# Both {#save}[rdoc-ref:Persistence#save] and +# {#destroy}[rdoc-ref:Persistence#destroy] come wrapped in a transaction that ensures +# that whatever you do in validations or callbacks will happen under its +# protected cover. So you can use validations to check for values that +# the transaction depends on or you can raise exceptions in the callbacks +# to rollback, including after_* callbacks. +# +# As a consequence changes to the database are not seen outside your connection +# until the operation is complete. For example, if you try to update the index +# of a search engine in +after_save+ the indexer won't see the updated record. +# The #after_commit callback is the only one that is triggered once the update +# is committed. See below. +# +# == Exception handling and rolling back +# +# Also have in mind that exceptions thrown within a transaction block will +# be propagated (after triggering the ROLLBACK), so you should be ready to +# catch those in your application code. +# +# One exception is the ActiveRecord::Rollback exception, which will trigger +# a ROLLBACK when raised, but not be re-raised by the transaction block. Any +# other exception will be re-raised. +# +# *Warning*: one should not catch ActiveRecord::StatementInvalid exceptions +# inside a transaction block. ActiveRecord::StatementInvalid exceptions indicate that an +# error occurred at the database level, for example when a unique constraint +# is violated. On some database systems, such as PostgreSQL, database errors +# inside a transaction cause the entire transaction to become unusable +# until it's restarted from the beginning. Here is an example which +# demonstrates the problem: +# +# # Suppose that we have a Number model with a unique column called 'i'. +# Number.transaction do +# Number.create(i: 0) +# begin +# # This will raise a unique constraint error... +# Number.create(i: 0) +# rescue ActiveRecord::StatementInvalid +# # ...which we ignore. +# end +# +# # On PostgreSQL, the transaction is now unusable. The following +# # statement will cause a PostgreSQL error, even though the unique +# # constraint is no longer violated: +# Number.create(i: 1) +# # => "PG::Error: ERROR: current transaction is aborted, commands +# # ignored until end of transaction block" +# end +# +# One should restart the entire transaction if an +# ActiveRecord::StatementInvalid occurred. +# +# == Nested transactions +# +# #transaction calls can be nested. By default, this makes all database +# statements in the nested transaction block become part of the parent +# transaction. For example, the following behavior may be surprising: +# +# User.transaction do +# User.create(username: 'Kotori') +# User.transaction do +# User.create(username: 'Nemu') +# raise ActiveRecord::Rollback +# end +# end +# +# creates both "Kotori" and "Nemu". Reason is the ActiveRecord::Rollback +# exception in the nested block does not issue a ROLLBACK. Since these exceptions +# are captured in transaction blocks, the parent block does not see it and the +# real transaction is committed. +# +# In order to get a ROLLBACK for the nested transaction you may ask for a real +# sub-transaction by passing requires_new: true. If anything goes wrong, +# the database rolls back to the beginning of the sub-transaction without rolling +# back the parent transaction. If we add it to the previous example: +# +# User.transaction do +# User.create(username: 'Kotori') +# User.transaction(requires_new: true) do +# User.create(username: 'Nemu') +# raise ActiveRecord::Rollback +# end +# end +# +# only "Kotori" is created. +# +# Most databases don't support true nested transactions. At the time of +# writing, the only database that we're aware of that supports true nested +# transactions, is MS-SQL. Because of this, Active Record emulates nested +# transactions by using savepoints. See +# https://dev.mysql.com/doc/refman/en/savepoint.html +# for more information about savepoints. +# +# === \Callbacks +# +# There are two types of callbacks associated with committing and rolling back transactions: +# #after_commit and #after_rollback. +# +# #after_commit callbacks are called on every record saved or destroyed within a +# transaction immediately after the transaction is committed. #after_rollback callbacks +# are called on every record saved or destroyed within a transaction immediately after the +# transaction or savepoint is rolled back. +# +# These callbacks are useful for interacting with other systems since you will be guaranteed +# that the callback is only executed when the database is in a permanent state. For example, +# #after_commit is a good spot to put in a hook to clearing a cache since clearing it from +# within a transaction could trigger the cache to be regenerated before the database is updated. +# +# ==== NOTE: Callbacks are deduplicated per callback by filter. +# +# Trying to define multiple callbacks with the same filter will result in a single callback being run. +# +# For example: +# +# after_commit :do_something +# after_commit :do_something # only the last one will be called +# +# This applies to all variations of after_*_commit callbacks as well. +# +# after_commit :do_something +# after_create_commit :do_something +# after_save_commit :do_something +# +# It is recommended to use the +on:+ option to specify when the callback should be run. +# +# after_commit :do_something, on: [:create, :update] +# +# This is equivalent to using +after_create_commit+ and +after_update_commit+, but will not be deduplicated. +# +# === Caveats +# +# If you're on MySQL, then do not use Data Definition Language (DDL) operations in nested +# transactions blocks that are emulated with savepoints. That is, do not execute statements +# like 'CREATE TABLE' inside such blocks. This is because MySQL automatically +# releases all savepoints upon executing a DDL operation. When +transaction+ +# is finished and tries to release the savepoint it created earlier, a +# database error will occur because the savepoint has already been +# automatically released. The following example demonstrates the problem: +# +# Model.transaction do # BEGIN +# Model.transaction(requires_new: true) do # CREATE SAVEPOINT active_record_1 +# Model.lease_connection.create_table(...) # active_record_1 now automatically released +# end # RELEASE SAVEPOINT active_record_1 +# end # ^^^^ BOOM! database error! +# +# Note that "TRUNCATE" is also a MySQL DDL statement! +# +# pkg:gem/activerecord#lib/active_record/transactions.rb:229 +module ActiveRecord::Transactions::ClassMethods + # This callback is called after a record has been created, updated, or destroyed. + # + # You can specify that the callback should only be fired by a certain action with + # the +:on+ option: + # + # after_commit :do_foo, on: :create + # after_commit :do_bar, on: :update + # after_commit :do_baz, on: :destroy + # + # after_commit :do_foo_bar, on: [:create, :update] + # after_commit :do_bar_baz, on: [:update, :destroy] + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:285 + def after_commit(*args, &block); end + + # Shortcut for after_commit :hook, on: :create. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:297 + def after_create_commit(*args, &block); end + + # Shortcut for after_commit :hook, on: :destroy. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:309 + def after_destroy_commit(*args, &block); end + + # This callback is called after a create, update, or destroy are rolled back. + # + # Please check the documentation of #after_commit for options. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:317 + def after_rollback(*args, &block); end + + # Shortcut for after_commit :hook, on: [ :create, :update ]. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:291 + def after_save_commit(*args, &block); end + + # Shortcut for after_commit :hook, on: :update. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:303 + def after_update_commit(*args, &block); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:268 + def before_commit(*args, &block); end + + # Returns a representation of the current transaction state, + # which can be a top level transaction, a savepoint, or the absence of a transaction. + # + # An object is always returned, whether or not a transaction is currently active. + # To check if a transaction was opened, use current_transaction.open?. + # + # See the ActiveRecord::Transaction documentation for detailed behavior. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:264 + def current_transaction; end + + # Returns the default isolation level for the connection pool, set earlier by #with_pool_transaction_isolation_level. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:253 + def pool_transaction_isolation_level; end + + # Similar to ActiveSupport::Callbacks::ClassMethods#set_callback, but with + # support for options available on #after_commit and #after_rollback callbacks. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:324 + def set_callback(name, *filter_list, &block); end + + # See the ConnectionAdapters::DatabaseStatements#transaction API docs. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:231 + def transaction(**options, &block); end + + # Makes all transactions the current pool use the isolation level initiated within the block. + # + # pkg:gem/activerecord#lib/active_record/transactions.rb:240 + def with_pool_transaction_isolation_level(isolation_level, &block); end + + private + + # pkg:gem/activerecord#lib/active_record/transactions.rb:367 + def assert_valid_transaction_action(actions); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:359 + def enforced_prepend_option(position, options); end + + # pkg:gem/activerecord#lib/active_record/transactions.rb:342 + def set_options_for_callbacks!(position, args, enforced_options = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/active_record/translation.rb:4 +module ActiveRecord::Translation + # Set the i18n scope to override ActiveModel. + # + # pkg:gem/activerecord#lib/active_record/translation.rb:18 + def i18n_scope; end + + # Set the lookup ancestors for ActiveModel. + # + # pkg:gem/activerecord#lib/active_record/translation.rb:6 + def lookup_ancestors; end +end + +# :stopdoc: +# +# pkg:gem/activerecord#lib/active_record/type/internal/timezone.rb:4 +module ActiveRecord::Type + class << self + # pkg:gem/activerecord#lib/active_record/type.rb:49 + def adapter_name_from(model); end + + # pkg:gem/activerecord#lib/active_record/type.rb:27 + def add_modifier(*, **, &); end + + # pkg:gem/activerecord#lib/active_record/type.rb:45 + def default_value; end + + # pkg:gem/activerecord#lib/active_record/type.rb:41 + def lookup(*args, adapter: T.unsafe(nil), **kwargs); end + + # Add a new type to the registry, allowing it to be referenced as a + # symbol by {ActiveRecord::Base.attribute}[rdoc-ref:Attributes::ClassMethods#attribute]. + # If your type is only meant to be used with a specific database adapter, you can + # do so by passing adapter: :postgresql. If your type has the same + # name as a native type for the current adapter, an exception will be + # raised unless you specify an +:override+ option. override: true will + # cause your type to be used instead of the native type. override: + # false will cause the native type to be used over yours if one exists. + # + # pkg:gem/activerecord#lib/active_record/type.rb:37 + def register(type_name, klass = T.unsafe(nil), **options, &block); end + + # pkg:gem/activerecord#lib/active_record/type.rb:26 + def registry; end + + # pkg:gem/activerecord#lib/active_record/type.rb:26 + def registry=(_arg0); end + + private + + # pkg:gem/activerecord#lib/active_record/type.rb:54 + def current_adapter_name; end + end +end + +# pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:6 +class ActiveRecord::Type::AdapterSpecificRegistry + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:7 + def initialize; end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:15 + def add_modifier(options, klass, **args); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:27 + def lookup(symbol, *args, **kwargs); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:19 + def register(type_name, klass = T.unsafe(nil), **options, &block); end + + private + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:40 + def find_registration(symbol, *args, **kwargs); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:11 + def initialize_copy(other); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:38 + def registrations; end +end + +# pkg:gem/activerecord#lib/active_record/type.rb:59 +ActiveRecord::Type::BigInteger = ActiveModel::Type::BigInteger + +# pkg:gem/activerecord#lib/active_record/type.rb:60 +ActiveRecord::Type::Binary = ActiveModel::Type::Binary + +# pkg:gem/activerecord#lib/active_record/type.rb:61 +ActiveRecord::Type::Boolean = ActiveModel::Type::Boolean + +# pkg:gem/activerecord#lib/active_record/type/date.rb:5 +class ActiveRecord::Type::Date < ::ActiveModel::Type::Date + include ::ActiveRecord::Type::Internal::Timezone +end + +# pkg:gem/activerecord#lib/active_record/type/date_time.rb:5 +class ActiveRecord::Type::DateTime < ::ActiveModel::Type::DateTime + include ::ActiveRecord::Type::Internal::Timezone +end + +# pkg:gem/activerecord#lib/active_record/type.rb:62 +ActiveRecord::Type::Decimal = ActiveModel::Type::Decimal + +# pkg:gem/activerecord#lib/active_record/type/decimal_without_scale.rb:5 +class ActiveRecord::Type::DecimalWithoutScale < ::ActiveModel::Type::BigInteger + # pkg:gem/activerecord#lib/active_record/type/decimal_without_scale.rb:6 + def type; end + + # pkg:gem/activerecord#lib/active_record/type/decimal_without_scale.rb:10 + def type_cast_for_schema(value); end +end + +# pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:110 +class ActiveRecord::Type::DecorationRegistration < ::ActiveRecord::Type::Registration + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:111 + def initialize(options, klass, adapter: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:117 + def call(registry, *args, **kwargs); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:122 + def matches?(*args, **kwargs); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:126 + def priority; end + + private + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:131 + def klass; end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:133 + def matches_options?(**kwargs); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:131 + def options; end +end + +# pkg:gem/activerecord#lib/active_record/type.rb:63 +ActiveRecord::Type::Float = ActiveModel::Type::Float + +# pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:5 +class ActiveRecord::Type::HashLookupTypeMap + # pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:6 + def initialize(parent = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:40 + def alias_type(type, alias_type); end + + # pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:35 + def clear; end + + # pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:17 + def fetch(lookup_key, *args, &block); end + + # pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:44 + def key?(key); end + + # pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:48 + def keys; end + + # pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:13 + def lookup(lookup_key, *args); end + + # pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:23 + def register_type(key, value = T.unsafe(nil), &block); end + + private + + # pkg:gem/activerecord#lib/active_record/type/hash_lookup_type_map.rb:53 + def perform_fetch(type, *args, &block); end +end + +# pkg:gem/activerecord#lib/active_record/type.rb:65 +ActiveRecord::Type::ImmutableString = ActiveModel::Type::ImmutableString + +# pkg:gem/activerecord#lib/active_record/type.rb:64 +ActiveRecord::Type::Integer = ActiveModel::Type::Integer + +# pkg:gem/activerecord#lib/active_record/type/internal/timezone.rb:5 +module ActiveRecord::Type::Internal; end + +# pkg:gem/activerecord#lib/active_record/type/internal/timezone.rb:6 +module ActiveRecord::Type::Internal::Timezone + # pkg:gem/activerecord#lib/active_record/type/internal/timezone.rb:7 + def initialize(timezone: T.unsafe(nil), **kwargs); end + + # pkg:gem/activerecord#lib/active_record/type/internal/timezone.rb:20 + def ==(other); end + + # pkg:gem/activerecord#lib/active_record/type/internal/timezone.rb:16 + def default_timezone; end + + # pkg:gem/activerecord#lib/active_record/type/internal/timezone.rb:12 + def is_utc?; end + + protected + + # pkg:gem/activerecord#lib/active_record/type/internal/timezone.rb:25 + def timezone; end +end + +# pkg:gem/activerecord#lib/active_record/type/json.rb:7 +class ActiveRecord::Type::Json < ::ActiveModel::Type::Value + include ::ActiveModel::Type::Helpers::Mutable + + # pkg:gem/activerecord#lib/active_record/type/json.rb:36 + def accessor; end + + # pkg:gem/activerecord#lib/active_record/type/json.rb:32 + def changed_in_place?(raw_old_value, new_value); end + + # pkg:gem/activerecord#lib/active_record/type/json.rb:14 + def deserialize(value); end + + # pkg:gem/activerecord#lib/active_record/type/json.rb:28 + def serialize(value); end + + # pkg:gem/activerecord#lib/active_record/type/json.rb:10 + def type; end +end + +# pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:47 +class ActiveRecord::Type::Registration + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:48 + def initialize(name, block, adapter: T.unsafe(nil), override: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:63 + def <=>(other); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:55 + def call(_registry, *args, adapter: T.unsafe(nil), **kwargs); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:59 + def matches?(type_name, *args, **kwargs); end + + protected + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:73 + def adapter; end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:73 + def block; end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:73 + def name; end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:73 + def override; end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:75 + def priority; end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:86 + def priority_except_adapter; end + + private + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:95 + def conflicts_with?(other); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:104 + def has_adapter_conflict?(other); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:91 + def matches_adapter?(adapter: T.unsafe(nil), **); end + + # pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:100 + def same_priority_except_adapter?(other); end +end + +# pkg:gem/activerecord#lib/active_record/type/serialized.rb:5 +class ActiveRecord::Type::Serialized + include ::ActiveModel::Type::Helpers::Mutable + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:12 + def initialize(subtype, coder, comparable: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:49 + def accessor; end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:53 + def assert_valid_value(value); end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:36 + def changed_in_place?(raw_old_value, value); end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:10 + def coder; end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:19 + def deserialize(value); end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:59 + def force_equality?(value); end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:34 + def inspect; end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:27 + def serialize(value); end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:63 + def serialized?; end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:10 + def subtype; end + + private + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:73 + def default_value?(value); end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:77 + def encoded(value); end + + # pkg:gem/activerecord#lib/active_record/type/serialized.rb:71 + def instance_variables_to_inspect; end +end + +# pkg:gem/activerecord#lib/active_record/type.rb:66 +ActiveRecord::Type::String = ActiveModel::Type::String + +# pkg:gem/activerecord#lib/active_record/type/text.rb:5 +class ActiveRecord::Type::Text < ::ActiveModel::Type::String + # pkg:gem/activerecord#lib/active_record/type/text.rb:6 + def type; end +end + +# pkg:gem/activerecord#lib/active_record/type/time.rb:5 +class ActiveRecord::Type::Time < ::ActiveModel::Type::Time + include ::ActiveRecord::Type::Internal::Timezone + + # pkg:gem/activerecord#lib/active_record/type/time.rb:11 + def serialize(value); end + + # pkg:gem/activerecord#lib/active_record/type/time.rb:20 + def serialize_cast_value(value); end + + private + + # pkg:gem/activerecord#lib/active_record/type/time.rb:25 + def cast_value(value); end +end + +# pkg:gem/activerecord#lib/active_record/type/time.rb:8 +class ActiveRecord::Type::Time::Value; end + +# pkg:gem/activerecord#lib/active_record/type/type_map.rb:7 +class ActiveRecord::Type::TypeMap + # pkg:gem/activerecord#lib/active_record/type/type_map.rb:8 + def initialize(parent = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/type/type_map.rb:35 + def alias_type(key, target_key); end + + # pkg:gem/activerecord#lib/active_record/type/type_map.rb:18 + def fetch(lookup_key, &block); end + + # pkg:gem/activerecord#lib/active_record/type/type_map.rb:14 + def lookup(lookup_key); end + + # pkg:gem/activerecord#lib/active_record/type/type_map.rb:24 + def register_type(key, value = T.unsafe(nil), &block); end + + protected + + # pkg:gem/activerecord#lib/active_record/type/type_map.rb:43 + def perform_fetch(lookup_key, &block); end +end + +# pkg:gem/activerecord#lib/active_record/type/unsigned_integer.rb:5 +class ActiveRecord::Type::UnsignedInteger < ::ActiveModel::Type::Integer + private + + # pkg:gem/activerecord#lib/active_record/type/unsigned_integer.rb:7 + def max_value; end + + # pkg:gem/activerecord#lib/active_record/type/unsigned_integer.rb:11 + def min_value; end +end + +# pkg:gem/activerecord#lib/active_record/type.rb:67 +ActiveRecord::Type::Value = ActiveModel::Type::Value + +# pkg:gem/activerecord#lib/active_record/type_caster/map.rb:4 +module ActiveRecord::TypeCaster; end + +# pkg:gem/activerecord#lib/active_record/type_caster/connection.rb:5 +class ActiveRecord::TypeCaster::Connection + # pkg:gem/activerecord#lib/active_record/type_caster/connection.rb:6 + def initialize(klass, table_name); end + + # pkg:gem/activerecord#lib/active_record/type_caster/connection.rb:11 + def type_cast_for_database(attr_name, value); end + + # pkg:gem/activerecord#lib/active_record/type_caster/connection.rb:16 + def type_for_attribute(attr_name); end + + private + + # pkg:gem/activerecord#lib/active_record/type_caster/connection.rb:31 + def table_name; end +end + +# pkg:gem/activerecord#lib/active_record/type_caster/map.rb:5 +class ActiveRecord::TypeCaster::Map + # pkg:gem/activerecord#lib/active_record/type_caster/map.rb:6 + def initialize(klass); end + + # pkg:gem/activerecord#lib/active_record/type_caster/map.rb:10 + def type_cast_for_database(attr_name, value); end + + # pkg:gem/activerecord#lib/active_record/type_caster/map.rb:15 + def type_for_attribute(name); end + + private + + # pkg:gem/activerecord#lib/active_record/type_caster/map.rb:20 + def klass; end +end + +# pkg:gem/activerecord#lib/active_record/type/adapter_specific_registry.rb:141 +class ActiveRecord::TypeConflictError < ::StandardError; end + +# Raised when unknown attributes are supplied via mass assignment. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:451 +ActiveRecord::UnknownAttributeError = ActiveModel::UnknownAttributeError + +# UnknownAttributeReference is raised when an unknown and potentially unsafe +# value is passed to a query method. For example, passing a non column name +# value to a relation's #order method might cause this exception. +# +# When working around this exception, caution should be taken to avoid SQL +# injection vulnerabilities when passing user-provided values to query +# methods. Known-safe values can be passed to query methods by wrapping them +# in Arel.sql. +# +# For example, the following code would raise this exception: +# +# Post.order("REPLACE(title, 'misc', 'zzzz') asc").pluck(:id) +# +# The desired result can be accomplished by wrapping the known-safe string +# in Arel.sql: +# +# Post.order(Arel.sql("REPLACE(title, 'misc', 'zzzz') asc")).pluck(:id) +# +# Again, such a workaround should *not* be used when passing user-provided +# values, such as request parameters or model attributes to query methods. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:618 +class ActiveRecord::UnknownAttributeReference < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/migration.rb:111 +class ActiveRecord::UnknownMigrationVersionError < ::ActiveRecord::MigrationError + # pkg:gem/activerecord#lib/active_record/migration.rb:112 + def initialize(version = T.unsafe(nil)); end +end + +# Raised when a primary key is needed, but not specified in the schema or model. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:479 +class ActiveRecord::UnknownPrimaryKey < ::ActiveRecord::ActiveRecordError + # pkg:gem/activerecord#lib/active_record/errors.rb:482 + def initialize(model = T.unsafe(nil), description = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/errors.rb:480 + def model; end +end + +# Raised when a relation cannot be mutated because it's already loaded. +# +# class Task < ActiveRecord::Base +# end +# +# relation = Task.all +# relation.load +# relation.loaded? # => true +# +# # Methods which try to mutate a loaded relation fail. +# relation.where!(title: 'TODO') # => ActiveRecord::UnmodifiableRelation +# relation.limit!(5) # => ActiveRecord::UnmodifiableRelation +# +# pkg:gem/activerecord#lib/active_record/errors.rb:506 +class ActiveRecord::UnmodifiableRelation < ::ActiveRecord::ActiveRecordError; end + +# pkg:gem/activerecord#lib/active_record/gem_version.rb:9 +module ActiveRecord::VERSION; end + +# pkg:gem/activerecord#lib/active_record/gem_version.rb:10 +ActiveRecord::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activerecord#lib/active_record/gem_version.rb:11 +ActiveRecord::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activerecord#lib/active_record/gem_version.rb:13 +ActiveRecord::VERSION::PRE = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/gem_version.rb:15 +ActiveRecord::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/active_record/gem_version.rb:12 +ActiveRecord::VERSION::TINY = T.let(T.unsafe(nil), Integer) + +# = Active Record \Validations +# +# Active Record includes the majority of its validations from ActiveModel::Validations. +# +# In Active Record, all validations are performed on save by default. +# Validations accept the :on argument to define the context where +# the validations are active. Active Record will pass either the context of +# :create or :update depending on whether the model is a +# {new_record?}[rdoc-ref:Persistence#new_record?]. +# +# pkg:gem/activerecord#lib/active_record/validations.rb:40 +module ActiveRecord::Validations + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveRecord::Validations::ClassMethods + + # pkg:gem/activerecord#lib/active_record/validations.rb:77 + def custom_validation_context?; end + + # The validation process on save can be skipped by passing validate: false. + # The validation context can be changed by passing context: context. + # The regular {ActiveRecord::Base#save}[rdoc-ref:Persistence#save] method is replaced + # with this when the validations module is mixed in, which it is by default. + # + # pkg:gem/activerecord#lib/active_record/validations.rb:47 + def save(**options); end + + # Attempts to save the record just like {ActiveRecord::Base#save}[rdoc-ref:Base#save] but + # will raise an ActiveRecord::RecordInvalid exception instead of returning +false+ if the record is not valid. + # + # pkg:gem/activerecord#lib/active_record/validations.rb:53 + def save!(**options); end + + # Runs all the validations within the specified context. Returns +true+ if + # no errors are found, +false+ otherwise. + # + # Aliased as #validate. + # + # If the argument is +false+ (default is +nil+), the context is set to :create if + # {new_record?}[rdoc-ref:Persistence#new_record?] is +true+, and to :update if it is not. + # If the argument is an array of contexts, post.valid?([:create, :update]), the validations are + # run within multiple contexts. + # + # \Validations with no :on option will run no matter the context. \Validations with + # some :on option will only run in the specified context. + # + # pkg:gem/activerecord#lib/active_record/validations.rb:69 + def valid?(context = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/validations.rb:75 + def validate(context = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/validations.rb:82 + def default_validation_context; end + + # pkg:gem/activerecord#lib/active_record/validations.rb:90 + def perform_validations(options = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/active_record/validations.rb:86 + def raise_validation_error; end +end + +# pkg:gem/activerecord#lib/active_record/validations/absence.rb:5 +class ActiveRecord::Validations::AbsenceValidator < ::ActiveModel::Validations::AbsenceValidator + # pkg:gem/activerecord#lib/active_record/validations/absence.rb:6 + def validate_each(record, attribute, association_or_value); end +end + +# pkg:gem/activerecord#lib/active_record/validations/associated.rb:5 +class ActiveRecord::Validations::AssociatedValidator < ::ActiveModel::EachValidator + # pkg:gem/activerecord#lib/active_record/validations/associated.rb:6 + def validate_each(record, attribute, value); end + + private + + # pkg:gem/activerecord#lib/active_record/validations/associated.rb:19 + def record_validation_context_for_association(record); end + + # pkg:gem/activerecord#lib/active_record/validations/associated.rb:15 + def valid_object?(record, context); end +end + +# pkg:gem/activerecord#lib/active_record/validations/associated.rb:24 +module ActiveRecord::Validations::ClassMethods + # Validates that the specified attributes are not present (as defined by + # Object#present?). If the attribute is an association, the associated object + # is also considered not present if it is marked for destruction. + # + # See ActiveModel::Validations::HelperMethods.validates_absence_of for more information. + # + # pkg:gem/activerecord#lib/active_record/validations/absence.rb:20 + def validates_absence_of(*attr_names); end + + # Validates whether the associated object or objects are all valid. + # Works with any kind of association. + # + # class Book < ActiveRecord::Base + # has_many :pages + # belongs_to :library + # + # validates_associated :pages, :library + # end + # + # WARNING: This validation must not be used on both ends of an association. + # Doing so will lead to a circular dependency and cause infinite recursion. + # + # NOTE: This validation will not fail if the association hasn't been + # assigned. If you want to ensure that the association is both present and + # guaranteed to be valid, you also need to use + # {validates_presence_of}[rdoc-ref:Validations::ClassMethods#validates_presence_of]. + # + # Configuration options: + # + # * :message - A custom error message (default is: "is invalid"). + # * :on - Specifies the contexts where this validation is active. + # Runs in all validation contexts by default +nil+. You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or + # on: [:create, :custom_validation_context]) + # * :if - Specifies a method, proc, or string to call to determine + # if the validation should occur (e.g. if: :allow_validation, + # or if: Proc.new { |user| user.signup_step > 2 }). The method, + # proc or string should return or evaluate to a +true+ or +false+ value. + # * :unless - Specifies a method, proc, or string to call to + # determine if the validation should not occur (e.g. unless: :skip_validation, + # or unless: Proc.new { |user| user.signup_step <= 2 }). The + # method, proc, or string should return or evaluate to a +true+ or +false+ + # value. + # + # pkg:gem/activerecord#lib/active_record/validations/associated.rb:60 + def validates_associated(*attr_names); end + + # Validates that the specified attributes match the length restrictions supplied. + # If the attribute is an association, records that are marked for destruction are not counted. + # + # See ActiveModel::Validations::HelperMethods.validates_length_of for more information. + # + # pkg:gem/activerecord#lib/active_record/validations/length.rb:19 + def validates_length_of(*attr_names); end + + # Validates whether the value of the specified attribute is numeric by + # trying to convert it to a float with +Kernel.Float+ (if + # only_integer is +false+) or applying it to the regular + # expression /\A[\+\-]?\d+\z/ (if only_integer is set to + # +true+). +Kernel.Float+ precision defaults to the column's precision + # value or 15. + # + # See ActiveModel::Validations::HelperMethods.validates_numericality_of for more information. + # + # pkg:gem/activerecord#lib/active_record/validations/numericality.rb:31 + def validates_numericality_of(*attr_names); end + + # Validates that the specified attributes are not blank (as defined by + # Object#blank?). If the attribute is an association, the associated object + # is also considered blank if it is marked for destruction. + # + # class Person < ActiveRecord::Base + # has_one :face + # validates_presence_of :face + # end + # + # The face attribute must be in the object and it cannot be blank or marked + # for destruction. + # + # This validator defers to the Active Model validation for presence, adding the + # check to see that an associated object is not marked for destruction. This + # prevents the parent object from validating successfully and saving, which then + # deletes the associated object, thus putting the parent object into an invalid + # state. + # + # See ActiveModel::Validations::HelperMethods.validates_presence_of for + # more information. + # + # NOTE: This validation will not fail while using it with an association + # if the latter was assigned but not valid. If you want to ensure that + # it is both present and valid, you also need to use + # {validates_associated}[rdoc-ref:Validations::ClassMethods#validates_associated]. + # + # pkg:gem/activerecord#lib/active_record/validations/presence.rb:40 + def validates_presence_of(*attr_names); end + + # pkg:gem/activerecord#lib/active_record/validations/length.rb:23 + def validates_size_of(*attr_names); end + + # Validates whether the value of the specified attributes are unique + # across the system. Useful for making sure that only one user + # can be named "davidhh". + # + # class Person < ActiveRecord::Base + # validates_uniqueness_of :user_name + # end + # + # It can also validate whether the value of the specified attributes are + # unique based on a :scope parameter: + # + # class Person < ActiveRecord::Base + # validates_uniqueness_of :user_name, scope: :account_id + # end + # + # Or even multiple scope parameters. For example, making sure that a + # teacher can only be on the schedule once per semester for a particular + # class. + # + # class TeacherSchedule < ActiveRecord::Base + # validates_uniqueness_of :teacher_id, scope: [:semester_id, :class_id] + # end + # + # It is also possible to limit the uniqueness constraint to a set of + # records matching certain conditions. In this example archived articles + # are not being taken into consideration when validating uniqueness + # of the title attribute: + # + # class Article < ActiveRecord::Base + # validates_uniqueness_of :title, conditions: -> { where.not(status: 'archived') } + # end + # + # To build conditions based on the record's state, define the conditions + # callable with a parameter, which will be the record itself. This + # example validates the title is unique for the year of publication: + # + # class Article < ActiveRecord::Base + # validates_uniqueness_of :title, conditions: ->(article) { + # published_at = article.published_at + # where(published_at: published_at.beginning_of_year..published_at.end_of_year) + # } + # end + # + # When the record is created, a check is performed to make sure that no + # record exists in the database with the given value for the specified + # attribute (that maps to a column). When the record is updated, + # the same check is made but disregarding the record itself. + # + # Configuration options: + # + # * :message - Specifies a custom error message (default is: + # "has already been taken"). + # * :scope - One or more columns by which to limit the scope of + # the uniqueness constraint. + # * :conditions - Specify the conditions to be included as a + # WHERE SQL fragment to limit the uniqueness constraint lookup + # (e.g. conditions: -> { where(status: 'active') }). + # * :case_sensitive - Looks for an exact match. Ignored by + # non-text columns. The default behavior respects the default database collation. + # * :allow_nil - If set to +true+, skips this validation if the + # attribute is +nil+ (default is +false+). + # * :allow_blank - If set to +true+, skips this validation if the + # attribute is blank (default is +false+). + # * :if - Specifies a method, proc, or string to call to determine + # if the validation should occur (e.g. if: :allow_validation, + # or if: Proc.new { |user| user.signup_step > 2 }). The method, + # proc or string should return or evaluate to a +true+ or +false+ value. + # * :unless - Specifies a method, proc, or string to call to + # determine if the validation should not occur (e.g. unless: :skip_validation, + # or unless: Proc.new { |user| user.signup_step <= 2 }). The + # method, proc, or string should return or evaluate to a +true+ or +false+ + # value. + # + # === Concurrency and integrity + # + # Using this validation method in conjunction with + # {ActiveRecord::Base#save}[rdoc-ref:Persistence#save] + # does not guarantee the absence of duplicate record insertions, because + # uniqueness checks on the application level are inherently prone to race + # conditions. For example, suppose that two users try to post a Comment at + # the same time, and a Comment's title must be unique. At the database-level, + # the actions performed by these users could be interleaved in the following manner: + # + # User 1 | User 2 + # ------------------------------------+-------------------------------------- + # # User 1 checks whether there's | + # # already a comment with the title | + # # 'My Post'. This is not the case. | + # SELECT * FROM comments | + # WHERE title = 'My Post' | + # | + # | # User 2 does the same thing and also + # | # infers that their title is unique. + # | SELECT * FROM comments + # | WHERE title = 'My Post' + # | + # # User 1 inserts their comment. | + # INSERT INTO comments | + # (title, content) VALUES | + # ('My Post', 'hi!') | + # | + # | # User 2 does the same thing. + # | INSERT INTO comments + # | (title, content) VALUES + # | ('My Post', 'hello!') + # | + # | # ^^^^^^ + # | # Boom! We now have a duplicate + # | # title! + # + # The best way to work around this problem is to add a unique index to the database table using + # {connection.add_index}[rdoc-ref:ConnectionAdapters::SchemaStatements#add_index]. + # In the rare case that a race condition occurs, the database will guarantee + # the field's uniqueness. + # + # When the database catches such a duplicate insertion, + # {ActiveRecord::Base#save}[rdoc-ref:Persistence#save] will raise an ActiveRecord::StatementInvalid + # exception. You can either choose to let this error propagate (which + # will result in the default \Rails exception page being shown), or you + # can catch it and restart the transaction (e.g. by telling the user + # that the title already exists, and asking them to re-enter the title). + # This technique is also known as + # {optimistic concurrency control}[https://en.wikipedia.org/wiki/Optimistic_concurrency_control]. + # + # The bundled ActiveRecord::ConnectionAdapters distinguish unique index + # constraint errors from other types of database errors by throwing an + # ActiveRecord::RecordNotUnique exception. For other adapters you will + # have to parse the (database-specific) exception message to detect such + # a case. + # + # The following bundled adapters throw the ActiveRecord::RecordNotUnique exception: + # + # * ActiveRecord::ConnectionAdapters::Mysql2Adapter. + # * ActiveRecord::ConnectionAdapters::TrilogyAdapter. + # * ActiveRecord::ConnectionAdapters::SQLite3Adapter. + # * ActiveRecord::ConnectionAdapters::PostgreSQLAdapter. + # + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:291 + def validates_uniqueness_of(*attr_names); end +end + +# pkg:gem/activerecord#lib/active_record/validations/length.rb:5 +class ActiveRecord::Validations::LengthValidator < ::ActiveModel::Validations::LengthValidator + # pkg:gem/activerecord#lib/active_record/validations/length.rb:6 + def validate_each(record, attribute, association_or_value); end +end + +# pkg:gem/activerecord#lib/active_record/validations/numericality.rb:5 +class ActiveRecord::Validations::NumericalityValidator < ::ActiveModel::Validations::NumericalityValidator + # pkg:gem/activerecord#lib/active_record/validations/numericality.rb:6 + def validate_each(record, attribute, value, precision: T.unsafe(nil), scale: T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/active_record/validations/numericality.rb:13 + def column_precision_for(record, attribute); end + + # pkg:gem/activerecord#lib/active_record/validations/numericality.rb:17 + def column_scale_for(record, attribute); end +end + +# pkg:gem/activerecord#lib/active_record/validations/presence.rb:5 +class ActiveRecord::Validations::PresenceValidator < ::ActiveModel::Validations::PresenceValidator + # pkg:gem/activerecord#lib/active_record/validations/presence.rb:6 + def validate_each(record, attribute, association_or_value); end +end + +# pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:5 +class ActiveRecord::Validations::UniquenessValidator < ::ActiveModel::EachValidator + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:6 + def initialize(options); end + + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:20 + def validate_each(record, attribute, value); end + + private + + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:112 + def build_relation(klass, attribute, value); end + + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:83 + def covered_by_unique_index?(klass, record, attribute, scope); end + + # The check for an existing value should be run from a class that + # isn't abstract. This means working down from the current class + # (self), to the first non-abstract class. + # + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:58 + def find_finder_class_for(record); end + + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:147 + def map_enum_attribute(klass, attribute, value); end + + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:98 + def resolve_attributes(record, attributes); end + + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:134 + def scope_relation(record, relation); end + + # pkg:gem/activerecord#lib/active_record/validations/uniqueness.rb:70 + def validation_needed?(klass, record, attribute); end +end + +# Raised when a record cannot be inserted or updated because a value too long for a column type. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:304 +class ActiveRecord::ValueTooLong < ::ActiveRecord::StatementInvalid; end + +# Defunct wrapper class kept for compatibility. +# StatementInvalid wraps the original exception now. +# +# pkg:gem/activerecord#lib/active_record/errors.rb:224 +class ActiveRecord::WrappedDatabaseException < ::ActiveRecord::StatementInvalid; end + +# pkg:gem/activerecord#lib/arel/errors.rb:3 +module Arel + class << self + # pkg:gem/activerecord#lib/arel.rb:66 + def arel_node?(value); end + + # pkg:gem/activerecord#lib/arel.rb:70 + def fetch_attribute(value, &block); end + + # Wrap a known-safe SQL string for passing to query methods, e.g. + # + # Post.order(Arel.sql("REPLACE(title, 'misc', 'zzzz') asc")).pluck(:id) + # + # Great caution should be taken to avoid SQL injection vulnerabilities. + # This method should not be used with unsafe values such as request + # parameters or model attributes. + # + # Take a look at the {security guide}[https://guides.rubyonrails.org/security.html#sql-injection] + # for more information. + # + # To construct a more complex query fragment, including the possible + # use of user-provided values, the +sql_string+ may contain ? and + # +:key+ placeholders, corresponding to the additional arguments. Note + # that this behavior only applies when bind value parameters are + # supplied in the call; without them, the placeholder tokens have no + # special meaning, and will be passed through to the query as-is. + # + # The +:retryable+ option can be used to mark the SQL as safe to retry. + # Use this option only if the SQL is idempotent, as it could be executed + # more than once. + # + # pkg:gem/activerecord#lib/arel.rb:52 + def sql(sql_string, *positional_binds, retryable: T.unsafe(nil), **named_binds); end + + # pkg:gem/activerecord#lib/arel.rb:62 + def star; end + end +end + +# pkg:gem/activerecord#lib/arel/alias_predication.rb:4 +module Arel::AliasPredication + # pkg:gem/activerecord#lib/arel/alias_predication.rb:5 + def as(other); end +end + +# pkg:gem/activerecord#lib/arel/errors.rb:4 +class Arel::ArelError < ::StandardError; end + +# pkg:gem/activerecord#lib/arel/attributes/attribute.rb:32 +Arel::Attribute = Arel::Attributes::Attribute + +# pkg:gem/activerecord#lib/arel/attributes/attribute.rb:4 +module Arel::Attributes; end + +# pkg:gem/activerecord#lib/arel/attributes/attribute.rb:5 +class Arel::Attributes::Attribute < ::Struct + include ::Arel::Expressions + include ::Arel::Predications + include ::Arel::AliasPredication + include ::Arel::OrderPredications + include ::Arel::Math + + # pkg:gem/activerecord#lib/arel/attributes/attribute.rb:26 + def able_to_type_cast?; end + + # Create a node for lowering this attribute + # + # pkg:gem/activerecord#lib/arel/attributes/attribute.rb:18 + def lower; end + + # pkg:gem/activerecord#lib/arel/attributes/attribute.rb:22 + def type_cast_for_database(value); end + + # pkg:gem/activerecord#lib/arel/attributes/attribute.rb:12 + def type_caster; end +end + +# pkg:gem/activerecord#lib/arel/errors.rb:10 +class Arel::BindError < ::Arel::ArelError + # pkg:gem/activerecord#lib/arel/errors.rb:11 + def initialize(message, sql = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/arel/collectors/plain_string.rb:4 +module Arel::Collectors; end + +# pkg:gem/activerecord#lib/arel/collectors/bind.rb:5 +class Arel::Collectors::Bind + # pkg:gem/activerecord#lib/arel/collectors/bind.rb:8 + def initialize; end + + # pkg:gem/activerecord#lib/arel/collectors/bind.rb:12 + def <<(str); end + + # pkg:gem/activerecord#lib/arel/collectors/bind.rb:16 + def add_bind(bind, &); end + + # pkg:gem/activerecord#lib/arel/collectors/bind.rb:21 + def add_binds(binds, proc_for_binds = T.unsafe(nil), &); end + + # pkg:gem/activerecord#lib/arel/collectors/bind.rb:6 + def retryable; end + + # pkg:gem/activerecord#lib/arel/collectors/bind.rb:6 + def retryable=(_arg0); end + + # pkg:gem/activerecord#lib/arel/collectors/bind.rb:26 + def value; end +end + +# pkg:gem/activerecord#lib/arel/collectors/composite.rb:5 +class Arel::Collectors::Composite + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:9 + def initialize(left, right); end + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:20 + def <<(str); end + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:26 + def add_bind(bind, &block); end + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:32 + def add_binds(binds, proc_for_binds = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:6 + def preparable; end + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:6 + def preparable=(_arg0); end + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:7 + def retryable; end + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:14 + def retryable=(retryable); end + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:38 + def value; end + + private + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:43 + def left; end + + # pkg:gem/activerecord#lib/arel/collectors/composite.rb:43 + def right; end +end + +# pkg:gem/activerecord#lib/arel/collectors/plain_string.rb:5 +class Arel::Collectors::PlainString + # pkg:gem/activerecord#lib/arel/collectors/plain_string.rb:6 + def initialize; end + + # pkg:gem/activerecord#lib/arel/collectors/plain_string.rb:14 + def <<(str); end + + # pkg:gem/activerecord#lib/arel/collectors/plain_string.rb:10 + def value; end +end + +# pkg:gem/activerecord#lib/arel/collectors/sql_string.rb:7 +class Arel::Collectors::SQLString < ::Arel::Collectors::PlainString + # pkg:gem/activerecord#lib/arel/collectors/sql_string.rb:10 + def initialize(*); end + + # pkg:gem/activerecord#lib/arel/collectors/sql_string.rb:15 + def add_bind(bind, &); end + + # pkg:gem/activerecord#lib/arel/collectors/sql_string.rb:21 + def add_binds(binds, proc_for_binds = T.unsafe(nil), &block); end + + # pkg:gem/activerecord#lib/arel/collectors/sql_string.rb:8 + def preparable; end + + # pkg:gem/activerecord#lib/arel/collectors/sql_string.rb:8 + def preparable=(_arg0); end + + # pkg:gem/activerecord#lib/arel/collectors/sql_string.rb:8 + def retryable; end + + # pkg:gem/activerecord#lib/arel/collectors/sql_string.rb:8 + def retryable=(_arg0); end +end + +# pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:5 +class Arel::Collectors::SubstituteBinds + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:8 + def initialize(quoter, delegate_collector); end + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:13 + def <<(str); end + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:18 + def add_bind(bind, &); end + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:23 + def add_binds(binds, proc_for_binds = T.unsafe(nil), &); end + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:6 + def preparable; end + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:6 + def preparable=(_arg0); end + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:6 + def retryable; end + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:6 + def retryable=(_arg0); end + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:27 + def value; end + + private + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:32 + def delegate; end + + # pkg:gem/activerecord#lib/arel/collectors/substitute_binds.rb:32 + def quoter; end +end + +# FIXME hopefully we can remove this +# +# pkg:gem/activerecord#lib/arel/crud.rb:6 +module Arel::Crud + # pkg:gem/activerecord#lib/arel/crud.rb:32 + def compile_delete(key = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/crud.rb:7 + def compile_insert(values); end + + # pkg:gem/activerecord#lib/arel/crud.rb:17 + def compile_update(values, key = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/crud.rb:13 + def create_insert; end +end + +# pkg:gem/activerecord#lib/arel/delete_manager.rb:4 +class Arel::DeleteManager < ::Arel::TreeManager + include ::Arel::TreeManager::StatementMethods + + # pkg:gem/activerecord#lib/arel/delete_manager.rb:7 + def initialize(table = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/delete_manager.rb:32 + def comment(value); end + + # pkg:gem/activerecord#lib/arel/delete_manager.rb:11 + def from(relation); end + + # pkg:gem/activerecord#lib/arel/delete_manager.rb:16 + def group(columns); end + + # pkg:gem/activerecord#lib/arel/delete_manager.rb:27 + def having(expr); end +end + +# pkg:gem/activerecord#lib/arel/errors.rb:7 +class Arel::EmptyJoinError < ::Arel::ArelError; end + +# pkg:gem/activerecord#lib/arel/expressions.rb:4 +module Arel::Expressions + # pkg:gem/activerecord#lib/arel/expressions.rb:21 + def average; end + + # pkg:gem/activerecord#lib/arel/expressions.rb:5 + def count(distinct = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/expressions.rb:25 + def extract(field); end + + # pkg:gem/activerecord#lib/arel/expressions.rb:13 + def maximum; end + + # pkg:gem/activerecord#lib/arel/expressions.rb:17 + def minimum; end + + # pkg:gem/activerecord#lib/arel/expressions.rb:9 + def sum; end +end + +# Methods for creating various nodes +# +# pkg:gem/activerecord#lib/arel/factory_methods.rb:6 +module Arel::FactoryMethods + # pkg:gem/activerecord#lib/arel/factory_methods.rb:49 + def cast(name, type); end + + # pkg:gem/activerecord#lib/arel/factory_methods.rb:45 + def coalesce(*exprs); end + + # pkg:gem/activerecord#lib/arel/factory_methods.rb:27 + def create_and(clauses); end + + # pkg:gem/activerecord#lib/arel/factory_methods.rb:11 + def create_false; end + + # pkg:gem/activerecord#lib/arel/factory_methods.rb:19 + def create_join(to, constraint = T.unsafe(nil), klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/factory_methods.rb:31 + def create_on(expr); end + + # pkg:gem/activerecord#lib/arel/factory_methods.rb:23 + def create_string_join(to); end + + # pkg:gem/activerecord#lib/arel/factory_methods.rb:15 + def create_table_alias(relation, name); end + + # pkg:gem/activerecord#lib/arel/factory_methods.rb:7 + def create_true; end + + # pkg:gem/activerecord#lib/arel/factory_methods.rb:35 + def grouping(expr); end + + # Create a LOWER() function + # + # pkg:gem/activerecord#lib/arel/factory_methods.rb:41 + def lower(column); end +end + +# pkg:gem/activerecord#lib/arel/filter_predications.rb:4 +module Arel::FilterPredications + # pkg:gem/activerecord#lib/arel/filter_predications.rb:5 + def filter(expr); end +end + +# pkg:gem/activerecord#lib/arel/insert_manager.rb:4 +class Arel::InsertManager < ::Arel::TreeManager + # pkg:gem/activerecord#lib/arel/insert_manager.rb:5 + def initialize(table = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/insert_manager.rb:14 + def columns; end + + # pkg:gem/activerecord#lib/arel/insert_manager.rb:40 + def create_values(values); end + + # pkg:gem/activerecord#lib/arel/insert_manager.rb:44 + def create_values_list(rows); end + + # pkg:gem/activerecord#lib/arel/insert_manager.rb:21 + def insert(fields); end + + # pkg:gem/activerecord#lib/arel/insert_manager.rb:9 + def into(table); end + + # pkg:gem/activerecord#lib/arel/insert_manager.rb:17 + def select(select); end + + # pkg:gem/activerecord#lib/arel/insert_manager.rb:15 + def values=(val); end +end + +# pkg:gem/activerecord#lib/arel/math.rb:4 +module Arel::Math + # pkg:gem/activerecord#lib/arel/math.rb:21 + def &(other); end + + # pkg:gem/activerecord#lib/arel/math.rb:5 + def *(other); end + + # pkg:gem/activerecord#lib/arel/math.rb:9 + def +(other); end + + # pkg:gem/activerecord#lib/arel/math.rb:13 + def -(other); end + + # pkg:gem/activerecord#lib/arel/math.rb:17 + def /(other); end + + # pkg:gem/activerecord#lib/arel/math.rb:33 + def <<(other); end + + # pkg:gem/activerecord#lib/arel/math.rb:37 + def >>(other); end + + # pkg:gem/activerecord#lib/arel/math.rb:29 + def ^(other); end + + # pkg:gem/activerecord#lib/arel/math.rb:25 + def |(other); end + + # pkg:gem/activerecord#lib/arel/math.rb:41 + def ~; end +end + +# pkg:gem/activerecord#lib/arel/nodes/node.rb:4 +module Arel::Nodes + class << self + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:48 + def build_quoted(other, attribute = T.unsafe(nil)); end + end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:32 +class Arel::Nodes::Addition < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:33 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/nary.rb:36 +class Arel::Nodes::And < ::Arel::Nodes::Nary; end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:42 +class Arel::Nodes::As < ::Arel::Nodes::Binary + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:43 + def to_cte; end +end + +# pkg:gem/activerecord#lib/arel/nodes/ascending.rb:5 +class Arel::Nodes::Ascending < ::Arel::Nodes::Ordering + # pkg:gem/activerecord#lib/arel/nodes/ascending.rb:14 + def ascending?; end + + # pkg:gem/activerecord#lib/arel/nodes/ascending.rb:18 + def descending?; end + + # pkg:gem/activerecord#lib/arel/nodes/ascending.rb:10 + def direction; end + + # pkg:gem/activerecord#lib/arel/nodes/ascending.rb:6 + def reverse; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:122 +class Arel::Nodes::Assignment < ::Arel::Nodes::Binary; end + +# pkg:gem/activerecord#lib/arel/nodes/function.rb:36 +class Arel::Nodes::Avg < ::Arel::Nodes::Function; end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:48 +class Arel::Nodes::Between < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::Bin < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:5 +class Arel::Nodes::Binary < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:8 + def initialize(left, right); end + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:29 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:24 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:20 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:6 + def left; end + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:6 + def left=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:6 + def right; end + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:6 + def right=(_arg0); end + + private + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:14 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:5 +class Arel::Nodes::BindParam < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:8 + def initialize(value); end + + # pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:21 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:17 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:13 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:35 + def infinite?; end + + # pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:23 + def nil?; end + + # pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:39 + def unboundable?; end + + # pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:6 + def value; end + + # pkg:gem/activerecord#lib/arel/nodes/bind_param.rb:27 + def value_before_type_cast; end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:62 +class Arel::Nodes::BitwiseAnd < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:63 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary_operation.rb:14 +class Arel::Nodes::BitwiseNot < ::Arel::Nodes::UnaryOperation + # pkg:gem/activerecord#lib/arel/nodes/unary_operation.rb:15 + def initialize(operand); end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:68 +class Arel::Nodes::BitwiseOr < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:69 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:80 +class Arel::Nodes::BitwiseShiftLeft < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:81 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:86 +class Arel::Nodes::BitwiseShiftRight < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:87 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:74 +class Arel::Nodes::BitwiseXor < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:75 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:5 +class Arel::Nodes::BoundSqlLiteral < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:8 + def initialize(sql_with_placeholders, positional_binds, named_binds); end + + # pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:54 + def +(other); end + + # pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:52 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:46 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:42 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:60 + def inspect; end + + # pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:6 + def named_binds; end + + # pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:6 + def positional_binds; end + + # pkg:gem/activerecord#lib/arel/nodes/bound_sql_literal.rb:6 + def sql_with_placeholders; end +end + +# pkg:gem/activerecord#lib/arel/nodes/case.rb:5 +class Arel::Nodes::Case < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/case.rb:8 + def initialize(expression = T.unsafe(nil), default = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:46 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:6 + def case; end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:6 + def case=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:6 + def conditions; end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:6 + def conditions=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:6 + def default; end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:6 + def default=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:24 + def else(expression); end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:40 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:36 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:19 + def then(expression); end + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:14 + def when(condition, expression = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/arel/nodes/case.rb:29 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/casted.rb:5 +class Arel::Nodes::Casted < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:9 + def initialize(value, attribute); end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:34 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:6 + def attribute; end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:29 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:25 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:15 + def nil?; end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:6 + def value; end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:7 + def value_before_type_cast; end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:17 + def value_for_database; end +end + +# pkg:gem/activerecord#lib/arel/nodes/comment.rb:5 +class Arel::Nodes::Comment < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/comment.rb:8 + def initialize(values); end + + # pkg:gem/activerecord#lib/arel/nodes/comment.rb:26 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/comment.rb:22 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/comment.rb:18 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/comment.rb:6 + def values; end + + private + + # pkg:gem/activerecord#lib/arel/nodes/comment.rb:13 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:44 +class Arel::Nodes::Concat < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:45 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:50 +class Arel::Nodes::Contains < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:51 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/count.rb:5 +class Arel::Nodes::Count < ::Arel::Nodes::Function + # pkg:gem/activerecord#lib/arel/nodes/count.rb:6 + def initialize(expr, distinct = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/arel/nodes/cte.rb:5 +class Arel::Nodes::Cte < ::Arel::Nodes::Binary + # pkg:gem/activerecord#lib/arel/nodes/cte.rb:10 + def initialize(name, relation, materialized: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/cte.rb:25 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/cte.rb:19 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/cte.rb:15 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/cte.rb:8 + def materialized; end + + # pkg:gem/activerecord#lib/arel/nodes/cte.rb:6 + def name; end + + # pkg:gem/activerecord#lib/arel/nodes/cte.rb:7 + def relation; end + + # pkg:gem/activerecord#lib/arel/nodes/cte.rb:27 + def to_cte; end + + # pkg:gem/activerecord#lib/arel/nodes/cte.rb:31 + def to_table; end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::Cube < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/window.rb:103 +class Arel::Nodes::CurrentRow < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/window.rb:111 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:108 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:104 + def hash; end +end + +# pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:5 +class Arel::Nodes::DeleteStatement < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:8 + def initialize(relation = T.unsafe(nil), wheres = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:43 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def comment; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def comment=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:31 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def groups; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def groups=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:27 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def havings; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def havings=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def key; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def key=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def limit; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def limit=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def offset; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def offset=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def orders; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def orders=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def relation; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def relation=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def wheres; end + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:6 + def wheres=(_arg0); end + + private + + # pkg:gem/activerecord#lib/arel/nodes/delete_statement.rb:21 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/descending.rb:5 +class Arel::Nodes::Descending < ::Arel::Nodes::Ordering + # pkg:gem/activerecord#lib/arel/nodes/descending.rb:14 + def ascending?; end + + # pkg:gem/activerecord#lib/arel/nodes/descending.rb:18 + def descending?; end + + # pkg:gem/activerecord#lib/arel/nodes/descending.rb:10 + def direction; end + + # pkg:gem/activerecord#lib/arel/nodes/descending.rb:6 + def reverse; end +end + +# pkg:gem/activerecord#lib/arel/nodes/terminal.rb:5 +class Arel::Nodes::Distinct < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/terminal.rb:13 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/terminal.rb:10 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/terminal.rb:6 + def hash; end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::DistinctOn < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:26 +class Arel::Nodes::Division < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:27 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/matches.rb:16 +class Arel::Nodes::DoesNotMatch < ::Arel::Nodes::Matches; end + +# pkg:gem/activerecord#lib/arel/nodes/case.rb:52 +class Arel::Nodes::Else < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/equality.rb:5 +class Arel::Nodes::Equality < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/equality.rb:8 + def equality?; end + + # pkg:gem/activerecord#lib/arel/nodes/equality.rb:10 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:122 +class Arel::Nodes::Except < ::Arel::Nodes::Binary; end + +# pkg:gem/activerecord#lib/arel/nodes/function.rb:36 +class Arel::Nodes::Exists < ::Arel::Nodes::Function; end + +# pkg:gem/activerecord#lib/arel/nodes/extract.rb:5 +class Arel::Nodes::Extract < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/extract.rb:8 + def initialize(expr, field); end + + # pkg:gem/activerecord#lib/arel/nodes/extract.rb:21 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/extract.rb:17 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/extract.rb:6 + def field; end + + # pkg:gem/activerecord#lib/arel/nodes/extract.rb:6 + def field=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/extract.rb:13 + def hash; end +end + +# pkg:gem/activerecord#lib/arel/nodes/false.rb:5 +class Arel::Nodes::False < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/false.rb:13 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/false.rb:10 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/false.rb:6 + def hash; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:32 +module Arel::Nodes::FetchAttribute + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:33 + def fetch_attribute(&); end +end + +# pkg:gem/activerecord#lib/arel/nodes/filter.rb:5 +class Arel::Nodes::Filter < ::Arel::Nodes::Binary + include ::Arel::WindowPredications +end + +# pkg:gem/activerecord#lib/arel/nodes/window.rb:120 +class Arel::Nodes::Following < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/window.rb:121 + def initialize(expr = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/arel/nodes/fragments.rb:5 +class Arel::Nodes::Fragments < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/fragments.rb:8 + def initialize(values = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/fragments.rb:22 + def +(other); end + + # pkg:gem/activerecord#lib/arel/nodes/fragments.rb:32 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/fragments.rb:28 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/fragments.rb:18 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/fragments.rb:6 + def values; end + + private + + # pkg:gem/activerecord#lib/arel/nodes/fragments.rb:13 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/full_outer_join.rb:5 +class Arel::Nodes::FullOuterJoin < ::Arel::Nodes::Join; end + +# pkg:gem/activerecord#lib/arel/nodes/function.rb:5 +class Arel::Nodes::Function < ::Arel::Nodes::NodeExpression + include ::Arel::WindowPredications + include ::Arel::FilterPredications + + # pkg:gem/activerecord#lib/arel/nodes/function.rb:11 + def initialize(expr); end + + # pkg:gem/activerecord#lib/arel/nodes/function.rb:26 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/function.rb:9 + def distinct; end + + # pkg:gem/activerecord#lib/arel/nodes/function.rb:9 + def distinct=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/function.rb:21 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/function.rb:9 + def expressions; end + + # pkg:gem/activerecord#lib/arel/nodes/function.rb:9 + def expressions=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/function.rb:17 + def hash; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:50 +class Arel::Nodes::GreaterThan < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:53 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:58 +class Arel::Nodes::GreaterThanOrEqual < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:61 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::Group < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/grouping.rb:5 +class Arel::Nodes::Grouping < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/grouping.rb:6 + def fetch_attribute(&block); end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::GroupingElement < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::GroupingSet < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:5 +class Arel::Nodes::HomogeneousIn < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:8 + def initialize(values, attribute, type); end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:21 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:6 + def attribute; end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:39 + def casted_values; end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:18 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:23 + def equality?; end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:54 + def fetch_attribute(&block); end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:14 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:27 + def invert; end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:31 + def left; end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:50 + def proc_for_binds; end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:35 + def right; end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:6 + def type; end + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:6 + def values; end + + protected + + # pkg:gem/activerecord#lib/arel/nodes/homogeneous_in.rb:63 + def ivars; end +end + +# pkg:gem/activerecord#lib/arel/nodes/in.rb:5 +class Arel::Nodes::In < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/in.rb:8 + def equality?; end + + # pkg:gem/activerecord#lib/arel/nodes/in.rb:10 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:5 +class Arel::Nodes::InfixOperation < ::Arel::Nodes::Binary + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:14 + def initialize(operator, left, right); end + + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:12 + def operator; end +end + +# pkg:gem/activerecord#lib/arel/nodes/inner_join.rb:5 +class Arel::Nodes::InnerJoin < ::Arel::Nodes::Join; end + +# pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:5 +class Arel::Nodes::InsertStatement < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:8 + def initialize(relation = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:34 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:6 + def columns; end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:6 + def columns=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:27 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:23 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:6 + def relation; end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:6 + def relation=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:6 + def select; end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:6 + def select=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:6 + def values; end + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:6 + def values=(_arg0); end + + private + + # pkg:gem/activerecord#lib/arel/nodes/insert_statement.rb:16 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:122 +class Arel::Nodes::Intersect < ::Arel::Nodes::Binary; end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:82 +class Arel::Nodes::IsDistinctFrom < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:85 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:90 +class Arel::Nodes::IsNotDistinctFrom < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:93 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:122 +class Arel::Nodes::Join < ::Arel::Nodes::Binary; end + +# Class that represents a join source +# +# https://www.sqlite.org/syntaxdiagrams.html#join-source +# +# pkg:gem/activerecord#lib/arel/nodes/join_source.rb:10 +class Arel::Nodes::JoinSource < ::Arel::Nodes::Binary + # pkg:gem/activerecord#lib/arel/nodes/join_source.rb:11 + def initialize(single_source, joinop = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/join_source.rb:15 + def empty?; end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::Lateral < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/leading_join.rb:5 +class Arel::Nodes::LeadingJoin < ::Arel::Nodes::InnerJoin; end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:66 +class Arel::Nodes::LessThan < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:69 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:74 +class Arel::Nodes::LessThanOrEqual < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:77 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::Limit < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::Lock < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/matches.rb:5 +class Arel::Nodes::Matches < ::Arel::Nodes::Binary + # pkg:gem/activerecord#lib/arel/nodes/matches.rb:9 + def initialize(left, right, escape = T.unsafe(nil), case_sensitive = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/matches.rb:7 + def case_sensitive; end + + # pkg:gem/activerecord#lib/arel/nodes/matches.rb:7 + def case_sensitive=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/matches.rb:6 + def escape; end +end + +# pkg:gem/activerecord#lib/arel/nodes/function.rb:36 +class Arel::Nodes::Max < ::Arel::Nodes::Function; end + +# pkg:gem/activerecord#lib/arel/nodes/function.rb:36 +class Arel::Nodes::Min < ::Arel::Nodes::Function; end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:20 +class Arel::Nodes::Multiplication < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:21 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/named_function.rb:5 +class Arel::Nodes::NamedFunction < ::Arel::Nodes::Function + # pkg:gem/activerecord#lib/arel/nodes/named_function.rb:8 + def initialize(name, expr); end + + # pkg:gem/activerecord#lib/arel/nodes/named_function.rb:20 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/named_function.rb:17 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/named_function.rb:13 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/named_function.rb:6 + def name; end + + # pkg:gem/activerecord#lib/arel/nodes/named_function.rb:6 + def name=(_arg0); end +end + +# pkg:gem/activerecord#lib/arel/nodes/window.rb:68 +class Arel::Nodes::NamedWindow < ::Arel::Nodes::Window + # pkg:gem/activerecord#lib/arel/nodes/window.rb:71 + def initialize(name); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:88 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:85 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:81 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:69 + def name; end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:69 + def name=(_arg0); end + + private + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:76 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/nary.rb:5 +class Arel::Nodes::Nary < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/nary.rb:8 + def initialize(children); end + + # pkg:gem/activerecord#lib/arel/nodes/nary.rb:33 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/nary.rb:6 + def children; end + + # pkg:gem/activerecord#lib/arel/nodes/nary.rb:29 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/nary.rb:21 + def fetch_attribute(&block); end + + # pkg:gem/activerecord#lib/arel/nodes/nary.rb:25 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/nary.rb:13 + def left; end + + # pkg:gem/activerecord#lib/arel/nodes/nary.rb:17 + def right; end +end + +# = Using +Arel::Nodes::Node+ +# +# Active Record uses Arel to compose SQL statements. Instead of building SQL strings directly, it's building an +# abstract syntax tree (AST) of the statement using various types of Arel::Nodes::Node. Each node represents a +# fragment of an SQL statement. +# +# The intermediate representation allows Arel to compile the statement into the database's specific SQL dialect +# only before sending it without having to care about the nuances of each database when building the statement. +# It also allows easier composition of statements without having to resort to (brittle and unsafe) string manipulation. +# +# == Building constraints +# +# One of the most common use cases of Arel is generating constraints for +SELECT+ statements. To help with that, +# most nodes include a couple of useful factory methods to create subtree structures for common constraints. For +# a full list of those, please refer to Arel::Predications. +# +# The following example creates an equality constraint where the value of the name column on the users table +# matches the value DHH. +# +# users = Arel::Table.new(:users) +# constraint = users[:name].eq("DHH") +# +# # => Arel::Nodes::Equality.new( +# # Arel::Attributes::Attribute.new(users, "name"), +# # Arel::Nodes::Casted.new( +# # "DHH", +# # Arel::Attributes::Attribute.new(users, "name") +# # ) +# # ) +# +# The resulting SQL fragment will look like this: +# +# "users"."name" = 'DHH' +# +# The constraint fragments can be used with regular ActiveRecord::Relation objects instead of a Hash. The +# following two examples show two ways of creating the same query. +# +# User.where(name: 'DHH') +# +# # SELECT "users".* FROM "users" WHERE "users"."name" = 'DHH' +# +# users = User.arel_table +# +# User.where(users[:name].eq('DHH')) +# +# # SELECT "users".* FROM "users" WHERE "users"."name" = 'DHH' +# +# == Functions +# +# Arel comes with built-in support for SQL functions like +COUNT+, +SUM+, +MIN+, +MAX+, and +AVG+. The +# Arel::Expressions module includes factory methods for the default functions. +# +# employees = Employee.arel_table +# +# Employee.select(employees[:department_id], employees[:salary].average).group(employees[:department_id]) +# +# # SELECT "employees"."department_id", AVG("employees"."salary") +# # FROM "employees" GROUP BY "employees"."department_id" +# +# It’s also possible to use custom functions by using the Arel::Nodes::NamedFunction node type. It accepts a +# function name and an array of parameters. +# +# Arel::Nodes::NamedFunction.new('date_trunc', [Arel::Nodes.build_quoted('day'), User.arel_table[:created_at]]) +# +# # date_trunc('day', "users"."created_at") +# +# == Quoting & bind params +# +# Values that you pass to Arel nodes need to be quoted or wrapped in bind params. This ensures they are properly +# converted into the correct format without introducing a possible SQL injection vulnerability. Most factory +# methods (like +eq+, +gt+, +lteq+, …) quote passed values automatically. When not using a factory method, it’s +# possible to convert a value and wrap it in an Arel::Nodes::Quoted node (if necessary) by calling +Arel::Nodes. +# build_quoted+. +# +# Arel::Nodes.build_quoted("foo") # 'foo' +# Arel::Nodes.build_quoted(12.3) # 12.3 +# +# Instead of quoting values and embedding them directly in the SQL statement, it’s also possible to create bind +# params. This keeps the actual values outside of the statement and allows using the prepared statement feature +# of some databases. +# +# attribute = ActiveRecord::Relation::QueryAttribute.new(:name, "DHH", ActiveRecord::Type::String.new) +# Arel::Nodes::BindParam.new(attribute) +# +# When ActiveRecord runs the query, bind params are replaced by placeholders (like +$1+) and the values are passed +# separately. +# +# == SQL Literals +# +# For cases where there is no way to represent a particular SQL fragment using Arel nodes, you can use an SQL +# literal. SQL literals are strings that Arel will treat “as is”. +# +# Arel.sql('LOWER("users"."name")').eq('dhh') +# +# # LOWER("users"."name") = 'dhh' +# +# Please keep in mind that passing data as raw SQL literals might introduce a possible SQL injection. However, +# `Arel.sql` supports binding parameters which will ensure proper quoting. This can be useful when you need to +# control the exact SQL you run, but you still have potentially user-supplied values. +# +# Arel.sql('LOWER("users"."name") = ?', 'dhh') +# +# # LOWER("users"."name") = 'dhh' +# +# You can also combine SQL literals. +# +# sql = Arel.sql('SELECT * FROM "users" WHERE ') +# sql += Arel.sql('LOWER("users"."name") = :name', name: 'dhh') +# sql += Arel.sql('AND "users"."age" > :age', age: 35) +# +# # SELECT * FROM "users" WHERE LOWER("users"."name") = 'dhh' AND "users"."age" > '35' +# +# pkg:gem/activerecord#lib/arel/nodes/node.rb:116 +class Arel::Nodes::Node + include ::Arel::FactoryMethods + + # Factory method to create an Nodes::And node. + # + # pkg:gem/activerecord#lib/arel/nodes/node.rb:135 + def and(right); end + + # pkg:gem/activerecord#lib/arel/nodes/node.rb:158 + def equality?; end + + # pkg:gem/activerecord#lib/arel/nodes/node.rb:155 + def fetch_attribute(&); end + + # pkg:gem/activerecord#lib/arel/nodes/node.rb:139 + def invert; end + + # Factory method to create a Nodes::Not node that has the recipient of + # the caller as a child. + # + # pkg:gem/activerecord#lib/arel/nodes/node.rb:122 + def not; end + + # Factory method to create a Nodes::Grouping node that has an Nodes::Or + # node as a child. + # + # pkg:gem/activerecord#lib/arel/nodes/node.rb:129 + def or(right); end + + # FIXME: this method should go away. I don't like people calling + # to_sql on non-head nodes. This forces us to walk the AST until we + # can find a node that has a "relation" member. + # + # Maybe we should just use `Table.engine`? :'( + # + # pkg:gem/activerecord#lib/arel/nodes/node.rb:148 + def to_sql(engine = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/arel/nodes/node_expression.rb:5 +class Arel::Nodes::NodeExpression < ::Arel::Nodes::Node + include ::Arel::Expressions + include ::Arel::Predications + include ::Arel::AliasPredication + include ::Arel::OrderPredications + include ::Arel::Math +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::Not < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:98 +class Arel::Nodes::NotEqual < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:101 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:106 +class Arel::Nodes::NotIn < ::Arel::Nodes::Binary + include ::Arel::Nodes::FetchAttribute + + # pkg:gem/activerecord#lib/arel/nodes/binary.rb:109 + def invert; end +end + +# pkg:gem/activerecord#lib/arel/nodes/regexp.rb:14 +class Arel::Nodes::NotRegexp < ::Arel::Nodes::Regexp; end + +# pkg:gem/activerecord#lib/arel/nodes/ordering.rb:15 +class Arel::Nodes::NullsFirst < ::Arel::Nodes::Ordering + # pkg:gem/activerecord#lib/arel/nodes/ordering.rb:16 + def reverse; end +end + +# pkg:gem/activerecord#lib/arel/nodes/ordering.rb:21 +class Arel::Nodes::NullsLast < ::Arel::Nodes::Ordering + # pkg:gem/activerecord#lib/arel/nodes/ordering.rb:22 + def reverse; end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::Offset < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::On < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::OptimizerHints < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/nary.rb:37 +class Arel::Nodes::Or < ::Arel::Nodes::Nary; end + +# pkg:gem/activerecord#lib/arel/nodes/ordering.rb:5 +class Arel::Nodes::Ordering < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/ordering.rb:6 + def nulls_first; end + + # pkg:gem/activerecord#lib/arel/nodes/ordering.rb:10 + def nulls_last; end +end + +# pkg:gem/activerecord#lib/arel/nodes/outer_join.rb:5 +class Arel::Nodes::OuterJoin < ::Arel::Nodes::Join; end + +# pkg:gem/activerecord#lib/arel/nodes/over.rb:5 +class Arel::Nodes::Over < ::Arel::Nodes::Binary + # pkg:gem/activerecord#lib/arel/nodes/over.rb:8 + def initialize(left, right = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/over.rb:12 + def operator; end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:56 +class Arel::Nodes::Overlaps < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:57 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/window.rb:114 +class Arel::Nodes::Preceding < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/window.rb:115 + def initialize(expr = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/arel/nodes/casted.rb:37 +class Arel::Nodes::Quoted < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:43 + def infinite?; end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:41 + def nil?; end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:39 + def value_before_type_cast; end + + # pkg:gem/activerecord#lib/arel/nodes/casted.rb:38 + def value_for_database; end +end + +# pkg:gem/activerecord#lib/arel/nodes/window.rb:97 +class Arel::Nodes::Range < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/window.rb:98 + def initialize(expr = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/arel/nodes/regexp.rb:5 +class Arel::Nodes::Regexp < ::Arel::Nodes::Binary + # pkg:gem/activerecord#lib/arel/nodes/regexp.rb:8 + def initialize(left, right, case_sensitive = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/regexp.rb:6 + def case_sensitive; end + + # pkg:gem/activerecord#lib/arel/nodes/regexp.rb:6 + def case_sensitive=(_arg0); end +end + +# pkg:gem/activerecord#lib/arel/nodes/right_outer_join.rb:5 +class Arel::Nodes::RightOuterJoin < ::Arel::Nodes::Join; end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:41 +class Arel::Nodes::RollUp < ::Arel::Nodes::Unary; end + +# pkg:gem/activerecord#lib/arel/nodes/window.rb:91 +class Arel::Nodes::Rows < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/window.rb:92 + def initialize(expr = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/arel/nodes/select_core.rb:5 +class Arel::Nodes::SelectCore < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:9 + def initialize(relation = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:64 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def comment; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def comment=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:52 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:24 + def from; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:28 + def from=(value); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:33 + def froms; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:32 + def froms=(value); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def groups; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def groups=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:45 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:7 + def havings; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:7 + def havings=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:7 + def optimizer_hints; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:7 + def optimizer_hints=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def projections; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def projections=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:7 + def set_quantifier; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:7 + def set_quantifier=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:7 + def source; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:7 + def source=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def wheres; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def wheres=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def windows; end + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:6 + def windows=(_arg0); end + + private + + # pkg:gem/activerecord#lib/arel/nodes/select_core.rb:35 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:5 +class Arel::Nodes::SelectStatement < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:9 + def initialize(relation = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:38 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:6 + def cores; end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:29 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:25 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def limit; end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def limit=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def lock; end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def lock=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def offset; end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def offset=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def orders; end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def orders=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def with; end + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:7 + def with=(_arg0); end + + private + + # pkg:gem/activerecord#lib/arel/nodes/select_statement.rb:19 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/sql_literal.rb:5 +class Arel::Nodes::SqlLiteral < ::String + include ::Arel::Expressions + include ::Arel::Predications + include ::Arel::AliasPredication + include ::Arel::OrderPredications + + # pkg:gem/activerecord#lib/arel/nodes/sql_literal.rb:13 + def initialize(string, retryable: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/sql_literal.rb:25 + def +(other); end + + # pkg:gem/activerecord#lib/arel/nodes/sql_literal.rb:18 + def encode_with(coder); end + + # pkg:gem/activerecord#lib/arel/nodes/sql_literal.rb:22 + def fetch_attribute(&); end + + # pkg:gem/activerecord#lib/arel/nodes/sql_literal.rb:11 + def retryable; end +end + +# pkg:gem/activerecord#lib/arel/nodes/string_join.rb:5 +class Arel::Nodes::StringJoin < ::Arel::Nodes::Join + # pkg:gem/activerecord#lib/arel/nodes/string_join.rb:6 + def initialize(left, right = T.unsafe(nil)); end +end + +# pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:38 +class Arel::Nodes::Subtraction < ::Arel::Nodes::InfixOperation + # pkg:gem/activerecord#lib/arel/nodes/infix_operation.rb:39 + def initialize(left, right); end +end + +# pkg:gem/activerecord#lib/arel/nodes/function.rb:36 +class Arel::Nodes::Sum < ::Arel::Nodes::Function; end + +# pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:5 +class Arel::Nodes::TableAlias < ::Arel::Nodes::Binary + # pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:10 + def [](name); end + + # pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:26 + def able_to_type_cast?; end + + # pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:6 + def name; end + + # pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:7 + def relation; end + + # pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:8 + def table_alias; end + + # pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:14 + def table_name; end + + # pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:30 + def to_cte; end + + # pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:18 + def type_cast_for_database(attr_name, value); end + + # pkg:gem/activerecord#lib/arel/nodes/table_alias.rb:22 + def type_for_attribute(name); end +end + +# pkg:gem/activerecord#lib/arel/nodes/true.rb:5 +class Arel::Nodes::True < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/true.rb:13 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/true.rb:10 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/true.rb:6 + def hash; end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary.rb:5 +class Arel::Nodes::Unary < ::Arel::Nodes::NodeExpression + # pkg:gem/activerecord#lib/arel/nodes/unary.rb:9 + def initialize(expr); end + + # pkg:gem/activerecord#lib/arel/nodes/unary.rb:22 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/unary.rb:18 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/unary.rb:6 + def expr; end + + # pkg:gem/activerecord#lib/arel/nodes/unary.rb:6 + def expr=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/unary.rb:14 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/unary.rb:7 + def value; end +end + +# pkg:gem/activerecord#lib/arel/nodes/unary_operation.rb:5 +class Arel::Nodes::UnaryOperation < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/unary_operation.rb:8 + def initialize(operator, operand); end + + # pkg:gem/activerecord#lib/arel/nodes/unary_operation.rb:6 + def operator; end +end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:122 +class Arel::Nodes::Union < ::Arel::Nodes::Binary; end + +# pkg:gem/activerecord#lib/arel/nodes/binary.rb:122 +class Arel::Nodes::UnionAll < ::Arel::Nodes::Binary; end + +# pkg:gem/activerecord#lib/arel/nodes/unqualified_column.rb:5 +class Arel::Nodes::UnqualifiedColumn < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/unqualified_column.rb:6 + def attribute; end + + # pkg:gem/activerecord#lib/arel/nodes/unqualified_column.rb:7 + def attribute=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/unqualified_column.rb:13 + def column; end + + # pkg:gem/activerecord#lib/arel/nodes/unqualified_column.rb:17 + def name; end + + # pkg:gem/activerecord#lib/arel/nodes/unqualified_column.rb:9 + def relation; end +end + +# pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:5 +class Arel::Nodes::UpdateStatement < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:8 + def initialize(relation = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:45 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def comment; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def comment=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:32 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def groups; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def groups=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:28 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def havings; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def havings=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def key; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def key=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def limit; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def limit=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def offset; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def offset=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def orders; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def orders=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def relation; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def relation=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def values; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def values=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def wheres; end + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:6 + def wheres=(_arg0); end + + private + + # pkg:gem/activerecord#lib/arel/nodes/update_statement.rb:22 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/values_list.rb:5 +class Arel::Nodes::ValuesList < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/values_list.rb:6 + def rows; end +end + +# pkg:gem/activerecord#lib/arel/nodes/case.rb:49 +class Arel::Nodes::When < ::Arel::Nodes::Binary; end + +# pkg:gem/activerecord#lib/arel/nodes/window.rb:5 +class Arel::Nodes::Window < ::Arel::Nodes::Node + # pkg:gem/activerecord#lib/arel/nodes/window.rb:8 + def initialize; end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:65 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:59 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:30 + def frame(expr); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:6 + def framing; end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:6 + def framing=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:55 + def hash; end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:14 + def order(*expr); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:6 + def orders; end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:6 + def orders=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:22 + def partition(*expr); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:6 + def partitions; end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:6 + def partitions=(_arg0); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:42 + def range(expr = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:34 + def rows(expr = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/arel/nodes/window.rb:50 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/nodes/with.rb:5 +class Arel::Nodes::With < ::Arel::Nodes::Unary + # pkg:gem/activerecord#lib/arel/nodes/with.rb:6 + def children; end +end + +# pkg:gem/activerecord#lib/arel/nodes/with.rb:9 +class Arel::Nodes::WithRecursive < ::Arel::Nodes::With; end + +# pkg:gem/activerecord#lib/arel/order_predications.rb:4 +module Arel::OrderPredications + # pkg:gem/activerecord#lib/arel/order_predications.rb:5 + def asc; end + + # pkg:gem/activerecord#lib/arel/order_predications.rb:9 + def desc; end +end + +# pkg:gem/activerecord#lib/arel/predications.rb:4 +module Arel::Predications + # pkg:gem/activerecord#lib/arel/predications.rb:37 + def between(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:215 + def concat(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:219 + def contains(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:147 + def does_not_match(other, escape = T.unsafe(nil), case_sensitive = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/predications.rb:159 + def does_not_match_all(others, escape = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/predications.rb:155 + def does_not_match_any(others, escape = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/predications.rb:151 + def does_not_match_regexp(other, case_sensitive = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/predications.rb:17 + def eq(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:33 + def eq_all(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:29 + def eq_any(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:175 + def gt(right); end + + # pkg:gem/activerecord#lib/arel/predications.rb:183 + def gt_all(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:179 + def gt_any(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:163 + def gteq(right); end + + # pkg:gem/activerecord#lib/arel/predications.rb:171 + def gteq_all(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:167 + def gteq_any(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:65 + def in(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:80 + def in_all(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:76 + def in_any(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:25 + def is_distinct_from(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:21 + def is_not_distinct_from(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:187 + def lt(right); end + + # pkg:gem/activerecord#lib/arel/predications.rb:195 + def lt_all(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:191 + def lt_any(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:199 + def lteq(right); end + + # pkg:gem/activerecord#lib/arel/predications.rb:207 + def lteq_all(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:203 + def lteq_any(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:131 + def matches(other, escape = T.unsafe(nil), case_sensitive = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/predications.rb:143 + def matches_all(others, escape = T.unsafe(nil), case_sensitive = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/predications.rb:139 + def matches_any(others, escape = T.unsafe(nil), case_sensitive = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/predications.rb:135 + def matches_regexp(other, case_sensitive = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/predications.rb:84 + def not_between(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:5 + def not_eq(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:13 + def not_eq_all(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:9 + def not_eq_any(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:112 + def not_in(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:127 + def not_in_all(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:123 + def not_in_any(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:223 + def overlaps(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:227 + def quoted_array(others); end + + # pkg:gem/activerecord#lib/arel/predications.rb:211 + def when(right); end + + private + + # pkg:gem/activerecord#lib/arel/predications.rb:237 + def grouping_all(method_id, others, *extras); end + + # pkg:gem/activerecord#lib/arel/predications.rb:232 + def grouping_any(method_id, others, *extras); end + + # pkg:gem/activerecord#lib/arel/predications.rb:246 + def infinity?(value); end + + # pkg:gem/activerecord#lib/arel/predications.rb:254 + def open_ended?(value); end + + # pkg:gem/activerecord#lib/arel/predications.rb:242 + def quoted_node(other); end + + # pkg:gem/activerecord#lib/arel/predications.rb:250 + def unboundable?(value); end +end + +# pkg:gem/activerecord#lib/arel/select_manager.rb:4 +class Arel::SelectManager < ::Arel::TreeManager + include ::Arel::Crud + + # pkg:gem/activerecord#lib/arel/select_manager.rb:9 + def initialize(table = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:48 + def as(other); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:257 + def comment(*values); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:24 + def constraints; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:159 + def distinct(value = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:168 + def distinct_on(value); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:218 + def except(other); end + + # Produces an Arel::Nodes::Exists node + # + # pkg:gem/activerecord#lib/arel/select_manager.rb:44 + def exists; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:90 + def from(table); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:103 + def froms; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:74 + def group(*columns); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:124 + def having(expr); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:214 + def intersect(other); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:107 + def join(relation, klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:249 + def join_sources; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:223 + def lateral(table_name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:19 + def limit; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:247 + def limit=(limit); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:52 + def lock(locking = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:65 + def locked; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:221 + def minus(other); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:28 + def offset; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:40 + def offset=(amount); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:69 + def on(*exprs); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:152 + def optimizer_hints(*hints); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:177 + def order(*expr); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:185 + def orders; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:120 + def outer_join(relation); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:135 + def project(*projections); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:144 + def projections; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:148 + def projections=(projections); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:32 + def skip(amount); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:253 + def source; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:239 + def take(limit); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:22 + def taken; end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:203 + def union(operation, other = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:189 + def where(expr); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:197 + def where_sql(engine = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:129 + def window(name); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:228 + def with(*subqueries); end + + private + + # pkg:gem/activerecord#lib/arel/select_manager.rb:267 + def collapse(exprs); end + + # pkg:gem/activerecord#lib/arel/select_manager.rb:14 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/select_manager.rb:7 +Arel::SelectManager::STRING_OR_SYMBOL_CLASS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activerecord#lib/arel/table.rb:4 +class Arel::Table + include ::Arel::FactoryMethods + include ::Arel::AliasPredication + + # pkg:gem/activerecord#lib/arel/table.rb:14 + def initialize(name, as: T.unsafe(nil), klass: T.unsafe(nil), type_caster: T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/table.rb:100 + def ==(other); end + + # pkg:gem/activerecord#lib/arel/table.rb:82 + def [](name, table = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/table.rb:110 + def able_to_type_cast?; end + + # pkg:gem/activerecord#lib/arel/table.rb:30 + def alias(name = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/table.rb:95 + def eql?(other); end + + # pkg:gem/activerecord#lib/arel/table.rb:34 + def from; end + + # pkg:gem/activerecord#lib/arel/table.rb:54 + def group(*columns); end + + # pkg:gem/activerecord#lib/arel/table.rb:88 + def hash; end + + # pkg:gem/activerecord#lib/arel/table.rb:78 + def having(expr); end + + # pkg:gem/activerecord#lib/arel/table.rb:38 + def join(relation, klass = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/table.rb:11 + def name; end + + # pkg:gem/activerecord#lib/arel/table.rb:11 + def name=(_arg0); end + + # pkg:gem/activerecord#lib/arel/table.rb:58 + def order(*expr); end + + # pkg:gem/activerecord#lib/arel/table.rb:50 + def outer_join(relation); end + + # pkg:gem/activerecord#lib/arel/table.rb:66 + def project(*things); end + + # pkg:gem/activerecord#lib/arel/table.rb:74 + def skip(amount); end + + # pkg:gem/activerecord#lib/arel/table.rb:12 + def table_alias; end + + # pkg:gem/activerecord#lib/arel/table.rb:70 + def take(amount); end + + # pkg:gem/activerecord#lib/arel/table.rb:102 + def type_cast_for_database(attr_name, value); end + + # pkg:gem/activerecord#lib/arel/table.rb:106 + def type_for_attribute(name); end + + # pkg:gem/activerecord#lib/arel/table.rb:62 + def where(condition); end + + private + + # pkg:gem/activerecord#lib/arel/table.rb:115 + def type_caster; end + + class << self + # pkg:gem/activerecord#lib/arel/table.rb:9 + def engine; end + + # pkg:gem/activerecord#lib/arel/table.rb:9 + def engine=(_arg0); end + end +end + +# pkg:gem/activerecord#lib/arel/tree_manager.rb:4 +class Arel::TreeManager + include ::Arel::FactoryMethods + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:45 + def ast; end + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:47 + def to_dot; end + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:53 + def to_sql(engine = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:60 + def initialize_copy(other); end +end + +# pkg:gem/activerecord#lib/arel/tree_manager.rb:7 +module Arel::TreeManager::StatementMethods + # pkg:gem/activerecord#lib/arel/tree_manager.rb:31 + def key; end + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:23 + def key=(key); end + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:13 + def offset(offset); end + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:18 + def order(*expr); end + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:8 + def take(limit); end + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:39 + def where(expr); end + + # pkg:gem/activerecord#lib/arel/tree_manager.rb:35 + def wheres=(exprs); end +end + +# pkg:gem/activerecord#lib/arel/update_manager.rb:4 +class Arel::UpdateManager < ::Arel::TreeManager + include ::Arel::TreeManager::StatementMethods + + # pkg:gem/activerecord#lib/arel/update_manager.rb:7 + def initialize(table = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/update_manager.rb:49 + def comment(value); end + + # pkg:gem/activerecord#lib/arel/update_manager.rb:33 + def group(columns); end + + # pkg:gem/activerecord#lib/arel/update_manager.rb:44 + def having(expr); end + + # pkg:gem/activerecord#lib/arel/update_manager.rb:18 + def set(values); end + + # UPDATE +table+ + # + # pkg:gem/activerecord#lib/arel/update_manager.rb:13 + def table(table); end +end + +# pkg:gem/activerecord#lib/arel.rb:29 +Arel::VERSION = T.let(T.unsafe(nil), String) + +# pkg:gem/activerecord#lib/arel/visitors/visitor.rb:4 +module Arel::Visitors; end + +# pkg:gem/activerecord#lib/arel/visitors/dot.rb:5 +class Arel::Visitors::Dot < ::Arel::Visitors::Visitor + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:19 + def initialize; end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:28 + def accept(object, collector); end + + private + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:260 + def edge(name); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:278 + def quote(string); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:282 + def to_dot; end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:246 + def visit(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:215 + def visit_ActiveModel_Attribute(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:182 + def visit_Arel_Attributes_Attribute(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:192 + def visit_Arel_Nodes_And(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:43 + def visit_Arel_Nodes_Binary(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:211 + def visit_Arel_Nodes_BindParam(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:236 + def visit_Arel_Nodes_Case(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:171 + def visit_Arel_Nodes_Casted(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:232 + def visit_Arel_Nodes_Comment(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:76 + def visit_Arel_Nodes_Count(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:105 + def visit_Arel_Nodes_CurrentRow(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:157 + def visit_Arel_Nodes_DeleteStatement(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:106 + def visit_Arel_Nodes_Distinct(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:108 + def visit_Arel_Nodes_Extract(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:34 + def visit_Arel_Nodes_Function(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:176 + def visit_Arel_Nodes_HomogeneousIn(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:53 + def visit_Arel_Nodes_InfixOperation(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:118 + def visit_Arel_Nodes_InsertStatement(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:112 + def visit_Arel_Nodes_NamedFunction(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:95 + def visit_Arel_Nodes_NamedWindow(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:65 + def visit_Arel_Nodes_NotRegexp(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:193 + def visit_Arel_Nodes_Or(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:67 + def visit_Arel_Nodes_Ordering(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:64 + def visit_Arel_Nodes_Regexp(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:125 + def visit_Arel_Nodes_SelectCore(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:137 + def visit_Arel_Nodes_SelectStatement(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:209 + def visit_Arel_Nodes_SqlLiteral(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:85 + def visit_Arel_Nodes_StringJoin(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:71 + def visit_Arel_Nodes_TableAlias(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:39 + def visit_Arel_Nodes_Unary(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:48 + def visit_Arel_Nodes_UnaryOperation(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:146 + def visit_Arel_Nodes_UpdateStatement(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:81 + def visit_Arel_Nodes_ValuesList(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:89 + def visit_Arel_Nodes_Window(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:194 + def visit_Arel_Nodes_With(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:167 + def visit_Arel_Table(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:225 + def visit_Array(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:206 + def visit_BigDecimal(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:200 + def visit_Date(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:201 + def visit_DateTime(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:204 + def visit_FalseClass(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:207 + def visit_Float(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:219 + def visit_Hash(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:205 + def visit_Integer(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:202 + def visit_NilClass(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:230 + def visit_Set(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:196 + def visit_String(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:208 + def visit_Symbol(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:199 + def visit_Time(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:203 + def visit_TrueClass(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:187 + def visit__children(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:102 + def visit__no_edges(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:59 + def visit__regexp(o); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:242 + def visit_edge(o, method); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:268 + def with_node(node); end +end + +# pkg:gem/activerecord#lib/arel/visitors/dot.rb:16 +class Arel::Visitors::Dot::Edge < ::Struct; end + +# pkg:gem/activerecord#lib/arel/visitors/dot.rb:6 +class Arel::Visitors::Dot::Node + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:9 + def initialize(name, id, fields = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:7 + def fields; end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:7 + def fields=(_arg0); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:7 + def id; end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:7 + def id=(_arg0); end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:7 + def name; end + + # pkg:gem/activerecord#lib/arel/visitors/dot.rb:7 + def name=(_arg0); end +end + +# pkg:gem/activerecord#lib/arel/visitors/mysql.rb:5 +class Arel::Visitors::MySQL < ::Arel::Visitors::ToSql + private + + # MySQL doesn't automatically create a temporary table for use subquery, so we have + # to give it some prompting in the form of a subsubquery. + # + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:93 + def build_subselect(key, o); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:89 + def prepare_delete_statement(o); end + + # In the simple case, MySQL allows us to place JOINs directly into the UPDATE + # query. However, this does not allow for LIMIT, OFFSET and ORDER. To support + # these, we must use a subquery. + # + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:81 + def prepare_update_statement(o); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:7 + def visit_Arel_Nodes_Bin(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:34 + def visit_Arel_Nodes_Concat(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:72 + def visit_Arel_Nodes_Cte(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:49 + def visit_Arel_Nodes_IsDistinctFrom(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:43 + def visit_Arel_Nodes_IsNotDistinctFrom(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:58 + def visit_Arel_Nodes_NotRegexp(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:62 + def visit_Arel_Nodes_NullsFirst(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:67 + def visit_Arel_Nodes_NullsLast(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:54 + def visit_Arel_Nodes_Regexp(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:29 + def visit_Arel_Nodes_SelectCore(o, collector); end + + # :'( + # To retrieve all rows from a certain offset up to the end of the result set, + # you can use some large number for the second parameter. + # https://dev.mysql.com/doc/refman/en/select.html + # + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:22 + def visit_Arel_Nodes_SelectStatement(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/mysql.rb:13 + def visit_Arel_Nodes_UnqualifiedColumn(o, collector); end +end + +# pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:5 +class Arel::Visitors::PostgreSQL < ::Arel::Visitors::ToSql + private + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:139 + def bind_block; end + + # Utilized by GroupingSet, Cube & RollUp visitors to + # handle grouping aggregation semantics + # + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:143 + def grouping_array_or_grouping_element(o, collector); end + + # In the simple case, PostgreSQL allows us to place FROM or JOINs directly into the UPDATE + # query. However, this does not allow for LIMIT, OFFSET and ORDER. To support + # these, we must use a subquery. + # + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:38 + def prepare_update_statement(o); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:98 + def visit_Arel_Nodes_Cube(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:88 + def visit_Arel_Nodes_DistinctOn(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:67 + def visit_Arel_Nodes_DoesNotMatch(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:93 + def visit_Arel_Nodes_GroupingElement(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:108 + def visit_Arel_Nodes_GroupingSet(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:118 + def visit_Arel_Nodes_InnerJoin(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:130 + def visit_Arel_Nodes_IsDistinctFrom(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:124 + def visit_Arel_Nodes_IsNotDistinctFrom(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:113 + def visit_Arel_Nodes_Lateral(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:56 + def visit_Arel_Nodes_Matches(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:83 + def visit_Arel_Nodes_NotRegexp(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:78 + def visit_Arel_Nodes_Regexp(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:103 + def visit_Arel_Nodes_RollUp(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:7 + def visit_Arel_Nodes_UpdateStatement(o, collector); end +end + +# pkg:gem/activerecord#lib/arel/visitors/postgresql.rb:136 +Arel::Visitors::PostgreSQL::BIND_BLOCK = T.let(T.unsafe(nil), Proc) + +# pkg:gem/activerecord#lib/arel/visitors/sqlite.rb:5 +class Arel::Visitors::SQLite < ::Arel::Visitors::ToSql + private + + # Queries used in UNION should not be wrapped by parentheses, + # because it is an invalid syntax in SQLite. + # + # pkg:gem/activerecord#lib/arel/visitors/sqlite.rb:86 + def infix_value_with_paren(o, collector, value, suppress_parens = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/visitors/sqlite.rb:35 + def prepare_update_statement(o); end + + # pkg:gem/activerecord#lib/arel/visitors/sqlite.rb:78 + def visit_Arel_Nodes_IsDistinctFrom(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/sqlite.rb:72 + def visit_Arel_Nodes_IsNotDistinctFrom(o, collector); end + + # Locks are not supported in SQLite + # + # pkg:gem/activerecord#lib/arel/visitors/sqlite.rb:63 + def visit_Arel_Nodes_Lock(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/sqlite.rb:67 + def visit_Arel_Nodes_SelectStatement(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/sqlite.rb:55 + def visit_Arel_Nodes_TableAlias(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/sqlite.rb:7 + def visit_Arel_Nodes_UpdateStatement(o, collector); end +end + +# pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:11 +class Arel::Visitors::ToSql < ::Arel::Visitors::Visitor + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:12 + def initialize(connection); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:17 + def compile(node, collector = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:986 + def aggregate(name, o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:744 + def bind_block; end + + # FIXME: we should probably have a 2-pass visitor for this + # + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:933 + def build_subselect(key, o); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:1007 + def collect_ctes(children, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:175 + def collect_nodes_for(nodes, collector, spacer, connector = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:877 + def collect_optimizer_hints(o, collector); end + + # Used by some visitors to enclose select queries in parentheses + # + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:971 + def grouping_parentheses(o, collector, always_wrap_selects = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:907 + def has_group_by_and_having?(o); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:899 + def has_join_sources?(o); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:903 + def has_limit_or_offset_or_orders?(o); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:947 + def infix_value(o, collector, value); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:953 + def infix_value_with_paren(o, collector, value, suppress_parens = T.unsafe(nil)); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:887 + def inject_join(list, collector, join_str); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:994 + def is_distinct_from(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:881 + def maybe_visit(thing, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:930 + def prepare_delete_statement(o); end + + # The default strategy for an UPDATE with joins is to use a subquery. This doesn't work + # on MySQL (even when aliasing the tables), but MySQL allows using JOIN directly in + # an UPDATE statement, so in the MySQL visitor we redefine this to do that. + # + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:914 + def prepare_update_statement(o); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:857 + def quote(value); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:867 + def quote_column_name(name); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:862 + def quote_table_name(name); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:982 + def require_parentheses?(o); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:872 + def sanitize_as_sql_comment(value); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:895 + def unboundable?(value); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:818 + def unsupported(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:746 + def visit_ActiveModel_Attribute(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:822 + def visit_ActiveSupport_Multibyte_Chars(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:823 + def visit_ActiveSupport_StringInquirer(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:736 + def visit_Arel_Attributes_Attribute(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:612 + def visit_Arel_Nodes_And(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:683 + def visit_Arel_Nodes_As(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:359 + def visit_Arel_Nodes_Ascending(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:620 + def visit_Arel_Nodes_Assignment(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:411 + def visit_Arel_Nodes_Avg(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:421 + def visit_Arel_Nodes_Between(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:182 + def visit_Arel_Nodes_Bin(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:750 + def visit_Arel_Nodes_BindParam(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:760 + def visit_Arel_Nodes_BoundSqlLiteral(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:689 + def visit_Arel_Nodes_Case(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:83 + def visit_Arel_Nodes_Casted(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:171 + def visit_Arel_Nodes_Comment(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:395 + def visit_Arel_Nodes_Count(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:722 + def visit_Arel_Nodes_Cte(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:292 + def visit_Arel_Nodes_CurrentRow(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:22 + def visit_Arel_Nodes_DeleteStatement(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:363 + def visit_Arel_Nodes_Descending(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:186 + def visit_Arel_Nodes_Distinct(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:190 + def visit_Arel_Nodes_DistinctOn(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:487 + def visit_Arel_Nodes_DoesNotMatch(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:713 + def visit_Arel_Nodes_Else(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:633 + def visit_Arel_Nodes_Equality(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:217 + def visit_Arel_Nodes_Except(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:78 + def visit_Arel_Nodes_Exists(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:390 + def visit_Arel_Nodes_Extract(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:92 + def visit_Arel_Nodes_False(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:247 + def visit_Arel_Nodes_Filter(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:282 + def visit_Arel_Nodes_Following(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:853 + def visit_Arel_Nodes_Fragments(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:522 + def visit_Arel_Nodes_FullOuterJoin(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:439 + def visit_Arel_Nodes_GreaterThan(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:427 + def visit_Arel_Nodes_GreaterThanOrEqual(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:378 + def visit_Arel_Nodes_Group(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:323 + def visit_Arel_Nodes_Grouping(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:332 + def visit_Arel_Nodes_HomogeneousIn(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:578 + def visit_Arel_Nodes_In(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:837 + def visit_Arel_Nodes_InfixOperation(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:543 + def visit_Arel_Nodes_InnerJoin(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:55 + def visit_Arel_Nodes_InsertStatement(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:212 + def visit_Arel_Nodes_Intersect(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:658 + def visit_Arel_Nodes_IsDistinctFrom(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:648 + def visit_Arel_Nodes_IsNotDistinctFrom(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:499 + def visit_Arel_Nodes_JoinSource(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:463 + def visit_Arel_Nodes_LessThan(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:451 + def visit_Arel_Nodes_LessThanOrEqual(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:314 + def visit_Arel_Nodes_Limit(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:319 + def visit_Arel_Nodes_Lock(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:475 + def visit_Arel_Nodes_Matches(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:403 + def visit_Arel_Nodes_Max(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:407 + def visit_Arel_Nodes_Min(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:382 + def visit_Arel_Nodes_NamedFunction(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:222 + def visit_Arel_Nodes_NamedWindow(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:559 + def visit_Arel_Nodes_Not(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:668 + def visit_Arel_Nodes_NotEqual(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:595 + def visit_Arel_Nodes_NotIn(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:514 + def visit_Arel_Nodes_NotRegexp(o, collector); end + + # NullsFirst is available on all but MySQL, where it is redefined. + # + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:368 + def visit_Arel_Nodes_NullsFirst(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:373 + def visit_Arel_Nodes_NullsLast(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:309 + def visit_Arel_Nodes_Offset(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:554 + def visit_Arel_Nodes_On(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:166 + def visit_Arel_Nodes_OptimizerHints(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:616 + def visit_Arel_Nodes_Or(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:529 + def visit_Arel_Nodes_OuterJoin(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:296 + def visit_Arel_Nodes_Over(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:272 + def visit_Arel_Nodes_Preceding(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:86 + def visit_Arel_Nodes_Quoted(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:263 + def visit_Arel_Nodes_Range(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:510 + def visit_Arel_Nodes_Regexp(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:536 + def visit_Arel_Nodes_RightOuterJoin(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:254 + def visit_Arel_Nodes_Rows(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:145 + def visit_Arel_Nodes_SelectCore(o, collector); end + + # The Oracle enhanced adapter uses this private method, + # see https://github.com/rsim/oracle-enhanced/issues/2186 + # + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:139 + def visit_Arel_Nodes_SelectOptions(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:116 + def visit_Arel_Nodes_SelectStatement(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:754 + def visit_Arel_Nodes_SqlLiteral(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:518 + def visit_Arel_Nodes_StringJoin(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:399 + def visit_Arel_Nodes_Sum(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:415 + def visit_Arel_Nodes_TableAlias(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:88 + def visit_Arel_Nodes_True(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:843 + def visit_Arel_Nodes_UnaryOperation(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:204 + def visit_Arel_Nodes_Union(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:208 + def visit_Arel_Nodes_UnionAll(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:718 + def visit_Arel_Nodes_UnqualifiedColumn(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:41 + def visit_Arel_Nodes_UpdateStatement(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:96 + def visit_Arel_Nodes_ValuesList(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:706 + def visit_Arel_Nodes_When(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:228 + def visit_Arel_Nodes_Window(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:194 + def visit_Arel_Nodes_With(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:199 + def visit_Arel_Nodes_WithRecursive(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:354 + def visit_Arel_SelectManager(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:564 + def visit_Arel_Table(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:848 + def visit_Array(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:824 + def visit_BigDecimal(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:825 + def visit_Class(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:826 + def visit_Date(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:827 + def visit_DateTime(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:828 + def visit_FalseClass(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:829 + def visit_Float(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:830 + def visit_Hash(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:814 + def visit_Integer(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:831 + def visit_NilClass(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:851 + def visit_Set(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:832 + def visit_String(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:833 + def visit_Symbol(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:834 + def visit_Time(o, collector); end + + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:835 + def visit_TrueClass(o, collector); end +end + +# pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:741 +Arel::Visitors::ToSql::BIND_BLOCK = T.let(T.unsafe(nil), Proc) + +# pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:5 +class Arel::Visitors::UnsupportedVisitError < ::StandardError + # pkg:gem/activerecord#lib/arel/visitors/to_sql.rb:6 + def initialize(object); end +end + +# pkg:gem/activerecord#lib/arel/visitors/visitor.rb:5 +class Arel::Visitors::Visitor + # pkg:gem/activerecord#lib/arel/visitors/visitor.rb:6 + def initialize; end + + # pkg:gem/activerecord#lib/arel/visitors/visitor.rb:10 + def accept(object, collector = T.unsafe(nil)); end + + private + + # pkg:gem/activerecord#lib/arel/visitors/visitor.rb:15 + def dispatch; end + + # pkg:gem/activerecord#lib/arel/visitors/visitor.rb:23 + def get_dispatch_cache; end + + # pkg:gem/activerecord#lib/arel/visitors/visitor.rb:27 + def visit(object, collector = T.unsafe(nil)); end + + class << self + # pkg:gem/activerecord#lib/arel/visitors/visitor.rb:17 + def dispatch_cache; end + end +end + +# pkg:gem/activerecord#lib/arel/window_predications.rb:4 +module Arel::WindowPredications + # pkg:gem/activerecord#lib/arel/window_predications.rb:5 + def over(expr = T.unsafe(nil)); end +end diff --git a/sorbet/rbi/gems/activestorage@8.1.4.1.rbi b/sorbet/rbi/gems/activestorage@8.1.4.1.rbi new file mode 100644 index 000000000..f2e50c782 --- /dev/null +++ b/sorbet/rbi/gems/activestorage@8.1.4.1.rbi @@ -0,0 +1,2755 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `activestorage` gem. +# Please instead update this file by running `bin/tapioca gem activestorage`. + + +class ActiveRecord::Base + include ::ActiveModel::ForbiddenAttributesProtection + include ::ActiveModel::AttributeAssignment + include ::ActiveModel::Access + include ::ActiveModel::Serialization + extend ::ActiveRecord::SignedId::DeprecateSignedIdVerifierSecret +end + +# :markup: markdown +# :include: ../README.md +# +# pkg:gem/activestorage#lib/active_storage/gem_version.rb:3 +module ActiveStorage + extend ::ActiveSupport::Autoload + + # pkg:gem/activestorage#lib/active_storage.rb:59 + def analyzers; end + + # pkg:gem/activestorage#lib/active_storage.rb:59 + def analyzers=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:65 + def binary_content_type; end + + # pkg:gem/activestorage#lib/active_storage.rb:65 + def binary_content_type=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:67 + def content_types_allowed_inline; end + + # pkg:gem/activestorage#lib/active_storage.rb:67 + def content_types_allowed_inline=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:66 + def content_types_to_serve_as_binary; end + + # pkg:gem/activestorage#lib/active_storage.rb:66 + def content_types_to_serve_as_binary=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:366 + def draw_routes; end + + # pkg:gem/activestorage#lib/active_storage.rb:366 + def draw_routes=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:385 + def ffmpeg_allowed_formats; end + + # pkg:gem/activestorage#lib/active_storage.rb:385 + def ffmpeg_allowed_formats=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:50 + def logger; end + + # pkg:gem/activestorage#lib/active_storage.rb:50 + def logger=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:61 + def paths; end + + # pkg:gem/activestorage#lib/active_storage.rb:61 + def paths=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:58 + def previewers; end + + # pkg:gem/activestorage#lib/active_storage.rb:58 + def previewers=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:56 + def queues; end + + # pkg:gem/activestorage#lib/active_storage.rb:56 + def queues=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:367 + def resolve_model_to_route; end + + # pkg:gem/activestorage#lib/active_storage.rb:367 + def resolve_model_to_route=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:365 + def routes_prefix; end + + # pkg:gem/activestorage#lib/active_storage.rb:365 + def routes_prefix=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:358 + def service_urls_expire_in; end + + # pkg:gem/activestorage#lib/active_storage.rb:358 + def service_urls_expire_in=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:357 + def streaming_chunk_max_size; end + + # pkg:gem/activestorage#lib/active_storage.rb:357 + def streaming_chunk_max_size=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:69 + def supported_image_processing_methods; end + + # pkg:gem/activestorage#lib/active_storage.rb:69 + def supported_image_processing_methods=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:359 + def touch_attachment_records; end + + # pkg:gem/activestorage#lib/active_storage.rb:359 + def touch_attachment_records=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:369 + def track_variants; end + + # pkg:gem/activestorage#lib/active_storage.rb:369 + def track_variants=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:355 + def unsupported_image_processing_arguments; end + + # pkg:gem/activestorage#lib/active_storage.rb:355 + def unsupported_image_processing_arguments=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:360 + def urls_expire_in; end + + # pkg:gem/activestorage#lib/active_storage.rb:360 + def urls_expire_in=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:63 + def variable_content_types; end + + # pkg:gem/activestorage#lib/active_storage.rb:63 + def variable_content_types=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:52 + def variant_processor; end + + # pkg:gem/activestorage#lib/active_storage.rb:52 + def variant_processor=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:54 + def variant_transformer; end + + # pkg:gem/activestorage#lib/active_storage.rb:54 + def variant_transformer=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:51 + def verifier; end + + # pkg:gem/activestorage#lib/active_storage.rb:51 + def verifier=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:383 + def video_preview_arguments; end + + # pkg:gem/activestorage#lib/active_storage.rb:383 + def video_preview_arguments=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:64 + def web_image_content_types; end + + # pkg:gem/activestorage#lib/active_storage.rb:64 + def web_image_content_types=(val); end + + class << self + # pkg:gem/activestorage#lib/active_storage.rb:59 + def analyzers; end + + # pkg:gem/activestorage#lib/active_storage.rb:59 + def analyzers=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:65 + def binary_content_type; end + + # pkg:gem/activestorage#lib/active_storage.rb:65 + def binary_content_type=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:371 + def checksum_implementation; end + + # pkg:gem/activestorage#lib/active_storage.rb:371 + def checksum_implementation=(_arg0); end + + # pkg:gem/activestorage#lib/active_storage.rb:67 + def content_types_allowed_inline; end + + # pkg:gem/activestorage#lib/active_storage.rb:67 + def content_types_allowed_inline=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:66 + def content_types_to_serve_as_binary; end + + # pkg:gem/activestorage#lib/active_storage.rb:66 + def content_types_to_serve_as_binary=(val); end + + # pkg:gem/activestorage#lib/active_storage/deprecator.rb:4 + def deprecator; end + + # pkg:gem/activestorage#lib/active_storage.rb:366 + def draw_routes; end + + # pkg:gem/activestorage#lib/active_storage.rb:366 + def draw_routes=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:385 + def ffmpeg_allowed_formats; end + + # pkg:gem/activestorage#lib/active_storage.rb:385 + def ffmpeg_allowed_formats=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:387 + def ffmpeg_format_whitelist_arguments; end + + # Returns the currently loaded version of Active Storage as a +Gem::Version+. + # + # pkg:gem/activestorage#lib/active_storage/gem_version.rb:5 + def gem_version; end + + # pkg:gem/activestorage#lib/active_storage.rb:50 + def logger; end + + # pkg:gem/activestorage#lib/active_storage.rb:50 + def logger=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:61 + def paths; end + + # pkg:gem/activestorage#lib/active_storage.rb:61 + def paths=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:58 + def previewers; end + + # pkg:gem/activestorage#lib/active_storage.rb:58 + def previewers=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:56 + def queues; end + + # pkg:gem/activestorage#lib/active_storage.rb:56 + def queues=(val); end + + # pkg:gem/activestorage#lib/active_storage/engine.rb:24 + def railtie_helpers_paths; end + + # pkg:gem/activestorage#lib/active_storage/engine.rb:24 + def railtie_namespace; end + + # pkg:gem/activestorage#lib/active_storage/engine.rb:24 + def railtie_routes_url_helpers(include_path_helpers = T.unsafe(nil)); end + + # Raises when the installed mini_magick cannot apply the shipped ImageMagick security policy. + # Called before Active Storage hands untrusted content to ImageMagick. + # + # pkg:gem/activestorage#lib/active_storage/image_magick.rb:53 + def require_securable_mini_magick!; end + + # pkg:gem/activestorage#lib/active_storage.rb:367 + def resolve_model_to_route; end + + # pkg:gem/activestorage#lib/active_storage.rb:367 + def resolve_model_to_route=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:365 + def routes_prefix; end + + # pkg:gem/activestorage#lib/active_storage.rb:365 + def routes_prefix=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:358 + def service_urls_expire_in; end + + # pkg:gem/activestorage#lib/active_storage.rb:358 + def service_urls_expire_in=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:357 + def streaming_chunk_max_size; end + + # pkg:gem/activestorage#lib/active_storage.rb:357 + def streaming_chunk_max_size=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:380 + def streaming_max_ranges; end + + # pkg:gem/activestorage#lib/active_storage.rb:380 + def streaming_max_ranges=(_arg0); end + + # pkg:gem/activestorage#lib/active_storage.rb:69 + def supported_image_processing_methods; end + + # pkg:gem/activestorage#lib/active_storage.rb:69 + def supported_image_processing_methods=(val); end + + # pkg:gem/activestorage#lib/active_storage/engine.rb:24 + def table_name_prefix; end + + # pkg:gem/activestorage#lib/active_storage.rb:359 + def touch_attachment_records; end + + # pkg:gem/activestorage#lib/active_storage.rb:359 + def touch_attachment_records=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:369 + def track_variants; end + + # pkg:gem/activestorage#lib/active_storage.rb:369 + def track_variants=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:355 + def unsupported_image_processing_arguments; end + + # pkg:gem/activestorage#lib/active_storage.rb:355 + def unsupported_image_processing_arguments=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:360 + def urls_expire_in; end + + # pkg:gem/activestorage#lib/active_storage.rb:360 + def urls_expire_in=(val); end + + # pkg:gem/activestorage#lib/active_storage/engine.rb:24 + def use_relative_model_naming?; end + + # pkg:gem/activestorage#lib/active_storage.rb:63 + def variable_content_types; end + + # pkg:gem/activestorage#lib/active_storage.rb:63 + def variable_content_types=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:52 + def variant_processor; end + + # pkg:gem/activestorage#lib/active_storage.rb:52 + def variant_processor=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:54 + def variant_transformer; end + + # pkg:gem/activestorage#lib/active_storage.rb:54 + def variant_transformer=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:51 + def verifier; end + + # pkg:gem/activestorage#lib/active_storage.rb:51 + def verifier=(val); end + + # Returns the currently loaded version of Active Storage as a +Gem::Version+. + # + # pkg:gem/activestorage#lib/active_storage/version.rb:7 + def version; end + + # pkg:gem/activestorage#lib/active_storage.rb:383 + def video_preview_arguments; end + + # pkg:gem/activestorage#lib/active_storage.rb:383 + def video_preview_arguments=(val); end + + # pkg:gem/activestorage#lib/active_storage.rb:64 + def web_image_content_types; end + + # pkg:gem/activestorage#lib/active_storage.rb:64 + def web_image_content_types=(val); end + end +end + +class ActiveStorage::AnalyzeJob < ::ActiveStorage::BaseJob + def perform(blob); end + + class << self + private + + def __class_attr_queue_name; end + def __class_attr_queue_name=(new_value); end + def __class_attr_rescue_handlers; end + def __class_attr_rescue_handlers=(new_value); end + end +end + +# = Active Storage \Analyzer +# +# This is an abstract base class for analyzers, which extract metadata from blobs. See +# ActiveStorage::Analyzer::VideoAnalyzer for an example of a concrete subclass. +# +# pkg:gem/activestorage#lib/active_storage/analyzer.rb:8 +class ActiveStorage::Analyzer + # pkg:gem/activestorage#lib/active_storage/analyzer.rb:23 + def initialize(blob); end + + # pkg:gem/activestorage#lib/active_storage/analyzer.rb:9 + def blob; end + + # Override this method in a concrete subclass. Have it return a Hash of metadata. + # + # pkg:gem/activestorage#lib/active_storage/analyzer.rb:28 + def metadata; end + + private + + # Downloads the blob to a tempfile on disk. Yields the tempfile. + # + # pkg:gem/activestorage#lib/active_storage/analyzer.rb:34 + def download_blob_to_tempfile(&block); end + + # pkg:gem/activestorage#lib/active_storage/analyzer.rb:46 + def instrument(analyzer, &block); end + + # pkg:gem/activestorage#lib/active_storage/analyzer.rb:38 + def logger; end + + # pkg:gem/activestorage#lib/active_storage/analyzer.rb:42 + def tmpdir; end + + class << self + # Implement this method in a concrete subclass. Have it return true when given a blob from which + # the analyzer can extract metadata. + # + # pkg:gem/activestorage#lib/active_storage/analyzer.rb:13 + def accept?(blob); end + + # Implement this method in concrete subclasses. It will determine if blob analysis + # should be done in a job or performed inline. By default, analysis is enqueued in a job. + # + # pkg:gem/activestorage#lib/active_storage/analyzer.rb:19 + def analyze_later?; end + end +end + +# = Active Storage Audio \Analyzer +# +# Extracts duration (seconds), bit_rate (bits/s), sample_rate (hertz) and tags (internal metadata) from an audio blob. +# +# Example: +# +# ActiveStorage::Analyzer::AudioAnalyzer.new(blob).metadata +# # => { duration: 5.0, bit_rate: 320340, sample_rate: 44100, tags: { encoder: "Lavc57.64", ... } } +# +# This analyzer requires the {FFmpeg}[https://www.ffmpeg.org] system library, which is not provided by \Rails. +# +# pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:14 +class ActiveStorage::Analyzer::AudioAnalyzer < ::ActiveStorage::Analyzer + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:19 + def metadata; end + + private + + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:44 + def audio_stream; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:29 + def bit_rate; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:24 + def duration; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:76 + def ffprobe_path; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:52 + def probe; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:56 + def probe_from(file); end + + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:34 + def sample_rate; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:48 + def streams; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:39 + def tags; end + + class << self + # pkg:gem/activestorage#lib/active_storage/analyzer/audio_analyzer.rb:15 + def accept?(blob); end + end +end + +# = Active Storage Image \Analyzer +# +# This is an abstract base class for image analyzers, which extract width and height from an image blob. +# +# If the image contains EXIF data indicating its angle is 90 or 270 degrees, its width and height are swapped for convenience. +# +# Example: +# +# ActiveStorage::Analyzer::ImageAnalyzer::ImageMagick.new(blob).metadata +# # => { width: 4104, height: 2736 } +# +# pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer.rb:14 +class ActiveStorage::Analyzer::ImageAnalyzer < ::ActiveStorage::Analyzer + extend ::ActiveSupport::Autoload + + # pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer.rb:24 + def metadata; end + + class << self + # pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer.rb:20 + def accept?(blob); end + end +end + +# This analyzer relies on the third-party {MiniMagick}[https://github.com/minimagick/minimagick] gem. MiniMagick requires +# the {ImageMagick}[http://www.imagemagick.org] system library. +# +# pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer/image_magick.rb:8 +class ActiveStorage::Analyzer::ImageAnalyzer::ImageMagick < ::ActiveStorage::Analyzer::ImageAnalyzer + private + + # pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer/image_magick.rb:14 + def read_image; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer/image_magick.rb:39 + def rotated_image?(image); end + + class << self + # pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer/image_magick.rb:9 + def accept?(blob); end + end +end + +# This analyzer relies on the third-party {ruby-vips}[https://github.com/libvips/ruby-vips] gem. Ruby-vips requires +# the {libvips}[https://libvips.github.io/libvips/] system library. +# +# pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer/vips.rb:8 +class ActiveStorage::Analyzer::ImageAnalyzer::Vips < ::ActiveStorage::Analyzer::ImageAnalyzer + private + + # pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer/vips.rb:14 + def read_image; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer/vips.rb:44 + def rotated_image?(image); end + + class << self + # pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer/vips.rb:9 + def accept?(blob); end + end +end + +# pkg:gem/activestorage#lib/active_storage/analyzer/image_analyzer/vips.rb:43 +ActiveStorage::Analyzer::ImageAnalyzer::Vips::ROTATIONS = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activestorage#lib/active_storage/analyzer/null_analyzer.rb:4 +class ActiveStorage::Analyzer::NullAnalyzer < ::ActiveStorage::Analyzer + # pkg:gem/activestorage#lib/active_storage/analyzer/null_analyzer.rb:13 + def metadata; end + + class << self + # pkg:gem/activestorage#lib/active_storage/analyzer/null_analyzer.rb:5 + def accept?(blob); end + + # pkg:gem/activestorage#lib/active_storage/analyzer/null_analyzer.rb:9 + def analyze_later?; end + end +end + +# = Active Storage Video \Analyzer +# +# Extracts the following from a video blob: +# +# * Width (pixels) +# * Height (pixels) +# * Duration (seconds) +# * Angle (degrees) +# * Display aspect ratio +# * Audio (true if file has an audio channel, false if not) +# * Video (true if file has an video channel, false if not) +# +# Example: +# +# ActiveStorage::Analyzer::VideoAnalyzer.new(blob).metadata +# # => { width: 640.0, height: 480.0, duration: 5.0, angle: 0, display_aspect_ratio: [4, 3], audio: true, video: true } +# +# When a video's angle is 90, -90, 270 or -270 degrees, its width and height are automatically swapped for convenience. +# +# This analyzer requires the {FFmpeg}[https://www.ffmpeg.org] system library, which is not provided by \Rails. +# +# pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:24 +class ActiveStorage::Analyzer::VideoAnalyzer < ::ActiveStorage::Analyzer + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:29 + def metadata; end + + private + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:55 + def angle; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:82 + def audio?; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:120 + def audio_stream; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:90 + def computed_height; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:128 + def container; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:67 + def display_aspect_ratio; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:104 + def display_height_scale; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:63 + def display_matrix; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:50 + def duration; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:100 + def encoded_height; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:96 + def encoded_width; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:156 + def ffprobe_path; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:42 + def height; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:132 + def probe; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:136 + def probe_from(file); end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:78 + def rotated?; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:112 + def side_data; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:124 + def streams; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:108 + def tags; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:86 + def video?; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:116 + def video_stream; end + + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:34 + def width; end + + class << self + # pkg:gem/activestorage#lib/active_storage/analyzer/video_analyzer.rb:25 + def accept?(blob); end + end +end + +# = Active Storage \Attached +# +# Abstract base class for the concrete ActiveStorage::Attached::One and ActiveStorage::Attached::Many +# classes that both provide proxy access to the blob association for a record. +# +# pkg:gem/activestorage#lib/active_storage/attached.rb:9 +class ActiveStorage::Attached + # pkg:gem/activestorage#lib/active_storage/attached.rb:12 + def initialize(name, record); end + + # pkg:gem/activestorage#lib/active_storage/attached.rb:10 + def name; end + + # pkg:gem/activestorage#lib/active_storage/attached.rb:10 + def record; end + + private + + # pkg:gem/activestorage#lib/active_storage/attached.rb:17 + def change; end +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes.rb:4 +module ActiveStorage::Attached::Changes + extend ::ActiveSupport::Autoload +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:4 +class ActiveStorage::Attached::Changes::CreateMany + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:8 + def initialize(name, record, attachables, pending_uploads: T.unsafe(nil)); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:5 + def attachables; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:15 + def attachments; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:19 + def blobs; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:5 + def name; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:5 + def pending_uploads; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:6 + def record; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:6 + def record=(_arg0); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:27 + def save; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:23 + def upload; end + + private + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:45 + def assign_associated_attachments; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:37 + def build_subchange_from(attachable); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:53 + def persisted_or_new_attachments; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:49 + def reset_associated_blobs; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:33 + def subchanges; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_many.rb:41 + def subchanges_without_blobs; end +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:7 +class ActiveStorage::Attached::Changes::CreateOne + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:11 + def initialize(name, record, attachable); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:8 + def attachable; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:16 + def attachment; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:20 + def blob; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:8 + def name; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:9 + def record; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:9 + def record=(_arg0); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:49 + def save; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:24 + def upload; end + + private + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:121 + def attachment_service_name; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:65 + def build_attachment; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:59 + def find_attachment; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:55 + def find_or_build_attachment; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one.rb:69 + def find_or_build_blob; end +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes/create_one_of_many.rb:4 +class ActiveStorage::Attached::Changes::CreateOneOfMany < ::ActiveStorage::Attached::Changes::CreateOne + private + + # pkg:gem/activestorage#lib/active_storage/attached/changes/create_one_of_many.rb:6 + def find_attachment; end +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes/delete_many.rb:4 +class ActiveStorage::Attached::Changes::DeleteMany + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_many.rb:8 + def initialize(name, record); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_many.rb:12 + def attachables; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_many.rb:16 + def attachments; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_many.rb:20 + def blobs; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_many.rb:5 + def name; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_many.rb:6 + def record; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_many.rb:6 + def record=(_arg0); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_many.rb:24 + def save; end +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes/delete_one.rb:4 +class ActiveStorage::Attached::Changes::DeleteOne + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_one.rb:8 + def initialize(name, record); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_one.rb:12 + def attachment; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_one.rb:5 + def name; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_one.rb:6 + def record; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_one.rb:6 + def record=(_arg0); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/delete_one.rb:16 + def save; end +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes/detach_many.rb:4 +class ActiveStorage::Attached::Changes::DetachMany + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_many.rb:7 + def initialize(name, record, attachments); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_many.rb:5 + def attachments; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_many.rb:11 + def detach; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_many.rb:5 + def name; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_many.rb:5 + def record; end +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes/detach_one.rb:4 +class ActiveStorage::Attached::Changes::DetachOne + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_one.rb:7 + def initialize(name, record, attachment); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_one.rb:5 + def attachment; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_one.rb:11 + def detach; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_one.rb:5 + def name; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_one.rb:5 + def record; end + + private + + # pkg:gem/activestorage#lib/active_storage/attached/changes/detach_one.rb:19 + def reset; end +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes/purge_many.rb:4 +class ActiveStorage::Attached::Changes::PurgeMany + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_many.rb:7 + def initialize(name, record, attachments); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_many.rb:5 + def attachments; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_many.rb:5 + def name; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_many.rb:11 + def purge; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_many.rb:16 + def purge_later; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_many.rb:5 + def record; end + + private + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_many.rb:22 + def reset; end +end + +# pkg:gem/activestorage#lib/active_storage/attached/changes/purge_one.rb:4 +class ActiveStorage::Attached::Changes::PurgeOne + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_one.rb:7 + def initialize(name, record, attachment); end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_one.rb:5 + def attachment; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_one.rb:5 + def name; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_one.rb:11 + def purge; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_one.rb:16 + def purge_later; end + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_one.rb:5 + def record; end + + private + + # pkg:gem/activestorage#lib/active_storage/attached/changes/purge_one.rb:22 + def reset; end +end + +# = Active Storage \Attached \Many +# +# Decorated proxy object representing of multiple attachments to a model. +# +# pkg:gem/activestorage#lib/active_storage/attached/many.rb:7 +class ActiveStorage::Attached::Many < ::ActiveStorage::Attached + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:70 + def as_json(options = T.unsafe(nil)); end + + # Attaches one or more +attachables+ to the record. + # + # If the record is persisted and unchanged, the attachments are saved to + # the database immediately. Otherwise, they'll be saved to the DB when the + # record is next saved. + # + # document.images.attach(params[:images]) # Array of ActionDispatch::Http::UploadedFile objects + # document.images.attach(params[:signed_blob_id]) # Signed reference to blob from direct upload + # document.images.attach(io: File.open("/path/to/racecar.jpg"), filename: "racecar.jpg", content_type: "image/jpeg") + # document.images.attach([ first_blob, second_blob ]) + # + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:51 + def attach(*attachables); end + + # Returns true if any attachments have been made. + # + # class Gallery < ApplicationRecord + # has_many_attached :photos + # end + # + # Gallery.new.photos.attached? # => false + # + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:66 + def attached?; end + + # Returns all the associated attachment records. + # + # All methods called on this proxy object that aren't listed here will automatically be delegated to +attachments+. + # + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:32 + def attachments; end + + # Returns all attached blobs. + # + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:37 + def blobs; end + + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:25 + def detach(*, **, &); end + + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:27 + def method_missing(method, *, **, &); end + + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:13 + def purge(*, **, &); end + + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:19 + def purge_later(*, **, &); end + + private + + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:79 + def detach_many; end + + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:75 + def purge_many; end + + # pkg:gem/activestorage#lib/active_storage/attached/many.rb:27 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end +end + +# = Active Storage \Attached \Model +# +# Provides the class-level DSL for declaring an Active Record model's attachments. +# +# pkg:gem/activestorage#lib/active_storage/attached/model.rb:9 +module ActiveStorage::Attached::Model + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveStorage::Attached::Model::ClassMethods + + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:283 + def attachment_changes; end + + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:281 + def attachment_changes=(_arg0); end + + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:301 + def becomes(klass); end + + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:287 + def changed_for_autosave?; end + + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:297 + def reload(*); end + + private + + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:291 + def initialize_dup(*); end + + class << self + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:263 + def validate_service_configuration(service_name, model_class, association_name); end + + private + + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:274 + def validate_global_service_configuration(model_class); end + end +end + +# pkg:gem/activestorage#lib/active_storage/attached/model.rb:54 +module ActiveStorage::Attached::Model::ClassMethods + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:210 + def has_many_attached(name, dependent: T.unsafe(nil), service: T.unsafe(nil), strict_loading: T.unsafe(nil)); end + + # pkg:gem/activestorage#lib/active_storage/attached/model.rb:108 + def has_one_attached(name, dependent: T.unsafe(nil), service: T.unsafe(nil), strict_loading: T.unsafe(nil)); end +end + +# = Active Storage \Attached \One +# +# Representation of a single attachment to a model. +# +# pkg:gem/activestorage#lib/active_storage/attached/one.rb:7 +class ActiveStorage::Attached::One < ::ActiveStorage::Attached + # Returns the attachment record's JSON representation, or +nil+ when no + # attachment is present. + # + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:50 + def as_json(options = T.unsafe(nil)); end + + # Attaches an +attachable+ to the record. + # + # If the record is persisted and unchanged, the attachment is saved to + # the database immediately. Otherwise, it'll be saved to the DB when the + # record is next saved. + # + # person.avatar.attach(params[:avatar]) # ActionDispatch::Http::UploadedFile object + # person.avatar.attach(params[:signed_blob_id]) # Signed reference to blob from direct upload + # person.avatar.attach(io: File.open("/path/to/face.jpg"), filename: "face.jpg", content_type: "image/jpeg") + # person.avatar.attach(avatar_blob) # ActiveStorage::Blob object + # + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:64 + def attach(attachable); end + + # Returns +true+ if an attachment has been made. + # + # class User < ApplicationRecord + # has_one_attached :avatar + # end + # + # User.new.avatar.attached? # => false + # + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:79 + def attached?; end + + # Returns the associated attachment record. + # + # You don't have to call this method to access the attachment's methods as + # they are all available at the model level. + # + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:33 + def attachment; end + + # Returns +true+ if an attachment is not attached. + # + # class User < ApplicationRecord + # has_one_attached :avatar + # end + # + # User.new.avatar.blank? # => true + # + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:44 + def blank?; end + + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:25 + def detach(*, **, &); end + + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:27 + def method_missing(method, *, **, &); end + + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:13 + def purge(*, **, &); end + + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:19 + def purge_later(*, **, &); end + + private + + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:88 + def detach_one; end + + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:84 + def purge_one; end + + # pkg:gem/activestorage#lib/active_storage/attached/one.rb:27 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end +end + +class ActiveStorage::Attachment < ::ActiveStorage::Record + include ::ActiveStorage::Attachment::GeneratedAttributeMethods + include ::ActiveStorage::Attachment::GeneratedAssociationMethods + + def _run_commit_callbacks(&block); end + def _run_create_callbacks(&block); end + def _run_destroy_callbacks(&block); end + def _run_save_callbacks(&block); end + def _run_touch_callbacks(&block); end + def _run_update_callbacks(&block); end + def autosave_associated_records_for_blob(*args); end + def autosave_associated_records_for_record(*args); end + def method_missing(method, *, **, &); end + def preview(transformations); end + def purge; end + def purge_later; end + def representation(transformations); end + def signed_id(*, **, &); end + def validate_associated_records_for_blob(*args); end + def variant(transformations); end + + private + + def analyze_blob_later; end + def dependent; end + def mirror_blob_later; end + def named_variants; end + def purge_dependent_blob; end + def respond_to_missing?(name, include_private = T.unsafe(nil)); end + def transform_variants_later; end + def transformations_by_name(transformations); end + + class << self + def with_all_variant_records(*args, **); end + + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr__reflections; end + def __class_attr__reflections=(new_value); end + def __class_attr__validators; end + def __class_attr__validators=(new_value); end + def __class_attr_defined_enums; end + def __class_attr_defined_enums=(new_value); end + end +end + +module ActiveStorage::Attachment::GeneratedAssociationMethods + def blob; end + def blob=(value); end + def blob_changed?; end + def blob_previously_changed?; end + def build_blob(*args, &block); end + def create_blob(*args, &block); end + def create_blob!(*args, &block); end + def record; end + def record=(value); end + def record_changed?; end + def record_previously_changed?; end + def reload_blob; end + def reload_record; end + def reset_blob; end + def reset_record; end +end + +module ActiveStorage::Attachment::GeneratedAttributeMethods; end + +class ActiveStorage::BaseController < ::ActionController::Base + include ::ActiveStorage::SetCurrent + + private + + def _layout(lookup_context, formats, keys); end + + class << self + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr_config; end + def __class_attr_config=(new_value); end + def __class_attr_etag_with_template_digest; end + def __class_attr_etag_with_template_digest=(new_value); end + def __class_attr_middleware_stack; end + def __class_attr_middleware_stack=(new_value); end + end +end + +class ActiveStorage::BaseJob < ::ActiveJob::Base; end + +class ActiveStorage::Blob < ::ActiveStorage::Record + include ::ActiveStorage::Blob::GeneratedAttributeMethods + include ::ActiveStorage::Blob::GeneratedAssociationMethods + include ::ActiveStorage::Blob::Analyzable + include ::ActiveStorage::Blob::Identifiable + include ::ActiveStorage::Blob::Representable + include ::ActiveStorage::Blob::Servable + include ::ActionText::Attachable + extend ::ActionText::Attachable::ClassMethods + + def _run_commit_callbacks(&block); end + def _run_create_callbacks(&block); end + def _run_destroy_callbacks(&block); end + def _run_initialize_callbacks(&block); end + def _run_save_callbacks(&block); end + def _run_update_callbacks(&block); end + def attachable_plain_text_representation(caption = T.unsafe(nil)); end + def audio?; end + def autosave_associated_records_for_attachments(*args); end + def autosave_associated_records_for_preview_image_attachment(*args); end + def autosave_associated_records_for_preview_image_blob(*args); end + def autosave_associated_records_for_variant_records(*args); end + def compose(keys); end + def custom_metadata; end + def custom_metadata=(metadata); end + def delete; end + def download(&block); end + def download_chunk(range); end + def filename; end + def image?; end + def key; end + def mirror_later; end + def open(tmpdir: T.unsafe(nil), &block); end + def previewable_attachable?; end + def purge; end + def purge_later; end + def regenerate_key; end + def service; end + def service_headers_for_direct_upload; end + def service_metadata; end + def service_url_for_direct_upload(expires_in: T.unsafe(nil)); end + def services; end + def services=(_arg0); end + def services?; end + def signed_id(purpose: T.unsafe(nil), expires_in: T.unsafe(nil), expires_at: T.unsafe(nil)); end + def text?; end + def to_trix_content_attachment_partial_path; end + def unfurl(io, identify: T.unsafe(nil)); end + def upload(io, identify: T.unsafe(nil)); end + def upload_without_unfurling(io); end + def url(expires_in: T.unsafe(nil), disposition: T.unsafe(nil), filename: T.unsafe(nil), **options); end + def validate_associated_records_for_attachments(*args); end + def validate_associated_records_for_variant_records(*args); end + def video?; end + + private + + def compute_checksum_in_chunks(io); end + def extract_content_type(io); end + def media_type; end + def tempfile_extension; end + def touch_attachments; end + def update_service_metadata; end + def web_image?; end + + class << self + def build_after_unfurling(io:, filename:, key: T.unsafe(nil), content_type: T.unsafe(nil), metadata: T.unsafe(nil), service_name: T.unsafe(nil), identify: T.unsafe(nil), record: T.unsafe(nil)); end + def combine_signed_id_purposes(purpose); end + def compose(blobs, filename:, key: T.unsafe(nil), content_type: T.unsafe(nil), metadata: T.unsafe(nil)); end + def create_after_unfurling!(io:, filename:, key: T.unsafe(nil), content_type: T.unsafe(nil), metadata: T.unsafe(nil), service_name: T.unsafe(nil), identify: T.unsafe(nil), record: T.unsafe(nil)); end + def create_and_upload!(io:, filename:, key: T.unsafe(nil), content_type: T.unsafe(nil), metadata: T.unsafe(nil), service_name: T.unsafe(nil), identify: T.unsafe(nil), record: T.unsafe(nil)); end + def create_before_direct_upload!(filename:, byte_size:, checksum:, key: T.unsafe(nil), content_type: T.unsafe(nil), metadata: T.unsafe(nil), service_name: T.unsafe(nil), record: T.unsafe(nil)); end + def find_signed(id, record: T.unsafe(nil), purpose: T.unsafe(nil)); end + def find_signed!(id, record: T.unsafe(nil), purpose: T.unsafe(nil)); end + def generate_unique_secure_token(length: T.unsafe(nil)); end + def scope_for_strict_loading; end + def service; end + def service=(value); end + def service?; end + def services; end + def services=(value); end + def services?; end + def signed_id_verifier; end + def unattached(*args, **); end + def with_attached_preview_image(*args, **); end + + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr__reflections; end + def __class_attr__reflections=(new_value); end + def __class_attr__validators; end + def __class_attr__validators=(new_value); end + def __class_attr_attachment_reflections; end + def __class_attr_attachment_reflections=(new_value); end + def __class_attr_defined_enums; end + def __class_attr_defined_enums=(new_value); end + def __class_attr_service; end + def __class_attr_service=(new_value); end + def __class_attr_services; end + def __class_attr_services=(new_value); end + def filter_metadata(metadata); end + end +end + +module ActiveStorage::Blob::Analyzable + def analyze; end + def analyze_later; end + def analyzed?; end + + private + + def analyzer; end + def analyzer_class; end + def extract_metadata_via_analyzer; end +end + +module ActiveStorage::Blob::GeneratedAssociationMethods + def attachment_ids; end + def attachment_ids=(ids); end + def attachments; end + def attachments=(value); end + def build_preview_image_attachment(*args, &block); end + def build_preview_image_blob(*args, &block); end + def create_preview_image_attachment(*args, &block); end + def create_preview_image_attachment!(*args, &block); end + def create_preview_image_blob(*args, &block); end + def create_preview_image_blob!(*args, &block); end + def preview_image; end + def preview_image=(attachable); end + def preview_image_attachment; end + def preview_image_attachment=(value); end + def preview_image_blob; end + def preview_image_blob=(value); end + def reload_preview_image_attachment; end + def reload_preview_image_blob; end + def reset_preview_image_attachment; end + def reset_preview_image_blob; end + def variant_record_ids; end + def variant_record_ids=(ids); end + def variant_records; end + def variant_records=(value); end +end + +module ActiveStorage::Blob::GeneratedAttributeMethods; end + +module ActiveStorage::Blob::Identifiable + def identified?; end + def identify; end + def identify_without_saving; end + + private + + def download_identifiable_chunk; end + def identify_content_type; end +end + +ActiveStorage::Blob::MINIMUM_TOKEN_LENGTH = T.let(T.unsafe(nil), Integer) +ActiveStorage::Blob::PROTECTED_METADATA = T.let(T.unsafe(nil), Array) + +module ActiveStorage::Blob::Representable + extend ::ActiveSupport::Concern + + def create_preview_image_later(variations); end + def preprocessed(transformations); end + def preview(transformations); end + def preview_image_needed_before_processing_variants?; end + def previewable?; end + def representable?; end + def representation(transformations); end + def variable?; end + def variant(transformations); end + + private + + def default_variant_format; end + def default_variant_transformations; end + def format; end + def variant_class; end +end + +module ActiveStorage::Blob::Servable + def content_type_for_serving; end + def forced_disposition_for_serving; end + + private + + def allowed_inline?; end + def forcibly_serve_as_binary?; end +end + +module ActiveStorage::Blobs; end + +class ActiveStorage::Blobs::ProxyController < ::ActiveStorage::BaseController + include ::ActiveStorage::SetBlob + include ::ActionController::Live + include ::ActiveStorage::Streaming + include ::ActiveStorage::DisableSession + extend ::ActionController::Live::ClassMethods + + def show; end + + private + + def _layout(lookup_context, formats, keys); end + + class << self + def live_streaming_excluded_keys; end + def live_streaming_excluded_keys=(value); end + def live_streaming_excluded_keys?; end + + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr_config; end + def __class_attr_config=(new_value); end + def __class_attr_live_streaming_excluded_keys; end + def __class_attr_live_streaming_excluded_keys=(new_value); end + def __class_attr_middleware_stack; end + def __class_attr_middleware_stack=(new_value); end + end +end + +class ActiveStorage::Blobs::RedirectController < ::ActiveStorage::BaseController + include ::ActiveStorage::SetBlob + + def show; end + + private + + def _layout(lookup_context, formats, keys); end + + class << self + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr_config; end + def __class_attr_config=(new_value); end + def __class_attr_middleware_stack; end + def __class_attr_middleware_stack=(new_value); end + end +end + +class ActiveStorage::Current < ::ActiveSupport::CurrentAttributes + class << self + def url_options; end + def url_options=(value); end + + private + + def __class_attr_defaults; end + def __class_attr_defaults=(new_value); end + end +end + +class ActiveStorage::DirectUploadsController < ::ActiveStorage::BaseController + def create; end + + private + + def _layout(lookup_context, formats, keys); end + def blob_args; end + def direct_upload_json(blob); end + + class << self + private + + def __class_attr_config; end + def __class_attr_config=(new_value); end + def __class_attr_middleware_stack; end + def __class_attr_middleware_stack=(new_value); end + end +end + +module ActiveStorage::DisableSession + extend ::ActiveSupport::Concern +end + +class ActiveStorage::DiskController < ::ActiveStorage::BaseController + include ::ActiveStorage::FileServer + + def show; end + def update; end + + private + + def _layout(lookup_context, formats, keys); end + def acceptable_content?(token); end + def decode_verified_key; end + def decode_verified_token; end + def named_disk_service(name); end + + class << self + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr_config; end + def __class_attr_config=(new_value); end + def __class_attr_middleware_stack; end + def __class_attr_middleware_stack=(new_value); end + end +end + +# pkg:gem/activestorage#lib/active_storage/downloader.rb:4 +class ActiveStorage::Downloader + # pkg:gem/activestorage#lib/active_storage/downloader.rb:7 + def initialize(service); end + + # pkg:gem/activestorage#lib/active_storage/downloader.rb:11 + def open(key, checksum: T.unsafe(nil), verify: T.unsafe(nil), name: T.unsafe(nil), tmpdir: T.unsafe(nil)); end + + # pkg:gem/activestorage#lib/active_storage/downloader.rb:5 + def service; end + + private + + # pkg:gem/activestorage#lib/active_storage/downloader.rb:30 + def download(key, file); end + + # pkg:gem/activestorage#lib/active_storage/downloader.rb:20 + def open_tempfile(name, tmpdir = T.unsafe(nil)); end + + # pkg:gem/activestorage#lib/active_storage/downloader.rb:37 + def verify_integrity_of(file, checksum:); end +end + +# pkg:gem/activestorage#lib/active_storage/engine.rb:23 +class ActiveStorage::Engine < ::Rails::Engine; end + +# Generic base class for all Active Storage exceptions. +# +# pkg:gem/activestorage#lib/active_storage/errors.rb:5 +class ActiveStorage::Error < ::StandardError; end + +# Raised when ActiveStorage::Blob#download is called on a blob where the +# backing file is no longer present in its service. +# +# pkg:gem/activestorage#lib/active_storage/errors.rb:25 +class ActiveStorage::FileNotFoundError < ::ActiveStorage::Error; end + +module ActiveStorage::FileServer + private + + def serve_file(path, content_type:, disposition:); end +end + +class ActiveStorage::Filename + include ::Comparable + + def initialize(filename); end + + def <=>(other); end + def as_json(*); end + def base; end + def extension; end + def extension_with_delimiter; end + def extension_without_delimiter; end + def sanitized; end + def to_s; end + def to_str; end + + class << self + def wrap(filename); end + end +end + +# = Active Storage \FixtureSet +# +# Fixtures are a way of organizing data that you want to test against; in +# short, sample data. +# +# To learn more about fixtures, read the ActiveRecord::FixtureSet documentation. +# +# === YAML +# +# Like other Active Record-backed models, ActiveStorage::Attachment and +# ActiveStorage::Blob records inherit from ActiveRecord::Base instances and +# therefore can be populated by fixtures. +# +# Consider a hypothetical Article model class, its related +# fixture data, as well as fixture data for related ActiveStorage::Attachment +# and ActiveStorage::Blob records: +# +# # app/models/article.rb +# class Article < ApplicationRecord +# has_one_attached :thumbnail +# end +# +# +# +# # fixtures/active_storage/blobs.yml +# first_thumbnail_blob: <%= ActiveStorage::FixtureSet.blob filename: "first.png" %> +# +# +# +# # fixtures/active_storage/attachments.yml +# first_thumbnail_attachment: +# name: thumbnail +# record: first (Article) +# blob: first_thumbnail_blob +# +# When processed, Active Record will insert database records for each fixture +# entry and will ensure the Active Storage relationship is intact. +# +# pkg:gem/activestorage#lib/active_storage/fixture_set.rb:44 +class ActiveStorage::FixtureSet + include ::ActiveSupport::Testing::FileFixtures + include ::ActiveRecord::SecureToken + extend ::ActiveRecord::SecureToken::ClassMethods + + # pkg:gem/activestorage#lib/active_storage/fixture_set.rb:45 + def file_fixture_path; end + + # pkg:gem/activestorage#lib/active_storage/fixture_set.rb:45 + def file_fixture_path?; end + + # pkg:gem/activestorage#lib/active_storage/fixture_set.rb:70 + def prepare(instance, **attributes); end + + class << self + # Generate a YAML-encoded representation of an ActiveStorage::Blob + # instance's attributes, resolve the file relative to the directory mentioned + # by ActiveSupport::Testing::FileFixtures.file_fixture, and upload + # the file to the Service + # + # ==== Examples + # + # # tests/fixtures/active_storage/blobs.yml + # second_thumbnail_blob: <%= ActiveStorage::FixtureSet.blob( + # filename: "second.svg", + # ) %> + # + # third_thumbnail_blob: <%= ActiveStorage::FixtureSet.blob( + # filename: "third.svg", + # content_type: "image/svg+xml", + # service_name: "public" + # ) %> + # + # pkg:gem/activestorage#lib/active_storage/fixture_set.rb:66 + def blob(filename:, **attributes); end + + # pkg:gem/activestorage#lib/active_storage/fixture_set.rb:45 + def file_fixture_path; end + + # pkg:gem/activestorage#lib/active_storage/fixture_set.rb:45 + def file_fixture_path=(value); end + + # pkg:gem/activestorage#lib/active_storage/fixture_set.rb:45 + def file_fixture_path?; end + + private + + # pkg:gem/activestorage#lib/active_storage/fixture_set.rb:45 + def __class_attr_file_fixture_path; end + + # pkg:gem/activestorage#lib/active_storage/fixture_set.rb:45 + def __class_attr_file_fixture_path=(new_value); end + end +end + +# Adds Active Storage's ImageMagick security policy to every ImageMagick process MiniMagick spawns. +# +# ImageMagick reads every `policy.xml` on its configuration search path and applies all of them, +# so the shipped policy adds to the operator's policy rather than replacing it. `MAGICK_CONFIGURE_PATH` +# prepends to that search path; a value the operator has already set, in the environment or in +# `MiniMagick.cli_env`, is kept after the shipped directory. +# +# pkg:gem/activestorage#lib/active_storage/image_magick.rb:25 +module ActiveStorage::ImageMagick + class << self + # Called when Active Storage loads, and again after the application initializes, so that a + # `MAGICK_CONFIGURE_PATH` or `MiniMagick.cli_env` set by an initializer or dotenv keeps the policy. + # + # pkg:gem/activestorage#lib/active_storage/image_magick.rb:30 + def apply_policy; end + + # pkg:gem/activestorage#lib/active_storage/image_magick.rb:37 + def configure_path(operator_path); end + + private + + # pkg:gem/activestorage#lib/active_storage/image_magick.rb:41 + def operator_paths(path); end + end +end + +# pkg:gem/activestorage#lib/active_storage/image_magick.rb:26 +ActiveStorage::ImageMagick::POLICY_DIRECTORY = T.let(T.unsafe(nil), String) + +# Raised when uploaded or downloaded data does not match a precomputed checksum. +# Indicates that a network error or a software bug caused data corruption. +# +# pkg:gem/activestorage#lib/active_storage/errors.rb:21 +class ActiveStorage::IntegrityError < ::ActiveStorage::Error; end + +# Raised when a storage key resolves to a path outside the service's root +# directory, indicating a potential path traversal attack. +# +# pkg:gem/activestorage#lib/active_storage/errors.rb:32 +class ActiveStorage::InvalidKeyError < ::ActiveStorage::Error; end + +# Raised when ActiveStorage::Blob#variant is called on a blob that isn't variable. +# Use ActiveStorage::Blob#variable? to determine whether a blob is variable. +# +# pkg:gem/activestorage#lib/active_storage/errors.rb:9 +class ActiveStorage::InvariableError < ::ActiveStorage::Error; end + +# pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:6 +class ActiveStorage::LogSubscriber < ::ActiveSupport::LogSubscriber + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:53 + def logger; end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:21 + def preview(event); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:26 + def service_delete(event); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:31 + def service_delete_prefixed(event); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:14 + def service_download(event); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:36 + def service_exist(event); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:46 + def service_mirror(event); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:19 + def service_streaming_download(event); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:7 + def service_upload(event); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:41 + def service_url(event); end + + private + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:62 + def debug(event, colored_message); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:58 + def info(event, colored_message); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:70 + def key_in(event); end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:66 + def log_prefix_for_service(event); end + + class << self + private + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:12 + def __class_attr_log_levels; end + + # pkg:gem/activestorage#lib/active_storage/log_subscriber.rb:12 + def __class_attr_log_levels=(new_value); end + end +end + +# pkg:gem/activestorage#lib/active_storage/image_magick.rb:14 +ActiveStorage::MINIMAGICK_AVAILABLE = T.let(T.unsafe(nil), FalseClass) + +# pkg:gem/activestorage#lib/active_storage/image_magick.rb:48 +ActiveStorage::MINIMAGICK_UNSECURABLE = T.let(T.unsafe(nil), FalseClass) + +class ActiveStorage::MirrorJob < ::ActiveStorage::BaseJob + def perform(key, checksum:); end + + class << self + private + + def __class_attr_queue_name; end + def __class_attr_queue_name=(new_value); end + def __class_attr_rescue_handlers; end + def __class_attr_rescue_handlers=(new_value); end + end +end + +class ActiveStorage::NamedVariant + def initialize(transformations); end + + def preprocessed; end + def preprocessed?(record); end + def transformations; end +end + +class ActiveStorage::Preview + include ::ActiveStorage::Blob::Servable + + def initialize(blob, variation_or_variation_key); end + + def blob; end + def content_type(*, **, &); end + def download(&block); end + def filename(*, **, &); end + def image; end + def key; end + def processed; end + def url(**options); end + def variation; end + + private + + def presentation; end + def previewer; end + def previewer_class; end + def process; end + def processed?; end + def variant; end + def variant?; end +end + +class ActiveStorage::Preview::UnprocessedError < ::StandardError; end + +# Raised when a Previewer is unable to generate a preview image. +# +# pkg:gem/activestorage#lib/active_storage/errors.rb:28 +class ActiveStorage::PreviewError < ::ActiveStorage::Error; end + +class ActiveStorage::PreviewImageJob < ::ActiveStorage::BaseJob + def perform(blob, variations); end + + class << self + private + + def __class_attr_queue_name; end + def __class_attr_queue_name=(new_value); end + def __class_attr_rescue_handlers; end + def __class_attr_rescue_handlers=(new_value); end + end +end + +# = Active Storage \Previewer +# +# This is an abstract base class for previewers, which generate images from blobs. See +# ActiveStorage::Previewer::MuPDFPreviewer and ActiveStorage::Previewer::VideoPreviewer for +# examples of concrete subclasses. +# +# pkg:gem/activestorage#lib/active_storage/previewer.rb:9 +class ActiveStorage::Previewer + # pkg:gem/activestorage#lib/active_storage/previewer.rb:18 + def initialize(blob); end + + # pkg:gem/activestorage#lib/active_storage/previewer.rb:10 + def blob; end + + # Override this method in a concrete subclass. Have it yield an attachable preview image (i.e. + # anything accepted by ActiveStorage::Attached::One#attach). Pass the additional options to + # the underlying blob that is created. + # + # pkg:gem/activestorage#lib/active_storage/previewer.rb:25 + def preview(**options); end + + private + + # pkg:gem/activestorage#lib/active_storage/previewer.rb:78 + def capture(*argv, to:); end + + # Downloads the blob to a tempfile on disk. Yields the tempfile. + # + # pkg:gem/activestorage#lib/active_storage/previewer.rb:31 + def download_blob_to_tempfile(&block); end + + # Executes a system command, capturing its binary output in a tempfile. Yields the tempfile. + # + # Use this method to shell out to a system library (e.g. muPDF or FFmpeg) for preview image + # generation. The resulting tempfile can be used as the +:io+ value in an attachable Hash: + # + # def preview + # download_blob_to_tempfile do |input| + # draw "my-drawing-command", input.path, "--format", "png", "-" do |output| + # yield io: output, filename: "#{blob.filename.base}.png", content_type: "image/png" + # end + # end + # end + # + # The output tempfile is opened in the directory returned by #tmpdir. + # + # pkg:gem/activestorage#lib/active_storage/previewer.rb:49 + def draw(*argv); end + + # pkg:gem/activestorage#lib/active_storage/previewer.rb:69 + def instrument(operation, payload = T.unsafe(nil), &block); end + + # pkg:gem/activestorage#lib/active_storage/previewer.rb:93 + def logger; end + + # pkg:gem/activestorage#lib/active_storage/previewer.rb:59 + def open_tempfile; end + + # pkg:gem/activestorage#lib/active_storage/previewer.rb:73 + def service_name; end + + # pkg:gem/activestorage#lib/active_storage/previewer.rb:97 + def tmpdir; end + + class << self + # Implement this method in a concrete subclass. Have it return true when given a blob from which + # the previewer can generate an image. + # + # pkg:gem/activestorage#lib/active_storage/previewer.rb:14 + def accept?(blob); end + end +end + +# pkg:gem/activestorage#lib/active_storage/previewer/mupdf_previewer.rb:4 +class ActiveStorage::Previewer::MuPDFPreviewer < ::ActiveStorage::Previewer + # pkg:gem/activestorage#lib/active_storage/previewer/mupdf_previewer.rb:27 + def preview(**options); end + + private + + # pkg:gem/activestorage#lib/active_storage/previewer/mupdf_previewer.rb:36 + def draw_first_page_from(file, &block); end + + class << self + # pkg:gem/activestorage#lib/active_storage/previewer/mupdf_previewer.rb:6 + def accept?(blob); end + + # pkg:gem/activestorage#lib/active_storage/previewer/mupdf_previewer.rb:18 + def mutool_exists?; end + + # pkg:gem/activestorage#lib/active_storage/previewer/mupdf_previewer.rb:14 + def mutool_path; end + + # pkg:gem/activestorage#lib/active_storage/previewer/mupdf_previewer.rb:10 + def pdf?(content_type); end + end +end + +# pkg:gem/activestorage#lib/active_storage/previewer/poppler_pdf_previewer.rb:4 +class ActiveStorage::Previewer::PopplerPDFPreviewer < ::ActiveStorage::Previewer + # pkg:gem/activestorage#lib/active_storage/previewer/poppler_pdf_previewer.rb:25 + def preview(**options); end + + private + + # pkg:gem/activestorage#lib/active_storage/previewer/poppler_pdf_previewer.rb:34 + def draw_first_page_from(file, &block); end + + class << self + # pkg:gem/activestorage#lib/active_storage/previewer/poppler_pdf_previewer.rb:6 + def accept?(blob); end + + # pkg:gem/activestorage#lib/active_storage/previewer/poppler_pdf_previewer.rb:10 + def pdf?(content_type); end + + # pkg:gem/activestorage#lib/active_storage/previewer/poppler_pdf_previewer.rb:18 + def pdftoppm_exists?; end + + # pkg:gem/activestorage#lib/active_storage/previewer/poppler_pdf_previewer.rb:14 + def pdftoppm_path; end + end +end + +# pkg:gem/activestorage#lib/active_storage/previewer/video_previewer.rb:6 +class ActiveStorage::Previewer::VideoPreviewer < ::ActiveStorage::Previewer + # pkg:gem/activestorage#lib/active_storage/previewer/video_previewer.rb:23 + def preview(**options); end + + private + + # pkg:gem/activestorage#lib/active_storage/previewer/video_previewer.rb:32 + def draw_relevant_frame_from(file, &block); end + + class << self + # pkg:gem/activestorage#lib/active_storage/previewer/video_previewer.rb:8 + def accept?(blob); end + + # pkg:gem/activestorage#lib/active_storage/previewer/video_previewer.rb:12 + def ffmpeg_exists?; end + + # pkg:gem/activestorage#lib/active_storage/previewer/video_previewer.rb:18 + def ffmpeg_path; end + end +end + +class ActiveStorage::PurgeJob < ::ActiveStorage::BaseJob + def perform(blob); end + + class << self + private + + def __class_attr_queue_name; end + def __class_attr_queue_name=(new_value); end + def __class_attr_rescue_handlers; end + def __class_attr_rescue_handlers=(new_value); end + end +end + +class ActiveStorage::Record < ::ActiveRecord::Base + include ::ActiveStorage::Record::GeneratedAttributeMethods + include ::ActiveStorage::Record::GeneratedAssociationMethods + + class << self + private + + def __class_attr__validators; end + def __class_attr__validators=(new_value); end + def __class_attr_defined_enums; end + def __class_attr_defined_enums=(new_value); end + end +end + +module ActiveStorage::Record::GeneratedAssociationMethods; end +module ActiveStorage::Record::GeneratedAttributeMethods; end + +# pkg:gem/activestorage#lib/active_storage/reflection.rb:4 +module ActiveStorage::Reflection; end + +# pkg:gem/activestorage#lib/active_storage/reflection.rb:49 +module ActiveStorage::Reflection::ActiveRecordExtensions + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods + + module GeneratedClassMethods + def attachment_reflections; end + def attachment_reflections=(value); end + def attachment_reflections?; end + end + + module GeneratedInstanceMethods + def attachment_reflections; end + def attachment_reflections?; end + end +end + +# pkg:gem/activestorage#lib/active_storage/reflection.rb:56 +module ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods + # Returns an array of reflection objects for all the attachments in the + # class. + # + # pkg:gem/activestorage#lib/active_storage/reflection.rb:59 + def reflect_on_all_attachments; end + + # Returns the reflection object for the named +attachment+. + # + # User.reflect_on_attachment(:avatar) + # # => the avatar reflection + # + # pkg:gem/activestorage#lib/active_storage/reflection.rb:68 + def reflect_on_attachment(attachment); end +end + +# pkg:gem/activestorage#lib/active_storage/reflection.rb:5 +class ActiveStorage::Reflection::HasAttachedReflection < ::ActiveRecord::Reflection::MacroReflection + # pkg:gem/activestorage#lib/active_storage/reflection.rb:10 + def named_variants; end + + # pkg:gem/activestorage#lib/active_storage/reflection.rb:6 + def variant(name, transformations); end +end + +# Holds all the metadata about a has_many_attached attachment as it was +# specified in the Active Record class. +# +# pkg:gem/activestorage#lib/active_storage/reflection.rb:25 +class ActiveStorage::Reflection::HasManyAttachedReflection < ::ActiveStorage::Reflection::HasAttachedReflection + # pkg:gem/activestorage#lib/active_storage/reflection.rb:26 + def macro; end +end + +# Holds all the metadata about a has_one_attached attachment as it was +# specified in the Active Record class. +# +# pkg:gem/activestorage#lib/active_storage/reflection.rb:17 +class ActiveStorage::Reflection::HasOneAttachedReflection < ::ActiveStorage::Reflection::HasAttachedReflection + # pkg:gem/activestorage#lib/active_storage/reflection.rb:18 + def macro; end +end + +# pkg:gem/activestorage#lib/active_storage/reflection.rb:31 +module ActiveStorage::Reflection::ReflectionExtension + # pkg:gem/activestorage#lib/active_storage/reflection.rb:32 + def add_attachment_reflection(model, name, reflection); end + + private + + # pkg:gem/activestorage#lib/active_storage/reflection.rb:37 + def reflection_class_for(macro); end +end + +module ActiveStorage::Representations; end + +class ActiveStorage::Representations::BaseController < ::ActiveStorage::BaseController + include ::ActiveStorage::SetBlob + + private + + def _layout(lookup_context, formats, keys); end + def blob_scope; end + def set_representation; end + + class << self + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr_config; end + def __class_attr_config=(new_value); end + def __class_attr_middleware_stack; end + def __class_attr_middleware_stack=(new_value); end + end +end + +class ActiveStorage::Representations::ProxyController < ::ActiveStorage::Representations::BaseController + include ::ActionController::Live + include ::ActiveStorage::Streaming + include ::ActiveStorage::DisableSession + extend ::ActionController::Live::ClassMethods + + def show; end + + private + + def _layout(lookup_context, formats, keys); end + + class << self + def live_streaming_excluded_keys; end + def live_streaming_excluded_keys=(value); end + def live_streaming_excluded_keys?; end + + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr_config; end + def __class_attr_config=(new_value); end + def __class_attr_live_streaming_excluded_keys; end + def __class_attr_live_streaming_excluded_keys=(new_value); end + def __class_attr_middleware_stack; end + def __class_attr_middleware_stack=(new_value); end + end +end + +class ActiveStorage::Representations::RedirectController < ::ActiveStorage::Representations::BaseController + def show; end + + private + + def _layout(lookup_context, formats, keys); end + + class << self + private + + def __class_attr_config; end + def __class_attr_config=(new_value); end + def __class_attr_middleware_stack; end + def __class_attr_middleware_stack=(new_value); end + end +end + +# = Active Storage \Service +# +# Abstract class serving as an interface for concrete services. +# +# The available services are: +# +# * +Disk+, to manage attachments saved directly on the hard drive. +# * +GCS+, to manage attachments through Google Cloud Storage. +# * +S3+, to manage attachments through Amazon S3. +# * +Mirror+, to be able to use several services to manage attachments. +# +# Inside a \Rails application, you can set-up your services through the +# generated config/storage.yml file and reference one +# of the aforementioned constant under the +service+ key. For example: +# +# local: +# service: Disk +# root: <%= Rails.root.join("storage") %> +# +# You can checkout the service's constructor to know which keys are required. +# +# Then, in your application's configuration, you can specify the service to +# use like this: +# +# config.active_storage.service = :local +# +# If you are using Active Storage outside of a Ruby on \Rails application, you +# can configure the service to use like this: +# +# ActiveStorage::Blob.service = ActiveStorage::Service.configure( +# :local, +# { local: {service: "Disk", root: Pathname("/tmp/foo/storage") } } +# ) +# +# pkg:gem/activestorage#lib/active_storage/service.rb:43 +class ActiveStorage::Service + extend ::ActiveSupport::Autoload + + # Concatenate multiple files into a single "composed" file. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:96 + def compose(source_keys, destination_key, filename: T.unsafe(nil), content_type: T.unsafe(nil), disposition: T.unsafe(nil), custom_metadata: T.unsafe(nil)); end + + # Delete the file at the +key+. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:101 + def delete(key); end + + # Delete files at keys starting with the +prefix+. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:106 + def delete_prefixed(prefix); end + + # Return the content of the file at the +key+. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:82 + def download(key); end + + # Return the partial content in the byte +range+ of the file at the +key+. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:87 + def download_chunk(key, range); end + + # Return +true+ if a file exists at the +key+. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:111 + def exist?(key); end + + # Returns a Hash of headers for +url_for_direct_upload+ requests. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:143 + def headers_for_direct_upload(key, filename:, content_type:, content_length:, checksum:, custom_metadata: T.unsafe(nil)); end + + # pkg:gem/activestorage#lib/active_storage/service.rb:151 + def inspect; end + + # pkg:gem/activestorage#lib/active_storage/service.rb:46 + def name; end + + # pkg:gem/activestorage#lib/active_storage/service.rb:46 + def name=(_arg0); end + + # pkg:gem/activestorage#lib/active_storage/service.rb:91 + def open(*args, **options, &block); end + + # pkg:gem/activestorage#lib/active_storage/service.rb:147 + def public?; end + + # Update metadata for the file identified by +key+ in the service. + # Override in subclasses only if the service needs to store specific + # metadata that has to be updated upon identification. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:78 + def update_metadata(key, **metadata); end + + # Upload the +io+ to the +key+ specified. If a +checksum+ is provided, the service will + # ensure a match when the upload has completed or raise an ActiveStorage::IntegrityError. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:71 + def upload(key, io, checksum: T.unsafe(nil), **options); end + + # Returns the URL for the file at the +key+. This returns a permanent URL for public files, and returns a + # short-lived URL for private files. For private files you can provide the +disposition+ (+:inline+ or +:attachment+), + # +filename+, and +content_type+ that you wish the file to be served with on request. Additionally, you can also provide + # the amount of seconds the URL will be valid for, specified in +expires_in+. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:119 + def url(key, **options); end + + # Returns a signed, temporary URL that a direct upload file can be PUT to on the +key+. + # The URL will be valid for the amount of seconds specified in +expires_in+. + # You must also provide the +content_type+, +content_length+, and +checksum+ of the file + # that will be uploaded. All these attributes will be validated by the service upon upload. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:138 + def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, custom_metadata: T.unsafe(nil)); end + + private + + # pkg:gem/activestorage#lib/active_storage/service.rb:179 + def content_disposition_with(filename:, type: T.unsafe(nil)); end + + # pkg:gem/activestorage#lib/active_storage/service.rb:164 + def custom_metadata_headers(metadata); end + + # pkg:gem/activestorage#lib/active_storage/service.rb:168 + def instrument(operation, payload = T.unsafe(nil), &block); end + + # pkg:gem/activestorage#lib/active_storage/service.rb:156 + def private_url(key, expires_in:, filename:, disposition:, content_type:, **); end + + # pkg:gem/activestorage#lib/active_storage/service.rb:160 + def public_url(key, **); end + + # pkg:gem/activestorage#lib/active_storage/service.rb:174 + def service_name; end + + class << self + # Override in subclasses that stitch together multiple services and hence + # need to build additional services using the configurator. + # + # Passes the configurator and all of the service's config as keyword args. + # + # See MirrorService for an example. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:62 + def build(configurator:, name:, service: T.unsafe(nil), **service_config); end + + # Configure an Active Storage service by name from a set of configurations, + # typically loaded from a YAML file. The Active Storage engine uses this + # to set the global Active Storage service when the app boots. + # + # pkg:gem/activestorage#lib/active_storage/service.rb:52 + def configure(service_name, configurations); end + end +end + +# pkg:gem/activestorage#lib/active_storage/service/configurator.rb:4 +class ActiveStorage::Service::Configurator + # pkg:gem/activestorage#lib/active_storage/service/configurator.rb:11 + def initialize(configurations); end + + # pkg:gem/activestorage#lib/active_storage/service/configurator.rb:15 + def build(service_name); end + + # pkg:gem/activestorage#lib/active_storage/service/configurator.rb:5 + def configurations; end + + # pkg:gem/activestorage#lib/active_storage/service/configurator.rb:22 + def inspect; end + + private + + # pkg:gem/activestorage#lib/active_storage/service/configurator.rb:29 + def config_for(name); end + + # pkg:gem/activestorage#lib/active_storage/service/configurator.rb:35 + def resolve(class_name); end + + class << self + # pkg:gem/activestorage#lib/active_storage/service/configurator.rb:7 + def build(service_name, configurations); end + end +end + +# pkg:gem/activestorage#lib/active_storage/service/registry.rb:4 +class ActiveStorage::Service::Registry + # pkg:gem/activestorage#lib/active_storage/service/registry.rb:5 + def initialize(configurations); end + + # pkg:gem/activestorage#lib/active_storage/service/registry.rb:10 + def fetch(name); end + + # pkg:gem/activestorage#lib/active_storage/service/registry.rb:25 + def inspect; end + + private + + # pkg:gem/activestorage#lib/active_storage/service/registry.rb:32 + def configurations; end + + # pkg:gem/activestorage#lib/active_storage/service/registry.rb:34 + def configurator; end + + # pkg:gem/activestorage#lib/active_storage/service/registry.rb:32 + def services; end +end + +module ActiveStorage::SetBlob + extend ::ActiveSupport::Concern + + private + + def blob_scope; end + def set_blob; end +end + +module ActiveStorage::SetCurrent + extend ::ActiveSupport::Concern +end + +module ActiveStorage::Streaming + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + include ::ActionController::Rendering + include ::ActionController::DataStreaming + include ::ActionController::Live + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActionController::Rendering::ClassMethods + mixes_in_class_methods ::ActionController::Live::ClassMethods + + private + + def ranges_valid?(ranges); end + def send_blob_byte_range_data(blob, range_header, disposition: T.unsafe(nil)); end + def send_blob_stream(blob, disposition: T.unsafe(nil)); end + + module GeneratedClassMethods + def live_streaming_excluded_keys; end + def live_streaming_excluded_keys=(value); end + def live_streaming_excluded_keys?; end + end + + module GeneratedInstanceMethods; end +end + +ActiveStorage::Streaming::DEFAULT_BLOB_STREAMING_DISPOSITION = T.let(T.unsafe(nil), String) + +# pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:6 +class ActiveStorage::StructuredEventSubscriber < ::ActiveSupport::StructuredEventSubscriber + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:29 + def preview(event); end + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:36 + def service_delete(event); end + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:43 + def service_delete_prefixed(event); end + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:15 + def service_download(event); end + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:50 + def service_exist(event); end + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:68 + def service_mirror(event); end + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:22 + def service_streaming_download(event); end + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:7 + def service_upload(event); end + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:59 + def service_url(event); end + + class << self + private + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:57 + def __class_attr_debug_methods; end + + # pkg:gem/activestorage#lib/active_storage/structured_event_subscriber.rb:57 + def __class_attr_debug_methods=(new_value); end + end +end + +class ActiveStorage::TransformJob < ::ActiveStorage::BaseJob + def perform(blob, transformations); end + + class << self + private + + def __class_attr_queue_name; end + def __class_attr_queue_name=(new_value); end + def __class_attr_rescue_handlers; end + def __class_attr_rescue_handlers=(new_value); end + end +end + +# pkg:gem/activestorage#lib/active_storage.rb:391 +module ActiveStorage::Transformers + extend ::ActiveSupport::Autoload +end + +# pkg:gem/activestorage#lib/active_storage/transformers/image_magick.rb:7 +class ActiveStorage::Transformers::ImageMagick < ::ActiveStorage::Transformers::ImageProcessingTransformer + private + + # pkg:gem/activestorage#lib/active_storage/transformers/image_magick.rb:9 + def processor; end + + # pkg:gem/activestorage#lib/active_storage/transformers/image_magick.rb:43 + def validate_arg_array(argument); end + + # pkg:gem/activestorage#lib/active_storage/transformers/image_magick.rb:57 + def validate_arg_hash(argument); end + + # pkg:gem/activestorage#lib/active_storage/transformers/image_magick.rb:35 + def validate_arg_string(argument); end + + # pkg:gem/activestorage#lib/active_storage/transformers/image_magick.rb:13 + def validate_transformation(name, argument); end +end + +# pkg:gem/activestorage#lib/active_storage/transformers/image_processing_transformer.rb:14 +class ActiveStorage::Transformers::ImageProcessingTransformer < ::ActiveStorage::Transformers::Transformer + private + + # pkg:gem/activestorage#lib/active_storage/transformers/image_processing_transformer.rb:28 + def operations; end + + # pkg:gem/activestorage#lib/active_storage/transformers/image_processing_transformer.rb:19 + def process(file, format:); end + + # pkg:gem/activestorage#lib/active_storage/transformers/image_processing_transformer.rb:38 + def validate_transformation(name, argument); end +end + +# pkg:gem/activestorage#lib/active_storage/transformers/image_processing_transformer.rb:17 +class ActiveStorage::Transformers::ImageProcessingTransformer::UnsupportedImageProcessingArgument < ::StandardError; end + +# pkg:gem/activestorage#lib/active_storage/transformers/image_processing_transformer.rb:16 +class ActiveStorage::Transformers::ImageProcessingTransformer::UnsupportedImageProcessingMethod < ::StandardError; end + +# pkg:gem/activestorage#lib/active_storage/transformers/null_transformer.rb:5 +class ActiveStorage::Transformers::NullTransformer < ::ActiveStorage::Transformers::Transformer + private + + # pkg:gem/activestorage#lib/active_storage/transformers/null_transformer.rb:7 + def process(file, format:); end +end + +# = Active Storage \Transformers \Transformer +# +# A Transformer applies a set of transformations to an image. +# +# The following concrete subclasses are included in Active Storage: +# +# * ActiveStorage::Transformers::ImageProcessingTransformer: +# backed by ImageProcessing, a common interface for MiniMagick and ruby-vips +# +# pkg:gem/activestorage#lib/active_storage/transformers/transformer.rb:13 +class ActiveStorage::Transformers::Transformer + # pkg:gem/activestorage#lib/active_storage/transformers/transformer.rb:16 + def initialize(transformations); end + + # Applies the transformations to the source image in +file+, producing a target image in the + # specified +format+. Yields an open Tempfile containing the target image. Closes and unlinks + # the output tempfile after yielding to the given block. Returns the result of the block. + # + # pkg:gem/activestorage#lib/active_storage/transformers/transformer.rb:23 + def transform(file, format:); end + + # pkg:gem/activestorage#lib/active_storage/transformers/transformer.rb:14 + def transformations; end + + private + + # Returns an open Tempfile containing a transformed image in the given +format+. + # All subclasses implement this method. + # + # pkg:gem/activestorage#lib/active_storage/transformers/transformer.rb:36 + def process(file, format:); end +end + +# pkg:gem/activestorage#lib/active_storage/transformers/vips.rb:14 +class ActiveStorage::Transformers::Vips < ::ActiveStorage::Transformers::ImageProcessingTransformer + # pkg:gem/activestorage#lib/active_storage/transformers/vips.rb:15 + def processor; end +end + +# Raised when ActiveStorage::Blob#preview is called on a blob that isn't previewable. +# Use ActiveStorage::Blob#previewable? to determine whether a blob is previewable. +# +# pkg:gem/activestorage#lib/active_storage/errors.rb:13 +class ActiveStorage::UnpreviewableError < ::ActiveStorage::Error; end + +# Raised when ActiveStorage::Blob#representation is called on a blob that isn't representable. +# Use ActiveStorage::Blob#representable? to determine whether a blob is representable. +# +# pkg:gem/activestorage#lib/active_storage/errors.rb:17 +class ActiveStorage::UnrepresentableError < ::ActiveStorage::Error; end + +# pkg:gem/activestorage#lib/active_storage/gem_version.rb:9 +module ActiveStorage::VERSION; end + +# pkg:gem/activestorage#lib/active_storage/gem_version.rb:10 +ActiveStorage::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activestorage#lib/active_storage/gem_version.rb:11 +ActiveStorage::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activestorage#lib/active_storage/gem_version.rb:13 +ActiveStorage::VERSION::PRE = T.let(T.unsafe(nil), String) + +# pkg:gem/activestorage#lib/active_storage/gem_version.rb:15 +ActiveStorage::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/activestorage#lib/active_storage/gem_version.rb:12 +ActiveStorage::VERSION::TINY = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activestorage#lib/active_storage/vips.rb:19 +ActiveStorage::VIPS_AVAILABLE = T.let(T.unsafe(nil), TrueClass) + +class ActiveStorage::Variant + include ::ActiveStorage::Blob::Servable + + def initialize(blob, variation_or_variation_key); end + + def blob; end + def content_type(*, **, &); end + def destroy; end + def download(&block); end + def filename; end + def image; end + def key; end + def processed; end + def service(*, **, &); end + def url(expires_in: T.unsafe(nil), disposition: T.unsafe(nil)); end + def variation; end + + private + + def process; end + def processed?; end +end + +class ActiveStorage::VariantRecord < ::ActiveStorage::Record + include ::ActiveStorage::VariantRecord::GeneratedAttributeMethods + include ::ActiveStorage::VariantRecord::GeneratedAssociationMethods + + def _run_commit_callbacks(&block); end + def _run_create_callbacks(&block); end + def _run_destroy_callbacks(&block); end + def _run_save_callbacks(&block); end + def _run_update_callbacks(&block); end + def autosave_associated_records_for_blob(*args); end + def autosave_associated_records_for_image_attachment(*args); end + def autosave_associated_records_for_image_blob(*args); end + + class << self + def with_attached_image(*args, **); end + + private + + def __class_attr___callbacks; end + def __class_attr___callbacks=(new_value); end + def __class_attr__reflections; end + def __class_attr__reflections=(new_value); end + def __class_attr__validators; end + def __class_attr__validators=(new_value); end + def __class_attr_attachment_reflections; end + def __class_attr_attachment_reflections=(new_value); end + def __class_attr_defined_enums; end + def __class_attr_defined_enums=(new_value); end + end +end + +module ActiveStorage::VariantRecord::GeneratedAssociationMethods + def blob; end + def blob=(value); end + def blob_changed?; end + def blob_previously_changed?; end + def build_blob(*args, &block); end + def build_image_attachment(*args, &block); end + def build_image_blob(*args, &block); end + def create_blob(*args, &block); end + def create_blob!(*args, &block); end + def create_image_attachment(*args, &block); end + def create_image_attachment!(*args, &block); end + def create_image_blob(*args, &block); end + def create_image_blob!(*args, &block); end + def image; end + def image=(attachable); end + def image_attachment; end + def image_attachment=(value); end + def image_blob; end + def image_blob=(value); end + def reload_blob; end + def reload_image_attachment; end + def reload_image_blob; end + def reset_blob; end + def reset_image_attachment; end + def reset_image_blob; end +end + +module ActiveStorage::VariantRecord::GeneratedAttributeMethods; end + +class ActiveStorage::VariantWithRecord + include ::ActiveStorage::Blob::Servable + + def initialize(blob, variation); end + + def blob; end + def content_type(*, **, &); end + def destroy; end + def download(*, **, &); end + def filename; end + def image; end + def key(*, **, &); end + def processed; end + def service(*, **, &); end + def url(*, **, &); end + def variation; end + + private + + def create_or_find_record(image:); end + def process; end + def processed?; end + def record; end + def transform_blob; end +end + +class ActiveStorage::Variation + def initialize(transformations); end + + def content_type; end + def default_to(defaults); end + def digest; end + def format; end + def key; end + def transform(file, &block); end + def transformations; end + + private + + def transformer; end + + class << self + def decode(key); end + def encode(transformations); end + def wrap(variator); end + end +end diff --git a/sorbet/rbi/gems/activesupport@8.1.4.1.rbi b/sorbet/rbi/gems/activesupport@8.1.4.1.rbi new file mode 100644 index 000000000..c0cb5d5b2 --- /dev/null +++ b/sorbet/rbi/gems/activesupport@8.1.4.1.rbi @@ -0,0 +1,20819 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `activesupport` gem. +# Please instead update this file by running `bin/tapioca gem activesupport`. + + +# :include: ../README.rdoc +# -- +# The JSON gem adds a few modules to Ruby core classes containing :to_json definition, overwriting +# their default behavior. That said, we need to define the basic to_json method in all of them, +# otherwise they will always use to_json gem implementation, which is backwards incompatible in +# several cases (for instance, the JSON implementation for Hash does not work) with inheritance. +# +# On the other hand, we should avoid conflict with ::JSON.{generate,dump}(obj). Unfortunately, the +# JSON gem's encoder relies on its own to_json implementation to encode objects. Since it always +# passes a ::JSON::State object as the only argument to to_json, we can detect that and forward the +# calls to the original to_json method. +# +# It should be noted that when using ::JSON.{generate,dump} directly, ActiveSupport's encoder is +# bypassed completely. This means that as_json won't be invoked and the JSON gem will simply +# ignore any options it does not natively understand. This also means that ::JSON.{generate,dump} +# should give exactly the same results with or without Active Support. +# :markup: markdown +# -- +# Defines the standard inflection rules. These are the starting point for +# new projects and are not considered complete. The current set of inflection +# rules is frozen. This means, we do not change them to become more complete. +# This is a safety measure to keep existing applications from breaking. +# ++ +# +# pkg:gem/activesupport#lib/active_support/delegation.rb:3 +module ActiveSupport + extend ::ActiveSupport::LazyLoadHooks + extend ::ActiveSupport::Autoload + + # pkg:gem/activesupport#lib/active_support.rb:114 + def filter_parameters; end + + # pkg:gem/activesupport#lib/active_support.rb:114 + def filter_parameters=(val); end + + # pkg:gem/activesupport#lib/active_support.rb:106 + def parallelize_test_databases; end + + # pkg:gem/activesupport#lib/active_support.rb:106 + def parallelize_test_databases=(val); end + + # pkg:gem/activesupport#lib/active_support/json/decoding.rb:9 + def parse_json_times; end + + # pkg:gem/activesupport#lib/active_support/json/decoding.rb:9 + def parse_json_times=(val); end + + # pkg:gem/activesupport#lib/active_support.rb:104 + def test_order; end + + # pkg:gem/activesupport#lib/active_support.rb:104 + def test_order=(val); end + + # pkg:gem/activesupport#lib/active_support.rb:105 + def test_parallelization_threshold; end + + # pkg:gem/activesupport#lib/active_support.rb:105 + def test_parallelization_threshold=(val); end + + class << self + # pkg:gem/activesupport#lib/active_support.rb:116 + def cache_format_version; end + + # pkg:gem/activesupport#lib/active_support.rb:120 + def cache_format_version=(value); end + + # pkg:gem/activesupport#lib/active_support/deprecator.rb:4 + def deprecator; end + + # pkg:gem/activesupport#lib/active_support.rb:98 + def eager_load!; end + + # pkg:gem/activesupport#lib/active_support.rb:109 + def error_reporter; end + + # pkg:gem/activesupport#lib/active_support.rb:109 + def error_reporter=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def escape_html_entities_in_json(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def escape_html_entities_in_json=(arg); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def escape_js_separators_in_json(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def escape_js_separators_in_json=(arg); end + + # pkg:gem/activesupport#lib/active_support.rb:112 + def event_reporter; end + + # pkg:gem/activesupport#lib/active_support.rb:112 + def event_reporter=(_arg0); end + + # pkg:gem/activesupport#lib/active_support.rb:114 + def filter_parameters; end + + # pkg:gem/activesupport#lib/active_support.rb:114 + def filter_parameters=(val); end + + # Returns the currently loaded version of Active Support as a +Gem::Version+. + # + # pkg:gem/activesupport#lib/active_support/gem_version.rb:5 + def gem_version; end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def json_encoder(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def json_encoder=(arg); end + + # pkg:gem/activesupport#lib/active_support.rb:106 + def parallelize_test_databases; end + + # pkg:gem/activesupport#lib/active_support.rb:106 + def parallelize_test_databases=(val); end + + # pkg:gem/activesupport#lib/active_support/json/decoding.rb:9 + def parse_json_times; end + + # pkg:gem/activesupport#lib/active_support/json/decoding.rb:9 + def parse_json_times=(val); end + + # pkg:gem/activesupport#lib/active_support.rb:104 + def test_order; end + + # pkg:gem/activesupport#lib/active_support.rb:104 + def test_order=(val); end + + # pkg:gem/activesupport#lib/active_support.rb:105 + def test_parallelization_threshold; end + + # pkg:gem/activesupport#lib/active_support.rb:105 + def test_parallelization_threshold=(val); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def time_precision(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def time_precision=(arg); end + + # pkg:gem/activesupport#lib/active_support.rb:124 + def to_time_preserves_timezone; end + + # pkg:gem/activesupport#lib/active_support.rb:131 + def to_time_preserves_timezone=(value); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def use_standard_json_time_format(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:8 + def use_standard_json_time_format=(arg); end + + # pkg:gem/activesupport#lib/active_support.rb:139 + def utc_to_local_returns_utc_offset_times; end + + # pkg:gem/activesupport#lib/active_support.rb:143 + def utc_to_local_returns_utc_offset_times=(value); end + + # Returns the currently loaded version of Active Support as a +Gem::Version+. + # + # pkg:gem/activesupport#lib/active_support/version.rb:7 + def version; end + end +end + +# = Actionable Errors +# +# Actionable errors lets you define actions to resolve an error. +# +# To make an error actionable, include the +ActiveSupport::ActionableError+ +# module and invoke the +action+ class macro to define the action. An action +# needs a name and a block to execute. +# +# pkg:gem/activesupport#lib/active_support/actionable_error.rb:11 +module ActiveSupport::ActionableError + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveSupport::ActionableError::ClassMethods + + class << self + # pkg:gem/activesupport#lib/active_support/actionable_error.rb:20 + def actions(error); end + + # pkg:gem/activesupport#lib/active_support/actionable_error.rb:29 + def dispatch(error, name); end + end + + module GeneratedClassMethods + def _actions; end + def _actions=(value); end + def _actions?; end + end + + module GeneratedInstanceMethods + def _actions; end + def _actions=(value); end + def _actions?; end + end +end + +# pkg:gem/activesupport#lib/active_support/actionable_error.rb:35 +module ActiveSupport::ActionableError::ClassMethods + # Defines an action that can resolve the error. + # + # class PendingMigrationError < MigrationError + # include ActiveSupport::ActionableError + # + # action "Run pending migrations" do + # ActiveRecord::Tasks::DatabaseTasks.migrate + # end + # end + # + # pkg:gem/activesupport#lib/active_support/actionable_error.rb:45 + def action(name, &block); end +end + +# pkg:gem/activesupport#lib/active_support/actionable_error.rb:14 +class ActiveSupport::ActionableError::NonActionable < ::StandardError; end + +# = \Array Inquirer +# +# Wrapping an array in an +ArrayInquirer+ gives a friendlier way to check +# its string-like contents: +# +# variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet]) +# +# variants.phone? # => true +# variants.tablet? # => true +# variants.desktop? # => false +# +# pkg:gem/activesupport#lib/active_support/array_inquirer.rb:14 +class ActiveSupport::ArrayInquirer < ::Array + # Passes each element of +candidates+ collection to ArrayInquirer collection. + # The method returns true if any element from the ArrayInquirer collection + # is equal to the stringified or symbolized form of any element in the +candidates+ collection. + # + # If +candidates+ collection is not given, method returns true. + # + # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet]) + # + # variants.any? # => true + # variants.any?(:phone, :tablet) # => true + # variants.any?('phone', 'desktop') # => true + # variants.any?(:desktop, :watch) # => false + # + # pkg:gem/activesupport#lib/active_support/array_inquirer.rb:27 + def any?(*candidates); end + + private + + # pkg:gem/activesupport#lib/active_support/array_inquirer.rb:42 + def method_missing(name, *, **, &); end + + # pkg:gem/activesupport#lib/active_support/array_inquirer.rb:38 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end +end + +# = Active Support \Autoload +# +# Autoload and eager load conveniences for your library. +# +# This module allows you to define autoloads based on +# \Rails conventions (i.e. no need to define the path +# it is automatically guessed based on the filename) +# and also define a set of constants that needs to be +# eager loaded: +# +# module MyLib +# extend ActiveSupport::Autoload +# +# autoload :Model +# +# eager_autoload do +# autoload :Cache +# end +# end +# +# Then your library can be eager loaded by simply calling: +# +# MyLib.eager_load! +# +# pkg:gem/activesupport#lib/active_support/dependencies/autoload.rb:29 +module ActiveSupport::Autoload + # pkg:gem/activesupport#lib/active_support/dependencies/autoload.rb:30 + def autoload(const_name, path = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/dependencies/autoload.rb:51 + def autoload_at(path); end + + # pkg:gem/activesupport#lib/active_support/dependencies/autoload.rb:44 + def autoload_under(path); end + + # pkg:gem/activesupport#lib/active_support/dependencies/autoload.rb:58 + def eager_autoload; end + + # pkg:gem/activesupport#lib/active_support/dependencies/autoload.rb:65 + def eager_load!; end +end + +# = Backtrace Cleaner +# +# Backtraces often include many lines that are not relevant for the context +# under review. This makes it hard to find the signal amongst the backtrace +# noise, and adds debugging time. With a BacktraceCleaner, filters and +# silencers are used to remove the noisy lines, so that only the most relevant +# lines remain. +# +# Filters are used to modify lines of data, while silencers are used to remove +# lines entirely. The typical filter use case is to remove lengthy path +# information from the start of each line, and view file paths relevant to the +# app directory instead of the file system root. The typical silencer use case +# is to exclude the output of a noisy library from the backtrace, so that you +# can focus on the rest. +# +# bc = ActiveSupport::BacktraceCleaner.new +# root = "#{Rails.root}/" +# bc.add_filter { |line| line.delete_prefix(root) } # strip the Rails.root prefix +# bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems +# bc.clean(exception.backtrace) # perform the cleanup +# +# To reconfigure an existing BacktraceCleaner (like the default one in \Rails) +# and show as much data as possible, you can always call +# BacktraceCleaner#remove_silencers!, which will restore the +# backtrace to a pristine state. If you need to reconfigure an existing +# BacktraceCleaner so that it does not filter or modify the paths of any lines +# of the backtrace, you can call BacktraceCleaner#remove_filters! +# These two methods will give you a completely untouched backtrace. +# +# Inspired by the Quiet Backtrace gem by thoughtbot. +# +# pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:34 +class ActiveSupport::BacktraceCleaner + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:35 + def initialize; end + + # Adds a filter from the block provided. Each line in the backtrace will be + # mapped against this filter. + # + # # Will turn "/my/rails/root/app/models/person.rb" into "app/models/person.rb" + # root = "#{Rails.root}/" + # backtrace_cleaner.add_filter { |line| line.delete_prefix(root) } + # + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:154 + def add_filter(&block); end + + # Adds a silencer from the block provided. If the silencer returns +true+ + # for a given line, it will be excluded from the clean backtrace. + # + # # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb" + # backtrace_cleaner.add_silencer { |line| /puma/.match?(line) } + # + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:163 + def add_silencer(&block); end + + # Returns the backtrace after all filters and silencers have been run + # against it. Filters run first, then silencers. + # + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:45 + def clean(backtrace, kind = T.unsafe(nil)); end + + # Returns the frame with all filters applied. + # returns +nil+ if the frame was silenced. + # + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:73 + def clean_frame(frame, kind = T.unsafe(nil)); end + + # Given an array of Thread::Backtrace::Location objects, returns an array + # with the clean ones: + # + # clean_locations = backtrace_cleaner.clean_locations(caller_locations) + # + # Filters and silencers receive strings as usual. However, the +path+ + # attributes of the locations in the returned array are the original, + # unfiltered ones, since locations are immutable. + # + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:67 + def clean_locations(locations, kind = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:57 + def filter(backtrace, kind = T.unsafe(nil)); end + + # Returns the first clean frame of the caller's backtrace, or +nil+. + # + # Frames are strings. + # + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:94 + def first_clean_frame(kind = T.unsafe(nil)); end + + # Returns the first clean location of the caller's call stack, or +nil+. + # + # Locations are Thread::Backtrace::Location objects. Since they are + # immutable, their +path+ attributes are the original ones, but filters + # are applied internally so silencers can still rely on them. + # + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:113 + def first_clean_location(kind = T.unsafe(nil)); end + + # Removes all filters, but leaves in the silencers. Useful if you suddenly + # need to see entire filepaths in the backtrace that you had already + # filtered out. + # + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:177 + def remove_filters!; end + + # Removes all silencers, but leaves in the filters. Useful if your + # context of debugging suddenly expands as you suspect a bug in one of + # the libraries you use. + # + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:170 + def remove_silencers!; end + + private + + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:198 + def add_core_silencer; end + + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:189 + def add_gem_filter; end + + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:202 + def add_gem_silencer; end + + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:206 + def add_stdlib_silencer; end + + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:210 + def filter_backtrace(backtrace); end + + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:184 + def initialize_copy(_other); end + + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:226 + def noise(backtrace); end + + # pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:218 + def silence(backtrace); end +end + +# pkg:gem/activesupport#lib/active_support/backtrace_cleaner.rb:182 +ActiveSupport::BacktraceCleaner::FORMATTED_GEMS_PATTERN = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/benchmark.rb:4 +module ActiveSupport::Benchmark + class << self + # Benchmark realtime in the specified time unit. By default, + # the returned unit is in seconds. + # + # ActiveSupport::Benchmark.realtime { sleep 0.1 } + # # => 0.10007 + # + # ActiveSupport::Benchmark.realtime(:float_millisecond) { sleep 0.1 } + # # => 100.07 + # + # `unit` can be any of the values accepted by Ruby's `Process.clock_gettime`. + # + # pkg:gem/activesupport#lib/active_support/benchmark.rb:15 + def realtime(unit = T.unsafe(nil), &block); end + end +end + +# = \Benchmarkable +# +# pkg:gem/activesupport#lib/active_support/benchmarkable.rb:7 +module ActiveSupport::Benchmarkable + # Allows you to measure the execution time of a block in a template and + # records the result to the log. Wrap this block around expensive operations + # or possible bottlenecks to get a time reading for the operation. For + # example, let's say you thought your file processing method was taking too + # long; you could wrap it in a benchmark block. + # + # <% benchmark 'Process data files' do %> + # <%= expensive_files_operation %> + # <% end %> + # + # That would add something like "Process data files (345.2ms)" to the log, + # which you can then use to compare timings when optimizing your code. + # + # You may give an optional logger level (:debug, :info, + # :warn, :error) as the :level option. The + # default logger level value is :info. + # + # <% benchmark 'Low-level files', level: :debug do %> + # <%= lowlevel_files_operation %> + # <% end %> + # + # Finally, you can pass true as the third argument to silence all log + # activity (other than the timing information) from inside the block. This + # is great for boiling down a noisy block to just a single statement that + # produces one log line: + # + # <% benchmark 'Process data files', level: :info, silence: true do %> + # <%= expensive_and_chatty_files_operation %> + # <% end %> + # + # pkg:gem/activesupport#lib/active_support/benchmarkable.rb:37 + def benchmark(message = T.unsafe(nil), options = T.unsafe(nil), &block); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/big_decimal/conversions.rb:7 +module ActiveSupport::BigDecimalWithDefaultFormat + # pkg:gem/activesupport#lib/active_support/core_ext/big_decimal/conversions.rb:8 + def to_s(format = T.unsafe(nil)); end +end + +# = Active Support Broadcast Logger +# +# The Broadcast logger is a logger used to write messages to multiple IO. It is commonly used +# in development to display messages on STDOUT and also write them to a file (development.log). +# With the Broadcast logger, you can broadcast your logs to a unlimited number of sinks. +# +# The BroadcastLogger acts as a standard logger and all methods you are used to are available. +# However, all the methods on this logger will propagate and be delegated to the other loggers +# that are part of the broadcast. +# +# Broadcasting your logs. +# +# stdout_logger = Logger.new(STDOUT) +# file_logger = Logger.new("development.log") +# broadcast = BroadcastLogger.new(stdout_logger, file_logger) +# +# broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file. +# +# Add a logger to the broadcast. +# +# stdout_logger = Logger.new(STDOUT) +# broadcast = BroadcastLogger.new(stdout_logger) +# file_logger = Logger.new("development.log") +# broadcast.broadcast_to(file_logger) +# +# broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file. +# +# Modifying the log level for all broadcasted loggers. +# +# stdout_logger = Logger.new(STDOUT) +# file_logger = Logger.new("development.log") +# broadcast = BroadcastLogger.new(stdout_logger, file_logger) +# +# broadcast.level = Logger::FATAL # Modify the log level for the whole broadcast. +# +# Stop broadcasting log to a sink. +# +# stdout_logger = Logger.new(STDOUT) +# file_logger = Logger.new("development.log") +# broadcast = BroadcastLogger.new(stdout_logger, file_logger) +# broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file. +# +# broadcast.stop_broadcasting_to(file_logger) +# broadcast.info("Hello world!") # Writes the log *only* to STDOUT. +# +# At least one sink has to be part of the broadcast. Otherwise, your logs will not +# be written anywhere. For instance: +# +# broadcast = BroadcastLogger.new +# broadcast.info("Hello world") # The log message will appear nowhere. +# +# If you are adding a custom logger with custom methods to the broadcast, +# the `BroadcastLogger` will proxy them and return the raw value, or an array +# of raw values, depending on how many loggers in the broadcasts responded to +# the method: +# +# class MyLogger < ::Logger +# def loggable? +# true +# end +# end +# +# logger = BroadcastLogger.new +# logger.loggable? # => A NoMethodError exception is raised because no loggers in the broadcasts could respond. +# +# logger.broadcast_to(MyLogger.new(STDOUT)) +# logger.loggable? # => true +# logger.broadcast_to(MyLogger.new(STDOUT)) +# puts logger.broadcasts # => [MyLogger, MyLogger] +# logger.loggable? # [true, true] +# +# pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:74 +class ActiveSupport::BroadcastLogger + include ::ActiveSupport::LoggerSilence + include ::ActiveSupport::LoggerThreadSafeLevel + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:81 + def initialize(*loggers); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def <<(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def add(*, **, &); end + + # Add logger(s) to the broadcast. + # + # broadcast_logger = ActiveSupport::BroadcastLogger.new + # broadcast_logger.broadcast_to(Logger.new(STDOUT), Logger.new(STDERR)) + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:92 + def broadcast_to(*loggers); end + + # Returns all the logger that are part of this broadcast. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:78 + def broadcasts; end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def close(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def debug(*, **, &); end + + # Sets the log level to +Logger::DEBUG+ for the whole broadcast. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:146 + def debug!; end + + # True if the log level allows entries with severity +Logger::DEBUG+ to be written + # to at least one broadcast. False otherwise. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:141 + def debug?; end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def error(*, **, &); end + + # Sets the log level to +Logger::ERROR+ for the whole broadcast. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:179 + def error!; end + + # True if the log level allows entries with severity +Logger::ERROR+ to be written + # to at least one broadcast. False otherwise. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:174 + def error?; end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def fatal(*, **, &); end + + # Sets the log level to +Logger::FATAL+ for the whole broadcast. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:190 + def fatal!; end + + # True if the log level allows entries with severity +Logger::FATAL+ to be written + # to at least one broadcast. False otherwise. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:185 + def fatal?; end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def formatter(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def formatter=(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def info(*, **, &); end + + # Sets the log level to +Logger::INFO+ for the whole broadcast. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:157 + def info!; end + + # True if the log level allows entries with severity +Logger::INFO+ to be written + # to at least one broadcast. False otherwise. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:152 + def info?; end + + # Returns the lowest level of all the loggers in the broadcast. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:135 + def level; end + + # Returns the lowest level of all the loggers in the broadcast. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def level=(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:113 + def local_level; end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:107 + def local_level=(level); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def log(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:79 + def progname; end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:79 + def progname=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def sev_threshold=(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:75 + def silencer; end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:75 + def silencer=(val); end + + # Remove a logger from the broadcast. When a logger is removed, messages sent to + # the broadcast will no longer be written to its sink. + # + # sink = Logger.new(STDOUT) + # broadcast_logger = ActiveSupport::BroadcastLogger.new + # + # broadcast_logger.stop_broadcasting_to(sink) + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:103 + def stop_broadcasting_to(logger); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def unknown(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:127 + def warn(*, **, &); end + + # Sets the log level to +Logger::WARN+ for the whole broadcast. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:168 + def warn!; end + + # True if the log level allows entries with severity +Logger::WARN+ to be written + # to at least one broadcast. False otherwise. + # + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:163 + def warn?; end + + private + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:202 + def dispatch(method, *args, **kwargs, &block); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:194 + def initialize_copy(other); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:222 + def method_missing(name, *, **, &); end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:234 + def respond_to_missing?(method, include_all); end + + class << self + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:75 + def silencer; end + + # pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:75 + def silencer=(val); end + end +end + +# pkg:gem/activesupport#lib/active_support/broadcast_logger.rb:121 +ActiveSupport::BroadcastLogger::LOGGER_METHODS = T.let(T.unsafe(nil), Array) + +# See ActiveSupport::Cache::Store for documentation. +# +# pkg:gem/activesupport#lib/active_support/cache/entry.rb:6 +module ActiveSupport::Cache + class << self + # Expands out the +key+ argument into a key that can be used for the + # cache store. Optionally accepts a namespace, and all keys will be + # scoped within that namespace. + # + # If the +key+ argument provided is an array, or responds to +to_a+, then + # each of elements in the array will be turned into parameters/keys and + # concatenated into a single key. For example: + # + # ActiveSupport::Cache.expand_cache_key([:foo, :bar]) # => "foo/bar" + # ActiveSupport::Cache.expand_cache_key([:foo, :bar], "namespace") # => "namespace/foo/bar" + # + # The +key+ argument can also respond to +cache_key+ or +to_param+. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:113 + def expand_cache_key(key, namespace = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:60 + def format_version; end + + # pkg:gem/activesupport#lib/active_support/cache.rb:60 + def format_version=(_arg0); end + + # Creates a new Store object according to the given options. + # + # If no arguments are passed to this method, then a new + # ActiveSupport::Cache::MemoryStore object will be returned. + # + # If you pass a Symbol as the first argument, then a corresponding cache + # store class under the ActiveSupport::Cache namespace will be created. + # For example: + # + # ActiveSupport::Cache.lookup_store(:memory_store) + # # => returns a new ActiveSupport::Cache::MemoryStore object + # + # ActiveSupport::Cache.lookup_store(:mem_cache_store) + # # => returns a new ActiveSupport::Cache::MemCacheStore object + # + # Any additional arguments will be passed to the corresponding cache store + # class's constructor: + # + # ActiveSupport::Cache.lookup_store(:file_store, '/tmp/cache') + # # => same as: ActiveSupport::Cache::FileStore.new('/tmp/cache') + # + # If the first argument is not a Symbol, then it will simply be returned: + # + # ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new) + # # => returns MyOwnCacheStore.new + # + # pkg:gem/activesupport#lib/active_support/cache.rb:87 + def lookup_store(store = T.unsafe(nil), *parameters); end + + private + + # pkg:gem/activesupport#lib/active_support/cache.rb:125 + def retrieve_cache_key(key); end + + # Obtains the specified cache store class, given the name of the +store+. + # Raises an error when the store class cannot be found. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:137 + def retrieve_store_class(store); end + end +end + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:7 +class ActiveSupport::Cache::Coder + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:8 + def initialize(serializer, compressor, legacy_serializer: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:14 + def dump(entry); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:20 + def dump_compressed(entry, threshold); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:48 + def load(dumped); end + + private + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:136 + def dump_version(version); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:144 + def load_version(dumped_version); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:121 + def signature?(dumped); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:129 + def try_compress(string, threshold); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:125 + def type_for_string(value); end +end + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:76 +ActiveSupport::Cache::Coder::COMPRESSED_FLAG = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:98 +class ActiveSupport::Cache::Coder::LazyEntry < ::ActiveSupport::Cache::Entry + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:99 + def initialize(serializer, compressor, payload, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:114 + def mismatched?(version); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:106 + def value; end +end + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:84 +ActiveSupport::Cache::Coder::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:68 +ActiveSupport::Cache::Coder::OBJECT_DUMP_TYPE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:80 +ActiveSupport::Cache::Coder::PACKED_EXPIRES_AT_TEMPLATE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:78 +ActiveSupport::Cache::Coder::PACKED_TEMPLATE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:79 +ActiveSupport::Cache::Coder::PACKED_TYPE_TEMPLATE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:82 +ActiveSupport::Cache::Coder::PACKED_VERSION_INDEX = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:81 +ActiveSupport::Cache::Coder::PACKED_VERSION_LENGTH_TEMPLATE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:66 +ActiveSupport::Cache::Coder::SIGNATURE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:96 +ActiveSupport::Cache::Coder::STRING_DESERIALIZERS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:70 +ActiveSupport::Cache::Coder::STRING_ENCODINGS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/cache/coder.rb:86 +class ActiveSupport::Cache::Coder::StringDeserializer + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:87 + def initialize(encoding); end + + # pkg:gem/activesupport#lib/active_support/cache/coder.rb:91 + def load(payload); end +end + +# pkg:gem/activesupport#lib/active_support/cache.rb:47 +ActiveSupport::Cache::DEFAULT_COMPRESS_LIMIT = T.let(T.unsafe(nil), Integer) + +# Raised by coders when the cache entry can't be deserialized. +# This error is treated as a cache miss. +# +# pkg:gem/activesupport#lib/active_support/cache.rb:51 +class ActiveSupport::Cache::DeserializationError < ::StandardError; end + +# This class is used to represent cache entries. Cache entries have a value, an optional +# expiration time, and an optional version. The expiration time is used to support the :race_condition_ttl option +# on the cache. The version is used to support the :version option on the cache for rejecting +# mismatches. +# +# Since cache entries in most instances will be serialized, the internals of this class are highly optimized +# using short instance variable names that are lazily defined. +# +# pkg:gem/activesupport#lib/active_support/cache/entry.rb:14 +class ActiveSupport::Cache::Entry + # Creates a new cache entry for the specified value. Options supported are + # +:compressed+, +:version+, +:expires_at+ and +:expires_in+. + # + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:25 + def initialize(value, compressed: T.unsafe(nil), version: T.unsafe(nil), expires_in: T.unsafe(nil), expires_at: T.unsafe(nil), **); end + + # Returns the size of the cached value. This could be less than + # value.bytesize if the data is compressed. + # + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:61 + def bytesize; end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:76 + def compressed(compress_threshold); end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:72 + def compressed?; end + + # Duplicates the value in a class. This is used by cache implementations that don't natively + # serialize entries to protect against accidental cache modifications. + # + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:106 + def dup_value!; end + + # Checks if the entry is expired. The +expires_in+ parameter can override + # the value set when the entry was created. + # + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:43 + def expired?; end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:47 + def expires_at; end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:51 + def expires_at=(value); end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:100 + def local?; end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:37 + def mismatched?(version); end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:116 + def pack; end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:33 + def value; end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:21 + def version; end + + private + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:127 + def marshal_load(payload); end + + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:123 + def uncompress(value); end + + class << self + # pkg:gem/activesupport#lib/active_support/cache/entry.rb:16 + def unpack(members); end + end +end + +# = \File \Cache \Store +# +# A cache store implementation which stores everything on the filesystem. +# +# pkg:gem/activesupport#lib/active_support/cache/file_store.rb:13 +class ActiveSupport::Cache::FileStore < ::ActiveSupport::Cache::Store + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:21 + def initialize(cache_path, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:14 + def cache_path; end + + # Preemptively iterates through all stored keys and removes the ones which have expired. + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:41 + def cleanup(options = T.unsafe(nil)); end + + # Deletes all items from the cache. In this case it deletes all the entries in the specified + # file store directory except for .keep or .gitkeep. Be careful which directory is specified in your + # config file when using +FileStore+ because everything in that directory will be deleted. + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:34 + def clear(options = T.unsafe(nil)); end + + # Decrement a cached integer value. Returns the updated value. + # + # If the key is unset, it will be set to +-amount+. + # + # cache.decrement("foo") # => -1 + # + # To set a specific value, call #write: + # + # cache.write("baz", 5) + # cache.decrement("baz") # => 4 + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:81 + def decrement(name, amount = T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:90 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # Increment a cached integer value. Returns the updated value. + # + # If the key is unset, it starts from +0+: + # + # cache.increment("foo") # => 1 + # cache.increment("bar", 100) # => 100 + # + # To set a specific value, call #write: + # + # cache.write("baz", 5) + # cache.increment("baz") # => 6 + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:61 + def increment(name, amount = T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:102 + def inspect; end + + private + + # Delete empty directories in the cache. + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:196 + def delete_empty_directories(dir); end + + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:132 + def delete_entry(key, **options); end + + # Make sure a file path's directories exist. + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:205 + def ensure_cache_path(path); end + + # Translate a file path into a key. + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:190 + def file_path_key(path); end + + # Lock a file for a block so only one process can modify it at a time. + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:149 + def lock_file(file_name, &block); end + + # Modifies the amount of an integer value that is stored in the cache. + # If the key is not found it is created and set to +amount+. + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:223 + def modify_value(name, amount, options); end + + # Translate a key into a file path. + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:163 + def normalize_key(key, options); end + + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:107 + def read_entry(key, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:114 + def read_serialized_entry(key, **); end + + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:209 + def search_dir(dir, &callback); end + + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:121 + def write_entry(key, entry, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:125 + def write_serialized_entry(key, payload, **options); end + + class << self + # Advertise cache versioning support. + # + # pkg:gem/activesupport#lib/active_support/cache/file_store.rb:27 + def supports_cache_versioning?; end + end +end + +# pkg:gem/activesupport#lib/active_support/cache/file_store.rb:16 +ActiveSupport::Cache::FileStore::DIR_FORMATTER = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/file_store.rb:17 +ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE = T.let(T.unsafe(nil), Integer) + +# max filename size on file system is 255, minus room for timestamp, pid, and random characters appended by Tempfile (used by atomic write) +# +# pkg:gem/activesupport#lib/active_support/cache/file_store.rb:18 +ActiveSupport::Cache::FileStore::FILEPATH_MAX_SIZE = T.let(T.unsafe(nil), Integer) + +# max is 1024, plus some room +# +# pkg:gem/activesupport#lib/active_support/cache/file_store.rb:19 +ActiveSupport::Cache::FileStore::GITKEEP_FILES = T.let(T.unsafe(nil), Array) + +# = Memory \Cache \Store +# +# A cache store implementation which stores everything into memory in the +# same process. If you're running multiple Ruby on \Rails server processes +# (which is the case if you're using Phusion Passenger or puma clustered mode), +# then this means that \Rails server process instances won't be able +# to share cache data with each other and this may not be the most +# appropriate cache in that scenario. +# +# This cache has a bounded size specified by the +:size+ options to the +# initializer (default is 32Mb). When the cache exceeds the allotted size, +# a cleanup will occur which tries to prune the cache down to three quarters +# of the maximum size by removing the least recently used entries. +# +# Unlike other Cache store implementations, +MemoryStore+ does not compress +# values by default. +MemoryStore+ does not benefit from compression as much +# as other Store implementations, as it does not send data over a network. +# However, when compression is enabled, it still pays the full cost of +# compression in terms of cpu use. +# +# +MemoryStore+ is thread-safe. +# +# pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:28 +class ActiveSupport::Cache::MemoryStore < ::ActiveSupport::Cache::Store + include ::ActiveSupport::Cache::Strategy::LocalCache + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:75 + def initialize(options = T.unsafe(nil)); end + + # Preemptively iterates through all stored keys and removes the ones which have expired. + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:103 + def cleanup(options = T.unsafe(nil)); end + + # Delete all data stored in a given cache store. + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:95 + def clear(options = T.unsafe(nil)); end + + # Decrement a cached integer value. Returns the updated value. + # + # If the key is unset or has expired, it will be set to +-amount+. + # + # cache.decrement("foo") # => -1 + # + # To set a specific value, call #write: + # + # cache.write("baz", 5) + # cache.decrement("baz") # => 4 + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:168 + def decrement(name, amount = T.unsafe(nil), **options); end + + # Deletes cache entries if the cache key matches a given pattern. + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:175 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # Increment a cached integer value. Returns the updated value. + # + # If the key is unset, it will be set to +amount+: + # + # cache.increment("foo") # => 1 + # cache.increment("bar", 100) # => 100 + # + # To set a specific value, call #write: + # + # cache.write("baz", 5) + # cache.increment("baz") # => 6 + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:151 + def increment(name, amount = T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:187 + def inspect; end + + # To ensure entries fit within the specified memory prune the cache by removing the least + # recently accessed entries. + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:116 + def prune(target_size, max_time = T.unsafe(nil)); end + + # Returns true if the cache is currently being pruned. + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:135 + def pruning?; end + + # Synchronize calls to the cache. This should be called wherever the underlying cache implementation + # is not thread safe. + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:193 + def synchronize(&block); end + + private + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:200 + def cached_size(key, payload); end + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:233 + def delete_entry(key, **); end + + # Modifies the amount of an integer value that is stored in the cache. + # If the key is not found it is created and set to +amount+. + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:243 + def modify_value(name, amount, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:204 + def read_entry(key, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:216 + def write_entry(key, entry, **options); end + + class << self + # Advertise cache versioning support. + # + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:90 + def supports_cache_versioning?; end + end +end + +# pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:31 +module ActiveSupport::Cache::MemoryStore::DupCoder + extend ::ActiveSupport::Cache::MemoryStore::DupCoder + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:34 + def dump(entry); end + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:42 + def dump_compressed(entry, threshold); end + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:47 + def load(entry); end + + private + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:58 + def dump_value(value); end + + # pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:66 + def load_value(string); end +end + +# pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:56 +ActiveSupport::Cache::MemoryStore::DupCoder::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/memory_store.rb:198 +ActiveSupport::Cache::MemoryStore::PER_ENTRY_OVERHEAD = T.let(T.unsafe(nil), Integer) + +# = Null \Cache \Store +# +# A cache store implementation which doesn't actually store anything. Useful in +# development and test environments where you don't want caching turned on but +# need to go through the caching interface. +# +# This cache does implement the local cache strategy, so values will actually +# be cached inside blocks that utilize this strategy. See +# ActiveSupport::Cache::Strategy::LocalCache for more details. +# +# pkg:gem/activesupport#lib/active_support/cache/null_store.rb:14 +class ActiveSupport::Cache::NullStore < ::ActiveSupport::Cache::Store + include ::ActiveSupport::Cache::Strategy::LocalCache + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:25 + def cleanup(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:22 + def clear(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:31 + def decrement(name, amount = T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:34 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:28 + def increment(name, amount = T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:37 + def inspect; end + + private + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:57 + def delete_entry(key, **); end + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:42 + def read_entry(key, **s); end + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:46 + def read_serialized_entry(key, raw: T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:49 + def write_entry(key, entry, **); end + + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:53 + def write_serialized_entry(key, payload, **); end + + class << self + # Advertise cache versioning support. + # + # pkg:gem/activesupport#lib/active_support/cache/null_store.rb:18 + def supports_cache_versioning?; end + end +end + +# Mapping of canonical option names to aliases that a store will recognize. +# +# pkg:gem/activesupport#lib/active_support/cache.rb:43 +ActiveSupport::Cache::OPTION_ALIASES = T.let(T.unsafe(nil), Hash) + +# = Redis \Cache \Store +# +# Deployment note: Take care to use a dedicated Redis cache rather +# than pointing this at a persistent Redis server (for example, one used as +# an Active Job queue). Redis won't cope well with mixed usage patterns and it +# won't expire cache entries by default. +# +# Redis cache server setup guide: https://redis.io/topics/lru-cache +# +# * Supports vanilla Redis, hiredis, and +Redis::Distributed+. +# * Supports Memcached-like sharding across Redises with +Redis::Distributed+. +# * Fault tolerant. If the Redis server is unavailable, no exceptions are +# raised. Cache fetches are all misses and writes are dropped. +# * Local cache. Hot in-memory primary cache within block/middleware scope. +# * +read_multi+ and +write_multi+ support for Redis mget/mset. Use +# +Redis::Distributed+ 4.0.1+ for distributed mget support. +# * +delete_matched+ support for Redis KEYS globs. +# +# pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:37 +class ActiveSupport::Cache::RedisCacheStore < ::ActiveSupport::Cache::Store + include ::ActiveSupport::Cache::Strategy::LocalCache + + # Creates a new Redis cache store. + # + # There are a few ways to provide the Redis client used by the cache: + # + # 1. The +:redis+ param can be: + # - A Redis instance. + # - A +ConnectionPool+ instance wrapping a Redis instance. + # - A block that returns a Redis instance. + # + # 2. The +:url+ param can be: + # - A string used to create a Redis instance. + # - An array of strings used to create a +Redis::Distributed+ instance. + # + # If the final Redis instance is not already a +ConnectionPool+, it will + # be wrapped in one using +ActiveSupport::Cache::Store::DEFAULT_POOL_OPTIONS+. + # These options can be overridden with the +:pool+ param, or the pool can be + # disabled with +:pool: false+. + # + # Option Class Result + # :redis Object -> options[:redis] + # :redis Proc -> options[:redis].call + # :url String -> Redis.new(url: …) + # :url Array -> Redis::Distributed.new([{ url: … }, { url: … }, …]) + # + # No namespace is set by default. Provide one if the Redis cache + # server is shared with other apps: namespace: 'myapp-cache'. + # + # Compression is enabled by default with a 1kB threshold, so cached + # values larger than 1kB are automatically compressed. Disable by + # passing compress: false or change the threshold by passing + # compress_threshold: 4.kilobytes. + # + # No expiry is set on cache entries by default. Redis is expected to + # be configured with an eviction policy that automatically deletes + # least-recently or -frequently used keys when it reaches max memory. + # See https://redis.io/topics/lru-cache for cache server setup. + # + # Race condition TTL is not set by default. This can be used to avoid + # "thundering herd" cache writes when hot cache entries are expired. + # See ActiveSupport::Cache::Store#fetch for more. + # + # Setting skip_nil: true will not cache nil results: + # + # cache.fetch('foo') { nil } + # cache.fetch('bar', skip_nil: true) { nil } + # cache.exist?('foo') # => true + # cache.exist?('bar') # => false + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:155 + def initialize(error_handler: T.unsafe(nil), **redis_options); end + + # Cache Store API implementation. + # + # Removes expired entries. Handled natively by Redis least-recently-/ + # least-frequently-used expiry, so manual cleanup is not supported. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:301 + def cleanup(options = T.unsafe(nil)); end + + # Clear the entire cache on all Redis servers. Safe to use on + # shared servers if the cache is namespaced. + # + # Failsafe: Raises errors. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:309 + def clear(options = T.unsafe(nil)); end + + # Decrement a cached integer value using the Redis decrby atomic operator. + # Returns the updated value. + # + # If the key is unset or has expired, it will be set to +-amount+: + # + # cache.decrement("foo") # => -1 + # + # To set a specific value, call #write passing raw: true: + # + # cache.write("baz", 5, raw: true) + # cache.decrement("baz") # => 4 + # + # Decrementing a non-numeric value, or a value written without + # raw: true, will fail and return +nil+. + # + # To read the value later, call #read_counter: + # + # cache.decrement("baz") # => 3 + # cache.read_counter("baz") # 3 + # + # Failsafe: Raises errors. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:286 + def decrement(name, amount = T.unsafe(nil), **options); end + + # Cache Store API implementation. + # + # Supports Redis KEYS glob patterns: + # + # h?llo matches hello, hallo and hxllo + # h*llo matches hllo and heeeello + # h[ae]llo matches hello and hallo, but not hillo + # h[^e]llo matches hallo, hbllo, ... but not hello + # h[a-b]llo matches hallo and hbllo + # + # Use \ to escape special characters if you want to match them verbatim. + # + # See https://redis.io/commands/KEYS for more. + # + # Failsafe: Raises errors. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:210 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # Increment a cached integer value using the Redis incrby atomic operator. + # Returns the updated value. + # + # If the key is unset or has expired, it will be set to +amount+: + # + # cache.increment("foo") # => 1 + # cache.increment("bar", 100) # => 100 + # + # To set a specific value, call #write passing raw: true: + # + # cache.write("baz", 5, raw: true) + # cache.increment("baz") # => 6 + # + # Incrementing a non-numeric value, or a value written without + # raw: true, will fail and return +nil+. + # + # To read the value later, call #read_counter: + # + # cache.increment("baz") # => 7 + # cache.read_counter("baz") # 7 + # + # Failsafe: Raises errors. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:254 + def increment(name, amount = T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:173 + def inspect; end + + # Cache Store API implementation. + # + # Read multiple values at once. Returns a hash of requested keys -> + # fetched values. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:181 + def read_multi(*names); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:106 + def redis; end + + # Get info from redis servers. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:320 + def stats; end + + private + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:456 + def change_counter(key, amount, options); end + + # Delete an entry from the cache. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:404 + def delete_entry(key, **); end + + # Deletes multiple entries in the cache. Returns the number of entries deleted. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:411 + def delete_multi_entries(entries, **_options); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:434 + def deserialize_entry(payload, raw: T.unsafe(nil), **); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:498 + def failsafe(method, returning: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:325 + def pipeline_entries(entries, &block); end + + # Store provider interface: + # Read an entry from the cache. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:339 + def read_entry(key, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:349 + def read_multi_entries(names, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:343 + def read_serialized_entry(key, raw: T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:450 + def serialize_entries(entries, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:442 + def serialize_entry(entry, raw: T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:483 + def supports_expire_nx?; end + + # Write an entry to the cache. + # + # Requires Redis 2.6.12+ for extended SET options. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:376 + def write_entry(key, entry, raw: T.unsafe(nil), **options); end + + # Nonstandard store provider API to write multiple values at once. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:420 + def write_multi_entries(entries, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:380 + def write_serialized_entry(key, payload, **); end + + class << self + # Factory method to create a new Redis instance. + # + # Handles four options: :redis block, :redis instance, single :url + # string, and multiple :url strings. + # + # Option Class Result + # :redis Proc -> options[:redis].call + # :redis Object -> options[:redis] + # :url String -> Redis.new(url: …) + # :url Array -> Redis::Distributed.new([{ url: … }, { url: … }, …]) + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:78 + def build_redis(redis: T.unsafe(nil), url: T.unsafe(nil), **redis_options); end + + # Advertise cache versioning support. + # + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:60 + def supports_cache_versioning?; end + + private + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:101 + def build_redis_client(**redis_options); end + + # pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:95 + def build_redis_distributed_client(urls:, **redis_options); end + end +end + +# pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:44 +ActiveSupport::Cache::RedisCacheStore::DEFAULT_ERROR_HANDLER = T.let(T.unsafe(nil), Proc) + +# pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:38 +ActiveSupport::Cache::RedisCacheStore::DEFAULT_REDIS_OPTIONS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:490 +ActiveSupport::Cache::RedisCacheStore::FAILSAFE_ERRORS = T.let(T.unsafe(nil), Array) + +# The maximum number of entries to receive per SCAN call. +# +# pkg:gem/activesupport#lib/active_support/cache/redis_cache_store.rb:56 +ActiveSupport::Cache::RedisCacheStore::SCAN_BATCH_SIZE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:8 +module ActiveSupport::Cache::SerializerWithFallback + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:17 + def load(dumped); end + + private + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:39 + def marshal_load(payload); end + + class << self + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:9 + def [](format); end + end +end + +# pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:66 +module ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback + include ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:88 + def _load(marked); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:73 + def dump(entry); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:77 + def dump_compressed(entry, threshold); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:94 + def dumped?(dumped); end +end + +# pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:71 +ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback::MARK_COMPRESSED = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:70 +ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback::MARK_UNCOMPRESSED = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:99 +module ActiveSupport::Cache::SerializerWithFallback::Marshal71WithFallback + include ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback::Marshal71WithFallback + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:109 + def _load(dumped); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:105 + def dump(value); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:113 + def dumped?(dumped); end +end + +# pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:103 +ActiveSupport::Cache::SerializerWithFallback::Marshal71WithFallback::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:118 +module ActiveSupport::Cache::SerializerWithFallback::MessagePackWithFallback + include ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback::MessagePackWithFallback + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:126 + def _load(dumped); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:122 + def dump(value); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:130 + def dumped?(dumped); end + + private + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:135 + def available?; end +end + +# pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:45 +module ActiveSupport::Cache::SerializerWithFallback::PassthroughWithFallback + include ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback::PassthroughWithFallback + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:57 + def _load(entry); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:49 + def dump(entry); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:53 + def dump_compressed(entry, threshold); end + + # pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:61 + def dumped?(dumped); end +end + +# pkg:gem/activesupport#lib/active_support/cache/serializer_with_fallback.rb:144 +ActiveSupport::Cache::SerializerWithFallback::SERIALIZERS = T.let(T.unsafe(nil), Hash) + +# = Active Support \Cache \Store +# +# An abstract cache store class. There are multiple cache store +# implementations, each having its own additional features. See the classes +# under the ActiveSupport::Cache module, e.g. +# ActiveSupport::Cache::MemCacheStore. MemCacheStore is currently the most +# popular cache store for large production websites. +# +# Some implementations may not support all methods beyond the basic cache +# methods of #fetch, #write, #read, #exist?, and #delete. +# +# +ActiveSupport::Cache::Store+ can store any Ruby object that is supported +# by its +coder+'s +dump+ and +load+ methods. +# +# cache = ActiveSupport::Cache::MemoryStore.new +# +# cache.read('city') # => nil +# cache.write('city', "Duckburgh") # => true +# cache.read('city') # => "Duckburgh" +# +# cache.write('not serializable', Proc.new {}) # => TypeError +# +# Keys are always translated into Strings and are case sensitive. When an +# object is specified as a key and has a +cache_key+ method defined, this +# method will be called to define the key. Otherwise, the +to_param+ +# method will be called. Hashes and Arrays can also be used as keys. The +# elements will be delimited by slashes, and the elements within a Hash +# will be sorted by key so they are consistent. +# +# cache.read('city') == cache.read(:city) # => true +# +# Nil values can be cached. +# +# If your cache is on a shared infrastructure, you can define a namespace +# for your cache entries. If a namespace is defined, it will be prefixed on +# to every key. The namespace can be either a static value or a Proc. If it +# is a Proc, it will be invoked when each key is evaluated so that you can +# use application logic to invalidate keys. +# +# cache.namespace = -> { @last_mod_time } # Set the namespace to a variable +# @last_mod_time = Time.now # Invalidate the entire cache by changing namespace +# +# pkg:gem/activesupport#lib/active_support/cache.rb:190 +class ActiveSupport::Cache::Store + # Creates a new cache. + # + # ==== Options + # + # [+:namespace+] + # Sets the namespace for the cache. This option is especially useful if + # your application shares a cache with other applications. + # + # [+:serializer+] + # The serializer for cached values. Must respond to +dump+ and +load+. + # + # The default serializer depends on the cache format version (set via + # +config.active_support.cache_format_version+ when using Rails). The + # default serializer for each format version includes a fallback + # mechanism to deserialize values from any format version. This behavior + # makes it easy to migrate between format versions without invalidating + # the entire cache. + # + # You can also specify serializer: :message_pack to use a + # preconfigured serializer based on ActiveSupport::MessagePack. The + # +:message_pack+ serializer includes the same deserialization fallback + # mechanism, allowing easy migration from (or to) the default + # serializer. The +:message_pack+ serializer may improve performance, + # but it requires the +msgpack+ gem. + # + # [+:compressor+] + # The compressor for serialized cache values. Must respond to +deflate+ + # and +inflate+. + # + # The default compressor is +Zlib+. To define a new custom compressor + # that also decompresses old cache entries, you can check compressed + # values for Zlib's "\x78" signature: + # + # module MyCompressor + # def self.deflate(dumped) + # # compression logic... (make sure result does not start with "\x78"!) + # end + # + # def self.inflate(compressed) + # if compressed.start_with?("\x78") + # Zlib.inflate(compressed) + # else + # # decompression logic... + # end + # end + # end + # + # ActiveSupport::Cache.lookup_store(:redis_cache_store, compressor: MyCompressor) + # + # [+:coder+] + # The coder for serializing and (optionally) compressing cache entries. + # Must respond to +dump+ and +load+. + # + # The default coder composes the serializer and compressor, and includes + # some performance optimizations. If you only need to override the + # serializer or compressor, you should specify the +:serializer+ or + # +:compressor+ options instead. + # + # If the store can handle cache entries directly, you may also specify + # coder: nil to omit the serializer, compressor, and coder. For + # example, if you are using ActiveSupport::Cache::MemoryStore and can + # guarantee that cache values will not be mutated, you can specify + # coder: nil to avoid the overhead of safeguarding against + # mutation. + # + # The +:coder+ option is mutually exclusive with the +:serializer+ and + # +:compressor+ options. Specifying them together will raise an + # +ArgumentError+. + # + # Any other specified options are treated as default options for the + # relevant cache operations, such as #read, #write, and #fetch. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:300 + def initialize(options = T.unsafe(nil)); end + + # Cleans up the cache by removing expired entries. + # + # Options are passed to the underlying cache implementation. + # + # Some implementations may not support this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:785 + def cleanup(options = T.unsafe(nil)); end + + # Clears the entire cache. Be careful with this method since it could + # affect other processes if shared cache is being used. + # + # The options hash is passed to the underlying cache implementation. + # + # Some implementations may not support this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:795 + def clear(options = T.unsafe(nil)); end + + # Decrements an integer value in the cache. + # + # Options are passed to the underlying cache implementation. + # + # Some implementations may not support this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:750 + def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # Deletes an entry in the cache. Returns +true+ if an entry is deleted + # and +false+ otherwise. + # + # Options are passed to the underlying cache implementation. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:686 + def delete(name, options = T.unsafe(nil)); end + + # Deletes all entries with keys matching the pattern. + # + # Options are passed to the underlying cache implementation. + # + # Some implementations may not support this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:732 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # Deletes multiple entries in the cache. Returns the number of deleted + # entries. + # + # Options are passed to the underlying cache implementation. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:699 + def delete_multi(names, options = T.unsafe(nil)); end + + # Returns +true+ if the cache contains an entry for the given key. + # + # Options are passed to the underlying cache implementation. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:713 + def exist?(name, options = T.unsafe(nil)); end + + # Fetches data from the cache, using the given key. If there is data in + # the cache with the given key, then that data is returned. + # + # If there is no such data in the cache (a cache miss), then +nil+ will be + # returned. However, if a block has been passed, that block will be passed + # the key and executed in the event of a cache miss. The return value of the + # block will be written to the cache under the given cache key, and that + # return value will be returned. + # + # cache.write('today', 'Monday') + # cache.fetch('today') # => "Monday" + # + # cache.fetch('city') # => nil + # cache.fetch('city') do + # 'Duckburgh' + # end + # cache.fetch('city') # => "Duckburgh" + # + # ==== Options + # + # Internally, +fetch+ calls +read_entry+, and calls +write_entry+ on a + # cache miss. Thus, +fetch+ supports the same options as #read and #write. + # Additionally, +fetch+ supports the following options: + # + # * force: true - Forces a cache "miss," meaning we treat the + # cache value as missing even if it's present. Passing a block is + # required when +force+ is true so this always results in a cache write. + # + # cache.write('today', 'Monday') + # cache.fetch('today', force: true) { 'Tuesday' } # => 'Tuesday' + # cache.fetch('today', force: true) # => ArgumentError + # + # The +:force+ option is useful when you're calling some other method to + # ask whether you should force a cache write. Otherwise, it's clearer to + # just call +write+. + # + # * skip_nil: true - Prevents caching a nil result: + # + # cache.fetch('foo') { nil } + # cache.fetch('bar', skip_nil: true) { nil } + # cache.exist?('foo') # => true + # cache.exist?('bar') # => false + # + # * +:race_condition_ttl+ - Specifies the number of seconds during which + # an expired value can be reused while a new value is being generated. + # This can be used to prevent race conditions when cache entries expire, + # by preventing multiple processes from simultaneously regenerating the + # same entry (also known as the dog pile effect). + # + # When a process encounters a cache entry that has expired less than + # +:race_condition_ttl+ seconds ago, it will bump the expiration time by + # +:race_condition_ttl+ seconds before generating a new value. During + # this extended time window, while the process generates a new value, + # other processes will continue to use the old value. After the first + # process writes the new value, other processes will then use it. + # + # If the first process errors out while generating a new value, another + # process can try to generate a new value after the extended time window + # has elapsed. + # + # # Set all values to expire after one second. + # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 1) + # + # cache.write("foo", "original value") + # val_1 = nil + # val_2 = nil + # p cache.read("foo") # => "original value" + # + # sleep 1 # wait until the cache expires + # + # t1 = Thread.new do + # # fetch does the following: + # # 1. gets an recent expired entry + # # 2. extends the expiry by 2 seconds (race_condition_ttl) + # # 3. regenerates the new value + # val_1 = cache.fetch("foo", race_condition_ttl: 2) do + # sleep 1 + # "new value 1" + # end + # end + # + # # Wait until t1 extends the expiry of the entry + # # but before generating the new value + # sleep 0.1 + # + # val_2 = cache.fetch("foo", race_condition_ttl: 2) do + # # This block won't be executed because t1 extended the expiry + # "new value 2" + # end + # + # t1.join + # + # p val_1 # => "new value 1" + # p val_2 # => "original value" + # p cache.fetch("foo") # => "new value 1" + # + # # The entry requires 3 seconds to expire (expires_in + race_condition_ttl) + # # We have waited 2 seconds already (sleep(1) + t1.join) thus we need to wait 1 + # # more second to see the entry expire. + # sleep 1 + # + # p cache.fetch("foo") # => nil + # + # ==== Dynamic Options + # + # In some cases it may be necessary to dynamically compute options based + # on the cached value. To support this, an ActiveSupport::Cache::WriteOptions + # instance is passed as the second argument to the block. For example: + # + # cache.fetch("authentication-token:#{user.id}") do |key, options| + # token = authenticate_to_service + # options.expires_at = token.expires_at + # token + # end + # + # pkg:gem/activesupport#lib/active_support/cache.rb:452 + def fetch(name, options = T.unsafe(nil), &block); end + + # Fetches data from the cache, using the given keys. If there is data in + # the cache with the given keys, then that data is returned. Otherwise, + # the supplied block is called for each key for which there was no data, + # and the result will be written to the cache and returned. + # Therefore, you need to pass a block that returns the data to be written + # to the cache. If you do not want to write the cache when the cache is + # not found, use #read_multi. + # + # Returns a hash with the data for each of the names. For example: + # + # cache.write("bim", "bam") + # cache.fetch_multi("bim", "unknown_key") do |key| + # "Fallback value for key: #{key}" + # end + # # => { "bim" => "bam", + # # "unknown_key" => "Fallback value for key: unknown_key" } + # + # You may also specify additional options via the +options+ argument. See #fetch for details. + # Other options are passed to the underlying cache implementation. For example: + # + # cache.fetch_multi("fizz", expires_in: 5.seconds) do |key| + # "buzz" + # end + # # => {"fizz"=>"buzz"} + # cache.read("fizz") + # # => "buzz" + # sleep(6) + # cache.read("fizz") + # # => nil + # + # pkg:gem/activesupport#lib/active_support/cache.rb:603 + def fetch_multi(*names); end + + # Increments an integer value in the cache. + # + # Options are passed to the underlying cache implementation. + # + # Some implementations may not support this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:741 + def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:197 + def logger; end + + # pkg:gem/activesupport#lib/active_support/cache.rb:197 + def logger=(val); end + + # Silences the logger within a block. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:330 + def mute; end + + # Get the current namespace + # + # pkg:gem/activesupport#lib/active_support/cache.rb:800 + def namespace; end + + # Set the current namespace. Note, this will be ignored if custom + # options are passed to cache wills with a namespace key. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:806 + def namespace=(namespace); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:723 + def new_entry(value, options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:200 + def options; end + + # pkg:gem/activesupport#lib/active_support/cache.rb:198 + def raise_on_invalid_cache_expiration_time; end + + # pkg:gem/activesupport#lib/active_support/cache.rb:198 + def raise_on_invalid_cache_expiration_time=(val); end + + # Reads data from the cache, using the given key. If there is data in + # the cache with the given key, then that data is returned. Otherwise, + # +nil+ is returned. + # + # Note, if data was written with the :expires_in or + # :version options, both of these conditions are applied before + # the data is returned. + # + # ==== Options + # + # * +:namespace+ - Replace the store namespace for this call. + # * +:version+ - Specifies a version for the cache entry. If the cached + # version does not match the requested version, the read will be treated + # as a cache miss. This feature is used to support recyclable cache keys. + # + # Other options will be handled by the specific cache store implementation. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:506 + def read(name, options = T.unsafe(nil)); end + + # Reads a counter that was set by #increment / #decrement. + # + # cache.write_counter("foo", 1) + # cache.read_counter("foo") # => 1 + # cache.increment("foo") + # cache.read_counter("foo") # => 2 + # + # Options are passed to the underlying cache implementation. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:762 + def read_counter(name, **options); end + + # Reads multiple values at once from the cache. Options can be passed + # in the last argument. + # + # Some cache implementation may optimize this method. + # + # Returns a hash mapping the names provided to the values found. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:544 + def read_multi(*names); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:200 + def silence; end + + # Silences the logger. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:324 + def silence!; end + + # pkg:gem/activesupport#lib/active_support/cache.rb:201 + def silence?; end + + # Writes the value to the cache with the key. The value must be supported + # by the +coder+'s +dump+ and +load+ methods. + # + # Returns +true+ if the write succeeded, +nil+ if there was an error talking + # to the cache backend, or +false+ if the write failed for another reason. + # + # By default, cache entries larger than 1kB are compressed. Compression + # allows more data to be stored in the same memory footprint, leading to + # fewer cache evictions and higher hit rates. + # + # ==== Options + # + # * compress: false - Disables compression of the cache entry. + # + # * +:compress_threshold+ - The compression threshold, specified in bytes. + # \Cache entries larger than this threshold will be compressed. Defaults + # to +1.kilobyte+. + # + # * +:expires_in+ - Sets a relative expiration time for the cache entry, + # specified in seconds. +:expire_in+ and +:expired_in+ are aliases for + # +:expires_in+. + # + # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 5.minutes) + # cache.write(key, value, expires_in: 1.minute) # Set a lower value for one entry + # + # * +:expires_at+ - Sets an absolute expiration time for the cache entry. + # + # cache = ActiveSupport::Cache::MemoryStore.new + # cache.write(key, value, expires_at: Time.now.at_end_of_hour) + # + # * +:version+ - Specifies a version for the cache entry. When reading + # from the cache, if the cached version does not match the requested + # version, the read will be treated as a cache miss. This feature is + # used to support recyclable cache keys. + # + # * +:unless_exist+ - Prevents overwriting an existing cache entry. + # + # Other options will be handled by the specific cache store implementation. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:672 + def write(name, value, options = T.unsafe(nil)); end + + # Writes a counter that can then be modified by #increment / #decrement. + # + # cache.write_counter("foo", 1) + # cache.read_counter("foo") # => 1 + # cache.increment("foo") + # cache.read_counter("foo") # => 2 + # + # Options are passed to the underlying cache implementation. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:775 + def write_counter(name, value, **options); end + + # Cache Storage API to write multiple values at once. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:559 + def write_multi(hash, options = T.unsafe(nil)); end + + private + + # pkg:gem/activesupport#lib/active_support/cache.rb:1074 + def _instrument(operation, multi: T.unsafe(nil), options: T.unsafe(nil), **payload, &block); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:811 + def default_serializer; end + + # Deletes an entry from the cache implementation. Subclasses must + # implement this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:897 + def delete_entry(key, **options); end + + # Deletes multiples entries in the cache implementation. Subclasses MAY + # implement this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:903 + def delete_multi_entries(entries, **options); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:862 + def deserialize_entry(payload, **); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:984 + def expand_and_namespace_key(key, options = T.unsafe(nil)); end + + # Expands key to be a consistent string value. Invokes +cache_key+ if + # object responds to +cache_key+. Otherwise, +to_param+ method will be + # called. If the key is a Hash, then keys will be sorted alphabetically. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:1037 + def expanded_key(key); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1058 + def expanded_version(key); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1111 + def get_entry_value(entry, name, options); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1095 + def handle_expired_entry(entry, key, options); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:937 + def handle_invalid_expires_in(message); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1066 + def instrument(operation, key, options = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1070 + def instrument_multi(operation, keys, options = T.unsafe(nil), &block); end + + # Adds the namespace defined in the options to a pattern designed to + # match keys. Implementations that support delete_matched should call + # this method to translate a pattern that matches names into one that + # matches namespaced keys. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:826 + def key_matcher(pattern, options); end + + # Merges the default options with ones specific to a method call. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:908 + def merged_options(call_options); end + + # Prefix the key with a namespace string: + # + # namespace_key 'foo', namespace: 'cache' + # # => 'cache:foo' + # + # With a namespace block: + # + # namespace_key 'foo', namespace: -> { 'cache' } + # # => 'cache:foo' + # + # pkg:gem/activesupport#lib/active_support/cache.rb:1012 + def namespace_key(key, call_options = T.unsafe(nil)); end + + # Expands, namespaces and truncates the cache key. + # Raises an exception when the key is +nil+ or an empty string. + # May be overridden by cache stores to do additional normalization. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:979 + def normalize_key(key, options = T.unsafe(nil)); end + + # Normalize aliased options to their canonical form + # + # pkg:gem/activesupport#lib/active_support/cache.rb:948 + def normalize_options(options); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1054 + def normalize_version(key, options = T.unsafe(nil)); end + + # Reads an entry from the cache implementation. Subclasses must implement + # this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:843 + def read_entry(key, **options); end + + # Reads multiple entries from the cache implementation. Subclasses MAY + # implement this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:870 + def read_multi_entries(names, **options); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1116 + def save_block_result_to_cache(name, key, options); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:853 + def serialize_entry(entry, **options); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:991 + def truncate_key(key); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:959 + def validate_options(options); end + + # Writes an entry to the cache implementation. Subclasses must implement + # this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:849 + def write_entry(key, entry, **options); end + + # Writes multiple entries to the cache implementation. Subclasses MAY + # implement this method. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:889 + def write_multi_entries(hash, **options); end + + class << self + # pkg:gem/activesupport#lib/active_support/cache.rb:197 + def logger; end + + # pkg:gem/activesupport#lib/active_support/cache.rb:197 + def logger=(val); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:198 + def raise_on_invalid_cache_expiration_time; end + + # pkg:gem/activesupport#lib/active_support/cache.rb:198 + def raise_on_invalid_cache_expiration_time=(val); end + + private + + # pkg:gem/activesupport#lib/active_support/cache.rb:205 + def retrieve_pool_options(options); end + end +end + +# Default +ConnectionPool+ options +# +# pkg:gem/activesupport#lib/active_support/cache.rb:192 +ActiveSupport::Cache::Store::DEFAULT_POOL_OPTIONS = T.let(T.unsafe(nil), Hash) + +# Keys are truncated with the Active Support digest if they exceed the limit. +# +# pkg:gem/activesupport#lib/active_support/cache.rb:195 +ActiveSupport::Cache::Store::MAX_KEY_SIZE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/cache.rb:53 +module ActiveSupport::Cache::Strategy; end + +# = Local \Cache \Strategy +# +# Caches that implement LocalCache will be backed by an in-memory cache for the +# duration of a block. Repeated calls to the cache for the same key will hit the +# in-memory cache for faster access. +# +# pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:13 +module ActiveSupport::Cache::Strategy::LocalCache + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:98 + def cleanup(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:92 + def clear(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:117 + def decrement(name, amount = T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:104 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:124 + def fetch_multi(*names, &block); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:110 + def increment(name, amount = T.unsafe(nil), **options); end + + # The current local cache. + # + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:82 + def local_cache; end + + # Middleware class can be inserted as a Rack handler to be local cache for the + # duration of request. + # + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:88 + def middleware; end + + # Set a new local cache. + # + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:72 + def new_local_cache; end + + # Unset the current local cache. + # + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:77 + def unset_local_cache; end + + # Use a local cache for the duration of block. + # + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:67 + def with_local_cache(&block); end + + private + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:230 + def bypass_local_cache(&block); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:211 + def delete_entry(key, **); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:226 + def local_cache_key; end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:173 + def read_multi_entries(names, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:159 + def read_serialized_entry(key, raw: T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:234 + def use_temporary_local_cache(temporary_cache); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:216 + def write_cache_value(name, value, **options); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:202 + def write_serialized_entry(key, payload, **); end +end + +# Class for storing and registering the local caches. +# +# pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:17 +module ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry + extend ::ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:20 + def cache_for(local_cache_key); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:25 + def set_cache_for(local_cache_key, value); end +end + +# = Local \Cache \Store +# +# Simple memory backed cache. This cache is not thread safe and is intended only +# for serving as a temporary memory cache for a single thread. +# +# pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:35 +class ActiveSupport::Cache::Strategy::LocalCache::LocalStore + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:36 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:40 + def clear(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:57 + def delete_entry(key); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:61 + def fetch_entry(key); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:44 + def read_entry(key); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:48 + def read_multi_entries(keys); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache.rb:52 + def write_entry(key, entry); end +end + +# -- +# This class wraps up local storage for middlewares. Only the middleware method should +# construct them. +# +# pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache_middleware.rb:13 +class ActiveSupport::Cache::Strategy::LocalCache::Middleware + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache_middleware.rb:17 + def initialize(name, cache); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache_middleware.rb:15 + def cache; end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache_middleware.rb:15 + def cache=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache_middleware.rb:28 + def call(env); end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache_middleware.rb:14 + def name; end + + # pkg:gem/activesupport#lib/active_support/cache/strategy/local_cache_middleware.rb:23 + def new(app); end +end + +# These options mean something to all cache implementations. Individual cache +# implementations may support additional options. +# +# pkg:gem/activesupport#lib/active_support/cache.rb:26 +ActiveSupport::Cache::UNIVERSAL_OPTIONS = T.let(T.unsafe(nil), Array) + +# Enables the dynamic configuration of Cache entry options while ensuring +# that conflicting options are not both set. When a block is given to +# ActiveSupport::Cache::Store#fetch, the second argument will be an +# instance of +WriteOptions+. +# +# pkg:gem/activesupport#lib/active_support/cache.rb:1132 +class ActiveSupport::Cache::WriteOptions + # pkg:gem/activesupport#lib/active_support/cache.rb:1133 + def initialize(options); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1157 + def expires_at; end + + # Sets the Cache entry's +expires_at+ value. If an +expires_in+ option was + # previously set, this will unset it since +expires_at+ and +expires_in+ + # cannot both be set. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:1164 + def expires_at=(expires_at); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1145 + def expires_in; end + + # Sets the Cache entry's +expires_in+ value. If an +expires_at+ option was + # previously set, this will unset it since +expires_in+ and +expires_at+ + # cannot both be set. + # + # pkg:gem/activesupport#lib/active_support/cache.rb:1152 + def expires_in=(expires_in); end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1137 + def version; end + + # pkg:gem/activesupport#lib/active_support/cache.rb:1141 + def version=(version); end +end + +# = Caching Key Generator +# +# CachingKeyGenerator is a wrapper around KeyGenerator which allows users to avoid +# re-executing the key generation process when it's called using the same +salt+ and +# +key_size+. +# +# pkg:gem/activesupport#lib/active_support/key_generator.rb:55 +class ActiveSupport::CachingKeyGenerator + # pkg:gem/activesupport#lib/active_support/key_generator.rb:56 + def initialize(key_generator); end + + # Returns a derived key suitable for use. + # + # pkg:gem/activesupport#lib/active_support/key_generator.rb:62 + def generate_key(*args); end +end + +# = Active Support \Callbacks +# +# \Callbacks are code hooks that are run at key points in an object's life cycle. +# The typical use case is to have a base class define a set of callbacks +# relevant to the other functionality it supplies, so that subclasses can +# install callbacks that enhance or modify the base functionality without +# needing to override or redefine methods of the base class. +# +# Mixing in this module allows you to define the events in the object's +# life cycle that will support callbacks (via ClassMethods#define_callbacks), +# set the instance methods, procs, or callback objects to be called (via +# ClassMethods#set_callback), and run the installed callbacks at the +# appropriate times (via +run_callbacks+). +# +# By default callbacks are halted by throwing +:abort+. +# See ClassMethods#define_callbacks for details. +# +# Three kinds of callbacks are supported: before callbacks, run before a +# certain event; after callbacks, run after the event; and around callbacks, +# blocks that surround the event, triggering it when they yield. Callback code +# can be contained in instance methods, procs or lambdas, or callback objects +# that respond to certain predetermined methods. See ClassMethods#set_callback +# for details. +# +# class Record +# include ActiveSupport::Callbacks +# define_callbacks :save +# +# def save +# run_callbacks :save do +# puts "- save" +# end +# end +# end +# +# class PersonRecord < Record +# set_callback :save, :before, :saving_message +# def saving_message +# puts "saving..." +# end +# +# set_callback :save, :after do |object| +# puts "saved" +# end +# end +# +# person = PersonRecord.new +# person.save +# +# Output: +# saving... +# - save +# saved +# +# pkg:gem/activesupport#lib/active_support/callbacks.rb:65 +module ActiveSupport::Callbacks + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods + mixes_in_class_methods ::ActiveSupport::DescendantsTracker + + # Runs the callbacks for the given event. + # + # Calls the before and around callbacks in the order they were set, yields + # the block (if given one), and then runs the after callbacks in reverse + # order. + # + # If the callback chain was halted, returns +false+. Otherwise returns the + # result of the block, +nil+ if no callbacks have been set, or +true+ + # if callbacks have been set but no block is given. + # + # run_callbacks :save do + # save + # end + # + # -- + # + # As this method is used in many places, and often wraps large portions of + # user code, it has an additional design goal of minimizing its impact on + # the visible call stack. An exception from inside a :before or :after + # callback can be as noisy as it likes -- but when control has passed + # smoothly through and into the supplied block, we want as little evidence + # as possible that we were here. + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:97 + def run_callbacks(kind, type = T.unsafe(nil)); end + + private + + # A hook invoked every time a before callback is halted. + # This can be overridden in ActiveSupport::Callbacks implementors in order + # to provide better debugging/logging. + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:150 + def halted_callback_hook(filter, name); end + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + end + + module GeneratedInstanceMethods + def __callbacks; end + end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:73 +ActiveSupport::Callbacks::CALLBACK_FILTER_TYPES = T.let(T.unsafe(nil), Array) + +# A future invocation of user-supplied code (either as a callback, +# or a condition filter). +# +# pkg:gem/activesupport#lib/active_support/callbacks.rb:337 +module ActiveSupport::Callbacks::CallTemplate + class << self + # Filters support: + # + # Symbols:: A method to call. + # Procs:: A proc to call with the object. + # Objects:: An object with a before_foo method on it to call. + # + # All of these objects are converted into a CallTemplate and handled + # the same after this point. + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:495 + def build(filter, callback); end + end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:396 +class ActiveSupport::Callbacks::CallTemplate::InstanceExec0 + # pkg:gem/activesupport#lib/active_support/callbacks.rb:397 + def initialize(block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:401 + def expand(target, value, block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:411 + def inverted_lambda; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:405 + def make_lambda; end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:418 +class ActiveSupport::Callbacks::CallTemplate::InstanceExec1 + # pkg:gem/activesupport#lib/active_support/callbacks.rb:419 + def initialize(block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:423 + def expand(target, value, block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:433 + def inverted_lambda; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:427 + def make_lambda; end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:440 +class ActiveSupport::Callbacks::CallTemplate::InstanceExec2 + # pkg:gem/activesupport#lib/active_support/callbacks.rb:441 + def initialize(block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:445 + def expand(target, value, block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:457 + def inverted_lambda; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:450 + def make_lambda; end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:338 +class ActiveSupport::Callbacks::CallTemplate::MethodCall + # pkg:gem/activesupport#lib/active_support/callbacks.rb:339 + def initialize(method); end + + # Return the parts needed to make this call, with the given + # input values. + # + # Returns an array of the form: + # + # [target, block, method, *arguments] + # + # This array can be used as such: + # + # target.send(method, *arguments, &block) + # + # The actual invocation is left up to the caller to minimize + # call stack pollution. + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:356 + def expand(target, value, block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:366 + def inverted_lambda; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:360 + def make_lambda; end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:373 +class ActiveSupport::Callbacks::CallTemplate::ObjectCall + # pkg:gem/activesupport#lib/active_support/callbacks.rb:374 + def initialize(target, method); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:379 + def expand(target, value, block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:389 + def inverted_lambda; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:383 + def make_lambda; end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:465 +class ActiveSupport::Callbacks::CallTemplate::ProcCall + # pkg:gem/activesupport#lib/active_support/callbacks.rb:466 + def initialize(target); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:470 + def expand(target, value, block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:480 + def inverted_lambda; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:474 + def make_lambda; end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:231 +class ActiveSupport::Callbacks::Callback + # pkg:gem/activesupport#lib/active_support/callbacks.rb:246 + def initialize(name, filter, kind, options, chain_config); end + + # Wraps code with filter + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:300 + def apply(callback_sequence); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:244 + def chain_config; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:282 + def compiled; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:304 + def current_scopes; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:273 + def duplicates?(other); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:244 + def filter; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:243 + def kind; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:243 + def kind=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:269 + def matches?(_kind, _filter); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:257 + def merge_conditional_options(chain, if_option:, unless_option:); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:243 + def name; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:243 + def name=(_arg0); end + + private + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:312 + def check_conditionals(conditionals); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:327 + def conditions_lambdas; end + + class << self + # pkg:gem/activesupport#lib/active_support/callbacks.rb:232 + def build(chain, filter, kind, options); end + end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:309 +ActiveSupport::Callbacks::Callback::EMPTY_ARRAY = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:568 +class ActiveSupport::Callbacks::CallbackChain + include ::Enumerable + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:573 + def initialize(name, config); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:633 + def append(*callbacks); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:601 + def clear; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:615 + def compile(type); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:571 + def config; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:595 + def delete(o); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:585 + def each(&block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:587 + def empty?; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:586 + def index(o); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:589 + def insert(index, o); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:571 + def name; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:637 + def prepend(*callbacks); end + + protected + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:642 + def chain; end + + private + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:645 + def append_one(callback); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:608 + def initialize_copy(other); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:652 + def prepend_one(callback); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:659 + def remove_duplicates(callback); end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:675 +ActiveSupport::Callbacks::CallbackChain::DEFAULT_TERMINATOR = T.let(T.unsafe(nil), ActiveSupport::Callbacks::CallbackChain::DefaultTerminator) + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:665 +class ActiveSupport::Callbacks::CallbackChain::DefaultTerminator + # pkg:gem/activesupport#lib/active_support/callbacks.rb:666 + def call(target, result_lambda); end +end + +# Execute before and after filters in a sequence instead of +# chaining them with nested lambda calls, see: +# https://github.com/rails/rails/issues/18011 +# +# pkg:gem/activesupport#lib/active_support/callbacks.rb:519 +class ActiveSupport::Callbacks::CallbackSequence + # pkg:gem/activesupport#lib/active_support/callbacks.rb:520 + def initialize(nested = T.unsafe(nil), call_template = T.unsafe(nil), user_conditions = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:535 + def after(after); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:541 + def around(call_template, user_conditions); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:529 + def before(before); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:555 + def expand_call_template(arg, block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:551 + def final?; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:563 + def invoke_after(arg); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:559 + def invoke_before(arg); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:549 + def nested; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:545 + def skip?(arg); end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:678 +module ActiveSupport::Callbacks::ClassMethods + # This is used internally to append, prepend and skip callbacks to the + # CallbackChain. + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:688 + def __update_callbacks(name); end + + # Define sets of events in the object life cycle that support callbacks. + # + # define_callbacks :validate + # define_callbacks :initialize, :save, :destroy + # + # ===== Options + # + # * :terminator - Determines when a before filter will halt the + # callback chain, preventing following before and around callbacks from + # being called and the event from being triggered. + # This should be a lambda to be executed. + # The current object and the result lambda of the callback will be provided + # to the terminator lambda. + # + # define_callbacks :validate, terminator: ->(target, result_lambda) { result_lambda.call == false } + # + # In this example, if any before validate callbacks returns +false+, + # any successive before and around callback is not executed. + # + # The default terminator halts the chain when a callback throws +:abort+. + # + # * :skip_after_callbacks_if_terminated - Determines if after + # callbacks should be terminated by the :terminator option. By + # default after callbacks are executed no matter if callback chain was + # terminated or not. This option has no effect if :terminator + # option is set to +nil+. + # + # * :scope - Indicates which methods should be executed when an + # object is used as a callback. + # + # class Audit + # def before(caller) + # puts 'Audit: before is called' + # end + # + # def before_save(caller) + # puts 'Audit: before_save is called' + # end + # end + # + # class Account + # include ActiveSupport::Callbacks + # + # define_callbacks :save + # set_callback :save, :before, Audit.new + # + # def save + # run_callbacks :save do + # puts 'save in main' + # end + # end + # end + # + # In the above case whenever you save an account the method + # Audit#before will be called. On the other hand + # + # define_callbacks :save, scope: [:kind, :name] + # + # would trigger Audit#before_save instead. That's constructed + # by calling #{kind}_#{name} on the given instance. In this + # case "kind" is "before" and "name" is "save". In this context +:kind+ + # and +:name+ have special meanings: +:kind+ refers to the kind of + # callback (before/after/around) and +:name+ refers to the method on + # which callbacks are being defined. + # + # A declaration like + # + # define_callbacks :save, scope: [:name] + # + # would call Audit#save. + # + # ===== Notes + # + # +names+ passed to +define_callbacks+ must not end with + # !, ? or =. + # + # Calling +define_callbacks+ multiple times with the same +names+ will + # overwrite previous callbacks registered with #set_callback. + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:903 + def define_callbacks(*names); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:679 + def normalize_callback_params(filters, block); end + + # Remove all set callbacks for the given event. + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:813 + def reset_callbacks(name); end + + # Install a callback for the given event. + # + # set_callback :save, :before, :before_method + # set_callback :save, :after, :after_method, if: :condition + # set_callback :save, :around, ->(r, block) { stuff; result = block.call; stuff } + # + # The second argument indicates whether the callback is to be run +:before+, + # +:after+, or +:around+ the event. If omitted, +:before+ is assumed. This + # means the first example above can also be written as: + # + # set_callback :save, :before_method + # + # The callback can be specified as a symbol naming an instance method; as a + # proc, lambda, or block; or as an object that responds to a certain method + # determined by the :scope argument to #define_callbacks. + # + # If a proc, lambda, or block is given, its body is evaluated in the context + # of the current object. It can also optionally accept the current object as + # an argument. + # + # Before and around callbacks are called in the order that they are set; + # after callbacks are called in the reverse order. + # + # Around callbacks can access the return value from the event, if it + # wasn't halted, from the +yield+ call. + # + # ===== Options + # + # * :if - A symbol or an array of symbols, each naming an instance + # method or a proc; the callback will be called only when they all return + # a true value. + # + # If a proc is given, its body is evaluated in the context of the + # current object. It can also optionally accept the current object as + # an argument. + # * :unless - A symbol or an array of symbols, each naming an + # instance method or a proc; the callback will be called only when they + # all return a false value. + # + # If a proc is given, its body is evaluated in the context of the + # current object. It can also optionally accept the current object as + # an argument. + # * :prepend - If +true+, the callback will be prepended to the + # existing chain rather than appended. + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:739 + def set_callback(name, *filter_list, &block); end + + # Skip a previously set callback. Like #set_callback, :if or + # :unless options may be passed in order to control when the + # callback is skipped. + # + # Note: this example uses +PersonRecord+ and +#saving_message+, which you + # can see defined here[rdoc-ref:ActiveSupport::Callbacks] + # + # class Writer < PersonRecord + # attr_accessor :age + # skip_callback :save, :before, :saving_message, if: -> { age > 18 } + # end + # + # When if option returns true, callback is skipped. + # + # writer = Writer.new + # writer.age = 20 + # writer.save + # + # Output: + # - save + # saved + # + # When if option returns false, callback is NOT skipped. + # + # young_writer = Writer.new + # young_writer.age = 17 + # young_writer.save + # + # Output: + # saving... + # - save + # saved + # + # An ArgumentError will be raised if the callback has not + # already been set (unless the :raise option is set to false). + # + # pkg:gem/activesupport#lib/active_support/callbacks.rb:788 + def skip_callback(name, *filter_list, &block); end + + protected + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:939 + def get_callbacks(name); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:943 + def set_callbacks(name, callbacks); end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:153 +module ActiveSupport::Callbacks::Conditionals; end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:154 +class ActiveSupport::Callbacks::Conditionals::Value + # pkg:gem/activesupport#lib/active_support/callbacks.rb:155 + def initialize(&block); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:158 + def call(target, value); end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:162 +module ActiveSupport::Callbacks::Filters; end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:194 +class ActiveSupport::Callbacks::Filters::After + # pkg:gem/activesupport#lib/active_support/callbacks.rb:196 + def initialize(user_callback, user_conditions, chain_config); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:214 + def apply(callback_sequence); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:202 + def call(env); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:195 + def halting; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:195 + def user_callback; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:195 + def user_conditions; end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:219 +class ActiveSupport::Callbacks::Filters::Around + # pkg:gem/activesupport#lib/active_support/callbacks.rb:220 + def initialize(user_callback, user_conditions); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:225 + def apply(callback_sequence); end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:165 +class ActiveSupport::Callbacks::Filters::Before + # pkg:gem/activesupport#lib/active_support/callbacks.rb:166 + def initialize(user_callback, user_conditions, chain_config, filter, name); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:189 + def apply(callback_sequence); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:173 + def call(env); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:171 + def filter; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:171 + def halted_lambda; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:171 + def name; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:171 + def user_callback; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:171 + def user_conditions; end +end + +# pkg:gem/activesupport#lib/active_support/callbacks.rb:163 +class ActiveSupport::Callbacks::Filters::Environment < ::Struct + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def halted; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def halted=(_); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def target; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def target=(_); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def value; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def value=(_); end + + class << self + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def [](*_arg0); end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def keyword_init?; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def members; end + + # pkg:gem/activesupport#lib/active_support/callbacks.rb:163 + def new(*_arg0); end + end +end + +# pkg:gem/activesupport#lib/active_support/class_attribute.rb:4 +module ActiveSupport::ClassAttribute + class << self + # pkg:gem/activesupport#lib/active_support/class_attribute.rb:6 + def redefine(owner, name, namespaced_name, value); end + + # pkg:gem/activesupport#lib/active_support/class_attribute.rb:26 + def redefine_method(owner, name, private: T.unsafe(nil), &block); end + end +end + +# pkg:gem/activesupport#lib/active_support/code_generator.rb:4 +class ActiveSupport::CodeGenerator + # pkg:gem/activesupport#lib/active_support/code_generator.rb:53 + def initialize(owner, path, line); end + + # pkg:gem/activesupport#lib/active_support/code_generator.rb:61 + def class_eval; end + + # pkg:gem/activesupport#lib/active_support/code_generator.rb:65 + def define_cached_method(canonical_name, namespace:, as: T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/code_generator.rb:69 + def execute; end + + class << self + # pkg:gem/activesupport#lib/active_support/code_generator.rb:41 + def batch(owner, path, line); end + end +end + +# pkg:gem/activesupport#lib/active_support/code_generator.rb:5 +class ActiveSupport::CodeGenerator::MethodSet + # pkg:gem/activesupport#lib/active_support/code_generator.rb:8 + def initialize(namespace); end + + # pkg:gem/activesupport#lib/active_support/code_generator.rb:28 + def apply(owner, path, line); end + + # pkg:gem/activesupport#lib/active_support/code_generator.rb:15 + def define_cached_method(canonical_name, as: T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/code_generator.rb:6 +ActiveSupport::CodeGenerator::MethodSet::METHOD_CACHES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/core_ext/range/compare_range.rb:4 +module ActiveSupport::CompareWithRange + # Extends the default Range#=== to support range comparisons. + # (1..5) === (1..5) # => true + # (1..5) === (2..3) # => true + # (1..5) === (1...6) # => true + # (1..5) === (2..6) # => false + # + # The native Range#=== behavior is untouched. + # ('a'..'f') === ('c') # => true + # (5..9) === (11) # => false + # + # The given range must be fully bounded, with both start and end. + # + # pkg:gem/activesupport#lib/active_support/core_ext/range/compare_range.rb:16 + def ===(value); end + + # Extends the default Range#include? to support range comparisons. + # (1..5).include?(1..5) # => true + # (1..5).include?(2..3) # => true + # (1..5).include?(1...6) # => true + # (1..5).include?(2..6) # => false + # + # The native Range#include? behavior is untouched. + # ('a'..'f').include?('c') # => true + # (5..9).include?(11) # => false + # + # The given range must be fully bounded, with both start and end. + # + # pkg:gem/activesupport#lib/active_support/core_ext/range/compare_range.rb:35 + def include?(value); end +end + +# = Active Support \Concern +# +# A typical module looks like this: +# +# module M +# def self.included(base) +# base.extend ClassMethods +# base.class_eval do +# scope :disabled, -> { where(disabled: true) } +# end +# end +# +# module ClassMethods +# ... +# end +# end +# +# By using +ActiveSupport::Concern+ the above module could instead be +# written as: +# +# require "active_support/concern" +# +# module M +# extend ActiveSupport::Concern +# +# included do +# scope :disabled, -> { where(disabled: true) } +# end +# +# class_methods do +# ... +# end +# end +# +# Moreover, it gracefully handles module dependencies. Given a +Foo+ module +# and a +Bar+ module which depends on the former, we would typically write the +# following: +# +# module Foo +# def self.included(base) +# base.class_eval do +# def self.method_injected_by_foo +# ... +# end +# end +# end +# end +# +# module Bar +# def self.included(base) +# base.method_injected_by_foo +# end +# end +# +# class Host +# include Foo # We need to include this dependency for Bar +# include Bar # Bar is the module that Host really needs +# end +# +# But why should +Host+ care about +Bar+'s dependencies, namely +Foo+? We +# could try to hide these from +Host+ directly including +Foo+ in +Bar+: +# +# module Bar +# include Foo +# def self.included(base) +# base.method_injected_by_foo +# end +# end +# +# class Host +# include Bar +# end +# +# Unfortunately this won't work, since when +Foo+ is included, its base +# is the +Bar+ module, not the +Host+ class. With +ActiveSupport::Concern+, +# module dependencies are properly resolved: +# +# require "active_support/concern" +# +# module Foo +# extend ActiveSupport::Concern +# included do +# def self.method_injected_by_foo +# ... +# end +# end +# end +# +# module Bar +# extend ActiveSupport::Concern +# include Foo +# +# included do +# self.method_injected_by_foo +# end +# end +# +# class Host +# include Bar # It works, now Bar takes care of its dependencies +# end +# +# === Prepending concerns +# +# Just like include, concerns also support prepend with a corresponding +# prepended do callback. module ClassMethods or class_methods do are +# prepended as well. +# +# prepend is also used for any dependencies. +# +# pkg:gem/activesupport#lib/active_support/concern.rb:112 +module ActiveSupport::Concern + # pkg:gem/activesupport#lib/active_support/concern.rb:129 + def append_features(base); end + + # Define class methods from given block. + # You can define private class methods as well. + # + # module Example + # extend ActiveSupport::Concern + # + # class_methods do + # def foo; puts 'foo'; end + # + # private + # def bar; puts 'bar'; end + # end + # end + # + # class Buzz + # include Example + # end + # + # Buzz.foo # => "foo" + # Buzz.bar # => private method 'bar' called for Buzz:Class(NoMethodError) + # + # pkg:gem/activesupport#lib/active_support/concern.rb:209 + def class_methods(&class_methods_module_definition); end + + # Evaluate given block in context of base class, + # so that you can write class macros here. + # When you define more than one +included+ block, it raises an exception. + # + # pkg:gem/activesupport#lib/active_support/concern.rb:158 + def included(base = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/concern.rb:142 + def prepend_features(base); end + + # Evaluate given block in context of base class, + # so that you can write class macros here. + # When you define more than one +prepended+ block, it raises an exception. + # + # pkg:gem/activesupport#lib/active_support/concern.rb:175 + def prepended(base = T.unsafe(nil), &block); end + + class << self + # pkg:gem/activesupport#lib/active_support/concern.rb:125 + def extended(base); end + end +end + +# pkg:gem/activesupport#lib/active_support/concern.rb:113 +class ActiveSupport::Concern::MultipleIncludedBlocks < ::StandardError + # pkg:gem/activesupport#lib/active_support/concern.rb:114 + def initialize; end +end + +# pkg:gem/activesupport#lib/active_support/concern.rb:119 +class ActiveSupport::Concern::MultiplePrependBlocks < ::StandardError + # pkg:gem/activesupport#lib/active_support/concern.rb:120 + def initialize; end +end + +# pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:6 +module ActiveSupport::Concurrency; end + +# A monitor that will permit dependency loading while blocked waiting for +# the lock. +# +# pkg:gem/activesupport#lib/active_support/concurrency/load_interlock_aware_monitor.rb:9 +ActiveSupport::Concurrency::LoadInterlockAwareMonitor = Monitor + +# pkg:gem/activesupport#lib/active_support/concurrency/null_lock.rb:5 +module ActiveSupport::Concurrency::NullLock + extend ::ActiveSupport::Concurrency::NullLock + + # pkg:gem/activesupport#lib/active_support/concurrency/null_lock.rb:8 + def synchronize; end +end + +# A share/exclusive lock, otherwise known as a read/write lock. +# +# https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock +# +# pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:10 +class ActiveSupport::Concurrency::ShareLock + include ::MonitorMixin + + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:49 + def initialize; end + + # Execute the supplied block while holding the Exclusive lock. If + # +no_wait+ is set and the lock is not immediately available, + # returns +nil+ without yielding. Otherwise, returns the result of + # the block. + # + # See +start_exclusive+ for other options. + # + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:147 + def exclusive(purpose: T.unsafe(nil), compatible: T.unsafe(nil), after_compatible: T.unsafe(nil), no_wait: T.unsafe(nil)); end + + # We track Thread objects, instead of just using counters, because + # we need exclusive locks to be reentrant, and we need to be able + # to upgrade share locks to exclusive. + # + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:17 + def raw_state; end + + # Execute the supplied block while holding the Share lock. + # + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:158 + def sharing; end + + # Returns false if +no_wait+ is set and the lock is not + # immediately available. Otherwise, returns true after the lock + # has been acquired. + # + # +purpose+ and +compatible+ work together; while this thread is + # waiting for the exclusive lock, it will yield its share (if any) + # to any other attempt whose +purpose+ appears in this attempt's + # +compatible+ list. This allows a "loose" upgrade, which, being + # less strict, prevents some classes of deadlocks. + # + # For many resources, loose upgrades are sufficient: if a thread + # is awaiting a lock, it is not running any other code. With + # +purpose+ matching, it is possible to yield only to other + # threads whose activity will not interfere. + # + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:75 + def start_exclusive(purpose: T.unsafe(nil), compatible: T.unsafe(nil), no_wait: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:113 + def start_sharing; end + + # Relinquish the exclusive lock. Must only be called by the thread + # that called start_exclusive (and currently holds the lock). + # + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:95 + def stop_exclusive(compatible: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:130 + def stop_sharing; end + + # Temporarily give up all held Share locks while executing the + # supplied block, allowing any +compatible+ exclusive lock request + # to proceed. + # + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:170 + def yield_shares(purpose: T.unsafe(nil), compatible: T.unsafe(nil), block_share: T.unsafe(nil)); end + + private + + # Must be called within synchronize + # + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:203 + def busy_for_exclusive?(purpose); end + + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:208 + def busy_for_sharing?(purpose); end + + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:213 + def eligible_waiters?(compatible); end + + # pkg:gem/activesupport#lib/active_support/concurrency/share_lock.rb:217 + def wait_for(method, &block); end +end + +# pkg:gem/activesupport#lib/active_support/concurrency/thread_monitor.rb:5 +class ActiveSupport::Concurrency::ThreadMonitor + # pkg:gem/activesupport#lib/active_support/concurrency/thread_monitor.rb:10 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/concurrency/thread_monitor.rb:16 + def synchronize(&block); end + + private + + # pkg:gem/activesupport#lib/active_support/concurrency/thread_monitor.rb:37 + def mon_enter; end + + # pkg:gem/activesupport#lib/active_support/concurrency/thread_monitor.rb:43 + def mon_exit; end + + # pkg:gem/activesupport#lib/active_support/concurrency/thread_monitor.rb:29 + def mon_try_enter; end +end + +# pkg:gem/activesupport#lib/active_support/concurrency/thread_monitor.rb:7 +ActiveSupport::Concurrency::ThreadMonitor::EXCEPTION_IMMEDIATE = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/concurrency/thread_monitor.rb:6 +ActiveSupport::Concurrency::ThreadMonitor::EXCEPTION_NEVER = T.let(T.unsafe(nil), Hash) + +# = Active Support \Configurable +# +# Configurable provides a config method to store and retrieve +# configuration options as an OrderedOptions. +# +# pkg:gem/activesupport#lib/active_support/configurable.rb:17 +module ActiveSupport::Configurable + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveSupport::Configurable::ClassMethods + + # Reads and writes attributes from a configuration OrderedOptions. + # + # require "active_support/configurable" + # + # class User + # include ActiveSupport::Configurable + # end + # + # user = User.new + # + # user.config.allowed_access = true + # user.config.level = 1 + # + # user.config.allowed_access # => true + # user.config.level # => 1 + # + # pkg:gem/activesupport#lib/active_support/configurable.rb:189 + def config; end +end + +# pkg:gem/activesupport#lib/active_support/configurable.rb:35 +module ActiveSupport::Configurable::ClassMethods + # Reads and writes attributes from a configuration OrderedOptions. + # + # require "active_support/configurable" + # + # class User + # include ActiveSupport::Configurable + # end + # + # User.config.allowed_access = true + # User.config.level = 1 + # + # User.config.allowed_access # => true + # User.config.level # => 1 + # + # pkg:gem/activesupport#lib/active_support/configurable.rb:49 + def config; end + + # Configure values from within the passed block. + # + # require "active_support/configurable" + # + # class User + # include ActiveSupport::Configurable + # end + # + # User.config.allowed_access # => nil + # + # User.configure do |config| + # config.allowed_access = true + # end + # + # User.config.allowed_access # => true + # + # pkg:gem/activesupport#lib/active_support/configurable.rb:73 + def configure; end + + private + + # Allows you to add shortcut so that you don't have to refer to attribute + # through config. Also look at the example for config to contrast. + # + # Defines both class and instance config accessors. + # + # class User + # include ActiveSupport::Configurable + # config_accessor :allowed_access + # end + # + # User.allowed_access # => nil + # User.allowed_access = false + # User.allowed_access # => false + # + # user = User.new + # user.allowed_access # => false + # user.allowed_access = true + # user.allowed_access # => true + # + # User.allowed_access # => false + # + # The attribute name must be a valid method name in Ruby. + # + # class User + # include ActiveSupport::Configurable + # config_accessor :"1_Badname" + # end + # # => NameError: invalid config attribute name + # + # To omit the instance writer method, pass instance_writer: false. + # To omit the instance reader method, pass instance_reader: false. + # + # class User + # include ActiveSupport::Configurable + # config_accessor :allowed_access, instance_reader: false, instance_writer: false + # end + # + # User.allowed_access = false + # User.allowed_access # => false + # + # User.new.allowed_access = true # => NoMethodError + # User.new.allowed_access # => NoMethodError + # + # Or pass instance_accessor: false, to omit both instance methods. + # + # class User + # include ActiveSupport::Configurable + # config_accessor :allowed_access, instance_accessor: false + # end + # + # User.allowed_access = false + # User.allowed_access # => false + # + # User.new.allowed_access = true # => NoMethodError + # User.new.allowed_access # => NoMethodError + # + # Also you can pass default or a block to set up the attribute with a default value. + # + # class User + # include ActiveSupport::Configurable + # config_accessor :allowed_access, default: false + # config_accessor :hair_colors do + # [:brown, :black, :blonde, :red] + # end + # end + # + # User.allowed_access # => false + # User.hair_colors # => [:brown, :black, :blonde, :red] + # + # pkg:gem/activesupport#lib/active_support/configurable.rb:145 + def config_accessor(*names, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/configurable.rb:166 + def inherited(subclass); end +end + +# pkg:gem/activesupport#lib/active_support/configurable.rb:20 +class ActiveSupport::Configurable::Configuration < ::ActiveSupport::InheritableOptions + # pkg:gem/activesupport#lib/active_support/configurable.rb:21 + def compile_methods!; end + + class << self + # Compiles reader methods so we don't have to go through method_missing. + # + # pkg:gem/activesupport#lib/active_support/configurable.rb:26 + def compile_methods!(keys); end + end +end + +# Reads a YAML configuration file, evaluating any ERB, then +# parsing the resulting YAML. +# +# Warns in case of YAML confusing characters, like invisible +# non-breaking spaces. +# +# pkg:gem/activesupport#lib/active_support/configuration_file.rb:9 +class ActiveSupport::ConfigurationFile + # pkg:gem/activesupport#lib/active_support/configuration_file.rb:12 + def initialize(content_path); end + + # pkg:gem/activesupport#lib/active_support/configuration_file.rb:21 + def parse(context: T.unsafe(nil), **options); end + + private + + # pkg:gem/activesupport#lib/active_support/configuration_file.rb:44 + def read(content_path); end + + # pkg:gem/activesupport#lib/active_support/configuration_file.rb:54 + def render(context); end + + class << self + # pkg:gem/activesupport#lib/active_support/configuration_file.rb:17 + def parse(content_path, **options); end + end +end + +# pkg:gem/activesupport#lib/active_support/configuration_file.rb:10 +class ActiveSupport::ConfigurationFile::FormatError < ::StandardError; end + +# Provides a DSL for declaring a continuous integration workflow that can be run either locally or in the cloud. +# Each step is timed, reports success/error, and is aggregated into a collective report that reports total runtime, +# as well as whether the entire run was successful or not. +# +# Example: +# +# ActiveSupport::ContinuousIntegration.run do +# step "Setup", "bin/setup --skip-server" +# step "Style: Ruby", "bin/rubocop" +# step "Security: Gem audit", "bin/bundler-audit" +# step "Tests: Rails", "bin/rails test test:system" +# +# if success? +# step "Signoff: Ready for merge and deploy", "gh signoff" +# else +# failure "Skipping signoff; CI failed.", "Fix the issues and try again." +# end +# end +# +# Starting with Rails 8.1, a default `bin/ci` and `config/ci.rb` file are created to provide out-of-the-box CI. +# +# pkg:gem/activesupport#lib/active_support/continuous_integration.rb:24 +class ActiveSupport::ContinuousIntegration + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:64 + def initialize; end + + # Echo text to the terminal in the color corresponding to the type of the text. + # + # Examples: + # + # echo "This is going to be green!", type: :success + # echo "This is going to be red!", type: :error + # + # See ActiveSupport::ContinuousIntegration::COLORS for a complete list of options. + # + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:111 + def echo(text, type:); end + + # Display an error heading with the title and optional subtitle to reflect that the run failed. + # + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:86 + def failure(title, subtitle = T.unsafe(nil)); end + + # Display a colorized heading followed by an optional subtitle. + # + # Examples: + # + # heading "Smoke Testing", "End-to-end tests verifying key functionality", padding: false + # heading "Skipping video encoding tests", "Install FFmpeg to run these tests", type: :error + # + # See ActiveSupport::ContinuousIntegration::COLORS for a complete list of options. + # + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:98 + def heading(heading, subtitle = T.unsafe(nil), type: T.unsafe(nil), padding: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:116 + def report(title, &block); end + + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:33 + def results; end + + # Declare a step with a title and a command. The command can either be given as a single string or as multiple + # strings that will be passed to `system` as individual arguments (and therefore correctly escaped for paths etc). + # + # Examples: + # + # step "Setup", "bin/setup" + # step "Single test", "bin/rails", "test", "--name", "test_that_is_one" + # + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:75 + def step(title, *command); end + + # Returns true if all steps were successful. + # + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:81 + def success?; end + + private + + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:141 + def colorize(text, type); end + + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:134 + def timing; end + + class << self + # Perform a CI run. Execute each step, show their results and runtime, and exit with a non-zero status if there are any failures. + # + # Pass an optional title, subtitle, and a block that declares the steps to be executed. + # + # Sets the CI environment variable to "true" to allow for conditional behavior in the app, like enabling eager loading and disabling logging. + # + # Example: + # + # ActiveSupport::ContinuousIntegration.run do + # step "Setup", "bin/setup --skip-server" + # step "Style: Ruby", "bin/rubocop" + # step "Security: Gem audit", "bin/bundler-audit" + # step "Tests: Rails", "bin/rails test test:system" + # + # if success? + # step "Signoff: Ready for merge and deploy", "gh signoff" + # else + # failure "Skipping signoff; CI failed.", "Fix the issues and try again." + # end + # end + # + # pkg:gem/activesupport#lib/active_support/continuous_integration.rb:55 + def run(title = T.unsafe(nil), subtitle = T.unsafe(nil), &block); end + end +end + +# pkg:gem/activesupport#lib/active_support/continuous_integration.rb:25 +ActiveSupport::ContinuousIntegration::COLORS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:6 +module ActiveSupport::CoreExt; end + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:7 +module ActiveSupport::CoreExt::ERBUtil + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:28 + def h(s); end + + # HTML escapes strings but doesn't wrap them with an ActiveSupport::SafeBuffer. + # This method is not for public consumption! Seriously! + # A utility method for escaping HTML tag characters. + # This method is also aliased as h. + # + # puts html_escape('is a > 0 & a < 10?') + # # => is a > 0 & a < 10? + # + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:10 + def html_escape(s); end + + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:18 + def unwrapped_html_escape(s); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:31 +module ActiveSupport::CoreExt::ERBUtilPrivate + include ::ActiveSupport::CoreExt::ERBUtil + + private + + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:33 + def h(s); end + + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:33 + def html_escape(s); end + + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:33 + def unwrapped_html_escape(s); end +end + +# = Current Attributes +# +# Abstract super class that provides a thread-isolated attributes singleton, which resets automatically +# before and after each request. This allows you to keep all the per-request attributes easily +# available to the whole system. +# +# The following full app-like example demonstrates how to use a Current class to +# facilitate easy access to the global, per-request attributes without passing them deeply +# around everywhere: +# +# # app/models/current.rb +# class Current < ActiveSupport::CurrentAttributes +# attribute :account, :user +# attribute :request_id, :user_agent, :ip_address +# +# resets { Time.zone = nil } +# +# def user=(user) +# super +# self.account = user.account +# Time.zone = user.time_zone +# end +# end +# +# # app/controllers/concerns/authentication.rb +# module Authentication +# extend ActiveSupport::Concern +# +# included do +# before_action :authenticate +# end +# +# private +# def authenticate +# if authenticated_user = User.find_by(id: cookies.encrypted[:user_id]) +# Current.user = authenticated_user +# else +# redirect_to new_session_url +# end +# end +# end +# +# # app/controllers/concerns/set_current_request_details.rb +# module SetCurrentRequestDetails +# extend ActiveSupport::Concern +# +# included do +# before_action do +# Current.request_id = request.uuid +# Current.user_agent = request.user_agent +# Current.ip_address = request.ip +# end +# end +# end +# +# class ApplicationController < ActionController::Base +# include Authentication +# include SetCurrentRequestDetails +# end +# +# class MessagesController < ApplicationController +# def create +# Current.account.messages.create(message_params) +# end +# end +# +# class Message < ApplicationRecord +# belongs_to :creator, default: -> { Current.user } +# after_create { |message| Event.create(record: message) } +# end +# +# class Event < ApplicationRecord +# before_create do +# self.request_id = Current.request_id +# self.user_agent = Current.user_agent +# self.ip_address = Current.ip_address +# end +# end +# +# A word of caution: It's easy to overdo a global singleton like Current and tangle your model as a result. +# Current should only be used for a few, top-level globals, like account, user, and request details. +# The attributes stuck in Current should be used by more or less all actions on all requests. If you start +# sticking controller-specific attributes in there, you're going to create a mess. +# +# pkg:gem/activesupport#lib/active_support/current_attributes.rb:93 +class ActiveSupport::CurrentAttributes + include ::ActiveSupport::Callbacks + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:186 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:94 + def __callbacks; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:95 + def _reset_callbacks; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:95 + def _run_reset_callbacks; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:95 + def _run_reset_callbacks!(&block); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:186 + def attributes; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:186 + def attributes=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:186 + def defaults; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:186 + def defaults?; end + + # Reset all attributes. Should be called before and after actions, when used as a per-request singleton. + # + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:186 + def reset; end + + # Expose one or more attributes within a block. Old values are returned after the block concludes. + # Example demonstrating the common use of needing to set Current attributes outside the request-cycle: + # + # class Chat::PublicationJob < ApplicationJob + # def perform(attributes, room_number, creator) + # Current.set(person: creator) do + # Chat::Publisher.publish(attributes: attributes, room_number: room_number) + # end + # end + # end + # + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:186 + def set(attributes, &block); end + + private + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:186 + def resolve_defaults; end + + class << self + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:94 + def __callbacks; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:94 + def __callbacks=(value); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:95 + def _reset_callbacks; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:95 + def _reset_callbacks=(value); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:153 + def after_reset(*methods, &block); end + + # Declares one or more attributes that will be given both class and instance accessor methods. + # + # ==== Options + # + # * :default - The default value for the attributes. If the value + # is a proc or lambda, it will be called whenever an instance is + # constructed. Otherwise, the value will be duplicated with +#dup+. + # Default values are re-assigned when the attributes are reset. + # + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:115 + def attribute(*names, default: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:197 + def attributes(&); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:197 + def attributes=(arg); end + + # Calls this callback before #reset is called on the instance. Used for resetting external collaborators that depend on current values. + # + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:145 + def before_reset(*methods, &block); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:157 + def clear_all; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:201 + def defaults; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:201 + def defaults=(value); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:201 + def defaults?; end + + # Returns singleton instance for this class in this thread. If none exists, one is created. + # + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:103 + def instance; end + + # Reset all attributes. Should be called before and after actions, when used as a per-request singleton. + # + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:155 + def reset(*, **, &); end + + # Calls this callback after #reset is called on the instance. Used for resetting external collaborators, like Time.zone. + # + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:150 + def resets(*methods, &block); end + + # Expose one or more attributes within a block. Old values are returned after the block concludes. + # Example demonstrating the common use of needing to set Current attributes outside the request-cycle: + # + # class Chat::PublicationJob < ApplicationJob + # def perform(attributes, room_number, creator) + # Current.set(person: creator) do + # Chat::Publisher.publish(attributes: attributes, room_number: room_number) + # end + # end + # end + # + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:155 + def set(*, **, &); end + + private + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:94 + def __class_attr___callbacks; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:94 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:201 + def __class_attr_defaults; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:201 + def __class_attr_defaults=(new_value); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:169 + def current_instances; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:173 + def current_instances_key; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:165 + def generated_attribute_methods; end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:185 + def method_added(name); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:177 + def method_missing(name, *, **, &); end + + # pkg:gem/activesupport#lib/active_support/current_attributes.rb:181 + def respond_to_missing?(name, _); end + end +end + +# pkg:gem/activesupport#lib/active_support/current_attributes.rb:97 +ActiveSupport::CurrentAttributes::INVALID_ATTRIBUTE_NAMES = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/current_attributes.rb:99 +ActiveSupport::CurrentAttributes::NOT_SET = T.let(T.unsafe(nil), Object) + +# Provides +deep_merge+ and +deep_merge!+ methods. Expects the including class +# to provide a merge!(other, &block) method. +# +# pkg:gem/activesupport#lib/active_support/deep_mergeable.rb:6 +module ActiveSupport::DeepMergeable + # Returns a new instance with the values from +other+ merged recursively. + # + # class Hash + # include ActiveSupport::DeepMergeable + # end + # + # hash_1 = { a: true, b: { c: [1, 2, 3] } } + # hash_2 = { a: false, b: { x: [3, 4, 5] } } + # + # hash_1.deep_merge(hash_2) + # # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } } + # + # A block can be provided to merge non-DeepMergeable values: + # + # hash_1 = { a: 100, b: 200, c: { c1: 100 } } + # hash_2 = { b: 250, c: { c1: 200 } } + # + # hash_1.deep_merge(hash_2) do |key, this_val, other_val| + # this_val + other_val + # end + # # => { a: 100, b: 450, c: { c1: 300 } } + # + # pkg:gem/activesupport#lib/active_support/deep_mergeable.rb:29 + def deep_merge(other, &block); end + + # Same as #deep_merge, but modifies +self+. + # + # pkg:gem/activesupport#lib/active_support/deep_mergeable.rb:34 + def deep_merge!(other, &block); end + + # Returns true if +other+ can be deep merged into +self+. Classes may + # override this method to restrict or expand the domain of deep mergeable + # values. Defaults to checking that +other+ is of type +self.class+. + # + # pkg:gem/activesupport#lib/active_support/deep_mergeable.rb:49 + def deep_merge?(other); end +end + +# pkg:gem/activesupport#lib/active_support/delegation.rb:14 +module ActiveSupport::Delegation + class << self + # pkg:gem/activesupport#lib/active_support/delegation.rb:21 + def generate(owner, methods, location: T.unsafe(nil), to: T.unsafe(nil), prefix: T.unsafe(nil), allow_nil: T.unsafe(nil), nilable: T.unsafe(nil), private: T.unsafe(nil), as: T.unsafe(nil), signature: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/delegation.rb:150 + def generate_method_missing(owner, target, allow_nil: T.unsafe(nil)); end + end +end + +# pkg:gem/activesupport#lib/active_support/delegation.rb:18 +ActiveSupport::Delegation::RESERVED_METHOD_NAMES = T.let(T.unsafe(nil), Set) + +# pkg:gem/activesupport#lib/active_support/delegation.rb:15 +ActiveSupport::Delegation::RUBY_RESERVED_KEYWORDS = T.let(T.unsafe(nil), Array) + +# Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+ +# option is not used. +# +# pkg:gem/activesupport#lib/active_support/delegation.rb:6 +class ActiveSupport::DelegationError < ::NoMethodError + class << self + # pkg:gem/activesupport#lib/active_support/delegation.rb:8 + def nil_target(method_name, target); end + end +end + +# pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:6 +module ActiveSupport::Dependencies + class << self + # pkg:gem/activesupport#lib/active_support/dependencies.rb:66 + def _autoloaded_tracked_classes; end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:66 + def _autoloaded_tracked_classes=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:60 + def _eager_load_paths; end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:60 + def _eager_load_paths=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:53 + def autoload_once_paths; end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:53 + def autoload_once_paths=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:47 + def autoload_paths; end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:47 + def autoload_paths=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:73 + def autoloader; end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:73 + def autoloader=(_arg0); end + + # Private method that reloads constants autoloaded by the main autoloader. + # + # Rails.application.reloader.reload! is the public interface for application + # reload. That involves more things, like deleting unloaded classes from the + # internal state of the descendants tracker, or reloading routes. + # + # pkg:gem/activesupport#lib/active_support/dependencies.rb:80 + def clear; end + + # Private method that helps configuring the autoloaders. + # + # pkg:gem/activesupport#lib/active_support/dependencies.rb:98 + def eager_load?(path); end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:9 + def interlock; end + + # pkg:gem/activesupport#lib/active_support/dependencies.rb:9 + def interlock=(_arg0); end + + # Execute the supplied block while holding an exclusive lock, + # preventing any other thread from being inside a #run_interlock + # block at the same time. + # + # pkg:gem/activesupport#lib/active_support/dependencies.rb:23 + def load_interlock(&block); end + + # Execute the supplied block without interference from any + # concurrent loads. + # + # pkg:gem/activesupport#lib/active_support/dependencies.rb:16 + def run_interlock(&block); end + + # Private method used by require_dependency. + # + # pkg:gem/activesupport#lib/active_support/dependencies.rb:88 + def search_for_file(relpath); end + + # Execute the supplied block while holding an exclusive lock, + # preventing any other thread from being inside a #run_interlock + # block at the same time. + # + # pkg:gem/activesupport#lib/active_support/dependencies.rb:35 + def unload_interlock(&block); end + end +end + +# pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:7 +class ActiveSupport::Dependencies::Interlock + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:8 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:37 + def done_running; end + + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:29 + def done_unloading; end + + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:12 + def loading(&block); end + + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:45 + def permit_concurrent_loads(&block); end + + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:50 + def raw_state(&block); end + + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:41 + def running(&block); end + + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:33 + def start_running; end + + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:25 + def start_unloading; end + + # pkg:gem/activesupport#lib/active_support/dependencies/interlock.rb:21 + def unloading(&block); end +end + +# pkg:gem/activesupport#lib/active_support/dependencies/require_dependency.rb:3 +module ActiveSupport::Dependencies::RequireDependency + # Warning: This method is obsolete. The semantics of the autoloader + # match Ruby's and you do not need to be defensive with load order anymore. + # Just refer to classes and modules normally. + # + # Engines that do not control the mode in which their parent application runs + # should call +require_dependency+ where needed in case the runtime mode is + # +:classic+. + # + # pkg:gem/activesupport#lib/active_support/dependencies/require_dependency.rb:11 + def require_dependency(filename); end +end + +# = Active Support \Deprecation +# +# \Deprecation specifies the API used by \Rails to deprecate methods, instance variables, objects, and constants. It's +# also available for gems or applications. +# +# For a gem, use Deprecation.new to create a Deprecation object and store it in your module or class (in order for +# users to be able to configure it). +# +# module MyLibrary +# def self.deprecator +# @deprecator ||= ActiveSupport::Deprecation.new("2.0", "MyLibrary") +# end +# end +# +# For a Railtie or Engine, you may also want to add it to the application's deprecators, so that the application's +# configuration can be applied to it. +# +# module MyLibrary +# class Railtie < Rails::Railtie +# initializer "my_library.deprecator" do |app| +# app.deprecators[:my_library] = MyLibrary.deprecator +# end +# end +# end +# +# With the above initializer, configuration settings like the following will affect +MyLibrary.deprecator+: +# +# # in config/environments/test.rb +# config.active_support.deprecation = :raise +# +# pkg:gem/activesupport#lib/active_support/deprecation.rb:33 +class ActiveSupport::Deprecation + include ::ActiveSupport::Deprecation::Behavior + include ::ActiveSupport::Deprecation::Reporting + include ::ActiveSupport::Deprecation::Disallowed + include ::ActiveSupport::Deprecation::MethodWrapper + + # It accepts two parameters on initialization. The first is a version of library + # and the second is a library name. + # + # ActiveSupport::Deprecation.new('2.0', 'MyLibrary') + # + # pkg:gem/activesupport#lib/active_support/deprecation.rb:71 + def initialize(deprecation_horizon = T.unsafe(nil), gem_name = T.unsafe(nil)); end + + # The version number in which the deprecated behavior will be removed, by default. + # + # pkg:gem/activesupport#lib/active_support/deprecation.rb:65 + def deprecation_horizon; end + + # The version number in which the deprecated behavior will be removed, by default. + # + # pkg:gem/activesupport#lib/active_support/deprecation.rb:65 + def deprecation_horizon=(_arg0); end + + class << self + # pkg:gem/activesupport#lib/active_support/deprecation.rb:60 + def _instance; end + end +end + +# Behavior module allows to determine how to display deprecation messages. +# You can create a custom behavior or set any from the +DEFAULT_BEHAVIORS+ +# constant. Available behaviors are: +# +# [+:raise+] Raise ActiveSupport::DeprecationException. +# [+:stderr+] Log all deprecation warnings to $stderr. +# [+:log+] Log all deprecation warnings to +Rails.logger+. +# [+:notify+] Use ActiveSupport::Notifications to notify +deprecation.rails+. +# [+:report+] Use ActiveSupport::ErrorReporter to report deprecations. +# [+:silence+] Do nothing. On \Rails, set config.active_support.report_deprecations = false to disable all behaviors. +# +# Setting behaviors only affects deprecations that happen after boot time. +# For more information you can read the documentation of the #behavior= method. +# +# pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:69 +module ActiveSupport::Deprecation::Behavior + # Returns the current behavior or if one isn't set, defaults to +:stderr+. + # + # pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:74 + def behavior; end + + # Sets the behavior to the specified value. Can be a single value, array, + # or an object that responds to +call+. + # + # Available behaviors: + # + # [+:raise+] Raise ActiveSupport::DeprecationException. + # [+:stderr+] Log all deprecation warnings to $stderr. + # [+:log+] Log all deprecation warnings to +Rails.logger+. + # [+:notify+] Use ActiveSupport::Notifications to notify +deprecation.rails+. + # [+:report+] Use ActiveSupport::ErrorReporter to report deprecations. + # [+:silence+] Do nothing. + # + # Setting behaviors only affects deprecations that happen after boot time. + # Deprecation warnings raised by gems are not affected by this setting + # because they happen before \Rails boots up. + # + # deprecator = ActiveSupport::Deprecation.new + # deprecator.behavior = :stderr + # deprecator.behavior = [:stderr, :log] + # deprecator.behavior = MyCustomHandler + # deprecator.behavior = ->(message, callstack, deprecation_horizon, gem_name) { + # # custom stuff + # } + # + # If you are using \Rails, you can set + # config.active_support.report_deprecations = false to disable + # all deprecation behaviors. This is similar to the +:silence+ option but + # more performant. + # + # pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:111 + def behavior=(behavior); end + + # Whether to print a backtrace along with the warning. + # + # pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:71 + def debug; end + + # Whether to print a backtrace along with the warning. + # + # pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:71 + def debug=(_arg0); end + + # Returns the current behavior for disallowed deprecations or if one isn't set, defaults to +:raise+. + # + # pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:79 + def disallowed_behavior; end + + # Sets the behavior for disallowed deprecations (those configured by + # ActiveSupport::Deprecation#disallowed_warnings=) to the specified + # value. As with #behavior=, this can be a single value, array, or an + # object that responds to +call+. + # + # pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:119 + def disallowed_behavior=(behavior); end + + private + + # pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:124 + def arity_coerce(behavior); end + + # pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:143 + def arity_of_callable(callable); end +end + +# Default warning behaviors per Rails.env. +# +# pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:13 +ActiveSupport::Deprecation::DEFAULT_BEHAVIORS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/deprecation/constant_accessor.rb:5 +module ActiveSupport::Deprecation::DeprecatedConstantAccessor + class << self + # pkg:gem/activesupport#lib/active_support/deprecation/constant_accessor.rb:6 + def included(base); end + end +end + +# DeprecatedConstantProxy transforms a constant into a deprecated one. It takes the full names of an old +# (deprecated) constant and of a new constant (both in string form) and a deprecator. The deprecated constant now +# returns the value of the new one. +# +# PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto) +# +# # (In a later update, the original implementation of `PLANETS` has been removed.) +# +# PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) +# PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("PLANETS", "PLANETS_POST_2006", ActiveSupport::Deprecation.new) +# +# PLANETS.map { |planet| planet.capitalize } +# # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead. +# (Backtrace information…) +# ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"] +# +# pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:120 +class ActiveSupport::Deprecation::DeprecatedConstantProxy < ::Module + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:128 + def initialize(old_const, new_const, deprecator, message: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:158 + def append_features(base); end + + # Returns the class of the new constant. + # + # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) + # PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('PLANETS', 'PLANETS_POST_2006') + # PLANETS.class # => Array + # + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:154 + def class; end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:168 + def extended(base); end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:147 + def hash(*, **, &); end + + # Don't give a deprecation warning on inspect since test/unit and error + # logs rely on it for diagnostics. + # + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:141 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:147 + def instance_methods(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:147 + def name(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:163 + def prepend_features(base); end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:147 + def respond_to?(*, **, &); end + + private + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:178 + def const_missing(name); end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:183 + def method_missing(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:174 + def target; end + + class << self + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:121 + def new(*args, **options, &block); end + end +end + +# DeprecatedInstanceVariableProxy transforms an instance variable into a deprecated one. It takes an instance of a +# class, a method on that class, an instance variable, and a deprecator as the last argument. +# +# Trying to use the deprecated instance variable will result in a deprecation warning, pointing to the method as a +# replacement. +# +# class Example +# def initialize +# @request = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :request, :@request, ActiveSupport::Deprecation.new) +# @_request = :special_request +# end +# +# def request +# @_request +# end +# +# def old_request +# @request +# end +# end +# +# example = Example.new +# # => # +# +# example.old_request.to_s +# # => DEPRECATION WARNING: @request is deprecated! Call request.to_s instead of +# @request.to_s +# (Backtrace information…) +# "special_request" +# +# example.request.to_s +# # => "special_request" +# +# pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:87 +class ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy < ::ActiveSupport::Deprecation::DeprecationProxy + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:88 + def initialize(instance, method, var = T.unsafe(nil), deprecator:); end + + private + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:96 + def target; end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:100 + def warn(callstack, called, args); end +end + +# DeprecatedObjectProxy transforms an object into a deprecated one. It takes an object, a deprecation message, and +# a deprecator. +# +# deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated", ActiveSupport::Deprecation.new) +# # => # +# +# deprecated_object.to_s +# DEPRECATION WARNING: This object is now deprecated. +# (Backtrace) +# # => "#" +# +# pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:38 +class ActiveSupport::Deprecation::DeprecatedObjectProxy < ::ActiveSupport::Deprecation::DeprecationProxy + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:39 + def initialize(object, message, deprecator); end + + private + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:46 + def target; end + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:50 + def warn(callstack, called, args); end +end + +# pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:5 +class ActiveSupport::Deprecation::DeprecationProxy + # Don't give a deprecation warning on inspect since test/unit and error + # logs rely on it for diagnostics. + # + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:17 + def inspect; end + + private + + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:22 + def method_missing(called, *args, &block); end + + class << self + # pkg:gem/activesupport#lib/active_support/deprecation/proxy_wrappers.rb:6 + def new(*args, **kwargs, &block); end + end +end + +# A managed collection of deprecators. Configuration methods, such as +# #behavior=, affect all deprecators in the collection. Additionally, the +# #silence method silences all deprecators in the collection for the +# duration of a given block. +# +# pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:9 +class ActiveSupport::Deprecation::Deprecators + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:10 + def initialize; end + + # Returns a deprecator added to this collection via #[]=. + # + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:16 + def [](name); end + + # Adds a given +deprecator+ to this collection. The deprecator will be + # immediately configured with any options previously set on this + # collection. + # + # deprecators = ActiveSupport::Deprecation::Deprecators.new + # deprecators.debug = true + # + # foo_deprecator = ActiveSupport::Deprecation.new("2.0", "Foo") + # foo_deprecator.debug # => false + # + # deprecators[:foo] = foo_deprecator + # deprecators[:foo].debug # => true + # foo_deprecator.debug # => true + # + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:34 + def []=(name, deprecator); end + + # Sets the deprecation warning behavior for all deprecators in this + # collection. + # + # See ActiveSupport::Deprecation#behavior=. + # + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:60 + def behavior=(behavior); end + + # Sets the debug flag for all deprecators in this collection. + # + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:52 + def debug=(debug); end + + # Sets the disallowed deprecation warning behavior for all deprecators in + # this collection. + # + # See ActiveSupport::Deprecation#disallowed_behavior=. + # + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:68 + def disallowed_behavior=(disallowed_behavior); end + + # Sets the disallowed deprecation warnings for all deprecators in this + # collection. + # + # See ActiveSupport::Deprecation#disallowed_warnings=. + # + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:76 + def disallowed_warnings=(disallowed_warnings); end + + # Iterates over all deprecators in this collection. If no block is given, + # returns an +Enumerator+. + # + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:41 + def each(&block); end + + # Silences all deprecators in this collection for the duration of the + # given block. + # + # See ActiveSupport::Deprecation#silence. + # + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:84 + def silence(&block); end + + # Sets the silenced flag for all deprecators in this collection. + # + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:47 + def silenced=(silenced); end + + private + + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:97 + def apply_options(deprecator); end + + # pkg:gem/activesupport#lib/active_support/deprecation/deprecators.rb:92 + def set_option(name, value); end +end + +# pkg:gem/activesupport#lib/active_support/deprecation/disallowed.rb:5 +module ActiveSupport::Deprecation::Disallowed + # Sets the criteria used to identify deprecation messages which should be + # disallowed. Can be an array containing strings, symbols, or regular + # expressions. (Symbols are treated as strings.) These are compared against + # the text of the generated deprecation warning. + # + # Additionally the scalar symbol +:all+ may be used to treat all + # deprecations as disallowed. + # + # Deprecations matching a substring or regular expression will be handled + # using the configured Behavior#disallowed_behavior rather than + # Behavior#behavior. + # Returns the configured criteria used to identify deprecation messages + # which should be treated as disallowed. + # + # pkg:gem/activesupport#lib/active_support/deprecation/disallowed.rb:21 + def disallowed_warnings; end + + # Sets the criteria used to identify deprecation messages which should be + # disallowed. Can be an array containing strings, symbols, or regular + # expressions. (Symbols are treated as strings.) These are compared against + # the text of the generated deprecation warning. + # + # Additionally the scalar symbol +:all+ may be used to treat all + # deprecations as disallowed. + # + # Deprecations matching a substring or regular expression will be handled + # using the configured Behavior#disallowed_behavior rather than + # Behavior#behavior. + # Returns the configured criteria used to identify deprecation messages + # which should be treated as disallowed. + # + # pkg:gem/activesupport#lib/active_support/deprecation/disallowed.rb:17 + def disallowed_warnings=(_arg0); end + + private + + # pkg:gem/activesupport#lib/active_support/deprecation/disallowed.rb:26 + def deprecation_disallowed?(message); end + + # pkg:gem/activesupport#lib/active_support/deprecation/disallowed.rb:39 + def explicitly_allowed?(message); end +end + +# pkg:gem/activesupport#lib/active_support/deprecation.rb:57 +ActiveSupport::Deprecation::MUTEX = T.let(T.unsafe(nil), Thread::Mutex) + +# pkg:gem/activesupport#lib/active_support/deprecation/method_wrappers.rb:8 +module ActiveSupport::Deprecation::MethodWrapper + # Declare that a method has been deprecated. + # + # class Fred + # def aaa; end + # def bbb; end + # def ccc; end + # def ddd; end + # def eee; end + # end + # + # deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem') + # + # deprecator.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead') + # # => Fred + # + # Fred.new.aaa + # # DEPRECATION WARNING: aaa is deprecated and will be removed from MyGem next-release. (called from irb_binding at (irb):10) + # # => nil + # + # Fred.new.bbb + # # DEPRECATION WARNING: bbb is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):11) + # # => nil + # + # Fred.new.ccc + # # DEPRECATION WARNING: ccc is deprecated and will be removed from MyGem next-release (use Bar#ccc instead). (called from irb_binding at (irb):12) + # # => nil + # + # pkg:gem/activesupport#lib/active_support/deprecation/method_wrappers.rb:35 + def deprecate_methods(target_module, *method_names); end +end + +# pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:7 +module ActiveSupport::Deprecation::Reporting + # Allow previously disallowed deprecation warnings within the block. + # allowed_warnings can be an array containing strings, symbols, or regular + # expressions. (Symbols are treated as strings). These are compared against + # the text of deprecation warning messages generated within the block. + # Matching warnings will be exempt from the rules set by + # ActiveSupport::Deprecation#disallowed_warnings. + # + # The optional if: argument accepts a truthy/falsy value or an object that + # responds to .call. If truthy, then matching warnings will be allowed. + # If falsey then the method yields to the block without allowing the warning. + # + # deprecator = ActiveSupport::Deprecation.new + # deprecator.disallowed_behavior = :raise + # deprecator.disallowed_warnings = [ + # "something broke" + # ] + # + # deprecator.warn('something broke!') + # # => ActiveSupport::DeprecationException + # + # deprecator.allow ['something broke'] do + # deprecator.warn('something broke!') + # end + # # => nil + # + # deprecator.allow ['something broke'], if: Rails.env.production? do + # deprecator.warn('something broke!') + # end + # # => ActiveSupport::DeprecationException for dev/test, nil for production + # + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:89 + def allow(allowed_warnings = T.unsafe(nil), if: T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:48 + def begin_silence; end + + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:99 + def deprecation_warning(deprecated_method_name, message = T.unsafe(nil), caller_backtrace = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:52 + def end_silence; end + + # Name of gem where method is deprecated + # + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:11 + def gem_name; end + + # Name of gem where method is deprecated + # + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:11 + def gem_name=(_arg0); end + + # Silence deprecation warnings within the block. + # + # deprecator = ActiveSupport::Deprecation.new + # deprecator.warn('something broke!') + # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" + # + # deprecator.silence do + # deprecator.warn('something broke!') + # end + # # => nil + # + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:41 + def silence(&block); end + + # Whether to print a message (silent mode) + # + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:56 + def silenced; end + + # Whether to print a message (silent mode) + # + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:9 + def silenced=(_arg0); end + + # Outputs a deprecation warning to the output configured by + # ActiveSupport::Deprecation#behavior. + # + # ActiveSupport::Deprecation.new.warn('something broke!') + # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" + # + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:18 + def warn(message = T.unsafe(nil), callstack = T.unsafe(nil)); end + + private + + # Outputs a deprecation warning message + # + # deprecated_method_warning(:method_name) + # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon}" + # deprecated_method_warning(:method_name, :another_method) + # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (use another_method instead)" + # deprecated_method_warning(:method_name, "Optional message") + # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (Optional message)" + # + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:115 + def deprecated_method_warning(method_name, message = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:129 + def deprecation_caller_message(callstack); end + + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:124 + def deprecation_message(callstack, message = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:140 + def extract_callstack(callstack); end + + # pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:157 + def ignored_callstack?(path); end +end + +# pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:154 +ActiveSupport::Deprecation::Reporting::LIB_DIR = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/deprecation/reporting.rb:152 +ActiveSupport::Deprecation::Reporting::RAILS_GEM_ROOT = T.let(T.unsafe(nil), String) + +# Raised when ActiveSupport::Deprecation::Behavior#behavior is set with :raise. +# You would set :raise, as a behavior to raise errors and proactively report exceptions from deprecations. +# +# pkg:gem/activesupport#lib/active_support/deprecation/behaviors.rb:8 +class ActiveSupport::DeprecationException < ::StandardError; end + +# = Active Support Descendants Tracker +# +# This module provides an internal implementation to track descendants +# which is faster than iterating through +ObjectSpace+. +# +# However Ruby 3.1 provide a fast native +Class#subclasses+ method, +# so if you know your code won't be executed on older rubies, including +# +ActiveSupport::DescendantsTracker+ does not provide any benefit. +# +# pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:14 +module ActiveSupport::DescendantsTracker + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:107 + def descendants; end + + class << self + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:78 + def clear(classes); end + + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:102 + def descendants(klass); end + + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:69 + def disable_clear!; end + + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:89 + def reject!(classes); end + + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:98 + def subclasses(klass); end + end +end + +# pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:58 +module ActiveSupport::DescendantsTracker::ReloadedClassesFiltering + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:63 + def descendants; end + + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:59 + def subclasses; end +end + +# On MRI `ObjectSpace::WeakMap` keys are weak references. +# So we can simply use WeakMap as a `Set`. +# On TruffleRuby `ObjectSpace::WeakMap` keys are strong references. +# So we use `object_id` as a key and the actual object as a value. +# +# JRuby for now doesn't have Class#descendant, but when it will, it will likely +# have the same WeakMap semantic than Truffle so we future proof this as much as possible. +# +# pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:20 +class ActiveSupport::DescendantsTracker::WeakSet < ::ObjectSpace::WeakMap + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:23 + def <<(object); end + + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:21 + def to_a; end +end + +# pkg:gem/activesupport#lib/active_support/digest.rb:6 +class ActiveSupport::Digest + class << self + # pkg:gem/activesupport#lib/active_support/digest.rb:8 + def hash_digest_class; end + + # pkg:gem/activesupport#lib/active_support/digest.rb:12 + def hash_digest_class=(klass); end + + # pkg:gem/activesupport#lib/active_support/digest.rb:17 + def hexdigest(arg); end + end +end + +# = Active Support \Duration +# +# Provides accurate date and time measurements using Date#advance and +# Time#advance, respectively. It mainly supports the methods on Numeric. +# +# 1.month.ago # equivalent to Time.now.advance(months: -1) +# +# pkg:gem/activesupport#lib/active_support/duration.rb:14 +class ActiveSupport::Duration + # pkg:gem/activesupport#lib/active_support/duration.rb:226 + def initialize(value, parts, variable = T.unsafe(nil)); end + + # Returns the modulo of this Duration by another Duration or Numeric. + # Numeric values are treated as seconds. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:312 + def %(other); end + + # Multiplies this Duration by a Numeric and returns a new Duration. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:287 + def *(other); end + + # Adds another Duration or a Numeric to this Duration. Numeric values + # are treated as seconds. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:268 + def +(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:326 + def +@; end + + # Subtracts another Duration or a Numeric from this Duration. Numeric + # values are treated as seconds. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:282 + def -(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:322 + def -@; end + + # Divides this Duration by a Numeric and returns a new Duration. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:298 + def /(other); end + + # Compares one Duration with another or a Numeric to this Duration. + # Numeric values are treated as seconds. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:258 + def <=>(other); end + + # Returns +true+ if +other+ is also a Duration instance with the + # same +value+, or if other == value. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:341 + def ==(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:481 + def _parts; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:224 + def abs(&); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:440 + def after(time = T.unsafe(nil)); end + + # Calculates a new Time or Date that is as far in the past + # as this Duration represents. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:444 + def ago(time = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:459 + def as_json(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:448 + def before(time = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:245 + def coerce(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:467 + def encode_with(coder); end + + # Returns +true+ if +other+ is also a Duration instance, which has the + # same parts as this one. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:426 + def eql?(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:439 + def from_now(time = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:430 + def hash; end + + # Returns the amount of days a duration covers as a float + # + # 12.hours.in_days # => 0.5 + # + # pkg:gem/activesupport#lib/active_support/duration.rb:399 + def in_days; end + + # Returns the amount of hours a duration covers as a float + # + # 1.day.in_hours # => 24.0 + # + # pkg:gem/activesupport#lib/active_support/duration.rb:392 + def in_hours; end + + # Returns the amount of minutes a duration covers as a float + # + # 1.day.in_minutes # => 1440.0 + # + # pkg:gem/activesupport#lib/active_support/duration.rb:385 + def in_minutes; end + + # Returns the amount of months a duration covers as a float + # + # 9.weeks.in_months # => 2.07 + # + # pkg:gem/activesupport#lib/active_support/duration.rb:413 + def in_months; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:380 + def in_seconds; end + + # Returns the amount of weeks a duration covers as a float + # + # 2.months.in_weeks # => 8.696 + # + # pkg:gem/activesupport#lib/active_support/duration.rb:406 + def in_weeks; end + + # Returns the amount of years a duration covers as a float + # + # 30.days.in_years # => 0.082 + # + # pkg:gem/activesupport#lib/active_support/duration.rb:420 + def in_years; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:463 + def init_with(coder); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:450 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:335 + def instance_of?(klass); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:330 + def is_a?(klass); end + + # Build ISO 8601 Duration string for this duration. + # The +precision+ parameter can be used to limit seconds' precision of duration. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:473 + def iso8601(precision: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:333 + def kind_of?(klass); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:224 + def negative?(&); end + + # Returns a copy of the parts hash that defines the duration. + # + # 5.minutes.parts # => {:minutes=>5} + # 3.years.parts # => {:years=>3} + # + # pkg:gem/activesupport#lib/active_support/duration.rb:241 + def parts; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:224 + def positive?(&); end + + # Calculates a new Time or Date that is as far in the future + # as this Duration represents. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:436 + def since(time = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:224 + def to_f(&); end + + # Returns the number of seconds that this Duration represents. + # + # 1.minute.to_i # => 60 + # 1.hour.to_i # => 3600 + # 1.day.to_i # => 86400 + # + # Note that this conversion makes some assumptions about the + # duration of some periods, e.g. months are always 1/12 of year + # and years are 365.2425 days: + # + # # equivalent to (1.year / 12).to_i + # 1.month.to_i # => 2629746 + # + # # equivalent to 365.2425.days.to_i + # 1.year.to_i # => 31556952 + # + # In such cases, Ruby's core + # Date[https://docs.ruby-lang.org/en/master/Date.html] and + # Time[https://docs.ruby-lang.org/en/master/Time.html] should be used for precision + # date and time arithmetic. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:377 + def to_i; end + + # Returns the amount of seconds a duration covers as a string. + # For more information check to_i method. + # + # 1.day.to_s # => "86400" + # + # pkg:gem/activesupport#lib/active_support/duration.rb:353 + def to_s; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:447 + def until(time = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:133 + def value; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:477 + def variable?; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:224 + def zero?(&); end + + private + + # pkg:gem/activesupport#lib/active_support/duration.rb:516 + def method_missing(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:520 + def raise_type_error(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:512 + def respond_to_missing?(method, _); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:486 + def sum(sign, time = T.unsafe(nil)); end + + class << self + # pkg:gem/activesupport#lib/active_support/duration.rb:149 + def ===(other); end + + # Creates a new Duration from a seconds value that is converted + # to the individual parts: + # + # ActiveSupport::Duration.build(31556952).parts # => {:years=>1} + # ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1} + # + # pkg:gem/activesupport#lib/active_support/duration.rb:189 + def build(value); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:167 + def days(value); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:163 + def hours(value); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:159 + def minutes(value); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:175 + def months(value); end + + # Creates a new Duration from string formatted according to ISO 8601 Duration. + # + # See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information. + # This method allows negative parts to be present in pattern. + # If invalid string is provided, it will raise +ActiveSupport::Duration::ISO8601Parser::ParsingError+. + # + # pkg:gem/activesupport#lib/active_support/duration.rb:144 + def parse(iso8601duration); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:155 + def seconds(value); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:171 + def weeks(value); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:179 + def years(value); end + + private + + # pkg:gem/activesupport#lib/active_support/duration.rb:217 + def calculate_total_seconds(parts); end + end +end + +# Parses a string formatted according to ISO 8601 Duration into the hash. +# +# See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information. +# +# This parser allows negative parts to be present in pattern. +# +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:12 +class ActiveSupport::Duration::ISO8601Parser + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:34 + def initialize(string); end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:32 + def mode; end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:32 + def mode=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:41 + def parse!; end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:31 + def parts; end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:31 + def scanner; end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:32 + def sign; end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:32 + def sign=(_arg0); end + + private + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:83 + def finished?; end + + # Parses number which can be a float with either comma or period. + # + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:88 + def number; end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:96 + def raise_parsing_error(reason = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:92 + def scan(pattern); end + + # Checks for various semantic errors as stated in ISO 8601 standard. + # + # pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:101 + def validate!; end +end + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:17 +ActiveSupport::Duration::ISO8601Parser::COMMA = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:22 +ActiveSupport::Duration::ISO8601Parser::DATE_COMPONENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:28 +ActiveSupport::Duration::ISO8601Parser::DATE_COMPONENTS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:20 +ActiveSupport::Duration::ISO8601Parser::DATE_MARKER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:25 +ActiveSupport::Duration::ISO8601Parser::DATE_TO_PART = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:16 +ActiveSupport::Duration::ISO8601Parser::PERIOD = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:15 +ActiveSupport::Duration::ISO8601Parser::PERIOD_OR_COMMA = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:13 +class ActiveSupport::Duration::ISO8601Parser::ParsingError < ::ArgumentError; end + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:19 +ActiveSupport::Duration::ISO8601Parser::SIGN_MARKER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:23 +ActiveSupport::Duration::ISO8601Parser::TIME_COMPONENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:29 +ActiveSupport::Duration::ISO8601Parser::TIME_COMPONENTS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:21 +ActiveSupport::Duration::ISO8601Parser::TIME_MARKER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_parser.rb:26 +ActiveSupport::Duration::ISO8601Parser::TIME_TO_PART = T.let(T.unsafe(nil), Hash) + +# Serializes duration to string according to ISO 8601 Duration format. +# +# pkg:gem/activesupport#lib/active_support/duration/iso8601_serializer.rb:6 +class ActiveSupport::Duration::ISO8601Serializer + # pkg:gem/activesupport#lib/active_support/duration/iso8601_serializer.rb:9 + def initialize(duration, precision: T.unsafe(nil)); end + + # Builds and returns output string. + # + # pkg:gem/activesupport#lib/active_support/duration/iso8601_serializer.rb:15 + def serialize; end + + private + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_serializer.rb:55 + def format_seconds(seconds); end + + # Return pair of duration's parts and whole duration sign. + # Parts are summarized (as they can become repetitive due to addition, etc). + # Zero parts are removed as not significant. + # + # pkg:gem/activesupport#lib/active_support/duration/iso8601_serializer.rb:38 + def normalize; end + + # pkg:gem/activesupport#lib/active_support/duration/iso8601_serializer.rb:51 + def week_mixed_with_date?(parts); end +end + +# pkg:gem/activesupport#lib/active_support/duration/iso8601_serializer.rb:7 +ActiveSupport::Duration::ISO8601Serializer::DATE_COMPONENTS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/duration.rb:130 +ActiveSupport::Duration::PARTS = T.let(T.unsafe(nil), Array) + +# length of a gregorian year (365.2425 days) +# +# pkg:gem/activesupport#lib/active_support/duration.rb:120 +ActiveSupport::Duration::PARTS_IN_SECONDS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/duration.rb:115 +ActiveSupport::Duration::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/duration.rb:114 +ActiveSupport::Duration::SECONDS_PER_HOUR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/duration.rb:113 +ActiveSupport::Duration::SECONDS_PER_MINUTE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/duration.rb:117 +ActiveSupport::Duration::SECONDS_PER_MONTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/duration.rb:116 +ActiveSupport::Duration::SECONDS_PER_WEEK = T.let(T.unsafe(nil), Integer) + +# 1/12 of a gregorian year +# +# pkg:gem/activesupport#lib/active_support/duration.rb:118 +ActiveSupport::Duration::SECONDS_PER_YEAR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/duration.rb:15 +class ActiveSupport::Duration::Scalar < ::Numeric + # pkg:gem/activesupport#lib/active_support/duration.rb:19 + def initialize(value); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:85 + def %(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:66 + def *(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:41 + def +(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:53 + def -(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:27 + def -@; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:77 + def /(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:31 + def <=>(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:23 + def coerce(other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:17 + def to_f(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:17 + def to_i(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:17 + def to_s(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:16 + def value; end + + # pkg:gem/activesupport#lib/active_support/duration.rb:93 + def variable?; end + + private + + # pkg:gem/activesupport#lib/active_support/duration.rb:98 + def calculate(op, other); end + + # pkg:gem/activesupport#lib/active_support/duration.rb:108 + def raise_type_error(other); end +end + +# pkg:gem/activesupport#lib/active_support/duration.rb:131 +ActiveSupport::Duration::VARIABLE_PARTS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/editor.rb:6 +class ActiveSupport::Editor + # pkg:gem/activesupport#lib/active_support/editor.rb:48 + def initialize(url_pattern); end + + # pkg:gem/activesupport#lib/active_support/editor.rb:52 + def url_for(path, line); end + + class << self + # Returns the current editor pattern if it is known. + # First check for the `RAILS_EDITOR` environment variable, and if it's + # missing, check for the `EDITOR` environment variable. + # + # pkg:gem/activesupport#lib/active_support/editor.rb:28 + def current; end + + # pkg:gem/activesupport#lib/active_support/editor.rb:39 + def find(name); end + + # Registers a URL pattern for opening file in a given editor. + # This allows Rails to generate clickable links to control known editors. + # + # Example: + # + # ActiveSupport::Editor.register("myeditor", "myeditor://%s:%d") + # + # pkg:gem/activesupport#lib/active_support/editor.rb:17 + def register(name, url_pattern, aliases: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/editor.rb:43 + def reset; end + end +end + +# = Encrypted Configuration +# +# Provides convenience methods on top of EncryptedFile to access values stored +# as encrypted YAML. +# +# Values can be accessed via +Hash+ methods, such as +fetch+ and +dig+, or via +# dynamic accessor methods, similar to OrderedOptions. +# +# my_config = ActiveSupport::EncryptedConfiguration.new(...) +# my_config.read # => "some_secret: 123\nsome_namespace:\n another_secret: 456" +# +# my_config[:some_secret] +# # => 123 +# my_config.some_secret +# # => 123 +# my_config.dig(:some_namespace, :another_secret) +# # => 456 +# my_config.some_namespace.another_secret +# # => 456 +# my_config.fetch(:foo) +# # => KeyError +# my_config.foo! +# # => KeyError +# +# pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:35 +class ActiveSupport::EncryptedConfiguration < ::ActiveSupport::EncryptedFile + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:54 + def initialize(config_path:, key_path:, env_key:, raise_if_missing_key:); end + + # Returns the decrypted content as a Hash with symbolized keys. + # + # my_config = ActiveSupport::EncryptedConfiguration.new(...) + # my_config.read # => "some_secret: 123\nsome_namespace:\n another_secret: 456" + # + # my_config.config + # # => { some_secret: 123, some_namespace: { another_secret: 789 } } + # + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:85 + def config; end + + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:89 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:52 + def method_missing(method, *, **, &); end + + # Reads the file and returns the decrypted content. See EncryptedFile#read. + # + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:62 + def read; end + + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:69 + def validate!; end + + private + + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:94 + def deep_symbolize_keys(hash); end + + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:102 + def deep_transform(hash); end + + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:116 + def deserialize(content); end + + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:112 + def options; end + + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:52 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:36 +class ActiveSupport::EncryptedConfiguration::InvalidContentError < ::RuntimeError + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:37 + def initialize(content_path); end + + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:41 + def message; end +end + +# pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:46 +class ActiveSupport::EncryptedConfiguration::InvalidKeyError < ::RuntimeError + # pkg:gem/activesupport#lib/active_support/encrypted_configuration.rb:47 + def initialize(content_path, key); end +end + +# pkg:gem/activesupport#lib/active_support/encrypted_file.rb:8 +class ActiveSupport::EncryptedFile + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:42 + def initialize(content_path:, key_path:, env_key:, raise_if_missing_key:); end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:83 + def change(&block); end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:40 + def content_path; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:40 + def env_key; end + + # Returns the encryption key, first trying the environment variable + # specified by +env_key+, then trying the key file specified by +key_path+. + # If +raise_if_missing_key+ is true, raises MissingKeyError if the + # environment variable is not set and the key file does not exist. + # + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:52 + def key; end + + # Returns truthy if #key is truthy. Returns falsy otherwise. Unlike #key, + # does not raise MissingKeyError when +raise_if_missing_key+ is true. + # + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:58 + def key?; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:40 + def key_path; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:40 + def raise_if_missing_key; end + + # Reads the file and returns the decrypted content. + # + # Raises: + # - MissingKeyError if the key is missing and +raise_if_missing_key+ is true. + # - MissingContentError if the encrypted file does not exist or otherwise + # if the key is missing. + # - ActiveSupport::MessageEncryptor::InvalidMessage if the content cannot be + # decrypted or verified. + # + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:70 + def read; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:78 + def write(contents); end + + private + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:129 + def check_key_length; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:108 + def decrypt(contents); end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:103 + def encrypt(contents); end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:112 + def encryptor; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:125 + def handle_missing_key; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:117 + def read_env_key; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:121 + def read_key_file; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:89 + def writing(contents); end + + class << self + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:35 + def expected_key_length; end + + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:31 + def generate_key; end + end +end + +# pkg:gem/activesupport#lib/active_support/encrypted_file.rb:29 +ActiveSupport::EncryptedFile::CIPHER = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/encrypted_file.rb:23 +class ActiveSupport::EncryptedFile::InvalidKeyLengthError < ::RuntimeError + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:24 + def initialize; end +end + +# pkg:gem/activesupport#lib/active_support/encrypted_file.rb:9 +class ActiveSupport::EncryptedFile::MissingContentError < ::RuntimeError + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:10 + def initialize(content_path); end +end + +# pkg:gem/activesupport#lib/active_support/encrypted_file.rb:15 +class ActiveSupport::EncryptedFile::MissingKeyError < ::RuntimeError + # pkg:gem/activesupport#lib/active_support/encrypted_file.rb:16 + def initialize(key_path:, env_key:); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:4 +module ActiveSupport::EnumerableCoreExt; end + +# pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:5 +module ActiveSupport::EnumerableCoreExt::Constants + private + + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:7 + def const_missing(name); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:25 +ActiveSupport::EnumerableCoreExt::SoleItemExpectedError = Enumerable::SoleItemExpectedError + +# pkg:gem/activesupport#lib/active_support/environment_inquirer.rb:9 +class ActiveSupport::EnvironmentInquirer < ::ActiveSupport::StringInquirer + # pkg:gem/activesupport#lib/active_support/environment_inquirer.rb:15 + def initialize(env); end + + # pkg:gem/activesupport#lib/active_support/environment_inquirer.rb:28 + def development?; end + + # Returns true if we're in the development or test environment. + # + # pkg:gem/activesupport#lib/active_support/environment_inquirer.rb:36 + def local?; end + + # pkg:gem/activesupport#lib/active_support/environment_inquirer.rb:28 + def production?; end + + # pkg:gem/activesupport#lib/active_support/environment_inquirer.rb:28 + def test?; end +end + +# Optimization for the three default environments, so this inquirer doesn't need to rely on +# the slower delegation through method_missing that StringInquirer would normally entail. +# +# pkg:gem/activesupport#lib/active_support/environment_inquirer.rb:10 +ActiveSupport::EnvironmentInquirer::DEFAULT_ENVIRONMENTS = T.let(T.unsafe(nil), Array) + +# Environments that'll respond true for #local? +# +# pkg:gem/activesupport#lib/active_support/environment_inquirer.rb:13 +ActiveSupport::EnvironmentInquirer::LOCAL_ENVIRONMENTS = T.let(T.unsafe(nil), Array) + +# = Active Support \Error Reporter +# +# +ActiveSupport::ErrorReporter+ is a common interface for error reporting services. +# +# To rescue and report any unhandled error, you can use the #handle method: +# +# Rails.error.handle do +# do_something! +# end +# +# If an error is raised, it will be reported and swallowed. +# +# Alternatively, if you want to report the error but not swallow it, you can use #record: +# +# Rails.error.record do +# do_something! +# end +# +# Both methods can be restricted to handle only a specific error class: +# +# maybe_tags = Rails.error.handle(Redis::BaseError) { redis.get("tags") } +# +# pkg:gem/activesupport#lib/active_support/error_reporter.rb:26 +class ActiveSupport::ErrorReporter + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:35 + def initialize(*subscribers, logger: T.unsafe(nil)); end + + # Add a middleware to modify the error context before it is sent to subscribers. + # + # Middleware is added to a stack of callables run on an error's execution context + # before passing to subscribers. Allows creation of entries in error context that + # are shared by all subscribers. + # + # A context middleware receives the same parameters as #report. + # It must return a hash - the middleware stack returns the hash after it has + # run through all middlewares. A middleware can mutate or replace the hash. + # + # Rails.error.add_middleware(-> (error, context) { context.merge({ foo: :bar }) }) + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:218 + def add_middleware(middleware); end + + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:31 + def debug_mode; end + + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:31 + def debug_mode=(_arg0); end + + # Prevent a subscriber from being notified of errors for the + # duration of the block. You may pass in the subscriber itself, or its class. + # + # This can be helpful for error reporting service integrations, when they wish + # to handle any errors higher in the stack. + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:186 + def disable(subscriber); end + + # Evaluates the given block, reporting and swallowing any unhandled error. + # If no error is raised, returns the return value of the block. Otherwise, + # returns the result of +fallback.call+, or +nil+ if +fallback+ is not + # specified. + # + # # Will report a TypeError to all subscribers and return nil. + # Rails.error.handle do + # 1 + '1' + # end + # + # Can be restricted to handle only specific error classes: + # + # maybe_tags = Rails.error.handle(Redis::BaseError) { redis.get("tags") } + # + # ==== Options + # + # * +:severity+ - This value is passed along to subscribers to indicate how + # important the error report is. Can be +:error+, +:warning+, or +:info+. + # Defaults to +:warning+. + # + # * +:context+ - Extra information that is passed along to subscribers. For + # example: + # + # Rails.error.handle(context: { section: "admin" }) do + # # ... + # end + # + # * +:fallback+ - A callable that provides +handle+'s return value when an + # unhandled error is raised. For example: + # + # user = Rails.error.handle(fallback: -> { User.anonymous }) do + # User.find_by(params) + # end + # + # * +:source+ - This value is passed along to subscribers to indicate the + # source of the error. Subscribers can use this value to ignore certain + # errors. Defaults to "application". + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:79 + def handle(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), fallback: T.unsafe(nil), source: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:31 + def logger; end + + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:31 + def logger=(_arg0); end + + # Evaluates the given block, reporting and re-raising any unhandled error. + # If no error is raised, returns the return value of the block. + # + # # Will report a TypeError to all subscribers and re-raise it. + # Rails.error.record do + # 1 + '1' + # end + # + # Can be restricted to handle only specific error classes: + # + # tags = Rails.error.record(Redis::BaseError) { redis.get("tags") } + # + # ==== Options + # + # * +:severity+ - This value is passed along to subscribers to indicate how + # important the error report is. Can be +:error+, +:warning+, or +:info+. + # Defaults to +:error+. + # + # * +:context+ - Extra information that is passed along to subscribers. For + # example: + # + # Rails.error.record(context: { section: "admin" }) do + # # ... + # end + # + # * +:source+ - This value is passed along to subscribers to indicate the + # source of the error. Subscribers can use this value to ignore certain + # errors. Defaults to "application". + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:115 + def record(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end + + # Report an error directly to subscribers. You can use this method when the + # block-based #handle and #record methods are not suitable. + # + # Rails.error.report(error) + # + # The +error+ argument must be an instance of Exception. + # + # Rails.error.report(Exception.new("Something went wrong")) + # + # Otherwise you can use #unexpected to report an error which does accept a + # string argument. + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:233 + def report(error, handled: T.unsafe(nil), severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end + + # Update the execution context that is accessible to error subscribers. Any + # context passed to #handle, #record, or #report will be merged with the + # context set here. + # + # Rails.error.set_context(section: "checkout", user_id: @user.id) + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:202 + def set_context(*, **, &); end + + # Register a new error subscriber. The subscriber must respond to + # + # report(Exception, handled: Boolean, severity: (:error OR :warning OR :info), context: Hash, source: String) + # + # The +report+ method should never raise an error. + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:162 + def subscribe(subscriber); end + + # Either report the given error when in production, or raise it when in development or test. + # + # When called in production, after the error is reported, this method will return + # nil and execution will continue. + # + # When called in development, the original error is wrapped in a different error class to ensure + # it's not being rescued higher in the stack and will be surfaced to the developer. + # + # This method is intended for reporting violated assertions about preconditions, or similar + # cases that can and should be gracefully handled in production, but that aren't supposed to happen. + # + # The error can be either an exception instance or a String. + # + # example: + # + # def edit + # if published? + # Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible") + # return false + # end + # # ... + # end + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:146 + def unexpected(error, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end + + # Unregister an error subscriber. Accepts either a subscriber or a class. + # + # subscriber = MyErrorSubscriber.new + # Rails.error.subscribe(subscriber) + # + # Rails.error.unsubscribe(subscriber) + # # or + # Rails.error.unsubscribe(MyErrorSubscriber) + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:177 + def unsubscribe(subscriber); end + + private + + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:278 + def ensure_backtrace(error); end +end + +# pkg:gem/activesupport#lib/active_support/error_reporter.rb:29 +ActiveSupport::ErrorReporter::DEFAULT_RESCUE = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/error_reporter.rb:28 +ActiveSupport::ErrorReporter::DEFAULT_SOURCE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/error_reporter.rb:298 +class ActiveSupport::ErrorReporter::ErrorContextMiddlewareStack + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:299 + def initialize; end + + # Run all middlewares in the stack + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:313 + def execute(error, handled:, severity:, context:, source:); end + + # Add a middleware to the error context stack. + # + # pkg:gem/activesupport#lib/active_support/error_reporter.rb:304 + def use(middleware); end +end + +# pkg:gem/activesupport#lib/active_support/error_reporter.rb:27 +ActiveSupport::ErrorReporter::SEVERITIES = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/error_reporter.rb:33 +class ActiveSupport::ErrorReporter::UnexpectedError < ::Exception; end + +# pkg:gem/activesupport#lib/active_support/event_reporter.rb:49 +class ActiveSupport::EventContext + class << self + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:65 + def clear; end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:54 + def context; end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:58 + def set_context(context_hash); end + end +end + +# pkg:gem/activesupport#lib/active_support/event_reporter.rb:50 +ActiveSupport::EventContext::EMPTY_CONTEXT = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/event_reporter.rb:51 +ActiveSupport::EventContext::FIBER_KEY = T.let(T.unsafe(nil), Symbol) + +# = Active Support \Event Reporter +# +# +ActiveSupport::EventReporter+ provides an interface for reporting structured events to subscribers. +# +# To report an event, you can use the +notify+ method: +# +# Rails.event.notify("user_created", { id: 123 }) +# # Emits event: +# # { +# # name: "user_created", +# # payload: { id: 123 }, +# # timestamp: 1738964843208679035, +# # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } +# # } +# +# The +notify+ API can receive either an event name and a payload hash, or an event object. Names are coerced to strings. +# +# === Event Objects +# +# If an event object is passed to the +notify+ API, it will be passed through to subscribers as-is, and the name of the +# object's class will be used as the event name. +# +# class UserCreatedEvent +# def initialize(id:, name:) +# @id = id +# @name = name +# end +# +# def serialize +# { +# id: @id, +# name: @name +# } +# end +# end +# +# Rails.event.notify(UserCreatedEvent.new(id: 123, name: "John Doe")) +# # Emits event: +# # { +# # name: "UserCreatedEvent", +# # payload: #, +# # timestamp: 1738964843208679035, +# # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } +# # } +# +# An event is any Ruby object representing a schematized event. While payload hashes allow arbitrary, +# implicitly-structured data, event objects are intended to enforce a particular schema. +# +# Subscribers are responsible for serializing event objects. +# +# === Subscribers +# +# Subscribers must implement the +emit+ method, which will be called with the event hash. +# +# The event hash has the following keys: +# +# name: String (The name of the event) +# payload: Hash, Object (The payload of the event, or the event object itself) +# tags: Hash (The tags of the event) +# context: Hash (The context of the event) +# timestamp: Integer (The timestamp of the event, in nanoseconds) +# source_location: Hash (The source location of the event, containing the filepath, lineno, and label) +# +# Subscribers are responsible for encoding events to their desired format before emitting them to their +# target destination, such as a streaming platform, a log device, or an alerting service. +# +# class JSONEventSubscriber +# def emit(event) +# json_data = JSON.generate(event) +# LogExporter.export(json_data) +# end +# end +# +# class LogSubscriber +# def emit(event) +# payload = event[:payload].map { |key, value| "#{key}=#{value}" }.join(" ") +# source_location = event[:source_location] +# log = "[#{event[:name]}] #{payload} at #{source_location[:filepath]}:#{source_location[:lineno]}" +# Rails.logger.info(log) +# end +# end +# +# Note that event objects are passed through to subscribers as-is, and may need to be serialized before being encoded: +# +# class UserCreatedEvent +# def initialize(id:, name:) +# @id = id +# @name = name +# end +# +# def serialize +# { +# id: @id, +# name: @name +# } +# end +# end +# +# class LogSubscriber +# def emit(event) +# payload = event[:payload] +# json_data = JSON.generate(payload.serialize) +# LogExporter.export(json_data) +# end +# end +# +# ==== Filtered Subscriptions +# +# Subscribers can be configured with an optional filter proc to only receive a subset of events: +# +# # Only receive events with names starting with "user." +# Rails.event.subscribe(user_subscriber) { |event| event[:name].start_with?("user.") } +# +# # Only receive events with specific payload types +# Rails.event.subscribe(audit_subscriber) { |event| event[:payload].is_a?(AuditEvent) } +# +# === Debug Events +# +# You can use the +debug+ method to report an event that will only be reported if the +# event reporter is in debug mode: +# +# Rails.event.debug("my_debug_event", { foo: "bar" }) +# +# === Tags +# +# To add additional context to an event, separate from the event payload, you can add +# tags via the +tagged+ method: +# +# Rails.event.tagged("graphql") do +# Rails.event.notify("user_created", { id: 123 }) +# end +# +# # Emits event: +# # { +# # name: "user_created", +# # payload: { id: 123 }, +# # tags: { graphql: true }, +# # context: {}, +# # timestamp: 1738964843208679035, +# # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } +# # } +# +# === Context Store +# +# You may want to attach metadata to every event emitted by the reporter. While tags +# provide domain-specific context for a series of events, context is scoped to the job / request +# and should be used for metadata associated with the execution context. +# Context can be set via the +set_context+ method: +# +# Rails.event.set_context(request_id: "abcd123", user_agent: "TestAgent") +# Rails.event.notify("user_created", { id: 123 }) +# +# # Emits event: +# # { +# # name: "user_created", +# # payload: { id: 123 }, +# # tags: {}, +# # context: { request_id: "abcd123", user_agent: "TestAgent" }, +# # timestamp: 1738964843208679035, +# # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } +# # } +# +# Context is reset automatically before and after each request. +# +# A custom context store can be configured via +config.active_support.event_reporter_context_store+. +# +# # config/application.rb +# config.active_support.event_reporter_context_store = CustomContextStore +# +# class CustomContextStore +# class << self +# def context +# # Return the context. +# end +# +# def set_context(context_hash) +# # Append context_hash to the existing context store. +# end +# +# def clear +# # Delete the stored context. +# end +# end +# end +# +# The Event Reporter standardizes on symbol keys for all payload data, tags, and context store entries. +# String keys are automatically converted to symbols for consistency. +# +# Rails.event.notify("user.created", { "id" => 123 }) +# # Emits event: +# # { +# # name: "user.created", +# # payload: { id: 123 }, +# # } +# +# === Security +# +# When reporting events, Hash-based payloads are automatically filtered to remove sensitive data based on {Rails.application.filter_parameters}[https://guides.rubyonrails.org/configuring.html#config-filter-parameters]. +# +# If an {event object}[rdoc-ref:EventReporter@Event+Objects] is given instead, subscribers will need to filter sensitive data themselves, e.g. with ActiveSupport::ParameterFilter. +# +# pkg:gem/activesupport#lib/active_support/event_reporter.rb:271 +class ActiveSupport::EventReporter + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:286 + def initialize(*subscribers, raise_on_error: T.unsafe(nil)); end + + # Clears all context data. + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:525 + def clear_context; end + + # Returns the current context data. + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:530 + def context; end + + # Report an event only when in debug mode. For example: + # + # Rails.event.debug("sql.query", { sql: "SELECT * FROM users" }) + # + # ==== Arguments + # + # * +:payload+ - The event payload when using string/symbol event names. + # + # * +:caller_depth+ - The stack depth to use for source location (default: 1). + # + # * +:kwargs+ - Additional payload data when using string/symbol event names. + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:435 + def debug(name_or_object, payload = T.unsafe(nil), caller_depth: T.unsafe(nil), **kwargs); end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:276 + def debug_mode=(_arg0); end + + # Check if debug mode is currently enabled. Debug mode is enabled on the reporter + # via +with_debug+, and in local environments. + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:420 + def debug_mode?; end + + # Reports an event to all registered subscribers. An event name and payload can be provided: + # + # Rails.event.notify("user.created", { id: 123 }) + # # Emits event: + # # { + # # name: "user.created", + # # payload: { id: 123 }, + # # tags: {}, + # # context: {}, + # # timestamp: 1738964843208679035, + # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } + # # } + # + # Alternatively, an event object can be provided: + # + # Rails.event.notify(UserCreatedEvent.new(id: 123)) + # # Emits event: + # # { + # # name: "UserCreatedEvent", + # # payload: #, + # # tags: {}, + # # context: {}, + # # timestamp: 1738964843208679035, + # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } + # # } + # + # ==== Arguments + # + # * +:payload+ - The event payload when using string/symbol event names. + # + # * +:caller_depth+ - The stack depth to use for source location (default: 1). + # + # * +:kwargs+ - Additional payload data when using string/symbol event names. + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:363 + def notify(name_or_object, payload = T.unsafe(nil), caller_depth: T.unsafe(nil), **kwargs); end + + # Sets whether to raise an error if a subscriber raises an error during + # event emission, or when unexpected arguments are passed to +notify+. + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:274 + def raise_on_error=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:534 + def reload_payload_filter; end + + # Sets context data that will be included with all events emitted by the reporter. + # Context data should be scoped to the job or request, and is reset automatically + # before and after each request and job. + # + # Rails.event.set_context(user_agent: "TestAgent") + # Rails.event.set_context(job_id: "abc123") + # Rails.event.tagged("graphql") do + # Rails.event.notify("user_created", { id: 123 }) + # end + # + # # Emits event: + # # { + # # name: "user_created", + # # payload: { id: 123 }, + # # tags: { graphql: true }, + # # context: { user_agent: "TestAgent", job_id: "abc123" }, + # # timestamp: 1738964843208679035 + # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } + # # } + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:520 + def set_context(context); end + + # Registers a new event subscriber. The subscriber must respond to + # + # emit(event: Hash) + # + # The event hash will have the following keys: + # + # name: String (The name of the event) + # payload: Hash, Object (The payload of the event, or the event object itself) + # tags: Hash (The tags of the event) + # context: Hash (The context of the event) + # timestamp: Integer (The timestamp of the event, in nanoseconds) + # source_location: Hash (The source location of the event, containing the filepath, lineno, and label) + # + # An optional filter proc can be provided to only receive a subset of events: + # + # Rails.event.subscribe(subscriber) { |event| event[:name].start_with?("user.") } + # Rails.event.subscribe(subscriber) { |event| event[:payload].is_a?(UserEvent) } + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:311 + def subscribe(subscriber, &filter); end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:278 + def subscribers; end + + # Add tags to events to supply additional context. Tags operate in a stack-oriented manner, + # so all events emitted within the block inherit the same set of tags. For example: + # + # Rails.event.tagged("graphql") do + # Rails.event.notify("user.created", { id: 123 }) + # end + # + # # Emits event: + # # { + # # name: "user.created", + # # payload: { id: 123 }, + # # tags: { graphql: true }, + # # context: {}, + # # timestamp: 1738964843208679035, + # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } + # # } + # + # Tags can be provided as arguments or as keyword arguments, and can be nested: + # + # Rails.event.tagged("graphql") do + # # Other code here... + # Rails.event.tagged(section: "admin") do + # Rails.event.notify("user.created", { id: 123 }) + # end + # end + # + # # Emits event: + # # { + # # name: "user.created", + # # payload: { id: 123 }, + # # tags: { section: "admin", graphql: true }, + # # context: {}, + # # timestamp: 1738964843208679035, + # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } + # # } + # + # The +tagged+ API can also receive a tag object: + # + # graphql_tag = GraphqlTag.new(operation_name: "user_created", operation_type: "mutation") + # Rails.event.tagged(graphql_tag) do + # Rails.event.notify("user.created", { id: 123 }) + # end + # + # # Emits event: + # # { + # # name: "user.created", + # # payload: { id: 123 }, + # # tags: { "GraphqlTag": # }, + # # context: {}, + # # timestamp: 1738964843208679035, + # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } + # # } + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:497 + def tagged(*args, **kwargs, &block); end + + # Unregister an event subscriber. Accepts either a subscriber or a class. + # + # subscriber = MyEventSubscriber.new + # Rails.event.subscribe(subscriber) + # + # Rails.event.unsubscribe(subscriber) + # # or + # Rails.event.unsubscribe(MyEventSubscriber) + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:326 + def unsubscribe(subscriber); end + + # Temporarily enables debug mode for the duration of the block. + # Calls to +debug+ will only be reported if debug mode is enabled. + # + # Rails.event.with_debug do + # Rails.event.debug("sql.query", { sql: "SELECT * FROM users" }) + # end + # + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:410 + def with_debug; end + + private + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:544 + def context_store; end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:579 + def handle_unexpected_args(name_or_object, payload, kwargs); end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:548 + def payload_filter; end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:540 + def raise_on_error?; end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:555 + def resolve_name(name_or_object); end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:564 + def resolve_payload(name_or_object, payload, **kwargs); end + + class << self + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:281 + def context_store; end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:281 + def context_store=(_arg0); end + end +end + +# pkg:gem/activesupport#lib/active_support/execution_context.rb:4 +module ActiveSupport::ExecutionContext + class << self + # pkg:gem/activesupport#lib/active_support/execution_context.rb:76 + def []=(key, value); end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:47 + def after_change(&block); end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:103 + def clear; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:111 + def current_attributes_instances; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:107 + def flush; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:45 + def nestable; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:45 + def nestable=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:94 + def pop; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:85 + def push; end + + # Updates the execution context. If a block is given, it resets the provided keys to their + # previous value once the block exits. + # + # pkg:gem/activesupport#lib/active_support/execution_context.rb:53 + def set(**options); end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:81 + def to_h; end + + private + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:116 + def record; end + end +end + +# pkg:gem/activesupport#lib/active_support/execution_context.rb:5 +class ActiveSupport::ExecutionContext::Record + # pkg:gem/activesupport#lib/active_support/execution_context.rb:8 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:6 + def current_attributes_instances; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:27 + def flush; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:21 + def pop; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:14 + def push; end + + # pkg:gem/activesupport#lib/active_support/execution_context.rb:6 + def store; end +end + +# pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:7 +class ActiveSupport::ExecutionWrapper + include ::ActiveSupport::Callbacks + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:8 + def __callbacks; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:15 + def _complete_callbacks; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:14 + def _run_callbacks; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:15 + def _run_complete_callbacks; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:15 + def _run_complete_callbacks!(&block); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:14 + def _run_run_callbacks; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:14 + def _run_run_callbacks!(&block); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:141 + def complete; end + + # Complete this in-flight execution. This method *must* be called + # exactly once on the result of any call to +run!+. + # + # Where possible, prefer +wrap+. + # + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:135 + def complete!; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:127 + def run; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:122 + def run!; end + + private + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:146 + def hook_state; end + + class << self + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:8 + def __callbacks; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:8 + def __callbacks=(value); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:15 + def _complete_callbacks; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:15 + def _complete_callbacks=(value); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:14 + def _run_callbacks; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:14 + def _run_callbacks=(value); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:118 + def active?; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:114 + def active_key; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:110 + def error_reporter; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:100 + def perform; end + + # Register an object to be invoked during both the +run+ and + # +complete+ steps. + # + # +hook.complete+ will be passed the value returned from +hook.run+, + # and will only be invoked if +run+ has previously been called. + # (Mostly, this means it won't be invoked if an exception occurs in + # a preceding +to_run+ block; all ordinary +to_complete+ blocks are + # invoked in that situation.) + # + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:50 + def register_hook(hook, outer: T.unsafe(nil)); end + + # Run this execution. + # + # Returns an instance, whose +complete!+ method *must* be invoked + # after the work has been performed. + # + # Where possible, prefer +wrap+. + # + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:66 + def run!(reset: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:21 + def to_complete(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:17 + def to_run(*args, &block); end + + # Perform the work in the supplied block as an execution. + # + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:86 + def wrap(source: T.unsafe(nil)); end + + private + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:8 + def __class_attr___callbacks; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:8 + def __class_attr___callbacks=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:32 +class ActiveSupport::ExecutionWrapper::CompleteHook < ::Struct + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:39 + def after(target); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:33 + def before(target); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:32 + def hook; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:32 + def hook=(_); end + + class << self + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:32 + def [](*_arg0); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:32 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:32 + def keyword_init?; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:32 + def members; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:32 + def new(*_arg0); end + end +end + +# pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:10 +ActiveSupport::ExecutionWrapper::Null = T.let(T.unsafe(nil), Object) + +# pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:25 +class ActiveSupport::ExecutionWrapper::RunHook < ::Struct + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:26 + def before(target); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:25 + def hook; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:25 + def hook=(_); end + + class << self + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:25 + def [](*_arg0); end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:25 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:25 + def keyword_init?; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:25 + def members; end + + # pkg:gem/activesupport#lib/active_support/execution_wrapper.rb:25 + def new(*_arg0); end + end +end + +# pkg:gem/activesupport#lib/active_support/executor.rb:6 +class ActiveSupport::Executor < ::ActiveSupport::ExecutionWrapper; end + +# = \File Update Checker +# +# FileUpdateChecker specifies the API used by \Rails to watch files +# and control reloading. The API depends on four methods: +# +# * +initialize+ which expects two parameters and one block as +# described below. +# +# * +updated?+ which returns a boolean if there were updates in +# the filesystem or not. +# +# * +execute+ which executes the given block on initialization +# and updates the latest watched files and timestamp. +# +# * +execute_if_updated+ which just executes the block if it was updated. +# +# After initialization, a call to +execute_if_updated+ must execute +# the block only if there was really a change in the filesystem. +# +# This class is used by \Rails to reload the I18n framework whenever +# they are changed upon a new request. +# +# i18n_reloader = ActiveSupport::FileUpdateChecker.new(paths) do +# I18n.reload! +# end +# +# ActiveSupport::Reloader.to_prepare do +# i18n_reloader.execute_if_updated +# end +# +# pkg:gem/activesupport#lib/active_support/file_update_checker.rb:35 +class ActiveSupport::FileUpdateChecker + # It accepts two parameters on initialization. The first is an array + # of files and the second is an optional hash of directories. The hash must + # have directories as keys and the value is an array of extensions to be + # watched under that directory. + # + # This method must also receive a block that will be called once a path + # changes. The array of files and list of directories cannot be changed + # after FileUpdateChecker has been initialized. + # + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:44 + def initialize(files, dirs = T.unsafe(nil), &block); end + + # Executes the given block and updates the latest watched files and + # timestamp. + # + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:85 + def execute; end + + # Execute the block given if updated. + # + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:95 + def execute_if_updated; end + + # Check if any of the entries were updated. If so, the watched and/or + # updated_at values are cached until the block is executed via +execute+ + # or +execute_if_updated+. + # + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:66 + def updated?; end + + private + + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:160 + def compile_ext(array); end + + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:147 + def compile_glob(hash); end + + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:156 + def escape(key); end + + # This method returns the maximum mtime of the files in +paths+, or +nil+ + # if the array is empty. + # + # Files with a mtime in the future are ignored. Such abnormal situation + # can happen for example if the user changes the clock by hand. It is + # healthy to consider this edge case because with mtimes in the future + # reloading is not triggered. + # + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:125 + def max_mtime(paths); end + + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:114 + def updated_at(paths); end + + # pkg:gem/activesupport#lib/active_support/file_update_checker.rb:106 + def watched; end +end + +# pkg:gem/activesupport#lib/active_support/fork_tracker.rb:4 +module ActiveSupport::ForkTracker + class << self + # pkg:gem/activesupport#lib/active_support/fork_tracker.rb:31 + def after_fork(&block); end + + # pkg:gem/activesupport#lib/active_support/fork_tracker.rb:19 + def after_fork_callback; end + + # pkg:gem/activesupport#lib/active_support/fork_tracker.rb:27 + def hook!; end + + # pkg:gem/activesupport#lib/active_support/fork_tracker.rb:36 + def unregister(callback); end + end +end + +# pkg:gem/activesupport#lib/active_support/fork_tracker.rb:5 +module ActiveSupport::ForkTracker::CoreExt + # pkg:gem/activesupport#lib/active_support/fork_tracker.rb:6 + def _fork; end +end + +# = Active Support \Gzip +# +# A convenient wrapper for the zlib standard library that allows +# compression/decompression of strings with gzip. +# +# gzip = ActiveSupport::Gzip.compress('compress me!') +# # => "\x1F\x8B\b\x00o\x8D\xCDO\x00\x03K\xCE\xCF-(J-.V\xC8MU\x04\x00R>n\x83\f\x00\x00\x00" +# +# ActiveSupport::Gzip.decompress(gzip) +# # => "compress me!" +# +# pkg:gem/activesupport#lib/active_support/gzip.rb:17 +module ActiveSupport::Gzip + class << self + # Compresses a string using gzip. + # + # pkg:gem/activesupport#lib/active_support/gzip.rb:32 + def compress(source, level = T.unsafe(nil), strategy = T.unsafe(nil)); end + + # Decompresses a gzipped string. + # + # pkg:gem/activesupport#lib/active_support/gzip.rb:27 + def decompress(source); end + end +end + +# pkg:gem/activesupport#lib/active_support/gzip.rb:18 +class ActiveSupport::Gzip::Stream < ::StringIO + # pkg:gem/activesupport#lib/active_support/gzip.rb:19 + def initialize(*); end + + # pkg:gem/activesupport#lib/active_support/gzip.rb:23 + def close; end +end + +# = \Hash With Indifferent Access +# +# Implements a hash where keys :foo and "foo" are considered +# to be the same. +# +# rgb = ActiveSupport::HashWithIndifferentAccess.new +# +# rgb[:black] = '#000000' +# rgb[:black] # => '#000000' +# rgb['black'] # => '#000000' +# +# rgb['white'] = '#FFFFFF' +# rgb[:white] # => '#FFFFFF' +# rgb['white'] # => '#FFFFFF' +# +# Internally symbols are mapped to strings when used as keys in the entire +# writing interface (calling []=, merge, etc). This +# mapping belongs to the public interface. For example, given: +# +# hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1) +# +# You are guaranteed that the key is returned as a string: +# +# hash.keys # => ["a"] +# +# Technically other types of keys are accepted: +# +# hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1) +# hash[0] = 0 +# hash # => {"a"=>1, 0=>0} +# +# but this class is intended for use cases where strings or symbols are the +# expected keys and it is convenient to understand both as the same. For +# example the +params+ hash in Ruby on \Rails. +# +# Note that core extensions define Hash#with_indifferent_access: +# +# rgb = { black: '#000000', white: '#FFFFFF' }.with_indifferent_access +# +# which may be handy. +# +# To access this class outside of \Rails, require the core extension with: +# +# require "active_support/core_ext/hash/indifferent_access" +# +# which will, in turn, require this file. +# +# pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:55 +class ActiveSupport::HashWithIndifferentAccess < ::Hash + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:70 + def initialize(constructor = T.unsafe(nil)); end + + # Same as Hash#[] where the key passed as argument can be + # either a string or a symbol: + # + # counters = ActiveSupport::HashWithIndifferentAccess.new + # counters[:foo] = 1 + # + # counters['foo'] # => 1 + # counters[:foo] # => 1 + # counters[:zoo] # => nil + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:184 + def [](key); end + + # Assigns a new value to the hash: + # + # hash = ActiveSupport::HashWithIndifferentAccess.new + # hash[:key] = 'value' + # + # This value can be later fetched using either +:key+ or 'key'. + # + # If the value is a Hash or contains one or multiple Hashes, they will be + # converted to +HashWithIndifferentAccess+. + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:101 + def []=(key, value); end + + # Same as Hash#assoc where the key passed as argument can be + # either a string or a symbol: + # + # counters = ActiveSupport::HashWithIndifferentAccess.new + # counters[:foo] = 1 + # + # counters.assoc('foo') # => ["foo", 1] + # counters.assoc(:foo) # => ["foo", 1] + # counters.assoc(:zoo) # => nil + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:197 + def assoc(key); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:391 + def compact; end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:334 + def deep_symbolize_keys; end + + # Same as Hash#default where the key passed as argument can be + # either a string or a symbol: + # + # hash = ActiveSupport::HashWithIndifferentAccess.new(1) + # hash.default # => 1 + # + # hash = ActiveSupport::HashWithIndifferentAccess.new { |hash, key| key } + # hash.default # => nil + # hash.default('foo') # => 'foo' + # hash.default(:foo) # => 'foo' + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:239 + def default(key = T.unsafe(nil)); end + + # Removes the specified key from the hash. + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:317 + def delete(key); end + + # Same as Hash#dig where the key passed as argument can be + # either a string or a symbol: + # + # counters = ActiveSupport::HashWithIndifferentAccess.new + # counters[:foo] = { bar: 1 } + # + # counters.dig('foo', 'bar') # => 1 + # counters.dig(:foo, :bar) # => 1 + # counters.dig(:zoo) # => nil + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:224 + def dig(*args); end + + # Returns a shallow copy of the hash. + # + # hash = ActiveSupport::HashWithIndifferentAccess.new({ a: { b: 'b' } }) + # dup = hash.dup + # dup[:a][:c] = 'c' + # + # hash[:a][:c] # => "c" + # dup[:a][:c] # => "c" + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:280 + def dup; end + + # Returns a hash with indifferent access that includes everything except given keys. + # hash = { a: "x", b: "y", c: 10 }.with_indifferent_access + # hash.except(:a, "b") # => {c: 10}.with_indifferent_access + # hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:325 + def except(*keys); end + + # Returns +true+ so that Array#extract_options! finds members of + # this class. + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:58 + def extractable_options?; end + + # Same as Hash#fetch where the key passed as argument can be + # either a string or a symbol: + # + # counters = ActiveSupport::HashWithIndifferentAccess.new + # counters[:foo] = 1 + # + # counters.fetch('foo') # => 1 + # counters.fetch(:bar, 0) # => 0 + # counters.fetch(:bar) { |key| 0 } # => 0 + # counters.fetch(:zoo) # => KeyError: key not found: "zoo" + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:211 + def fetch(key, *extras); end + + # Returns an array of the values at the specified indices, but also + # raises an exception when one of the keys can't be found. + # + # hash = ActiveSupport::HashWithIndifferentAccess.new + # hash[:a] = 'x' + # hash[:b] = 'y' + # hash.fetch_values('a', 'b') # => ["x", "y"] + # hash.fetch_values('a', 'c') { |key| 'z' } # => ["x", "z"] + # hash.fetch_values('a', 'c') # => KeyError: key not found: "c" + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:267 + def fetch_values(*indices, &block); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:341 + def filter(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:172 + def has_key?(key); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:171 + def include?(key); end + + # Checks the hash for a key matching the argument passed in: + # + # hash = ActiveSupport::HashWithIndifferentAccess.new + # hash['key'] = 'value' + # hash.key?(:key) # => true + # hash.key?('key') # => true + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:167 + def key?(key); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:173 + def member?(key); end + + # This method has the same semantics of +update+, except it does not + # modify the receiver but rather returns a new hash with indifferent + # access with the result of the merge. + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:287 + def merge(*hashes, &block); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:159 + def merge!(*other_hashes, &block); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:66 + def nested_under_indifferent_access; end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:90 + def regular_update(*_arg0); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:89 + def regular_writer(_arg0, _arg1); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:343 + def reject(*args, &block); end + + # Replaces the contents of this hash with other_hash. + # + # h = { "a" => 100, "b" => 200 } + # h.replace({ "c" => 300, "d" => 400 }) # => {"c"=>300, "d"=>400} + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:312 + def replace(other_hash); end + + # Like +merge+ but the other way around: Merges the receiver into the + # argument and returns a new hash with indifferent access as result: + # + # hash = ActiveSupport::HashWithIndifferentAccess.new + # hash['a'] = nil + # hash.reverse_merge(a: 0, b: 1) # => {"a"=>nil, "b"=>1} + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:297 + def reverse_merge(other_hash); end + + # Same semantics as +reverse_merge+ but modifies the receiver in-place. + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:303 + def reverse_merge!(other_hash); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:337 + def select(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:381 + def slice(*keys); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:386 + def slice!(*keys); end + + # Assigns a new value to the hash: + # + # hash = ActiveSupport::HashWithIndifferentAccess.new + # hash[:key] = 'value' + # + # This value can be later fetched using either +:key+ or 'key'. + # + # If the value is a Hash or contains one or multiple Hashes, they will be + # converted to +HashWithIndifferentAccess+. unless `convert_value: false` + # is set. + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:115 + def store(key, value, convert_value: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:332 + def symbolize_keys; end + + # Convert to a regular hash with string keys. + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:396 + def to_hash; end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:333 + def to_options; end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:335 + def to_options!; end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:402 + def to_proc; end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:355 + def transform_keys(hash = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:367 + def transform_keys!(hash = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:348 + def transform_values(&block); end + + # Updates the receiver in-place, merging in the hashes passed as arguments: + # + # hash_1 = ActiveSupport::HashWithIndifferentAccess.new + # hash_1[:key] = 'value' + # + # hash_2 = ActiveSupport::HashWithIndifferentAccess.new + # hash_2[:key] = 'New Value!' + # + # hash_1.update(hash_2) # => {"key"=>"New Value!"} + # + # hash = ActiveSupport::HashWithIndifferentAccess.new + # hash.update({ "a" => 1 }, { "b" => 2 }) # => { "a" => 1, "b" => 2 } + # + # The arguments can be either an + # +ActiveSupport::HashWithIndifferentAccess+ or a regular +Hash+. + # In either case the merge respects the semantics of indifferent access. + # + # If the argument is a regular hash with keys +:key+ and "key" only one + # of the values end up in the receiver, but which one is unspecified. + # + # When given a block, the value for duplicated keys will be determined + # by the result of invoking the block with the duplicated key, the value + # in the receiver, and the value in +other_hash+. The rules for duplicated + # keys follow the semantics of indifferent access: + # + # hash_1[:key] = 10 + # hash_2['key'] = 12 + # hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22} + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:148 + def update(*other_hashes, &block); end + + # Returns an array of the values at the specified indices: + # + # hash = ActiveSupport::HashWithIndifferentAccess.new + # hash[:a] = 'x' + # hash[:b] = 'y' + # hash.values_at('a', 'b') # => ["x", "y"] + # + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:253 + def values_at(*keys); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:300 + def with_defaults(other_hash); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:306 + def with_defaults!(other_hash); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:62 + def with_indifferent_access; end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:328 + def without(*keys); end + + private + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:407 + def cast(other); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:411 + def convert_key(key); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:415 + def convert_value(value, conversion: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:428 + def convert_value_to_hash(value); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:439 + def copy_defaults(target); end + + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:448 + def update_with_single_argument(other_hash, block); end + + class << self + # pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:85 + def [](*args); end + end +end + +# pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:353 +ActiveSupport::HashWithIndifferentAccess::NOT_GIVEN = T.let(T.unsafe(nil), Object) + +# pkg:gem/activesupport#lib/active_support/html_safe_translation.rb:4 +module ActiveSupport::HtmlSafeTranslation + extend ::ActiveSupport::HtmlSafeTranslation + + # pkg:gem/activesupport#lib/active_support/html_safe_translation.rb:30 + def html_safe_translation_key?(key); end + + # pkg:gem/activesupport#lib/active_support/html_safe_translation.rb:7 + def translate(key, **options); end + + private + + # pkg:gem/activesupport#lib/active_support/html_safe_translation.rb:35 + def html_escape_translation_options(options); end + + # pkg:gem/activesupport#lib/active_support/html_safe_translation.rb:48 + def html_safe_translation(translation); end + + # pkg:gem/activesupport#lib/active_support/html_safe_translation.rb:43 + def i18n_option?(name); end +end + +# = Active Support \Inflector +# +# The Inflector transforms words from singular to plural, class names to table +# names, modularized class names to ones without, and class names to foreign +# keys. The default inflections for pluralization, singularization, and +# uncountable words are kept in inflections.rb. +# +# The \Rails core team has stated patches for the inflections library will not +# be accepted in order to avoid breaking legacy applications which may be +# relying on errant inflections. If you discover an incorrect inflection and +# require it for your application or wish to define rules for languages other +# than English, please correct or add them yourself (explained below). +# +# pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:8 +module ActiveSupport::Inflector + extend ::ActiveSupport::Inflector + + # Converts strings to UpperCamelCase. + # If the +uppercase_first_letter+ parameter is set to false, then produces + # lowerCamelCase. + # + # Also converts '/' to '::' which is useful for converting + # paths to namespaces. + # + # camelize('active_model') # => "ActiveModel" + # camelize('active_model', false) # => "activeModel" + # camelize('active_model/errors') # => "ActiveModel::Errors" + # camelize('active_model/errors', false) # => "activeModel::Errors" + # + # As a rule of thumb you can think of +camelize+ as the inverse of + # #underscore, though there are cases where that does not hold: + # + # camelize(underscore('SSLError')) # => "SslError" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:70 + def camelize(term, uppercase_first_letter = T.unsafe(nil)); end + + # Creates a class name from a plural table name like \Rails does for table + # names to models. Note that this returns a string and not a Class. (To + # convert to an actual class follow +classify+ with #constantize.) + # + # classify('ham_and_eggs') # => "HamAndEgg" + # classify('posts') # => "Post" + # + # Singular names are not handled correctly: + # + # classify('calculus') # => "Calculu" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:218 + def classify(table_name); end + + # Tries to find a constant with the name specified in the argument string. + # + # constantize('Module') # => Module + # constantize('Foo::Bar') # => Foo::Bar + # + # The name is assumed to be the one of a top-level constant, no matter + # whether it starts with "::" or not. No lexical context is taken into + # account: + # + # C = 'outside' + # module M + # C = 'inside' + # C # => 'inside' + # constantize('C') # => 'outside', same as ::C + # end + # + # NameError is raised when the name is not in CamelCase or the constant is + # unknown. + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:289 + def constantize(camel_cased_word); end + + # Replaces underscores with dashes in the string. + # + # dasherize('puni_puni') # => "puni-puni" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:226 + def dasherize(underscored_word); end + + # Removes the rightmost segment from the constant expression in the string. + # + # deconstantize('Net::HTTP') # => "Net" + # deconstantize('::Net::HTTP') # => "::Net" + # deconstantize('String') # => "" + # deconstantize('::String') # => "" + # deconstantize('') # => "" + # + # See also #demodulize. + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:256 + def deconstantize(path); end + + # Removes the module part from the expression in the string. + # + # demodulize('ActiveSupport::Inflector::Inflections') # => "Inflections" + # demodulize('Inflections') # => "Inflections" + # demodulize('::Inflections') # => "Inflections" + # demodulize('') # => "" + # + # See also #deconstantize. + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:238 + def demodulize(path); end + + # Converts the first character in the string to lowercase. + # + # downcase_first('If they enjoyed The Matrix') # => "if they enjoyed The Matrix" + # downcase_first('I') # => "i" + # downcase_first('') # => "" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:175 + def downcase_first(string); end + + # Creates a foreign key name from a class name. + # +separate_class_name_and_id_with_underscore+ sets whether + # the method should put '_' between the name and 'id'. + # + # foreign_key('Message') # => "message_id" + # foreign_key('Message', false) # => "messageid" + # foreign_key('Admin::Post') # => "post_id" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:267 + def foreign_key(class_name, separate_class_name_and_id_with_underscore = T.unsafe(nil)); end + + # Tweaks an attribute name for display to end users. + # + # Specifically, performs these transformations: + # + # * Applies human inflection rules to the argument. + # * Deletes leading underscores, if any. + # * Removes an "_id" suffix if present. + # * Replaces underscores with spaces, if any. + # * Downcases all words except acronyms. + # * Capitalizes the first word. + # The capitalization of the first word can be turned off by setting the + # +:capitalize+ option to false (default is true). + # + # The trailing '_id' can be kept by setting the + # optional parameter +keep_id_suffix+ to true (default is false). + # + # humanize('employee_salary') # => "Employee salary" + # humanize('author_id') # => "Author" + # humanize('author_id', capitalize: false) # => "author" + # humanize('_id') # => "Id" + # humanize('author_id', keep_id_suffix: true) # => "Author id" + # + # If "SSL" was defined to be an acronym: + # + # humanize('ssl_error') # => "SSL error" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:135 + def humanize(lower_case_and_underscored_word, capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end + + # Yields a singleton instance of Inflector::Inflections so you can specify + # additional inflector rules. If passed an optional locale, rules for other + # languages can be specified. If not specified, defaults to :en. + # Only rules for English are provided. + # + # ActiveSupport::Inflector.inflections(:en) do |inflect| + # inflect.uncountable 'rails' + # end + # + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:283 + def inflections(locale = T.unsafe(nil)); end + + # Returns the suffix that should be added to a number to denote the position + # in an ordered sequence such as 1st, 2nd, 3rd, 4th. + # + # ordinal(1) # => "st" + # ordinal(2) # => "nd" + # ordinal(1002) # => "nd" + # ordinal(1003) # => "rd" + # ordinal(-11) # => "th" + # ordinal(-1021) # => "st" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:335 + def ordinal(number); end + + # Turns a number into an ordinal string used to denote the position in an + # ordered sequence such as 1st, 2nd, 3rd, 4th. + # + # ordinalize(1) # => "1st" + # ordinalize(2) # => "2nd" + # ordinalize(1002) # => "1002nd" + # ordinalize(1003) # => "1003rd" + # ordinalize(-11) # => "-11th" + # ordinalize(-1021) # => "-1021st" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:348 + def ordinalize(number); end + + # Replaces special characters in a string so that it may be used as part of + # a 'pretty' URL. + # + # parameterize("Donald E. Knuth") # => "donald-e-knuth" + # parameterize("^très|Jolie-- ") # => "tres-jolie" + # + # To use a custom separator, override the +separator+ argument. + # + # parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth" + # parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie" + # + # To remove the unwanted characters instead of replacing them, pass an + # empty separator. +nil+ is treated the same way. + # + # parameterize("Donald E. Knuth", separator: '') # => "donaldeknuth" + # + # To preserve the case of the characters in a string, use the +preserve_case+ argument. + # + # parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth" + # parameterize("^très|Jolie-- ", preserve_case: true) # => "tres-Jolie" + # + # It preserves dashes and underscores unless they are used as separators: + # + # parameterize("^très|Jolie__ ") # => "tres-jolie__" + # parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--" + # parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--" + # + # If the optional parameter +locale+ is specified, + # the word will be parameterized as a word of that language. + # By default, this parameter is set to nil and it will use + # the configured I18n.locale. + # + # pkg:gem/activesupport#lib/active_support/inflector/transliterate.rb:131 + def parameterize(string, separator: T.unsafe(nil), preserve_case: T.unsafe(nil), locale: T.unsafe(nil)); end + + # Returns the plural form of the word in the string. + # + # If passed an optional +locale+ parameter, the word will be + # pluralized using rules defined for that language. By default, + # this parameter is set to :en. + # + # pluralize('post') # => "posts" + # pluralize('octopus') # => "octopi" + # pluralize('sheep') # => "sheep" + # pluralize('words') # => "words" + # pluralize('CamelOctopus') # => "CamelOctopi" + # pluralize('ley', :es) # => "leyes" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:33 + def pluralize(word, locale = T.unsafe(nil)); end + + # Tries to find a constant with the name specified in the argument string. + # + # safe_constantize('Module') # => Module + # safe_constantize('Foo::Bar') # => Foo::Bar + # + # The name is assumed to be the one of a top-level constant, no matter + # whether it starts with "::" or not. No lexical context is taken into + # account: + # + # C = 'outside' + # module M + # C = 'inside' + # C # => 'inside' + # safe_constantize('C') # => 'outside', same as ::C + # end + # + # +nil+ is returned when the name is not in CamelCase or the constant (or + # part of it) is unknown. + # + # safe_constantize('blargle') # => nil + # safe_constantize('UnknownModule') # => nil + # safe_constantize('UnknownModule::Foo::Bar') # => nil + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:315 + def safe_constantize(camel_cased_word); end + + # The reverse of #pluralize, returns the singular form of a word in a + # string. + # + # If passed an optional +locale+ parameter, the word will be + # singularized using rules defined for that language. By default, + # this parameter is set to :en. + # + # singularize('posts') # => "post" + # singularize('octopi') # => "octopus" + # singularize('sheep') # => "sheep" + # singularize('word') # => "word" + # singularize('CamelOctopi') # => "CamelOctopus" + # singularize('leyes', :es) # => "ley" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:50 + def singularize(word, locale = T.unsafe(nil)); end + + # Creates the name of a table like \Rails does for models to table names. + # This method uses the #pluralize method on the last word in the string. + # + # tableize('RawScaledScorer') # => "raw_scaled_scorers" + # tableize('ham_and_egg') # => "ham_and_eggs" + # tableize('fancyCategory') # => "fancy_categories" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:204 + def tableize(class_name); end + + # Capitalizes all the words and replaces some characters in the string to + # create a nicer looking title. +titleize+ is meant for creating pretty + # output. It is not used in the \Rails internals. + # + # The trailing '_id','Id'.. can be kept and capitalized by setting the + # optional parameter +keep_id_suffix+ to true. + # By default, this parameter is false. + # + # titleize('man from the boondocks') # => "Man From The Boondocks" + # titleize('x-men: the last stand') # => "X Men: The Last Stand" + # titleize('TheManWithoutAPast') # => "The Man Without A Past" + # titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark" + # titleize('string_ending_with_id', keep_id_suffix: true) # => "String Ending With Id" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:192 + def titleize(word, keep_id_suffix: T.unsafe(nil)); end + + # Replaces non-ASCII characters with an ASCII approximation, or if none + # exists, a replacement character which defaults to "?". + # + # transliterate('Ærøskøbing') + # # => "AEroskobing" + # + # Default approximations are provided for Western/Latin characters, + # e.g, "ø", "ñ", "é", "ß", etc. + # + # This method is I18n aware, so you can set up custom approximations for a + # locale. This can be useful, for example, to transliterate German's "ü" + # and "ö" to "ue" and "oe", or to add support for transliterating Russian + # to ASCII. + # + # In order to make your custom transliterations available, you must set + # them as the i18n.transliterate.rule i18n key: + # + # # Store the transliterations in locales/de.yml + # i18n: + # transliterate: + # rule: + # ü: "ue" + # ö: "oe" + # + # # Or set them using Ruby + # I18n.backend.store_translations(:de, i18n: { + # transliterate: { + # rule: { + # 'ü' => 'ue', + # 'ö' => 'oe' + # } + # } + # }) + # + # The value for i18n.transliterate.rule can be a simple Hash that + # maps characters to ASCII approximations as shown above, or, for more + # complex requirements, a Proc: + # + # I18n.backend.store_translations(:de, i18n: { + # transliterate: { + # rule: ->(string) { MyTransliterator.transliterate(string) } + # } + # }) + # + # Now you can have different transliterations for each locale: + # + # transliterate('Jürgen', locale: :en) + # # => "Jurgen" + # + # transliterate('Jürgen', locale: :de) + # # => "Juergen" + # + # Transliteration is restricted to UTF-8, US-ASCII, and GB18030 strings. + # Other encodings will raise an ArgumentError. + # + # pkg:gem/activesupport#lib/active_support/inflector/transliterate.rb:64 + def transliterate(string, replacement = T.unsafe(nil), locale: T.unsafe(nil)); end + + # Makes an underscored, lowercase form from the expression in the string. + # + # Changes '::' to '/' to convert namespaces to paths. + # + # underscore('ActiveModel') # => "active_model" + # underscore('ActiveModel::Errors') # => "active_model/errors" + # + # As a rule of thumb you can think of +underscore+ as the inverse of + # #camelize, though there are cases where that does not hold: + # + # camelize(underscore('SSLError')) # => "SslError" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:99 + def underscore(camel_cased_word); end + + # Converts the first character in the string to uppercase. + # + # upcase_first('what a Lovely Day') # => "What a Lovely Day" + # upcase_first('w') # => "W" + # upcase_first('') # => "" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:166 + def upcase_first(string); end + + private + + # Applies inflection rules for +singularize+ and +pluralize+. + # + # If passed an optional +locale+ parameter, the uncountables will be + # found for that locale. + # + # apply_inflections('post', inflections.plurals, :en) # => "posts" + # apply_inflections('posts', inflections.singulars, :en) # => "post" + # + # pkg:gem/activesupport#lib/active_support/inflector/methods.rb:360 + def apply_inflections(word, rules, locale = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/inflector/transliterate.rb:8 +ActiveSupport::Inflector::ALLOWED_ENCODINGS_FOR_TRANSLITERATE = T.let(T.unsafe(nil), Array) + +# = Active Support \Inflections +# +# A singleton instance of this class is yielded by Inflector.inflections, +# which can then be used to specify additional inflection rules. If passed +# an optional locale, rules for other languages can be specified. The +# default locale is :en. Only rules for English are provided. +# +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1\2en' +# inflect.singular /^(ox)en/i, '\1' +# +# inflect.irregular 'cactus', 'cacti' +# +# inflect.uncountable 'equipment' +# end +# +# New rules are added at the top. So in the example above, the irregular +# rule for cactus will now be the first of the pluralization and +# singularization rules that is runs. This guarantees that your rules run +# before any of the rules that may already have been loaded. +# +# pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:31 +class ActiveSupport::Inflector::Inflections + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:97 + def initialize; end + + # Specifies a new acronym. An acronym must be specified as it will appear + # in a camelized string. An underscore string that contains the acronym + # will retain the acronym when passed to +camelize+, +humanize+, or + # +titleize+. A camelized string that contains the acronym will maintain + # the acronym when titleized or humanized, and will convert the acronym + # into a non-delimited single lowercase word when passed to +underscore+. + # + # acronym 'HTML' + # titleize 'html' # => 'HTML' + # camelize 'html' # => 'HTML' + # underscore 'MyHTML' # => 'my_html' + # + # The acronym, however, must occur as a delimited unit and not be part of + # another word for conversions to recognize it: + # + # acronym 'HTTP' + # camelize 'my_http_delimited' # => 'MyHTTPDelimited' + # camelize 'https' # => 'Https', not 'HTTPs' + # underscore 'HTTPS' # => 'http_s', not 'https' + # + # acronym 'HTTPS' + # camelize 'https' # => 'HTTPS' + # underscore 'HTTPS' # => 'https' + # + # Note: Acronyms that are passed to +pluralize+ will no longer be + # recognized, since the acronym will not occur as a delimited unit in the + # pluralized result. To work around this, you must specify the pluralized + # form as an acronym as well: + # + # acronym 'API' + # camelize(pluralize('api')) # => 'Apis' + # + # acronym 'APIs' + # camelize(pluralize('api')) # => 'APIs' + # + # +acronym+ may be used to specify any word that contains an acronym or + # otherwise needs to maintain a non-standard capitalization. The only + # restriction is that the word must begin with a capital letter. + # + # acronym 'RESTful' + # underscore 'RESTful' # => 'restful' + # underscore 'RESTfulController' # => 'restful_controller' + # titleize 'RESTfulController' # => 'RESTful Controller' + # camelize 'restful' # => 'RESTful' + # camelize 'restful_controller' # => 'RESTfulController' + # + # acronym 'McDonald' + # underscore 'McDonald' # => 'mcdonald' + # camelize 'mcdonald' # => 'McDonald' + # + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:159 + def acronym(word); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:93 + def acronyms; end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:95 + def acronyms_camelize_regex; end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:95 + def acronyms_underscore_regex; end + + # Clears the loaded inflections within a given scope (default is + # :all). Give the scope as a symbol of the inflection type, the + # options are: :plurals, :singulars, :uncountables, + # :humans, :acronyms. + # + # clear :all + # clear :plurals + # + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:248 + def clear(scope = T.unsafe(nil)); end + + # Specifies a humanized form of a string by a regular expression rule or + # by a string mapping. When using a regular expression based replacement, + # the normal humanize formatting is called after the replacement. When a + # string is used, the human form should be specified as desired (example: + # 'The name', not 'the_name'). + # + # human /_cnt$/i, '\1_count' + # human 'legacy_col_person_name', 'Name' + # + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:237 + def human(rule, replacement); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:93 + def humans; end + + # Specifies a new irregular that applies to both pluralization and + # singularization at the same time. This can only be used for strings, not + # regular expressions. You simply pass the irregular in singular and + # plural form. + # + # irregular 'cactus', 'cacti' + # irregular 'person', 'people' + # + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:191 + def irregular(singular, plural); end + + # Specifies a new pluralization rule and its replacement. The rule can + # either be a string or a regular expression. The replacement should + # always be a string that may include references to the matched data from + # the rule. + # + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:168 + def plural(rule, replacement); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:93 + def plurals; end + + # Specifies a new singularization rule and its replacement. The rule can + # either be a string or a regular expression. The replacement should + # always be a string that may include references to the matched data from + # the rule. + # + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:178 + def singular(rule, replacement); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:93 + def singulars; end + + # Specifies words that are uncountable and should not be inflected. + # + # uncountable 'money' + # uncountable 'money', 'information' + # uncountable %w( money information rice ) + # + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:225 + def uncountable(*words); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:93 + def uncountables; end + + private + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:267 + def define_acronym_regex_patterns; end + + # Private, for the test suite. + # + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:103 + def initialize_dup(orig); end + + class << self + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:77 + def instance(locale = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:83 + def instance_or_fallback(locale); end + end +end + +# pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:35 +class ActiveSupport::Inflector::Inflections::Uncountables + include ::Enumerable + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:40 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:50 + def <<(word); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:38 + def ==(arg); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:61 + def add(words); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:45 + def delete(entry); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:38 + def each(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:38 + def empty?(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:57 + def flatten; end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:38 + def pop(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:38 + def to_a(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:38 + def to_ary(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:38 + def to_s(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/inflector/inflections.rb:68 + def uncountable?(str); end +end + +# = Inheritable Options +# +# +InheritableOptions+ provides a constructor to build an OrderedOptions +# hash inherited from another hash. +# +# Use this if you already have some hash and you want to create a new one based on it. +# +# h = ActiveSupport::InheritableOptions.new({ girl: 'Mary', boy: 'John' }) +# h.girl # => 'Mary' +# h.boy # => 'John' +# +# If the existing hash has string keys, call Hash#symbolize_keys on it. +# +# h = ActiveSupport::InheritableOptions.new({ 'girl' => 'Mary', 'boy' => 'John' }.symbolize_keys) +# h.girl # => 'Mary' +# h.boy # => 'John' +# +# pkg:gem/activesupport#lib/active_support/ordered_options.rb:89 +class ActiveSupport::InheritableOptions < ::ActiveSupport::OrderedOptions + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:90 + def initialize(parent = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:107 + def ==(other); end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:142 + def each(&block); end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:134 + def inheritable_copy; end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:111 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:126 + def key?(key); end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:130 + def overridden?(key); end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:119 + def pretty_print(pp); end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:138 + def to_a; end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:103 + def to_h; end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:115 + def to_s; end + + private + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:123 + def own_key?(_arg0); end +end + +# pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:4 +module ActiveSupport::IsolatedExecutionState + class << self + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:31 + def [](key); end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:37 + def []=(key, value); end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:50 + def clear; end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:54 + def context; end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:46 + def delete(key); end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:11 + def isolation_level; end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:13 + def isolation_level=(level); end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:42 + def key?(key); end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:11 + def scope; end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:58 + def share_with(other, except: T.unsafe(nil), &block); end + end +end + +# pkg:gem/activesupport#lib/active_support/json/decoding.rb:11 +module ActiveSupport::JSON + class << self + # Parses a JSON string (JavaScript Object Notation) into a Ruby object. + # See http://www.json.org for more info. + # + # ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}") + # # => {"team" => "rails", "players" => "36"} + # ActiveSupport::JSON.decode("2.39") + # # => 2.39 + # + # pkg:gem/activesupport#lib/active_support/json/decoding.rb:24 + def decode(json, options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:56 + def dump(value, options = T.unsafe(nil)); end + + # Dumps objects in JSON (JavaScript Object Notation). + # See http://www.json.org for more info. + # + # ActiveSupport::JSON.encode({ team: 'rails', players: '36' }) + # # => "{\"team\":\"rails\",\"players\":\"36\"}" + # + # By default, it generates JSON that is safe to include in JavaScript, as + # it escapes U+2028 (Line Separator) and U+2029 (Paragraph Separator): + # + # ActiveSupport::JSON.encode({ key: "\u2028" }) + # # => "{\"key\":\"\\u2028\"}" + # + # By default, it also generates JSON that is safe to include in HTML, as + # it escapes <, >, and &: + # + # ActiveSupport::JSON.encode({ key: "<>&" }) + # # => "{\"key\":\"\\u003c\\u003e\\u0026\"}" + # + # This behavior can be changed with the +escape_html_entities+ option, or the + # global escape_html_entities_in_json configuration option. + # + # ActiveSupport::JSON.encode({ key: "<>&" }, escape_html_entities: false) + # # => "{\"key\":\"<>&\"}" + # + # For performance reasons, you can set the +escape+ option to false, + # which will skip all escaping: + # + # ActiveSupport::JSON.encode({ key: "\u2028<>&" }, escape: false) + # # => "{\"key\":\"\u2028<>&\"}" + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:47 + def encode(value, options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/json/decoding.rb:37 + def load(json, options = T.unsafe(nil)); end + + # Returns the class of the error that will be raised when there is an + # error in decoding JSON. Using this method means you won't directly + # depend on the ActiveSupport's JSON implementation, in case it changes + # in the future. + # + # begin + # obj = ActiveSupport::JSON.decode(some_string) + # rescue ActiveSupport::JSON.parse_error + # Rails.logger.warn("Attempted to decode invalid JSON: #{some_string}") + # end + # + # pkg:gem/activesupport#lib/active_support/json/decoding.rb:49 + def parse_error; end + + private + + # pkg:gem/activesupport#lib/active_support/json/decoding.rb:54 + def convert_dates_from(data); end + end +end + +# pkg:gem/activesupport#lib/active_support/json/decoding.rb:14 +ActiveSupport::JSON::DATETIME_REGEX = T.let(T.unsafe(nil), Regexp) + +# matches YAML-formatted dates +# +# pkg:gem/activesupport#lib/active_support/json/decoding.rb:13 +ActiveSupport::JSON::DATE_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/json/encoding.rb:59 +module ActiveSupport::JSON::Encoding + class << self + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:251 + def encode_without_escape(value); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:247 + def encode_without_options(value); end + + # If true, encode >, <, & as escaped unicode sequences (e.g. > as \u003e) + # as a safety measure. + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:224 + def escape_html_entities_in_json; end + + # If true, encode >, <, & as escaped unicode sequences (e.g. > as \u003e) + # as a safety measure. + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:224 + def escape_html_entities_in_json=(_arg0); end + + # If true, encode LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) + # as escaped unicode sequences ('\u2028' and '\u2029'). + # Historically these characters were not valid inside JavaScript strings + # but that changed in ECMAScript 2019. As such it's no longer a concern in + # modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset. + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:231 + def escape_js_separators_in_json; end + + # If true, encode LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) + # as escaped unicode sequences ('\u2028' and '\u2029'). + # Historically these characters were not valid inside JavaScript strings + # but that changed in ECMAScript 2019. As such it's no longer a concern in + # modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset. + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:231 + def escape_js_separators_in_json=(_arg0); end + + # Sets the encoder used by \Rails to encode Ruby objects into JSON strings + # in +Object#to_json+ and +ActiveSupport::JSON.encode+. + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:239 + def json_encoder; end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:241 + def json_encoder=(encoder); end + + # Sets the precision of encoded time values. + # Defaults to 3 (equivalent to millisecond precision) + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:235 + def time_precision; end + + # Sets the precision of encoded time values. + # Defaults to 3 (equivalent to millisecond precision) + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:235 + def time_precision=(_arg0); end + + # If true, use ISO 8601 format for dates and times. Otherwise, fall back + # to the Active Support legacy format. + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:220 + def use_standard_json_time_format; end + + # If true, use ISO 8601 format for dates and times. Otherwise, fall back + # to the Active Support legacy format. + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:220 + def use_standard_json_time_format=(_arg0); end + end +end + +# pkg:gem/activesupport#lib/active_support/json/encoding.rb:63 +ActiveSupport::JSON::Encoding::ESCAPED_CHARS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/json/encoding.rb:72 +ActiveSupport::JSON::Encoding::FULL_ESCAPE_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/json/encoding.rb:71 +ActiveSupport::JSON::Encoding::HTML_ENTITIES_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/json/encoding.rb:75 +class ActiveSupport::JSON::Encoding::JSONGemEncoder + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:78 + def initialize(options = T.unsafe(nil)); end + + # Encode the given object into a JSON string + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:83 + def encode(value); end + + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:76 + def options; end + + private + + # Convert an object into a "JSON-ready" representation composed of + # primitives like Hash, Array, String, Symbol, Numeric, + # and +true+/+false+/+nil+. + # Recursively calls #as_json to the object to recursively build a + # fully JSON-ready object. + # + # This allows developers to implement #as_json without having to + # worry about what base types of objects they are allowed to return + # or having to remember to call #as_json recursively. + # + # Note: the +options+ hash passed to +object.to_json+ is only passed + # to +object.as_json+, not any of this method's recursive +#as_json+ + # calls. + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:118 + def jsonify(value); end + + # Encode a "jsonified" Ruby data structure using the JSON gem + # + # pkg:gem/activesupport#lib/active_support/json/encoding.rb:143 + def stringify(jsonified); end +end + +# pkg:gem/activesupport#lib/active_support/json/encoding.rb:73 +ActiveSupport::JSON::Encoding::JS_SEPARATORS_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/json/encoding.rb:60 +ActiveSupport::JSON::Encoding::U2028 = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/json/encoding.rb:61 +ActiveSupport::JSON::Encoding::U2029 = T.let(T.unsafe(nil), String) + +# = Key Generator +# +# KeyGenerator is a simple wrapper around OpenSSL's implementation of PBKDF2. +# It can be used to derive a number of keys for various purposes from a given secret. +# This lets \Rails applications have a single secure secret, but avoid reusing that +# key in multiple incompatible contexts. +# +# pkg:gem/activesupport#lib/active_support/key_generator.rb:13 +class ActiveSupport::KeyGenerator + # pkg:gem/activesupport#lib/active_support/key_generator.rb:28 + def initialize(secret, options = T.unsafe(nil)); end + + # Returns a derived key suitable for use. The default +key_size+ is chosen + # to be compatible with the default settings of ActiveSupport::MessageVerifier. + # i.e. OpenSSL::Digest::SHA1#block_length + # + # pkg:gem/activesupport#lib/active_support/key_generator.rb:41 + def generate_key(salt, key_size = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/key_generator.rb:45 + def inspect; end + + class << self + # pkg:gem/activesupport#lib/active_support/key_generator.rb:23 + def hash_digest_class; end + + # pkg:gem/activesupport#lib/active_support/key_generator.rb:15 + def hash_digest_class=(klass); end + end +end + +# = Lazy Load Hooks +# +# LazyLoadHooks allows \Rails to lazily load a lot of components and thus +# making the app boot faster. Because of this feature now there is no need to +# require +ActiveRecord::Base+ at boot time purely to apply +# configuration. Instead a hook is registered that applies configuration once +# +ActiveRecord::Base+ is loaded. Here +ActiveRecord::Base+ is +# used as example but this feature can be applied elsewhere too. +# +# Here is an example where on_load method is called to register a hook. +# +# initializer 'active_record.initialize_timezone' do +# ActiveSupport.on_load(:active_record) do +# self.time_zone_aware_attributes = true +# self.default_timezone = :utc +# end +# end +# +# When the entirety of +ActiveRecord::Base+ has been +# evaluated then run_load_hooks is invoked. The very last line of +# +ActiveRecord::Base+ is: +# +# ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) +# +# run_load_hooks will then execute all the hooks that were registered +# with the on_load method. In the case of the above example, it will +# execute the block of code that is in the +initializer+. +# +# Registering a hook that has already run results in that hook executing +# immediately. This allows hooks to be nested for code that relies on +# multiple lazily loaded components: +# +# initializer "action_text.renderer" do +# ActiveSupport.on_load(:action_controller_base) do +# ActiveSupport.on_load(:action_text_content) do +# self.default_renderer = Class.new(ActionController::Base).renderer +# end +# end +# end +# +# pkg:gem/activesupport#lib/active_support/lazy_load_hooks.rb:43 +module ActiveSupport::LazyLoadHooks + # Declares a block that will be executed when a \Rails component is fully + # loaded. If the component has already loaded, the block is executed + # immediately. + # + # ==== Options + # + # * :yield - Yields the object that run_load_hooks to +block+. + # * :run_once - Given +block+ will run only once. + # + # pkg:gem/activesupport#lib/active_support/lazy_load_hooks.rb:60 + def on_load(name, options = T.unsafe(nil), &block); end + + # Executes all blocks registered to +name+ via on_load, using +base+ as the + # evaluation context. + # + # ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) + # + # In the case of the above example, it will execute all hooks registered + # for +:active_record+ within the class +ActiveRecord::Base+. + # + # pkg:gem/activesupport#lib/active_support/lazy_load_hooks.rb:75 + def run_load_hooks(name, base = T.unsafe(nil)); end + + private + + # pkg:gem/activesupport#lib/active_support/lazy_load_hooks.rb:91 + def execute_hook(name, base, options, block); end + + # pkg:gem/activesupport#lib/active_support/lazy_load_hooks.rb:83 + def with_execution_control(name, block, once); end + + class << self + # pkg:gem/activesupport#lib/active_support/lazy_load_hooks.rb:44 + def extended(base); end + end +end + +# = Active Support Log \Subscriber +# +# +ActiveSupport::LogSubscriber+ is an object set to consume +# ActiveSupport::Notifications with the sole purpose of logging them. +# The log subscriber dispatches notifications to a registered object based +# on its given namespace. +# +# An example would be Active Record log subscriber responsible for logging +# queries: +# +# module ActiveRecord +# class LogSubscriber < ActiveSupport::LogSubscriber +# attach_to :active_record +# +# def sql(event) +# info "#{event.payload[:name]} (#{event.duration}) #{event.payload[:sql]}" +# end +# end +# end +# +# ActiveRecord::LogSubscriber.logger must be set as well, but it is assigned +# automatically in a \Rails environment. +# +# After configured, whenever a "sql.active_record" notification is +# published, it will properly dispatch the event +# (ActiveSupport::Notifications::Event) to the +sql+ method. +# +# Being an ActiveSupport::Notifications consumer, +# +ActiveSupport::LogSubscriber+ exposes a simple interface to check if +# instrumented code raises an exception. It is common to log a different +# message in case of an error, and this can be achieved by extending +# the previous example: +# +# module ActiveRecord +# class LogSubscriber < ActiveSupport::LogSubscriber +# def sql(event) +# exception = event.payload[:exception] +# +# if exception +# exception_object = event.payload[:exception_object] +# +# error "[ERROR] #{event.payload[:name]}: #{exception.join(', ')} " \ +# "(#{exception_object.backtrace.first})" +# else +# # standard logger code +# end +# end +# end +# end +# +# +ActiveSupport::LogSubscriber+ also has some helpers to deal with +# logging. For example, ActiveSupport::LogSubscriber.flush_all! will ensure +# that all logs are flushed, and it is called in Rails::Rack::Logger after a +# request finishes. +# +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:64 +class ActiveSupport::LogSubscriber < ::ActiveSupport::Subscriber + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:133 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:146 + def call(event); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:83 + def colorize_logging; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:83 + def colorize_logging=(val); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:156 + def debug(progname = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:156 + def error(progname = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:152 + def event_levels=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:156 + def fatal(progname = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:156 + def info(progname = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:138 + def logger; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:142 + def silenced?(event); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:156 + def unknown(progname = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:156 + def warn(progname = T.unsafe(nil), &block); end + + private + + # Set color by using a symbol or one of the defined constants. Set modes + # by specifying bold, italic, or underline options. Inspired by Highline, + # this method will automatically clear formatting at the end of the returned String. + # + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:166 + def color(text, color, mode_options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:180 + def log_exception(name, e); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:174 + def mode_from(options); end + + class << self + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:99 + def attach_to(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:83 + def colorize_logging; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:83 + def colorize_logging=(val); end + + # Flush all log_subscribers' logger. + # + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:112 + def flush_all!; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:84 + def log_levels; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:84 + def log_levels=(value); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:84 + def log_levels?; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:107 + def log_subscribers; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:93 + def logger; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:105 + def logger=(_arg0); end + + private + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:84 + def __class_attr_log_levels; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:84 + def __class_attr_log_levels=(new_value); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:117 + def fetch_public_methods(subscriber, inherit_all); end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:121 + def set_event_levels; end + + # pkg:gem/activesupport#lib/active_support/log_subscriber.rb:127 + def subscribe_log_level(method, level); end + end +end + +# ANSI sequence colors +# +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:74 +ActiveSupport::LogSubscriber::BLACK = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:78 +ActiveSupport::LogSubscriber::BLUE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:80 +ActiveSupport::LogSubscriber::CYAN = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:76 +ActiveSupport::LogSubscriber::GREEN = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:86 +ActiveSupport::LogSubscriber::LEVEL_CHECKS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:79 +ActiveSupport::LogSubscriber::MAGENTA = T.let(T.unsafe(nil), String) + +# ANSI sequence modes +# +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:66 +ActiveSupport::LogSubscriber::MODES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:75 +ActiveSupport::LogSubscriber::RED = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:81 +ActiveSupport::LogSubscriber::WHITE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/log_subscriber.rb:77 +ActiveSupport::LogSubscriber::YELLOW = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/logger.rb:8 +class ActiveSupport::Logger < ::Logger + include ::ActiveSupport::LoggerSilence + include ::ActiveSupport::LoggerThreadSafeLevel + + # pkg:gem/activesupport#lib/active_support/logger.rb:33 + def initialize(*args, **kwargs); end + + # pkg:gem/activesupport#lib/active_support/logger.rb:9 + def silencer; end + + # pkg:gem/activesupport#lib/active_support/logger.rb:9 + def silencer=(val); end + + class << self + # Returns true if the logger destination matches one of the sources + # + # logger = Logger.new(STDOUT) + # ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT) + # # => true + # + # logger = Logger.new('/var/log/rails.log') + # ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log') + # # => true + # + # pkg:gem/activesupport#lib/active_support/logger.rb:20 + def logger_outputs_to?(logger, *sources); end + + # pkg:gem/activesupport#lib/active_support/logger.rb:47 + def normalize_sources(sources); end + + # pkg:gem/activesupport#lib/active_support/logger.rb:9 + def silencer; end + + # pkg:gem/activesupport#lib/active_support/logger.rb:9 + def silencer=(val); end + end +end + +# Simple formatter which only displays the message. +# +# pkg:gem/activesupport#lib/active_support/logger.rb:39 +class ActiveSupport::Logger::SimpleFormatter < ::Logger::Formatter + # This method is invoked when a log event occurs + # + # pkg:gem/activesupport#lib/active_support/logger.rb:41 + def call(severity, timestamp, progname, msg); end +end + +# pkg:gem/activesupport#lib/active_support/logger_silence.rb:8 +module ActiveSupport::LoggerSilence + extend ::ActiveSupport::Concern + include ::ActiveSupport::LoggerThreadSafeLevel + + # Silences the logger for the duration of the block. + # + # pkg:gem/activesupport#lib/active_support/logger_silence.rb:17 + def silence(severity = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/logger_thread_safe_level.rb:7 +module ActiveSupport::LoggerThreadSafeLevel + extend ::ActiveSupport::Concern + + # pkg:gem/activesupport#lib/active_support/logger_thread_safe_level.rb:10 + def initialize(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/logger_thread_safe_level.rb:35 + def level; end + + # pkg:gem/activesupport#lib/active_support/logger_thread_safe_level.rb:15 + def local_level; end + + # pkg:gem/activesupport#lib/active_support/logger_thread_safe_level.rb:19 + def local_level=(level); end + + # Change the thread-local level for the duration of the given block. + # + # pkg:gem/activesupport#lib/active_support/logger_thread_safe_level.rb:40 + def log_at(level); end + + private + + # pkg:gem/activesupport#lib/active_support/logger_thread_safe_level.rb:48 + def local_level_key; end +end + +# = Active Support Message Encryptor +# +# MessageEncryptor is a simple way to encrypt values which get stored +# somewhere you don't trust. +# +# The cipher text and initialization vector are base64 encoded and returned +# to you. +# +# This can be used in situations similar to the MessageVerifier, but +# where you don't want users to be able to determine the value of the payload. +# +# len = ActiveSupport::MessageEncryptor.key_len +# salt = SecureRandom.random_bytes(len) +# key = ActiveSupport::KeyGenerator.new('password').generate_key(salt, len) # => "\x89\xE0\x156\xAC..." +# crypt = ActiveSupport::MessageEncryptor.new(key) # => # +# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..." +# crypt.decrypt_and_verify(encrypted_data) # => "my secret data" +# +# The +decrypt_and_verify+ method will raise an +# +ActiveSupport::MessageEncryptor::InvalidMessage+ exception if the data +# provided cannot be decrypted or verified. +# +# crypt.decrypt_and_verify('not encrypted data') # => ActiveSupport::MessageEncryptor::InvalidMessage +# +# === Confining messages to a specific purpose +# +# By default any message can be used throughout your app. But they can also be +# confined to a specific +:purpose+. +# +# token = crypt.encrypt_and_sign("this is the chair", purpose: :login) +# +# Then that same purpose must be passed when verifying to get the data back out: +# +# crypt.decrypt_and_verify(token, purpose: :login) # => "this is the chair" +# crypt.decrypt_and_verify(token, purpose: :shipping) # => nil +# crypt.decrypt_and_verify(token) # => nil +# +# Likewise, if a message has no purpose it won't be returned when verifying with +# a specific purpose. +# +# token = crypt.encrypt_and_sign("the conversation is lively") +# crypt.decrypt_and_verify(token, purpose: :scare_tactics) # => nil +# crypt.decrypt_and_verify(token) # => "the conversation is lively" +# +# === Making messages expire +# +# By default messages last forever and verifying one year from now will still +# return the original value. But messages can be set to expire at a given +# time with +:expires_in+ or +:expires_at+. +# +# crypt.encrypt_and_sign(parcel, expires_in: 1.month) +# crypt.encrypt_and_sign(doowad, expires_at: Time.now.end_of_year) +# +# Then the messages can be verified and returned up to the expire time. +# Thereafter, verifying returns +nil+. +# +# === Rotating keys +# +# MessageEncryptor also supports rotating out old configurations by falling +# back to a stack of encryptors. Call +rotate+ to build and add an encryptor +# so +decrypt_and_verify+ will also try the fallback. +# +# By default any rotated encryptors use the values of the primary +# encryptor unless specified otherwise. +# +# You'd give your encryptor the new defaults: +# +# crypt = ActiveSupport::MessageEncryptor.new(@secret, cipher: "aes-256-gcm") +# +# Then gradually rotate the old values out by adding them as fallbacks. Any message +# generated with the old values will then work until the rotation is removed. +# +# crypt.rotate old_secret # Fallback to an old secret instead of @secret. +# crypt.rotate cipher: "aes-256-cbc" # Fallback to an old cipher instead of aes-256-gcm. +# +# Though if both the secret and the cipher was changed at the same time, +# the above should be combined into: +# +# crypt.rotate old_secret, cipher: "aes-256-cbc" +# +# pkg:gem/activesupport#lib/active_support/message_encryptor.rb:90 +class ActiveSupport::MessageEncryptor < ::ActiveSupport::Messages::Codec + include ::ActiveSupport::Messages::Rotator + + # Initialize a new MessageEncryptor. +secret+ must be at least as long as + # the cipher key size. For the default 'aes-256-gcm' cipher, this is 256 + # bits. If you are using a user-entered secret, you can generate a suitable + # key by using ActiveSupport::KeyGenerator or a similar key + # derivation function. + # + # The first additional parameter is used as the signature key for + # MessageVerifier. This allows you to specify keys to encrypt and sign + # data. Ignored when using an AEAD cipher like 'aes-256-gcm'. + # + # ActiveSupport::MessageEncryptor.new('secret', 'signature_secret') + # + # ==== Options + # + # [+:cipher+] + # Cipher to use. Can be any cipher returned by +OpenSSL::Cipher.ciphers+. + # Default is 'aes-256-gcm'. + # + # [+:digest+] + # Digest used for signing. Ignored when using an AEAD cipher like + # 'aes-256-gcm'. + # + # [+:serializer+] + # The serializer used to serialize message data. You can specify any + # object that responds to +dump+ and +load+, or you can choose from + # several preconfigured serializers: +:marshal+, +:json_allow_marshal+, + # +:json+, +:message_pack_allow_marshal+, +:message_pack+. + # + # The preconfigured serializers include a fallback mechanism to support + # multiple deserialization formats. For example, the +:marshal+ serializer + # will serialize using +Marshal+, but can deserialize using +Marshal+, + # ActiveSupport::JSON, or ActiveSupport::MessagePack. This makes it easy + # to migrate between serializers. + # + # The +:marshal+, +:json_allow_marshal+, and +:message_pack_allow_marshal+ + # serializers support deserializing using +Marshal+, but the others do + # not. Beware that +Marshal+ is a potential vector for deserialization + # attacks in cases where a message signing secret has been leaked. If + # possible, choose a serializer that does not support +Marshal+. + # + # The +:message_pack+ and +:message_pack_allow_marshal+ serializers use + # ActiveSupport::MessagePack, which can roundtrip some Ruby types that are + # not supported by JSON, and may provide improved performance. However, + # these require the +msgpack+ gem. + # + # When using \Rails, the default depends on +config.active_support.message_serializer+. + # Otherwise, the default is +:marshal+. + # + # [+:url_safe+] + # By default, MessageEncryptor generates RFC 4648 compliant strings + # which are not URL-safe. In other words, they can contain "+" and "/". + # If you want to generate URL-safe strings (in compliance with "Base 64 + # Encoding with URL and Filename Safe Alphabet" in RFC 4648), you can + # pass +true+. + # + # [+:force_legacy_metadata_serializer+] + # Whether to use the legacy metadata serializer, which serializes the + # message first, then wraps it in an envelope which is also serialized. This + # was the default in \Rails 7.0 and below. + # + # If you don't pass a truthy value, the default is set using + # +config.active_support.use_message_serializer_for_metadata+. + # + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:183 + def initialize(*args, on_rotation: T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:256 + def create_message(value, **options); end + + # Decrypt and verify a message. We need to verify the message in order to + # avoid padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/. + # + # ==== Options + # + # [+:purpose+] + # The purpose that the message was generated with. If the purpose does not + # match, +decrypt_and_verify+ will return +nil+. + # + # message = encryptor.encrypt_and_sign("hello", purpose: "greeting") + # encryptor.decrypt_and_verify(message, purpose: "greeting") # => "hello" + # encryptor.decrypt_and_verify(message) # => nil + # + # message = encryptor.encrypt_and_sign("bye") + # encryptor.decrypt_and_verify(message) # => "bye" + # encryptor.decrypt_and_verify(message, purpose: "greeting") # => nil + # + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:241 + def decrypt_and_verify(message, **options); end + + # Encrypt and sign a message. We need to sign the message in order to avoid + # padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/. + # + # ==== Options + # + # [+:expires_at+] + # The datetime at which the message expires. After this datetime, + # verification of the message will fail. + # + # message = encryptor.encrypt_and_sign("hello", expires_at: Time.now.tomorrow) + # encryptor.decrypt_and_verify(message) # => "hello" + # # 24 hours later... + # encryptor.decrypt_and_verify(message) # => nil + # + # [+:expires_in+] + # The duration for which the message is valid. After this duration has + # elapsed, verification of the message will fail. + # + # message = encryptor.encrypt_and_sign("hello", expires_in: 24.hours) + # encryptor.decrypt_and_verify(message) # => "hello" + # # 24 hours later... + # encryptor.decrypt_and_verify(message) # => nil + # + # [+:purpose+] + # The purpose of the message. If specified, the same purpose must be + # specified when verifying the message; otherwise, verification will fail. + # (See #decrypt_and_verify.) + # + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:220 + def encrypt_and_sign(value, **options); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:264 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:260 + def read_message(message, on_rotation: T.unsafe(nil), **options); end + + private + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:371 + def aead_mode; end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:372 + def aead_mode?; end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:295 + def decrypt(encrypted_message); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:277 + def encrypt(data); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:340 + def extract_part(encrypted_message, rindex, length); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:350 + def extract_parts(encrypted_message); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:336 + def join_parts(parts); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:320 + def length_after_encode(length_before_encode); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:332 + def length_of_encoded_auth_tag; end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:328 + def length_of_encoded_iv; end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:367 + def new_cipher; end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:269 + def sign(data); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:273 + def verify(data); end + + class << self + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:96 + def default_cipher; end + + # Given a cipher, returns the key length of the cipher to help generate the key of desired size + # + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:252 + def key_len(cipher = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:93 + def use_authenticated_message_encryption; end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:93 + def use_authenticated_message_encryption=(val); end + end +end + +# pkg:gem/activesupport#lib/active_support/message_encryptor.rb:118 +ActiveSupport::MessageEncryptor::AUTH_TAG_LENGTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/message_encryptor.rb:115 +class ActiveSupport::MessageEncryptor::InvalidMessage < ::StandardError; end + +# pkg:gem/activesupport#lib/active_support/message_encryptor.rb:105 +module ActiveSupport::MessageEncryptor::NullSerializer + class << self + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:110 + def dump(value); end + + # pkg:gem/activesupport#lib/active_support/message_encryptor.rb:106 + def load(value); end + end +end + +# pkg:gem/activesupport#lib/active_support/message_encryptor.rb:116 +ActiveSupport::MessageEncryptor::OpenSSLCipherError = OpenSSL::Cipher::CipherError + +# pkg:gem/activesupport#lib/active_support/message_encryptor.rb:119 +ActiveSupport::MessageEncryptor::SEPARATOR = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/message_encryptors.rb:6 +class ActiveSupport::MessageEncryptors < ::ActiveSupport::Messages::RotationCoordinator + private + + # pkg:gem/activesupport#lib/active_support/message_encryptors.rb:187 + def build(salt, secret_generator:, secret_generator_options:, **options); end +end + +# = Active Support Message Verifier +# +# +MessageVerifier+ makes it easy to generate and verify messages which are +# signed to prevent tampering. +# +# In a \Rails application, you can use +Rails.application.message_verifier+ +# to manage unique instances of verifiers for each use case. +# {Learn more}[link:classes/Rails/Application.html#method-i-message_verifier]. +# +# This is useful for cases like remember-me tokens and auto-unsubscribe links +# where the session store isn't suitable or available. +# +# First, generate a signed message: +# cookies[:remember_me] = Rails.application.message_verifier(:remember_me).generate([@user.id, 2.weeks.from_now]) +# +# Later verify that message: +# +# id, time = Rails.application.message_verifier(:remember_me).verify(cookies[:remember_me]) +# if time.future? +# self.current_user = User.find(id) +# end +# +# === Signing is not encryption +# +# The signed messages are not encrypted. The payload is merely encoded (Base64 by default) and can be decoded by +# anyone. The signature is just assuring that the message wasn't tampered with. For example: +# +# message = Rails.application.message_verifier('my_purpose').generate('never put secrets here') +# # => "BAhJIhtuZXZlciBwdXQgc2VjcmV0cyBoZXJlBjoGRVQ=--a0c1c0827919da5e949e989c971249355735e140" +# Base64.decode64(message.split("--").first) # no key needed +# # => 'never put secrets here' +# +# If you also need to encrypt the contents, you must use ActiveSupport::MessageEncryptor instead. +# +# === Confine messages to a specific purpose +# +# It's not recommended to use the same verifier for different purposes in your application. +# Doing so could allow a malicious actor to re-use a signed message to perform an unauthorized +# action. +# You can reduce this risk by confining signed messages to a specific +:purpose+. +# +# token = @verifier.generate("signed message", purpose: :login) +# +# Then that same purpose must be passed when verifying to get the data back out: +# +# @verifier.verified(token, purpose: :login) # => "signed message" +# @verifier.verified(token, purpose: :shipping) # => nil +# @verifier.verified(token) # => nil +# +# @verifier.verify(token, purpose: :login) # => "signed message" +# @verifier.verify(token, purpose: :shipping) # => raises ActiveSupport::MessageVerifier::InvalidSignature +# @verifier.verify(token) # => raises ActiveSupport::MessageVerifier::InvalidSignature +# +# Likewise, if a message has no purpose it won't be returned when verifying with +# a specific purpose. +# +# token = @verifier.generate("signed message") +# @verifier.verified(token, purpose: :redirect) # => nil +# @verifier.verified(token) # => "signed message" +# +# @verifier.verify(token, purpose: :redirect) # => raises ActiveSupport::MessageVerifier::InvalidSignature +# @verifier.verify(token) # => "signed message" +# +# === Expiring messages +# +# By default messages last forever and verifying one year from now will still +# return the original value. But messages can be set to expire at a given +# time with +:expires_in+ or +:expires_at+. +# +# @verifier.generate("signed message", expires_in: 1.month) +# @verifier.generate("signed message", expires_at: Time.now.end_of_year) +# +# Messages can then be verified and returned until expiry. +# Thereafter, the +verified+ method returns +nil+ while +verify+ raises +# +ActiveSupport::MessageVerifier::InvalidSignature+. +# +# === Rotating keys +# +# MessageVerifier also supports rotating out old configurations by falling +# back to a stack of verifiers. Call +rotate+ to build and add a verifier so +# either +verified+ or +verify+ will also try verifying with the fallback. +# +# By default any rotated verifiers use the values of the primary +# verifier unless specified otherwise. +# +# You'd give your verifier the new defaults: +# +# verifier = ActiveSupport::MessageVerifier.new(@secret, digest: "SHA512", serializer: JSON) +# +# Then gradually rotate the old values out by adding them as fallbacks. Any message +# generated with the old values will then work until the rotation is removed. +# +# verifier.rotate(old_secret) # Fallback to an old secret instead of @secret. +# verifier.rotate(digest: "SHA256") # Fallback to an old digest instead of SHA512. +# verifier.rotate(serializer: Marshal) # Fallback to an old serializer instead of JSON. +# +# Though the above would most likely be combined into one rotation: +# +# verifier.rotate(old_secret, digest: "SHA256", serializer: Marshal) +# +# pkg:gem/activesupport#lib/active_support/message_verifier.rb:110 +class ActiveSupport::MessageVerifier < ::ActiveSupport::Messages::Codec + include ::ActiveSupport::Messages::Rotator + + # Initialize a new MessageVerifier with a secret for the signature. + # + # ==== Options + # + # [+:digest+] + # Digest used for signing. The default is "SHA1". See + # +OpenSSL::Digest+ for alternatives. + # + # [+:serializer+] + # The serializer used to serialize message data. You can specify any + # object that responds to +dump+ and +load+, or you can choose from + # several preconfigured serializers: +:marshal+, +:json_allow_marshal+, + # +:json+, +:message_pack_allow_marshal+, +:message_pack+. + # + # The preconfigured serializers include a fallback mechanism to support + # multiple deserialization formats. For example, the +:marshal+ serializer + # will serialize using +Marshal+, but can deserialize using +Marshal+, + # ActiveSupport::JSON, or ActiveSupport::MessagePack. This makes it easy + # to migrate between serializers. + # + # The +:marshal+, +:json_allow_marshal+, and +:message_pack_allow_marshal+ + # serializers support deserializing using +Marshal+, but the others do + # not. Beware that +Marshal+ is a potential vector for deserialization + # attacks in cases where a message signing secret has been leaked. If + # possible, choose a serializer that does not support +Marshal+. + # + # The +:message_pack+ and +:message_pack_allow_marshal+ serializers use + # ActiveSupport::MessagePack, which can roundtrip some Ruby types that are + # not supported by JSON, and may provide improved performance. However, + # these require the +msgpack+ gem. + # + # When using \Rails, the default depends on +config.active_support.message_serializer+. + # Otherwise, the default is +:marshal+. + # + # [+:url_safe+] + # By default, MessageVerifier generates RFC 4648 compliant strings which are + # not URL-safe. In other words, they can contain "+" and "/". If you want to + # generate URL-safe strings (in compliance with "Base 64 Encoding with URL + # and Filename Safe Alphabet" in RFC 4648), you can pass +true+. + # Note that MessageVerifier will always accept both URL-safe and URL-unsafe + # encoded messages, to allow a smooth transition between the two settings. + # + # [+:force_legacy_metadata_serializer+] + # Whether to use the legacy metadata serializer, which serializes the + # message first, then wraps it in an envelope which is also serialized. This + # was the default in \Rails 7.0 and below. + # + # If you don't pass a truthy value, the default is set using + # +config.active_support.use_message_serializer_for_metadata+. + # + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:167 + def initialize(*args, on_rotation: T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:310 + def create_message(value, **options); end + + # Generates a signed message for the provided value. + # + # The message is signed with the +MessageVerifier+'s secret. + # Returns Base64-encoded message joined with the generated signature. + # + # verifier = ActiveSupport::MessageVerifier.new("secret") + # verifier.generate("signed message") # => "BAhJIhNzaWduZWQgbWVzc2FnZQY6BkVU--f67d5f27c3ee0b8483cebf2103757455e947493b" + # + # ==== Options + # + # [+:expires_at+] + # The datetime at which the message expires. After this datetime, + # verification of the message will fail. + # + # message = verifier.generate("hello", expires_at: Time.now.tomorrow) + # verifier.verified(message) # => "hello" + # # 24 hours later... + # verifier.verified(message) # => nil + # verifier.verify(message) # => raises ActiveSupport::MessageVerifier::InvalidSignature + # + # [+:expires_in+] + # The duration for which the message is valid. After this duration has + # elapsed, verification of the message will fail. + # + # message = verifier.generate("hello", expires_in: 24.hours) + # verifier.verified(message) # => "hello" + # # 24 hours later... + # verifier.verified(message) # => nil + # verifier.verify(message) # => raises ActiveSupport::MessageVerifier::InvalidSignature + # + # [+:purpose+] + # The purpose of the message. If specified, the same purpose must be + # specified when verifying the message; otherwise, verification will fail. + # (See #verified and #verify.) + # + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:306 + def generate(value, **options); end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:318 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:314 + def read_message(message, on_rotation: T.unsafe(nil), **options); end + + # Checks if a signed message could have been generated by signing an object + # with the +MessageVerifier+'s secret. + # + # verifier = ActiveSupport::MessageVerifier.new("secret") + # signed_message = verifier.generate("signed message") + # verifier.valid_message?(signed_message) # => true + # + # tampered_message = signed_message.chop # editing the message invalidates the signature + # verifier.valid_message?(tampered_message) # => false + # + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:183 + def valid_message?(message); end + + # Decodes the signed message using the +MessageVerifier+'s secret. + # + # verifier = ActiveSupport::MessageVerifier.new("secret") + # + # signed_message = verifier.generate("signed message") + # verifier.verified(signed_message) # => "signed message" + # + # Returns +nil+ if the message was not signed with the same secret. + # + # other_verifier = ActiveSupport::MessageVerifier.new("different_secret") + # other_verifier.verified(signed_message) # => nil + # + # Returns +nil+ if the message is not Base64-encoded. + # + # invalid_message = "f--46a0120593880c733a53b6dad75b42ddc1c8996d" + # verifier.verified(invalid_message) # => nil + # + # Raises any error raised while decoding the signed message. + # + # incompatible_message = "test--dad7b06c94abba8d46a15fafaef56c327665d5ff" + # verifier.verified(incompatible_message) # => TypeError: incompatible marshal file format + # + # ==== Options + # + # [+:purpose+] + # The purpose that the message was generated with. If the purpose does not + # match, +verified+ will return +nil+. + # + # message = verifier.generate("hello", purpose: "greeting") + # verifier.verified(message, purpose: "greeting") # => "hello" + # verifier.verified(message, purpose: "chatting") # => nil + # verifier.verified(message) # => nil + # + # message = verifier.generate("bye") + # verifier.verified(message) # => "bye" + # verifier.verified(message, purpose: "greeting") # => nil + # + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:224 + def verified(message, **options); end + + # Decodes the signed message using the +MessageVerifier+'s secret. + # + # verifier = ActiveSupport::MessageVerifier.new("secret") + # signed_message = verifier.generate("signed message") + # + # verifier.verify(signed_message) # => "signed message" + # + # Raises +InvalidSignature+ if the message was not signed with the same + # secret or was not Base64-encoded. + # + # other_verifier = ActiveSupport::MessageVerifier.new("different_secret") + # other_verifier.verify(signed_message) # => ActiveSupport::MessageVerifier::InvalidSignature + # + # ==== Options + # + # [+:purpose+] + # The purpose that the message was generated with. If the purpose does not + # match, +verify+ will raise ActiveSupport::MessageVerifier::InvalidSignature. + # + # message = verifier.generate("hello", purpose: "greeting") + # verifier.verify(message, purpose: "greeting") # => "hello" + # verifier.verify(message, purpose: "chatting") # => raises InvalidSignature + # verifier.verify(message) # => raises InvalidSignature + # + # message = verifier.generate("bye") + # verifier.verify(message) # => "bye" + # verifier.verify(message, purpose: "greeting") # => raises InvalidSignature + # + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:262 + def verify(message, **options); end + + private + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:323 + def decode(encoded, url_safe: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:356 + def digest_length_in_hex; end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:373 + def digest_matches_data?(digest, data); end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:335 + def extract_encoded(signed); end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:352 + def generate_digest(data); end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:364 + def separator_at?(signed_message, index); end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:368 + def separator_index_for(signed_message); end + + # pkg:gem/activesupport#lib/active_support/message_verifier.rb:330 + def sign_encoded(encoded); end +end + +# pkg:gem/activesupport#lib/active_support/message_verifier.rb:113 +class ActiveSupport::MessageVerifier::InvalidSignature < ::StandardError; end + +# pkg:gem/activesupport#lib/active_support/message_verifier.rb:115 +ActiveSupport::MessageVerifier::SEPARATOR = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/message_verifier.rb:116 +ActiveSupport::MessageVerifier::SEPARATOR_LENGTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/message_verifiers.rb:6 +class ActiveSupport::MessageVerifiers < ::ActiveSupport::Messages::RotationCoordinator + private + + # pkg:gem/activesupport#lib/active_support/message_verifiers.rb:185 + def build(salt, secret_generator:, secret_generator_options:, **options); end +end + +# pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:6 +module ActiveSupport::Messages; end + +# pkg:gem/activesupport#lib/active_support/messages/codec.rb:9 +class ActiveSupport::Messages::Codec + include ::ActiveSupport::Messages::Metadata + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:15 + def initialize(**options); end + + private + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:45 + def catch_and_ignore(throwable, &block); end + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:52 + def catch_and_raise(throwable, as: T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:29 + def decode(encoded, url_safe: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:39 + def deserialize(serialized); end + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:25 + def encode(data, url_safe: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:35 + def serialize(data); end + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:23 + def serializer; end + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:60 + def use_message_serializer_for_metadata?; end + + class << self + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:12 + def default_serializer; end + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:12 + def default_serializer=(value); end + + private + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:12 + def __class_attr_default_serializer; end + + # pkg:gem/activesupport#lib/active_support/messages/codec.rb:12 + def __class_attr_default_serializer=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/messages/metadata.rb:9 +module ActiveSupport::Messages::Metadata + private + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:128 + def deserialize_from_json(serialized); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:141 + def deserialize_from_json_safe_string(string); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:43 + def deserialize_with_metadata(message, **expected_metadata); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:96 + def dual_serialized_metadata_envelope_json?(string); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:78 + def extract_from_metadata_envelope(envelope, purpose: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:92 + def metadata_envelope?(object); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:114 + def parse_expiry(expires_at); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:100 + def pick_expiry(expires_at, expires_in); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:124 + def serialize_to_json(data); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:137 + def serialize_to_json_safe_string(data); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:30 + def serialize_with_metadata(data, **metadata); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:60 + def use_message_serializer_for_metadata?; end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:64 + def wrap_in_metadata_envelope(hash, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:71 + def wrap_in_metadata_legacy_envelope(hash, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end + + class << self + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:10 + def use_message_serializer_for_metadata; end + + # pkg:gem/activesupport#lib/active_support/messages/metadata.rb:10 + def use_message_serializer_for_metadata=(_arg0); end + end +end + +# pkg:gem/activesupport#lib/active_support/messages/metadata.rb:12 +ActiveSupport::Messages::Metadata::ENVELOPE_SERIALIZERS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/messages/metadata.rb:19 +ActiveSupport::Messages::Metadata::TIMESTAMP_SERIALIZERS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/messages/rotation_configuration.rb:5 +class ActiveSupport::Messages::RotationConfiguration + # pkg:gem/activesupport#lib/active_support/messages/rotation_configuration.rb:8 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_configuration.rb:6 + def encrypted; end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_configuration.rb:12 + def rotate(kind, *args, **options); end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_configuration.rb:6 + def signed; end +end + +# pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:7 +class ActiveSupport::Messages::RotationCoordinator + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:10 + def initialize(&secret_generator); end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:18 + def [](salt); end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:22 + def []=(salt, codec); end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:48 + def clear_rotations; end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:54 + def on_rotation(&callback); end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:35 + def prepend(**options, &block); end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:26 + def rotate(**options, &block); end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:44 + def rotate_defaults; end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:8 + def transitional; end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:8 + def transitional=(_arg0); end + + private + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:97 + def build(salt, secret_generator:, secret_generator_options:, **options); end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:85 + def build_with_rotations(salt); end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:60 + def changing_configuration!; end + + # pkg:gem/activesupport#lib/active_support/messages/rotation_coordinator.rb:71 + def normalize_options(options); end +end + +# pkg:gem/activesupport#lib/active_support/messages/rotator.rb:5 +module ActiveSupport::Messages::Rotator + # pkg:gem/activesupport#lib/active_support/messages/rotator.rb:6 + def initialize(*args, on_rotation: T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/messages/rotator.rb:23 + def fall_back_to(fallback); end + + # pkg:gem/activesupport#lib/active_support/messages/rotator.rb:18 + def on_rotation(&on_rotation); end + + # pkg:gem/activesupport#lib/active_support/messages/rotator.rb:28 + def read_message(message, on_rotation: T.unsafe(nil), **options); end + + # pkg:gem/activesupport#lib/active_support/messages/rotator.rb:14 + def rotate(*args, **options); end + + private + + # pkg:gem/activesupport#lib/active_support/messages/rotator.rb:54 + def build_rotation(*args, **options); end + + # pkg:gem/activesupport#lib/active_support/messages/rotator.rb:58 + def catch_rotation_error(&block); end + + # pkg:gem/activesupport#lib/active_support/messages/rotator.rb:48 + def initialize_dup(*); end +end + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:8 +module ActiveSupport::Messages::SerializerWithFallback + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:17 + def load(dumped); end + + private + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:33 + def detect_format(dumped); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:44 + def fallback?(format); end + + class << self + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:9 + def [](format); end + end +end + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:48 +module ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + private + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:50 + def fallback?(format); end +end + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:78 +module ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:90 + def _load(dumped); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:86 + def dump(object); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:96 + def dumped?(dumped); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:82 + def format; end + + private + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:101 + def detect_format(dumped); end +end + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:94 +ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback::JSON_START_WITH = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:107 +module ActiveSupport::Messages::SerializerWithFallback::JsonWithFallbackAllowMarshal + include ::ActiveSupport::Messages::SerializerWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + extend ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallbackAllowMarshal +end + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:55 +module ActiveSupport::Messages::SerializerWithFallback::MarshalWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::MarshalWithFallback + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:67 + def _load(dumped); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:63 + def dump(object); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:73 + def dumped?(dumped); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:59 + def format; end +end + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:71 +ActiveSupport::Messages::SerializerWithFallback::MarshalWithFallback::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:113 +module ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:125 + def _load(dumped); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:121 + def dump(object); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:129 + def dumped?(dumped); end + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:117 + def format; end + + private + + # pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:134 + def available?; end +end + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:143 +module ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallbackAllowMarshal + include ::ActiveSupport::Messages::SerializerWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + extend ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallbackAllowMarshal +end + +# pkg:gem/activesupport#lib/active_support/messages/serializer_with_fallback.rb:149 +ActiveSupport::Messages::SerializerWithFallback::SERIALIZERS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/multibyte.rb:4 +module ActiveSupport::Multibyte + class << self + # Returns the current proxy class. + # + # pkg:gem/activesupport#lib/active_support/multibyte.rb:23 + def proxy_class; end + + # The proxy class returned when calling mb_chars. You can use this accessor + # to configure your own proxy class so you can support other encodings. See + # the ActiveSupport::Multibyte::Chars implementation for an example how to + # do this. + # + # ActiveSupport::Multibyte.proxy_class = CharsForUTF32 + # + # pkg:gem/activesupport#lib/active_support/multibyte.rb:14 + def proxy_class=(klass); end + end +end + +# = Active Support \Multibyte \Chars +# +# Chars enables you to work transparently with UTF-8 encoding in the Ruby +# String class without having extensive knowledge about the encoding. A +# Chars object accepts a string upon initialization and proxies String +# methods in an encoding safe manner. All the normal String methods are also +# implemented on the proxy. +# +# String methods are proxied through the Chars object, and can be accessed +# through the +mb_chars+ method. Methods which would normally return a +# String object now return a Chars object so methods can be chained. +# +# 'The Perfect String '.mb_chars.downcase.strip +# # => # +# +# Chars objects are perfectly interchangeable with String objects as long as +# no explicit class checks are made. If certain methods do explicitly check +# the class, call +to_s+ before you pass chars objects to them. +# +# bad.explicit_checking_method 'T'.mb_chars.downcase.to_s +# +# The default Chars implementation assumes that the encoding of the string +# is UTF-8, if you want to handle different encodings you can write your own +# multibyte string handler and configure it through +# ActiveSupport::Multibyte.proxy_class. +# +# class CharsForUTF32 +# def size +# @wrapped_string.size / 4 +# end +# +# def self.accepts?(string) +# string.length % 4 == 0 +# end +# end +# +# ActiveSupport::Multibyte.proxy_class = CharsForUTF32 +# +# pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:47 +class ActiveSupport::Multibyte::Chars + include ::Comparable + + # Creates a new Chars instance by wrapping _string_. + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:56 + def initialize(string, deprecation: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:53 + def <=>(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:53 + def =~(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:53 + def acts_like_string?(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:171 + def as_json(options = T.unsafe(nil)); end + + # Performs composition on all the characters. + # + # 'é'.length # => 1 + # 'é'.mb_chars.compose.to_s.length # => 1 + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:150 + def compose; end + + # Performs canonical decomposition on all the characters. + # + # 'é'.length # => 1 + # 'é'.mb_chars.decompose.to_s.length # => 2 + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:142 + def decompose; end + + # Returns the number of grapheme clusters in the string. + # + # 'क्षि'.mb_chars.length # => 4 + # 'क्षि'.mb_chars.grapheme_length # => 2 + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:158 + def grapheme_length; end + + # Limits the byte size of the string to a number of bytes without breaking + # characters. Usable when the storage for a string is limited for some + # reason. + # + # 'こんにちは'.mb_chars.limit(7).to_s # => "こん" + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:125 + def limit(limit); end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:53 + def match?(*, **, &); end + + # Forward all undefined methods to the wrapped string. + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:72 + def method_missing(method, *, **, &); end + + # Reverses all characters in the string. + # + # 'Café'.mb_chars.reverse.to_s # => 'éfaC' + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:116 + def reverse; end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:176 + def reverse!(*args); end + + # Works like String#slice!, but returns an instance of + # Chars, or +nil+ if the string was not modified. The string will not be + # modified if the range given is out of bounds + # + # string = 'Welcome' + # string.mb_chars.slice!(3) # => # + # string # => 'Welome' + # string.mb_chars.slice!(0..3) # => # + # string # => 'me' + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:106 + def slice!(*args); end + + # Works just like String#split, with the exception that the items + # in the resulting list are Chars instances instead of String. This makes + # chaining methods easier. + # + # 'Café périferôl'.mb_chars.split(/é/).map { |part| part.upcase.to_s } # => ["CAF", " P", "RIFERÔL"] + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:93 + def split(*args); end + + # Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent + # resulting in a valid UTF-8 string. + # + # Passing +true+ will forcibly tidy all bytes, assuming that the string's + # encoding is entirely CP1252 or ISO-8859-1. + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:167 + def tidy_bytes(force = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:176 + def tidy_bytes!(*args); end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:136 + def titlecase; end + + # Capitalizes the first letter of every word, when possible. + # + # "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró" + # "日本語".mb_chars.titleize.to_s # => "日本語" + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:133 + def titleize; end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:50 + def to_s; end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:51 + def to_str; end + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:49 + def wrapped_string; end + + private + + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:183 + def chars(string); end + + # Returns +true+ if _obj_ responds to the given method. Private methods + # are included in the search only if the optional second parameter + # evaluates to +true+. + # + # pkg:gem/activesupport#lib/active_support/multibyte/chars.rb:84 + def respond_to_missing?(method, include_private); end +end + +# pkg:gem/activesupport#lib/active_support/multibyte/unicode.rb:5 +module ActiveSupport::Multibyte::Unicode + extend ::ActiveSupport::Multibyte::Unicode + + # Compose decomposed characters to the composed form. + # + # pkg:gem/activesupport#lib/active_support/multibyte/unicode.rb:21 + def compose(codepoints); end + + # Decompose composed characters to the decomposed form. + # + # pkg:gem/activesupport#lib/active_support/multibyte/unicode.rb:12 + def decompose(type, codepoints); end + + # Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent + # resulting in a valid UTF-8 string. + # + # Passing +true+ will forcibly tidy all bytes, assuming that the string's + # encoding is entirely CP1252 or ISO-8859-1. + # + # pkg:gem/activesupport#lib/active_support/multibyte/unicode.rb:30 + def tidy_bytes(string, force = T.unsafe(nil)); end + + private + + # pkg:gem/activesupport#lib/active_support/multibyte/unicode.rb:37 + def recode_windows1252_chars(string); end +end + +# The Unicode version that is supported by the implementation +# +# pkg:gem/activesupport#lib/active_support/multibyte/unicode.rb:9 +ActiveSupport::Multibyte::Unicode::UNICODE_VERSION = T.let(T.unsafe(nil), String) + +# = \Notifications +# +# +ActiveSupport::Notifications+ provides an instrumentation API for +# Ruby. +# +# == Instrumenters +# +# To instrument an event you just need to do: +# +# ActiveSupport::Notifications.instrument('render', extra: :information) do +# render plain: 'Foo' +# end +# +# That first executes the block and then notifies all subscribers once done. +# +# In the example above +render+ is the name of the event, and the rest is called +# the _payload_. The payload is a mechanism that allows instrumenters to pass +# extra information to subscribers. Payloads consist of a hash whose contents +# are arbitrary and generally depend on the event. +# +# == Subscribers +# +# You can consume those events and the information they provide by registering +# a subscriber. +# +# ActiveSupport::Notifications.subscribe('render') do |event| +# event.name # => "render" +# event.duration # => 10 (in milliseconds) +# event.payload # => { extra: :information } +# event.allocations # => 1826 (objects) +# end +# +# +Event+ objects record CPU time and allocations. If you don't need this +# it's also possible to pass a block that accepts five arguments: +# +# ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload| +# name # => String, name of the event (such as 'render' from above) +# start # => Time, when the instrumented block started execution +# finish # => Time, when the instrumented block ended execution +# id # => String, unique ID for the instrumenter that fired the event +# payload # => Hash, the payload +# end +# +# Here, the +start+ and +finish+ values represent wall-clock time. If you are +# concerned about accuracy, you can register a monotonic subscriber. +# +# ActiveSupport::Notifications.monotonic_subscribe('render') do |name, start, finish, id, payload| +# name # => String, name of the event (such as 'render' from above) +# start # => Float, monotonic time when the instrumented block started execution +# finish # => Float, monotonic time when the instrumented block ended execution +# id # => String, unique ID for the instrumenter that fired the event +# payload # => Hash, the payload +# end +# +# For instance, let's store all "render" events in an array: +# +# events = [] +# +# ActiveSupport::Notifications.subscribe('render') do |event| +# events << event +# end +# +# That code returns right away, you are just subscribing to "render" events. +# The block is saved and will be called whenever someone instruments "render": +# +# ActiveSupport::Notifications.instrument('render', extra: :information) do +# render plain: 'Foo' +# end +# +# event = events.first +# event.name # => "render" +# event.duration # => 10 (in milliseconds) +# event.payload # => { extra: :information } +# event.allocations # => 1826 (objects) +# +# If an exception happens during that particular instrumentation the payload will +# have a key :exception with an array of two elements as value: a string with +# the name of the exception class, and the exception message. +# The :exception_object key of the payload will have the exception +# itself as the value: +# +# event.payload[:exception] # => ["ArgumentError", "Invalid value"] +# event.payload[:exception_object] # => # +# +# As the earlier example depicts, the class ActiveSupport::Notifications::Event +# is able to take the arguments as they come and provide an object-oriented +# interface to that data. +# +# It is also possible to pass an object which responds to call method +# as the second parameter to the subscribe method instead of a block: +# +# module ActionController +# class PageRequest +# def call(name, started, finished, unique_id, payload) +# Rails.logger.debug ['notification:', name, started, finished, unique_id, payload].join(' ') +# end +# end +# end +# +# ActiveSupport::Notifications.subscribe('process_action.action_controller', ActionController::PageRequest.new) +# +# resulting in the following output within the logs including a hash with the payload: +# +# notification: process_action.action_controller 2012-04-13 01:08:35 +0300 2012-04-13 01:08:35 +0300 af358ed7fab884532ec7 { +# controller: "Devise::SessionsController", +# action: "new", +# params: {"action"=>"new", "controller"=>"devise/sessions"}, +# format: :html, +# method: "GET", +# path: "/login/sign_in", +# status: 200, +# view_runtime: 279.3080806732178, +# db_runtime: 40.053 +# } +# +# You can also subscribe to all events whose name matches a certain regexp: +# +# ActiveSupport::Notifications.subscribe(/render/) do |*args| +# ... +# end +# +# and even pass no argument to subscribe, in which case you are subscribing +# to all events. +# +# == Temporary Subscriptions +# +# Sometimes you do not want to subscribe to an event for the entire life of +# the application. There are two ways to unsubscribe. +# +# WARNING: The instrumentation framework is designed for long-running subscribers, +# use this feature sparingly because it wipes some internal caches and that has +# a negative impact on performance. +# +# === Subscribe While a Block Runs +# +# You can subscribe to some event temporarily while some block runs. For +# example, in +# +# callback = lambda {|event| ... } +# ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do +# ... +# end +# +# the callback will be called for all "sql.active_record" events instrumented +# during the execution of the block. The callback is unsubscribed automatically +# after that. +# +# To record +started+ and +finished+ values with monotonic time, +# specify the optional :monotonic option to the +# subscribed method. The :monotonic option is set +# to +false+ by default. +# +# callback = lambda {|name, started, finished, unique_id, payload| ... } +# ActiveSupport::Notifications.subscribed(callback, "sql.active_record", monotonic: true) do +# ... +# end +# +# === Manual Unsubscription +# +# The +subscribe+ method returns a subscriber object: +# +# subscriber = ActiveSupport::Notifications.subscribe("render") do |event| +# ... +# end +# +# To prevent that block from being called anymore, just unsubscribe passing +# that reference: +# +# ActiveSupport::Notifications.unsubscribe(subscriber) +# +# You can also unsubscribe by passing the name of the subscriber object. Note +# that this will unsubscribe all subscriptions with the given name: +# +# ActiveSupport::Notifications.unsubscribe("render") +# +# Subscribers using a regexp or other pattern-matching object will remain subscribed +# to all events that match their original pattern, unless those events match a string +# passed to +unsubscribe+: +# +# subscriber = ActiveSupport::Notifications.subscribe(/render/) { } +# ActiveSupport::Notifications.unsubscribe('render_template.action_view') +# subscriber.subscribed_to?('render_template.action_view') # => false +# subscriber.subscribed_to?('render_partial.action_view') # => true +# +# == Default Queue +# +# Notifications ships with a queue implementation that consumes and publishes events +# to all log subscribers. You can use any queue implementation you want. +# +# pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:7 +module ActiveSupport::Notifications + class << self + # pkg:gem/activesupport#lib/active_support/notifications.rb:208 + def instrument(name, payload = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/notifications.rb:269 + def instrumenter; end + + # Performs the same functionality as #subscribe, but the +start+ and + # +finish+ block arguments are in monotonic time instead of wall-clock + # time. Monotonic time will not jump forward or backward (due to NTP or + # Daylights Savings). Use +monotonic_subscribe+ when accuracy of time + # duration is important. For example, computing elapsed time between + # two events. + # + # pkg:gem/activesupport#lib/active_support/notifications.rb:254 + def monotonic_subscribe(pattern = T.unsafe(nil), callback = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/notifications.rb:198 + def notifier; end + + # pkg:gem/activesupport#lib/active_support/notifications.rb:198 + def notifier=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/notifications.rb:200 + def publish(name, *args); end + + # pkg:gem/activesupport#lib/active_support/notifications.rb:204 + def publish_event(event); end + + # Subscribe to a given event name with the passed +block+. + # + # You can subscribe to events by passing a String to match exact event + # names, or by passing a Regexp to match all events that match a pattern. + # + # If the block passed to the method only takes one argument, + # it will yield an +Event+ object to the block: + # + # ActiveSupport::Notifications.subscribe(/render/) do |event| + # @event = event + # end + # + # Otherwise the +block+ will receive five arguments with information + # about the event: + # + # ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload| + # name # => String, name of the event (such as 'render' from above) + # start # => Time, when the instrumented block started execution + # finish # => Time, when the instrumented block ended execution + # id # => String, unique ID for the instrumenter that fired the event + # payload # => Hash, the payload + # end + # + # Raises an error if invalid event name type is passed: + # + # ActiveSupport::Notifications.subscribe(:render) {|event| ...} + # #=> ArgumentError (pattern must be specified as a String, Regexp or empty) + # + # pkg:gem/activesupport#lib/active_support/notifications.rb:244 + def subscribe(pattern = T.unsafe(nil), callback = T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/notifications.rb:258 + def subscribed(callback, pattern = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/notifications.rb:265 + def unsubscribe(subscriber_or_name); end + + private + + # pkg:gem/activesupport#lib/active_support/notifications.rb:274 + def registry; end + end +end + +# pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:106 +class ActiveSupport::Notifications::Event + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:110 + def initialize(name, start, ending, transaction_id, payload); end + + # Returns the number of allocations made between the call to #start! and + # the call to #finish!. + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:176 + def allocations; end + + # Returns the CPU time (in milliseconds) passed between the call to + # #start! and the call to #finish!. + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:163 + def cpu_time; end + + # Returns the difference in milliseconds between when the execution of the + # event started and when it ended. + # + # ActiveSupport::Notifications.subscribe('wait') do |event| + # @event = event + # end + # + # ActiveSupport::Notifications.instrument('wait') do + # sleep 1 + # end + # + # @event.duration # => 1000.138 + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:198 + def duration; end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:128 + def end; end + + # Record information at the time this event finishes + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:154 + def finish!; end + + # Returns the time spent in GC (in milliseconds) between the call to #start! + # and the call to #finish! + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:182 + def gc_time; end + + # Returns the idle time (in milliseconds) passed between the call to + # #start! and the call to #finish!. + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:169 + def idle_time; end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:107 + def name; end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:108 + def payload; end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:108 + def payload=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:132 + def record; end + + # Record information at the time this event starts + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:146 + def start!; end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:124 + def time; end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:107 + def transaction_id; end + + private + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:203 + def now; end + + # Likely on JRuby, TruffleRuby + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:230 + def now_allocations; end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:210 + def now_cpu; end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:220 + def now_gc; end +end + +# This is a default queue implementation that ships with Notifications. +# It just pushes events to all registered log subscribers. +# +# This class is thread safe. All methods are reentrant. +# +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:55 +class ActiveSupport::Notifications::Fanout + include ::ActiveSupport::Notifications::FanoutIteration + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:56 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:319 + def all_listeners_for(name); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:286 + def build_handle(name, id, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:106 + def clear_cache(key = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:305 + def finish(name, id, payload, listeners = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:190 + def group_listeners(listeners); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:196 + def groups_for(name); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:64 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:328 + def listeners_for(name); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:332 + def listening?(name); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:311 + def publish(name, *, **, &); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:315 + def publish_event(event); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:298 + def start(name, id, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:69 + def subscribe(pattern = T.unsafe(nil), callable = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:86 + def unsubscribe(subscriber_or_name); end + + # This is a sync queue, so there is no waiting. + # + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:337 + def wait; end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:116 +class ActiveSupport::Notifications::Fanout::BaseGroup + include ::ActiveSupport::Notifications::FanoutIteration + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:119 + def initialize(listeners, name, id, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:123 + def each(&block); end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:128 +class ActiveSupport::Notifications::Fanout::BaseTimeGroup < ::ActiveSupport::Notifications::Fanout::BaseGroup + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:133 + def finish(name, id, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:129 + def start(name, id, payload); end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:169 +class ActiveSupport::Notifications::Fanout::EventObjectGroup < ::ActiveSupport::Notifications::Fanout::BaseGroup + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:175 + def finish(name, id, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:170 + def start(name, id, payload); end + + private + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:185 + def build_event(name, id, payload); end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:155 +class ActiveSupport::Notifications::Fanout::EventedGroup < ::ActiveSupport::Notifications::Fanout::BaseGroup + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:162 + def finish(name, id, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:156 + def start(name, id, payload); end +end + +# A +Handle+ is used to record the start and finish time of event. +# +# Both #start and #finish must each be called exactly once. +# +# Where possible, it's best to use the block form: ActiveSupport::Notifications.instrument. +# +Handle+ is a low-level API intended for cases where the block form can't be used. +# +# handle = ActiveSupport::Notifications.instrumenter.build_handle("my.event", {}) +# begin +# handle.start +# # work to be instrumented +# ensure +# handle.finish +# end +# +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:230 +class ActiveSupport::Notifications::Fanout::Handle + include ::ActiveSupport::Notifications::FanoutIteration + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:233 + def initialize(notifier, name, id, groups, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:250 + def finish; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:254 + def finish_with_values(name, id, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:241 + def start; end + + private + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:264 + def ensure_state!(expected); end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:141 +class ActiveSupport::Notifications::Fanout::MonotonicTimedGroup < ::ActiveSupport::Notifications::Fanout::BaseTimeGroup + private + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:143 + def now; end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:271 +module ActiveSupport::Notifications::Fanout::NullHandle + extend ::ActiveSupport::Notifications::Fanout::NullHandle + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:277 + def finish; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:280 + def finish_with_values(_name, _id, _payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:274 + def start; end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:340 +module ActiveSupport::Notifications::Fanout::Subscribers + class << self + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:341 + def new(pattern, listener, monotonic); end + end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:455 +class ActiveSupport::Notifications::Fanout::Subscribers::EventObject < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:456 + def group_class; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:460 + def publish_event(event); end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:397 +class ActiveSupport::Notifications::Fanout::Subscribers::Evented + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:400 + def initialize(pattern, delegate); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:398 + def delegate; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:408 + def group_class; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:398 + def pattern; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:412 + def publish(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:418 + def publish_event(event); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:398 + def silenceable; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:426 + def silenced?(name); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:430 + def subscribed_to?(name); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:434 + def unsubscribe!(name); end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:360 +class ActiveSupport::Notifications::Fanout::Subscribers::Matcher + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:373 + def initialize(pattern); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:382 + def ===(name); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:361 + def exclusions; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:361 + def pattern; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:378 + def unsubscribe!(name); end + + class << self + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:363 + def wrap(pattern); end + end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:386 +class ActiveSupport::Notifications::Fanout::Subscribers::Matcher::AllMessages + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:387 + def ===(name); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:391 + def unsubscribe!(*); end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:449 +class ActiveSupport::Notifications::Fanout::Subscribers::MonotonicTimed < ::ActiveSupport::Notifications::Fanout::Subscribers::Timed + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:450 + def group_class; end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:439 +class ActiveSupport::Notifications::Fanout::Subscribers::Timed < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:440 + def group_class; end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:444 + def publish(*, **, &); end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:148 +class ActiveSupport::Notifications::Fanout::TimedGroup < ::ActiveSupport::Notifications::Fanout::BaseTimeGroup + private + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:150 + def now; end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:18 +module ActiveSupport::Notifications::FanoutIteration + private + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:20 + def iterate_guarding_exceptions(collection, &block); end +end + +# pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:8 +class ActiveSupport::Notifications::InstrumentationSubscriberError < ::RuntimeError + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:11 + def initialize(exceptions); end + + # pkg:gem/activesupport#lib/active_support/notifications/fanout.rb:9 + def exceptions; end +end + +# Instrumenters are stored in a thread local. +# +# pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:9 +class ActiveSupport::Notifications::Instrumenter + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:12 + def initialize(notifier); end + + # Returns a "handle" for an event with the given +name+ and +payload+. + # + # #start and #finish must each be called exactly once on the returned object. + # + # Where possible, it's best to use #instrument, which will record the + # start and finish of the event and correctly handle any exceptions. + # +build_handle+ is a low-level API intended for cases where using + # +instrument+ isn't possible. + # + # See ActiveSupport::Notifications::Fanout::Handle. + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:78 + def build_handle(name, payload); end + + # Send a finish notification with +name+ and +payload+. + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:92 + def finish(name, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:96 + def finish_with_state(listeners_state, name, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:10 + def id; end + + # Given a block, instrument it by measuring the time taken to execute + # and publish it. Without a block, simply send a message via the + # notifier. Notice that events get sent even if an error occurs in the + # passed-in block. + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:54 + def instrument(name, payload = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:82 + def new_event(name, payload = T.unsafe(nil)); end + + # Send a start notification with +name+ and +payload+. + # + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:87 + def start(name, payload); end + + private + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:101 + def unique_id; end +end + +# pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:21 +class ActiveSupport::Notifications::Instrumenter::LegacyHandle + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:34 + def initialize(notifier, name, id, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:45 + def finish; end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:41 + def start; end +end + +# pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:22 +class ActiveSupport::Notifications::Instrumenter::LegacyHandle::Wrapper + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:23 + def initialize(notifier); end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:27 + def build_handle(name, id, payload); end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:31 + def finish(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/notifications/instrumenter.rb:31 + def start(*, **, &); end +end + +# = Number Helper +# +# Provides methods for formatting numbers into currencies, percentages, +# phone numbers, and more. +# +# Example usage in a class: +# class Topic +# include ActiveSupport::NumberHelper +# +# def price +# number_to_currency(@price) +# end +# end +# +# Example usage in a module: +# require "active_support/number_helper" +# +# module NumberFormatting +# def format_price(price) +# ActiveSupport::NumberHelper.number_to_currency(price) +# end +# end +# +# pkg:gem/activesupport#lib/active_support/number_helper.rb:26 +module ActiveSupport::NumberHelper + extend ::ActiveSupport::Autoload + extend ::ActiveSupport::NumberHelper + + # Formats a +number+ into a currency string. + # + # number_to_currency(1234567890.50) # => "$1,234,567,890.50" + # number_to_currency(1234567890.506) # => "$1,234,567,890.51" + # number_to_currency("12x34") # => "$12x34" + # + # number_to_currency(1234567890.50, unit: "£", separator: ",", delimiter: "") + # # => "£1234567890,50" + # + # The currency unit and number formatting of the current locale will be used + # unless otherwise specified via options. No currency conversion is + # performed. If the user is given a way to change their locale, they will + # also be able to change the relative value of the currency displayed with + # this helper. If your application will ever support multiple locales, you + # may want to specify a constant +:locale+ option or consider using a + # library capable of currency conversion. + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # number_to_currency(1234567890.506, locale: :fr) + # # => "1 234 567 890,51 €" + # + # [+:precision+] + # The level of precision. Defaults to 2. + # + # number_to_currency(1234567890.123, precision: 3) # => "$1,234,567,890.123" + # number_to_currency(0.456789, precision: 0) # => "$0" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_currency(1234567890.01, precision: 0, round_mode: :up) + # # => "$1,234,567,891" + # + # [+:unit+] + # The denomination of the currency. Defaults to "$". + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:format+] + # The format for non-negative numbers. %u represents the currency, + # and %n represents the number. Defaults to "%u%n". + # + # number_to_currency(1234567890.50, format: "%n %u") + # # => "1,234,567,890.50 $" + # + # [+:negative_format+] + # The format for negative numbers. %u and %n behave the + # same as in +:format+, but %n represents the absolute value of + # the number. Defaults to the value of +:format+ prepended with -. + # + # number_to_currency(-1234567890.50, negative_format: "(%u%n)") + # # => "($1,234,567,890.50)" + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to false. + # + # number_to_currency(1234567890.50, strip_insignificant_zeros: true) + # # => "$1,234,567,890.5" + # + # pkg:gem/activesupport#lib/active_support/number_helper.rb:161 + def number_to_currency(number, options = T.unsafe(nil)); end + + # Formats +number+ by grouping thousands with a delimiter. + # + # number_to_delimited(12345678) # => "12,345,678" + # number_to_delimited("123456") # => "123,456" + # number_to_delimited(12345678.9876) # => "12,345,678.9876" + # number_to_delimited("12x34") # => "12x34" + # + # number_to_delimited(12345678.9876, delimiter: ".", separator: ",") + # # => "12.345.678,9876" + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # number_to_delimited(12345678.05, locale: :fr) + # # => "12 345 678,05" + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # number_to_delimited(12345678, delimiter: ".") + # # => "12.345.678" + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # number_to_delimited(12345678.05, separator: " ") + # # => "12,345,678 05" + # + # [+:delimiter_pattern+] + # A regexp to determine the placement of delimiters. Helpful when using + # currency formats like INR. + # + # number_to_delimited("123456.78", delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/) + # # => "1,23,456.78" + # + # pkg:gem/activesupport#lib/active_support/number_helper.rb:264 + def number_to_delimited(number, options = T.unsafe(nil)); end + + # Formats +number+ into a more human-friendly representation. Useful for + # numbers that can become very large and too hard to read. + # + # number_to_human(123) # => "123" + # number_to_human(1234) # => "1.23 Thousand" + # number_to_human(12345) # => "12.3 Thousand" + # number_to_human(1234567) # => "1.23 Million" + # number_to_human(1234567890) # => "1.23 Billion" + # number_to_human(1234567890123) # => "1.23 Trillion" + # number_to_human(1234567890123456) # => "1.23 Quadrillion" + # number_to_human(1234567890123456789) # => "1230 Quadrillion" + # + # See #number_to_human_size if you want to pretty-print a file size. + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # [+:precision+] + # The level of precision. Defaults to 3. + # + # number_to_human(123456, precision: 2) # => "120 Thousand" + # number_to_human(123456, precision: 4) # => "123.5 Thousand" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_human(123456, precision: 2, round_mode: :up) + # # => "130 Thousand" + # + # [+:significant+] + # Whether +:precision+ should be applied to significant digits instead of + # fractional digits. Defaults to true. + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # number_to_human(123456, precision: 4, separator: ",") + # # => "123,5 Thousand" + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to true. + # + # number_to_human(1000000) # => "1 Million" + # number_to_human(1000000, strip_insignificant_zeros: false) # => "1.00 Million" + # number_to_human(10.01) # => "10" + # number_to_human(10.01, strip_insignificant_zeros: false) # => "10.0" + # + # [+:format+] + # The format of the output. %n represents the number, and + # %u represents the quantifier (e.g., "Thousand"). Defaults to + # "%n %u". + # + # [+:units+] + # A Hash of custom unit quantifier names. + # + # number_to_human(1, units: { unit: "m", thousand: "km" }) # => "1 m" + # number_to_human(100, units: { unit: "m", thousand: "km" }) # => "100 m" + # number_to_human(1000, units: { unit: "m", thousand: "km" }) # => "1 km" + # number_to_human(100000, units: { unit: "m", thousand: "km" }) # => "100 km" + # number_to_human(10000000, units: { unit: "m", thousand: "km" }) # => "10000 km" + # + # The following keys are supported for integer units: +:unit+, +:ten+, + # +:hundred+, +:thousand+, +:million+, +:billion+, +:trillion+, + # +:quadrillion+. Additionally, the following keys are supported for + # fractional units: +:deci+, +:centi+, +:mili+, +:micro+, +:nano+, + # +:pico+, +:femto+. + # + # The Hash can also be defined as a scope in an I18n locale. For example: + # + # en: + # distance: + # centi: + # one: "centimeter" + # other: "centimeters" + # unit: + # one: "meter" + # other: "meters" + # thousand: + # one: "kilometer" + # other: "kilometers" + # + # Then it can be specified by name: + # + # number_to_human(1, units: :distance) # => "1 meter" + # number_to_human(100, units: :distance) # => "100 meters" + # number_to_human(1000, units: :distance) # => "1 kilometer" + # number_to_human(100000, units: :distance) # => "100 kilometers" + # number_to_human(10000000, units: :distance) # => "10000 kilometers" + # number_to_human(0.1, units: :distance) # => "10 centimeters" + # number_to_human(0.01, units: :distance) # => "1 centimeter" + # + # pkg:gem/activesupport#lib/active_support/number_helper.rb:475 + def number_to_human(number, options = T.unsafe(nil)); end + + # Formats +number+ as bytes into a more human-friendly representation. + # Useful for reporting file sizes to users. + # + # number_to_human_size(123) # => "123 Bytes" + # number_to_human_size(1234) # => "1.21 KB" + # number_to_human_size(12345) # => "12.1 KB" + # number_to_human_size(1234567) # => "1.18 MB" + # number_to_human_size(1234567890) # => "1.15 GB" + # number_to_human_size(1234567890123) # => "1.12 TB" + # number_to_human_size(1234567890123456) # => "1.1 PB" + # number_to_human_size(1234567890123456789) # => "1.07 EB" + # + # See #number_to_human if you want to pretty-print a generic number. + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # [+:precision+] + # The level of precision. Defaults to 3. + # + # number_to_human_size(123456, precision: 2) # => "120 KB" + # number_to_human_size(1234567, precision: 2) # => "1.2 MB" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_human_size(123456, precision: 2, round_mode: :up) + # # => "130 KB" + # + # [+:significant+] + # Whether +:precision+ should be applied to significant digits instead of + # fractional digits. Defaults to true. + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # number_to_human_size(1234567, separator: ",") + # # => "1,18 MB" + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to true. + # + # pkg:gem/activesupport#lib/active_support/number_helper.rb:373 + def number_to_human_size(number, options = T.unsafe(nil)); end + + # Formats +number+ as a percentage string. + # + # number_to_percentage(100) # => "100.000%" + # number_to_percentage("99") # => "99.000%" + # number_to_percentage("99x") # => "99x%" + # + # number_to_percentage(12345.6789, delimiter: ".", separator: ",", precision: 2) + # # => "12.345,68%" + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # number_to_percentage(1000, locale: :fr) + # # => "1000,000%" + # + # [+:precision+] + # The level of precision, or +nil+ to preserve +number+'s precision. + # Defaults to 2. + # + # number_to_percentage(12.3456789, precision: 4) # => "12.3457%" + # number_to_percentage(99.999, precision: 0) # => "100%" + # number_to_percentage(99.999, precision: nil) # => "99.999%" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_percentage(12.3456789, precision: 4, round_mode: :down) + # # => "12.3456%" + # + # [+:significant+] + # Whether +:precision+ should be applied to significant digits instead of + # fractional digits. Defaults to false. + # + # number_to_percentage(12345.6789) # => "12345.679%" + # number_to_percentage(12345.6789, significant: true) # => "12300%" + # number_to_percentage(12345.6789, precision: 2) # => "12345.68%" + # number_to_percentage(12345.6789, precision: 2, significant: true) # => "12000%" + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to false. + # + # [+:format+] + # The format of the output. %n represents the number. Defaults to + # "%n%". + # + # number_to_percentage(100, format: "%n %") + # # => "100.000 %" + # + # pkg:gem/activesupport#lib/active_support/number_helper.rb:223 + def number_to_percentage(number, options = T.unsafe(nil)); end + + # Formats +number+ into a phone number. + # + # number_to_phone(5551234) # => "555-1234" + # number_to_phone("5551234") # => "555-1234" + # number_to_phone(1235551234) # => "123-555-1234" + # number_to_phone("12x34") # => "12x34" + # + # number_to_phone(1235551234, delimiter: ".", country_code: 1, extension: 1343) + # # => "+1.123.555.1234 x 1343" + # + # ==== Options + # + # [+:area_code+] + # Whether to use parentheses for the area code. Defaults to false. + # + # number_to_phone(1235551234, area_code: true) + # # => "(123) 555-1234" + # + # [+:delimiter+] + # The digit group delimiter to use. Defaults to "-". + # + # number_to_phone(1235551234, delimiter: " ") + # # => "123 555 1234" + # + # [+:country_code+] + # A country code to prepend. + # + # number_to_phone(1235551234, country_code: 1) + # # => "+1-123-555-1234" + # + # [+:extension+] + # An extension to append. + # + # number_to_phone(1235551234, extension: 555) + # # => "123-555-1234 x 555" + # + # [+:pattern+] + # A regexp that specifies how the digits should be grouped. The first + # three captures from the regexp are treated as digit groups. + # + # number_to_phone(13312345678, pattern: /(\d{3})(\d{4})(\d{4})$/) + # # => "133-1234-5678" + # number_to_phone(75561234567, pattern: /(\d{1,4})(\d{4})(\d{4})$/, area_code: true) + # # => "(755) 6123-4567" + # + # pkg:gem/activesupport#lib/active_support/number_helper.rb:88 + def number_to_phone(number, options = T.unsafe(nil)); end + + # Formats +number+ to a specific level of precision. + # + # number_to_rounded(12345.6789) # => "12345.679" + # number_to_rounded(12345.6789, precision: 2) # => "12345.68" + # number_to_rounded(12345.6789, precision: 0) # => "12345" + # number_to_rounded(12345, precision: 5) # => "12345.00000" + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # number_to_rounded(111.234, locale: :fr) + # # => "111,234" + # + # [+:precision+] + # The level of precision, or +nil+ to preserve +number+'s precision. + # Defaults to 3. + # + # number_to_rounded(12345.6789, precision: nil) + # # => "12345.6789" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_rounded(12.34, precision: 0, round_mode: :up) + # # => "13" + # + # [+:significant+] + # Whether +:precision+ should be applied to significant digits instead of + # fractional digits. Defaults to false. + # + # number_to_rounded(12345.6789) # => "12345.679" + # number_to_rounded(12345.6789, significant: true) # => "12300" + # number_to_rounded(12345.6789, precision: 2) # => "12345.68" + # number_to_rounded(12345.6789, precision: 2, significant: true) # => "12000" + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to false. + # + # number_to_rounded(12.34, strip_insignificant_zeros: false) # => "12.340" + # number_to_rounded(12.34, strip_insignificant_zeros: true) # => "12.34" + # number_to_rounded(12.3456, strip_insignificant_zeros: true) # => "12.346" + # + # pkg:gem/activesupport#lib/active_support/number_helper.rb:320 + def number_to_rounded(number, options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:12 +class ActiveSupport::NumberHelper::NumberConverter + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:127 + def initialize(number, options); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:133 + def execute; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:14 + def namespace; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:14 + def namespace=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:14 + def namespace?; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:19 + def number; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:19 + def opts; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:17 + def validate_float; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:17 + def validate_float=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:17 + def validate_float?; end + + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:152 + def default_format_options; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:177 + def default_value(key); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:148 + def format_options; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:158 + def i18n_format_options; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:144 + def options; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:173 + def translate_in_locale(key, **i18n_options); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:169 + def translate_number_value_with_default(key, **i18n_options); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:181 + def valid_bigdecimal; end + + class << self + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:123 + def convert(number, options); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:14 + def namespace; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:14 + def namespace=(value); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:14 + def namespace?; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:17 + def validate_float; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:17 + def validate_float=(value); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:17 + def validate_float?; end + + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:14 + def __class_attr_namespace; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:14 + def __class_attr_namespace=(new_value); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:17 + def __class_attr_validate_float; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:17 + def __class_attr_validate_float=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/number_helper/number_converter.rb:21 +ActiveSupport::NumberHelper::NumberConverter::DEFAULTS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_currency_converter.rb:7 +class ActiveSupport::NumberHelper::NumberToCurrencyConverter < ::ActiveSupport::NumberHelper::NumberConverter + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_currency_converter.rb:10 + def convert; end + + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_currency_converter.rb:38 + def i18n_opts; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_currency_converter.rb:29 + def options; end + + class << self + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_currency_converter.rb:8 + def __class_attr_namespace; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_currency_converter.rb:8 + def __class_attr_namespace=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_delimited_converter.rb:7 +class ActiveSupport::NumberHelper::NumberToDelimitedConverter < ::ActiveSupport::NumberHelper::NumberConverter + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_delimited_converter.rb:10 + def convert; end + + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_delimited_converter.rb:39 + def delimiter_pattern; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_delimited_converter.rb:15 + def parts; end + + class << self + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_delimited_converter.rb:8 + def __class_attr_validate_float; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_delimited_converter.rb:8 + def __class_attr_validate_float=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:7 +class ActiveSupport::NumberHelper::NumberToHumanConverter < ::ActiveSupport::NumberHelper::NumberConverter + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:15 + def convert; end + + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:50 + def calculate_exponent(units); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:38 + def determine_unit(units, exponent); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:34 + def format; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:55 + def unit_exponents(units); end + + class << self + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:12 + def __class_attr_namespace; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:12 + def __class_attr_namespace=(new_value); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:13 + def __class_attr_validate_float; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:13 + def __class_attr_validate_float=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:8 +ActiveSupport::NumberHelper::NumberToHumanConverter::DECIMAL_UNITS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_converter.rb:10 +ActiveSupport::NumberHelper::NumberToHumanConverter::INVERTED_DECIMAL_UNITS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:7 +class ActiveSupport::NumberHelper::NumberToHumanSizeConverter < ::ActiveSupport::NumberHelper::NumberConverter + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:13 + def convert; end + + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:55 + def base; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:31 + def conversion_format; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:44 + def exponent; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:51 + def smaller_than_base?; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:39 + def storage_unit_key; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:35 + def unit; end + + class << self + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:10 + def __class_attr_namespace; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:10 + def __class_attr_namespace=(new_value); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:11 + def __class_attr_validate_float; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:11 + def __class_attr_validate_float=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_human_size_converter.rb:8 +ActiveSupport::NumberHelper::NumberToHumanSizeConverter::STORAGE_UNITS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_percentage_converter.rb:7 +class ActiveSupport::NumberHelper::NumberToPercentageConverter < ::ActiveSupport::NumberHelper::NumberConverter + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_percentage_converter.rb:10 + def convert; end + + class << self + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_percentage_converter.rb:8 + def __class_attr_namespace; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_percentage_converter.rb:8 + def __class_attr_namespace=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_phone_converter.rb:8 +class ActiveSupport::NumberHelper::NumberToPhoneConverter < ::ActiveSupport::NumberHelper::NumberConverter + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_phone_converter.rb:9 + def convert; end + + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_phone_converter.rb:16 + def convert_to_phone_number(number); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_phone_converter.rb:24 + def convert_with_area_code(number); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_phone_converter.rb:31 + def convert_without_area_code(number); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_phone_converter.rb:43 + def country_code(code); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_phone_converter.rb:39 + def delimiter; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_phone_converter.rb:47 + def phone_ext(ext); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_phone_converter.rb:51 + def regexp_pattern(default_pattern); end +end + +# pkg:gem/activesupport#lib/active_support/number_helper/number_to_rounded_converter.rb:7 +class ActiveSupport::NumberHelper::NumberToRoundedConverter < ::ActiveSupport::NumberHelper::NumberConverter + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_rounded_converter.rb:11 + def convert; end + + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_rounded_converter.rb:49 + def format_number(number); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_rounded_converter.rb:45 + def strip_insignificant_zeros; end + + class << self + private + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_rounded_converter.rb:8 + def __class_attr_namespace; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_rounded_converter.rb:8 + def __class_attr_namespace=(new_value); end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_rounded_converter.rb:9 + def __class_attr_validate_float; end + + # pkg:gem/activesupport#lib/active_support/number_helper/number_to_rounded_converter.rb:9 + def __class_attr_validate_float=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/number_helper/rounding_helper.rb:5 +class ActiveSupport::NumberHelper::RoundingHelper + # pkg:gem/activesupport#lib/active_support/number_helper/rounding_helper.rb:8 + def initialize(options); end + + # pkg:gem/activesupport#lib/active_support/number_helper/rounding_helper.rb:20 + def digit_count(number); end + + # pkg:gem/activesupport#lib/active_support/number_helper/rounding_helper.rb:6 + def options; end + + # pkg:gem/activesupport#lib/active_support/number_helper/rounding_helper.rb:12 + def round(number); end + + private + + # pkg:gem/activesupport#lib/active_support/number_helper/rounding_helper.rb:37 + def absolute_precision(number); end + + # pkg:gem/activesupport#lib/active_support/number_helper/rounding_helper.rb:26 + def convert_to_decimal(number); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/numeric/conversions.rb:7 +module ActiveSupport::NumericWithFormat + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/conversions.rb:139 + def to_formatted_s(format = T.unsafe(nil), options = T.unsafe(nil)); end + + # \Numeric With Format + # + # Provides options for converting numbers into formatted strings. + # Options are provided for phone numbers, currency, percentage, + # precision, positional notation, file size, and pretty printing. + # + # This method is aliased to to_formatted_s. + # + # ==== Options + # + # For details on which formats use which options, see ActiveSupport::NumberHelper + # + # ==== Examples + # + # Phone Numbers: + # 5551234.to_fs(:phone) # => "555-1234" + # 1235551234.to_fs(:phone) # => "123-555-1234" + # 1235551234.to_fs(:phone, area_code: true) # => "(123) 555-1234" + # 1235551234.to_fs(:phone, delimiter: ' ') # => "123 555 1234" + # 1235551234.to_fs(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555" + # 1235551234.to_fs(:phone, country_code: 1) # => "+1-123-555-1234" + # 1235551234.to_fs(:phone, country_code: 1, extension: 1343, delimiter: '.') + # # => "+1.123.555.1234 x 1343" + # + # Currency: + # 1234567890.50.to_fs(:currency) # => "$1,234,567,890.50" + # 1234567890.506.to_fs(:currency) # => "$1,234,567,890.51" + # 1234567890.506.to_fs(:currency, precision: 3) # => "$1,234,567,890.506" + # 1234567890.506.to_fs(:currency, round_mode: :down) # => "$1,234,567,890.50" + # 1234567890.506.to_fs(:currency, locale: :fr) # => "1 234 567 890,51 €" + # -1234567890.50.to_fs(:currency, negative_format: '(%u%n)') + # # => "($1,234,567,890.50)" + # 1234567890.50.to_fs(:currency, unit: '£', separator: ',', delimiter: '') + # # => "£1234567890,50" + # 1234567890.50.to_fs(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u') + # # => "1234567890,50 £" + # + # Percentage: + # 100.to_fs(:percentage) # => "100.000%" + # 100.to_fs(:percentage, precision: 0) # => "100%" + # 1000.to_fs(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" + # 302.24398923423.to_fs(:percentage, precision: 5) # => "302.24399%" + # 302.24398923423.to_fs(:percentage, round_mode: :down) # => "302.243%" + # 1000.to_fs(:percentage, locale: :fr) # => "1 000,000%" + # 100.to_fs(:percentage, format: '%n %') # => "100.000 %" + # + # Delimited: + # 12345678.to_fs(:delimited) # => "12,345,678" + # 12345678.05.to_fs(:delimited) # => "12,345,678.05" + # 12345678.to_fs(:delimited, delimiter: '.') # => "12.345.678" + # 12345678.to_fs(:delimited, delimiter: ',') # => "12,345,678" + # 12345678.05.to_fs(:delimited, separator: ' ') # => "12,345,678 05" + # 12345678.05.to_fs(:delimited, locale: :fr) # => "12 345 678,05" + # 98765432.98.to_fs(:delimited, delimiter: ' ', separator: ',') + # # => "98 765 432,98" + # + # Rounded: + # 111.2345.to_fs(:rounded) # => "111.235" + # 111.2345.to_fs(:rounded, precision: 2) # => "111.23" + # 111.2345.to_fs(:rounded, precision: 2, round_mode: :up) # => "111.24" + # 13.to_fs(:rounded, precision: 5) # => "13.00000" + # 389.32314.to_fs(:rounded, precision: 0) # => "389" + # 111.2345.to_fs(:rounded, significant: true) # => "111" + # 111.2345.to_fs(:rounded, precision: 1, significant: true) # => "100" + # 13.to_fs(:rounded, precision: 5, significant: true) # => "13.000" + # 111.234.to_fs(:rounded, locale: :fr) # => "111,234" + # 13.to_fs(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true) + # # => "13" + # 389.32314.to_fs(:rounded, precision: 4, significant: true) # => "389.3" + # 1111.2345.to_fs(:rounded, precision: 2, separator: ',', delimiter: '.') + # # => "1.111,23" + # + # Human-friendly size in Bytes: + # 123.to_fs(:human_size) # => "123 Bytes" + # 1234.to_fs(:human_size) # => "1.21 KB" + # 12345.to_fs(:human_size) # => "12.1 KB" + # 1234567.to_fs(:human_size) # => "1.18 MB" + # 1234567890.to_fs(:human_size) # => "1.15 GB" + # 1234567890123.to_fs(:human_size) # => "1.12 TB" + # 1234567890123456.to_fs(:human_size) # => "1.1 PB" + # 1234567890123456789.to_fs(:human_size) # => "1.07 EB" + # 1234567.to_fs(:human_size, precision: 2) # => "1.2 MB" + # 1234567.to_fs(:human_size, precision: 2, round_mode: :up) # => "1.3 MB" + # 483989.to_fs(:human_size, precision: 2) # => "470 KB" + # 1234567.to_fs(:human_size, precision: 2, separator: ',') # => "1,2 MB" + # 1234567890123.to_fs(:human_size, precision: 5) # => "1.1228 TB" + # 524288000.to_fs(:human_size, precision: 5) # => "500 MB" + # + # Human-friendly format: + # 123.to_fs(:human) # => "123" + # 1234.to_fs(:human) # => "1.23 Thousand" + # 12345.to_fs(:human) # => "12.3 Thousand" + # 1234567.to_fs(:human) # => "1.23 Million" + # 1234567890.to_fs(:human) # => "1.23 Billion" + # 1234567890123.to_fs(:human) # => "1.23 Trillion" + # 1234567890123456.to_fs(:human) # => "1.23 Quadrillion" + # 1234567890123456789.to_fs(:human) # => "1230 Quadrillion" + # 489939.to_fs(:human, precision: 2) # => "490 Thousand" + # 489939.to_fs(:human, precision: 2, round_mode: :down) # => "480 Thousand" + # 489939.to_fs(:human, precision: 4) # => "489.9 Thousand" + # 1234567.to_fs(:human, precision: 4, + # significant: false) # => "1.2346 Million" + # 1234567.to_fs(:human, precision: 1, + # separator: ',', + # significant: false) # => "1,2 Million" + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/conversions.rb:113 + def to_fs(format = T.unsafe(nil), options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/option_merger.rb:6 +class ActiveSupport::OptionMerger + # pkg:gem/activesupport#lib/active_support/option_merger.rb:11 + def initialize(context, options); end + + private + + # pkg:gem/activesupport#lib/active_support/option_merger.rb:16 + def method_missing(method, *arguments, &block); end + + # pkg:gem/activesupport#lib/active_support/option_merger.rb:34 + def respond_to_missing?(*, **, &); end +end + +# DEPRECATED: +ActiveSupport::OrderedHash+ implements a hash that preserves +# insertion order. +# +# oh = ActiveSupport::OrderedHash.new +# oh[:a] = 1 +# oh[:b] = 2 +# oh.keys # => [:a, :b], this order is guaranteed +# +# Also, maps the +omap+ feature for YAML files +# (See https://yaml.org/type/omap.html) to support ordered items +# when loading from YAML. +# +# +ActiveSupport::OrderedHash+ is namespaced to prevent conflicts +# with other implementations. +# +# pkg:gem/activesupport#lib/active_support/ordered_hash.rb:24 +class ActiveSupport::OrderedHash < ::Hash + # pkg:gem/activesupport#lib/active_support/ordered_hash.rb:29 + def encode_with(coder); end + + # Returns true to make sure that this hash is extractable via Array#extract_options! + # + # pkg:gem/activesupport#lib/active_support/ordered_hash.rb:46 + def extractable_options?; end + + # pkg:gem/activesupport#lib/active_support/ordered_hash.rb:41 + def nested_under_indifferent_access; end + + # pkg:gem/activesupport#lib/active_support/ordered_hash.rb:37 + def reject(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/ordered_hash.rb:33 + def select(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/ordered_hash.rb:25 + def to_yaml_type; end +end + +# = Ordered Options +# +# +OrderedOptions+ inherits from +Hash+ and provides dynamic accessor methods. +# +# With a +Hash+, key-value pairs are typically managed like this: +# +# h = {} +# h[:boy] = 'John' +# h[:girl] = 'Mary' +# h[:boy] # => 'John' +# h[:girl] # => 'Mary' +# h[:dog] # => nil +# +# Using +OrderedOptions+, the above code can be written as: +# +# h = ActiveSupport::OrderedOptions.new +# h.boy = 'John' +# h.girl = 'Mary' +# h.boy # => 'John' +# h.girl # => 'Mary' +# h.dog # => nil +# +# To raise an exception when the value is blank, append a +# bang to the key name, like: +# +# h.dog! # => raises KeyError: :dog is blank +# +# pkg:gem/activesupport#lib/active_support/ordered_options.rb:33 +class ActiveSupport::OrderedOptions < ::Hash + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:41 + def [](key); end + + # make it protected + # + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:37 + def []=(key, value); end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:45 + def dig(key, *identifiers); end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:64 + def extractable_options?; end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:68 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:49 + def method_missing(method, *args); end + + protected + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:34 + def _get(_arg0); end + + private + + # pkg:gem/activesupport#lib/active_support/ordered_options.rb:60 + def respond_to_missing?(name, include_private); end +end + +# = Active Support Parameter Filter +# +# +ParameterFilter+ replaces values in a Hash-like object if their +# keys match one of the specified filters. +# +# Matching based on nested keys is possible by using dot notation, e.g. +# "credit_card.number". +# +# If a proc is given as a filter, each key and value of the Hash-like +# and of any nested Hashes will be passed to it. The value or key can +# then be mutated as desired using methods such as String#replace. +# +# # Replaces values with "[FILTERED]" for keys that match /password/i. +# ActiveSupport::ParameterFilter.new([:password]) +# +# # Replaces values with "[FILTERED]" for keys that match /foo|bar/i. +# ActiveSupport::ParameterFilter.new([:foo, "bar"]) +# +# # Replaces values for the exact key "pin" and for keys that begin with +# # "pin_". Does not match keys that otherwise include "pin" as a +# # substring, such as "shipping_id". +# ActiveSupport::ParameterFilter.new([/\Apin\z/, /\Apin_/]) +# +# # Replaces the value for :code in `{ credit_card: { code: "xxxx" } }`. +# # Does not change `{ file: { code: "xxxx" } }`. +# ActiveSupport::ParameterFilter.new(["credit_card.code"]) +# +# # Reverses values for keys that match /secret/i. +# ActiveSupport::ParameterFilter.new([-> (k, v) do +# v.reverse! if /secret/i.match?(k) +# end]) +# +# pkg:gem/activesupport#lib/active_support/parameter_filter.rb:39 +class ActiveSupport::ParameterFilter + # Create instance with given filters. Supported type of filters are +String+, +Regexp+, and +Proc+. + # Other types of filters are treated as +String+ using +to_s+. + # For +Proc+ filters, key, value, and optional original hash is passed to block arguments. + # + # ==== Options + # + # * :mask - A replaced object when filtered. Defaults to "[FILTERED]". + # + # pkg:gem/activesupport#lib/active_support/parameter_filter.rb:77 + def initialize(filters = T.unsafe(nil), mask: T.unsafe(nil)); end + + # Mask value of +params+ if key matches one of filters. + # + # pkg:gem/activesupport#lib/active_support/parameter_filter.rb:83 + def filter(params); end + + # Returns filtered value for given key. For +Proc+ filters, third block argument is not populated. + # + # pkg:gem/activesupport#lib/active_support/parameter_filter.rb:88 + def filter_param(key, value); end + + private + + # pkg:gem/activesupport#lib/active_support/parameter_filter.rb:125 + def call(params, full_parent_key = T.unsafe(nil), original_params = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/parameter_filter.rb:93 + def compile_filters!(filters); end + + # pkg:gem/activesupport#lib/active_support/parameter_filter.rb:135 + def value_for_key(key, value, full_parent_key = T.unsafe(nil), original_params = T.unsafe(nil)); end + + class << self + # Precompiles an array of filters that otherwise would be passed directly to + # #initialize. Depending on the quantity and types of filters, + # precompilation can improve filtering performance, especially in the case + # where the ParameterFilter instance itself cannot be retained (but the + # precompiled filters can be retained). + # + # filters = [/foo/, :bar, "nested.baz", /nested\.qux/] + # + # precompiled = ActiveSupport::ParameterFilter.precompile_filters(filters) + # # => [/(?-mix:foo)|(?i:bar)/, /(?i:nested\.baz)|(?-mix:nested\.qux)/] + # + # ActiveSupport::ParameterFilter.new(precompiled) + # + # pkg:gem/activesupport#lib/active_support/parameter_filter.rb:55 + def precompile_filters(filters); end + end +end + +# pkg:gem/activesupport#lib/active_support/parameter_filter.rb:40 +ActiveSupport::ParameterFilter::FILTERED = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/railtie.rb:7 +class ActiveSupport::Railtie < ::Rails::Railtie; end + +# = \Range With Format +# +# pkg:gem/activesupport#lib/active_support/core_ext/range/conversions.rb:5 +module ActiveSupport::RangeWithFormat + # pkg:gem/activesupport#lib/active_support/core_ext/range/conversions.rb:58 + def to_formatted_s(format = T.unsafe(nil)); end + + # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. + # + # This method is aliased to to_formatted_s. + # + # range = (1..100) # => 1..100 + # + # range.to_s # => "1..100" + # range.to_fs(:db) # => "BETWEEN '1' AND '100'" + # + # range = (1..) # => 1.. + # range.to_fs(:db) # => ">= '1'" + # + # range = (..100) # => ..100 + # range.to_fs(:db) # => "<= '100'" + # + # == Adding your own range formats to to_fs + # You can add your own formats to the Range::RANGE_FORMATS hash. + # Use the format name as the hash key and a Proc instance. + # + # # config/initializers/range_formats.rb + # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_fs(:db)} and #{stop.to_fs(:db)}" } + # + # pkg:gem/activesupport#lib/active_support/core_ext/range/conversions.rb:51 + def to_fs(format = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/range/conversions.rb:6 +ActiveSupport::RangeWithFormat::RANGE_FORMATS = T.let(T.unsafe(nil), Hash) + +# = Active Support \Reloader +# +# This class defines several callbacks: +# +# to_prepare -- Run once at application startup, and also from +# +to_run+. +# +# to_run -- Run before a work run that is reloading. If +# +reload_classes_only_on_change+ is true (the default), the class +# unload will have already occurred. +# +# to_complete -- Run after a work run that has reloaded. If +# +reload_classes_only_on_change+ is false, the class unload will +# have occurred after the work run, but before this callback. +# +# before_class_unload -- Run immediately before the classes are +# unloaded. +# +# after_class_unload -- Run immediately after the classes are +# unloaded. +# +# pkg:gem/activesupport#lib/active_support/reloader.rb:28 +class ActiveSupport::Reloader < ::ActiveSupport::ExecutionWrapper + # pkg:gem/activesupport#lib/active_support/reloader.rb:99 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:31 + def _class_unload_callbacks; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:29 + def _prepare_callbacks; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:31 + def _run_class_unload_callbacks; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:31 + def _run_class_unload_callbacks!(&block); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:29 + def _run_prepare_callbacks; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:29 + def _run_prepare_callbacks!(&block); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:48 + def _run_run_callbacks(&block); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:85 + def check; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:85 + def check=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:85 + def check?; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:126 + def class_unload!(&block); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:131 + def complete!; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:84 + def executor; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:84 + def executor=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:84 + def executor?; end + + # Release the unload lock if it has been previously obtained + # + # pkg:gem/activesupport#lib/active_support/reloader.rb:114 + def release_unload_lock!; end + + # Acquire the ActiveSupport::Dependencies::Interlock unload lock, + # ensuring it will be released automatically + # + # pkg:gem/activesupport#lib/active_support/reloader.rb:106 + def require_unload_lock!; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:121 + def run!; end + + class << self + # pkg:gem/activesupport#lib/active_support/reloader.rb:31 + def _class_unload_callbacks; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:31 + def _class_unload_callbacks=(value); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:29 + def _prepare_callbacks; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:29 + def _prepare_callbacks=(value); end + + # Registers a callback that will run immediately after the classes are unloaded. + # + # pkg:gem/activesupport#lib/active_support/reloader.rb:44 + def after_class_unload(*args, &block); end + + # Registers a callback that will run immediately before the classes are unloaded. + # + # pkg:gem/activesupport#lib/active_support/reloader.rb:39 + def before_class_unload(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:85 + def check; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:87 + def check!; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:85 + def check=(value); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:85 + def check?; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:84 + def executor; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:84 + def executor=(value); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:84 + def executor?; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:95 + def prepare!; end + + # Initiate a manual reload + # + # pkg:gem/activesupport#lib/active_support/reloader.rb:51 + def reload!; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:91 + def reloaded!; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:62 + def run!(reset: T.unsafe(nil)); end + + # Registers a callback that will run once at application startup and every time the code is reloaded. + # + # pkg:gem/activesupport#lib/active_support/reloader.rb:34 + def to_prepare(*args, &block); end + + # Run the supplied block as a work unit, reloading code as needed + # + # pkg:gem/activesupport#lib/active_support/reloader.rb:71 + def wrap(**kwargs); end + + private + + # pkg:gem/activesupport#lib/active_support/reloader.rb:29 + def __class_attr___callbacks; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:29 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:85 + def __class_attr_check; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:85 + def __class_attr_check=(new_value); end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:84 + def __class_attr_executor; end + + # pkg:gem/activesupport#lib/active_support/reloader.rb:84 + def __class_attr_executor=(new_value); end + end +end + +# = Active Support \Rescuable +# +# Rescuable module adds support for easier exception handling. +# +# pkg:gem/activesupport#lib/active_support/rescuable.rb:11 +module ActiveSupport::Rescuable + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveSupport::Rescuable::ClassMethods + + # Internal handler lookup. Delegates to class method. Some libraries call + # this directly, so keeping it around for compatibility. + # + # pkg:gem/activesupport#lib/active_support/rescuable.rb:172 + def handler_for_rescue(exception); end + + # Delegates to the class method, but uses the instance as the subject for + # rescue_from handlers (method calls, +instance_exec+ blocks). + # + # pkg:gem/activesupport#lib/active_support/rescuable.rb:166 + def rescue_with_handler(exception); end + + module GeneratedClassMethods + def rescue_handlers; end + def rescue_handlers=(value); end + def rescue_handlers?; end + end + + module GeneratedInstanceMethods + def rescue_handlers; end + def rescue_handlers=(value); end + def rescue_handlers?; end + end +end + +# pkg:gem/activesupport#lib/active_support/rescuable.rb:18 +module ActiveSupport::Rescuable::ClassMethods + # pkg:gem/activesupport#lib/active_support/rescuable.rb:105 + def handler_for_rescue(exception, object: T.unsafe(nil)); end + + # Registers exception classes with a handler to be called by rescue_with_handler. + # + # rescue_from receives a series of exception classes or class + # names, and an exception handler specified by a trailing :with + # option containing the name of a method or a Proc object. Alternatively, a block + # can be given as the handler. + # + # Handlers that take one argument will be called with the exception, so + # that the exception can be inspected when dealing with it. + # + # Handlers are inherited. They are searched from right to left, from + # bottom to top, and up the hierarchy. The handler of the first class for + # which exception.is_a?(klass) holds true is the one invoked, if + # any. + # + # class ApplicationController < ActionController::Base + # rescue_from User::NotAuthorized, with: :deny_access + # rescue_from ActiveRecord::RecordInvalid, with: :show_record_errors + # + # rescue_from "MyApp::BaseError" do |exception| + # redirect_to root_url, alert: exception.message + # end + # + # private + # def deny_access + # head :forbidden + # end + # + # def show_record_errors(exception) + # redirect_back_or_to root_url, alert: exception.record.errors.full_messages.to_sentence + # end + # end + # + # Exceptions raised inside exception handlers are not propagated up. + # + # pkg:gem/activesupport#lib/active_support/rescuable.rb:53 + def rescue_from(*klasses, with: T.unsafe(nil), &block); end + + # Matches an exception to a handler based on the exception class. + # + # If no handler matches the exception, check for a handler matching the + # (optional) +exception.cause+. If no handler matches the exception or its + # cause, this returns +nil+, so you can deal with unhandled exceptions. + # Be sure to re-raise unhandled exceptions if this is what you expect. + # + # begin + # # ... + # rescue => exception + # rescue_with_handler(exception) || raise + # end + # + # Returns the exception if it was handled and +nil+ if it was not. + # + # pkg:gem/activesupport#lib/active_support/rescuable.rb:90 + def rescue_with_handler(exception, object: T.unsafe(nil), visited_exceptions: T.unsafe(nil)); end + + private + + # pkg:gem/activesupport#lib/active_support/rescuable.rb:139 + def constantize_rescue_handler_class(class_or_name); end + + # pkg:gem/activesupport#lib/active_support/rescuable.rb:124 + def find_rescue_handler(exception); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:19 +class ActiveSupport::SafeBuffer < ::String + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:70 + def initialize(_str = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:124 + def %(args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:115 + def *(_); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:111 + def +(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:85 + def <<(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:38 + def [](*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:103 + def []=(arg1, arg2, arg3 = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:147 + def as_json(*); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:87 + def bytesplice(*args, value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def capitalize(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def capitalize!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def chomp(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def chomp!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def chop(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def chop!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:59 + def chr; end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:79 + def concat(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def delete(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def delete!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def delete_prefix(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def delete_prefix!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def delete_suffix(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def delete_suffix!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def downcase(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def downcase!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:155 + def encode_with(coder); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:175 + def gsub(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:175 + def gsub!(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:139 + def html_safe?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:91 + def insert(index, value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def lstrip(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def lstrip!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def next(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def next!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:95 + def prepend(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:99 + def replace(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def reverse(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def reverse!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def rstrip(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def rstrip!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:65 + def safe_concat(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def scrub(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def scrub!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:49 + def slice(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:51 + def slice!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def squeeze(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def squeeze!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def strip(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def strip!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:175 + def sub(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:175 + def sub!(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def succ(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def succ!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def swapcase(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def swapcase!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:151 + def to_param; end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:143 + def to_s; end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def tr(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def tr!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def tr_s(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def tr_s!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def unicode_normalize(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def unicode_normalize!(*args); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def upcase(*args, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:161 + def upcase!(*args); end + + protected + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:202 + def mark_unsafe!; end + + private + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:207 + def explicit_html_escape_interpolated_argument(arg); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:211 + def implicit_html_escape_interpolated_argument(arg); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:74 + def initialize_copy(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:28 + def original_concat(*_arg0); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:219 + def set_block_back_references(block, match_data); end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:225 + def string_into_safe_buffer(new_string, is_html_safe); end +end + +# Raised when ActiveSupport::SafeBuffer#safe_concat is called on unsafe buffers. +# +# pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:32 +class ActiveSupport::SafeBuffer::SafeConcatError < ::StandardError + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:33 + def initialize; end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:20 +ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:26 +ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS_WITH_BACKREF = T.let(T.unsafe(nil), Array) + +# = Secure Compare Rotator +# +# The ActiveSupport::SecureCompareRotator is a wrapper around ActiveSupport::SecurityUtils.secure_compare +# and allows you to rotate a previously defined value to a new one. +# +# It can be used as follow: +# +# rotator = ActiveSupport::SecureCompareRotator.new('new_production_value') +# rotator.rotate('previous_production_value') +# rotator.secure_compare!('previous_production_value') +# +# One real use case example would be to rotate a basic auth credentials: +# +# class MyController < ApplicationController +# def authenticate_request +# rotator = ActiveSupport::SecureCompareRotator.new('new_password') +# rotator.rotate('old_password') +# +# authenticate_or_request_with_http_basic do |username, password| +# rotator.secure_compare!(password) +# rescue ActiveSupport::SecureCompareRotator::InvalidMatch +# false +# end +# end +# end +# +# pkg:gem/activesupport#lib/active_support/secure_compare_rotator.rb:32 +class ActiveSupport::SecureCompareRotator + include ::ActiveSupport::SecurityUtils + + # pkg:gem/activesupport#lib/active_support/secure_compare_rotator.rb:37 + def initialize(value, on_rotation: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/secure_compare_rotator.rb:43 + def rotate(previous_value); end + + # pkg:gem/activesupport#lib/active_support/secure_compare_rotator.rb:47 + def secure_compare!(other_value, on_rotation: T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/secure_compare_rotator.rb:35 +class ActiveSupport::SecureCompareRotator::InvalidMatch < ::StandardError; end + +# pkg:gem/activesupport#lib/active_support/security_utils.rb:4 +module ActiveSupport::SecurityUtils + private + + # Constant time string comparison, for fixed length strings. + # + # The values compared should be of fixed length, such as strings + # that have already been processed by HMAC. Raises in case of length mismatch. + # + # pkg:gem/activesupport#lib/active_support/security_utils.rb:10 + def fixed_length_secure_compare(a, b); end + + # Secure string comparison for strings of variable length. + # + # While a timing attack would not be able to discern the content of + # a secret compared via secure_compare, it is possible to determine + # the secret length. This should be considered when using secure_compare + # to compare weak, short secrets to user input. + # + # pkg:gem/activesupport#lib/active_support/security_utils.rb:32 + def secure_compare(a, b); end + + class << self + # pkg:gem/activesupport#lib/active_support/security_utils.rb:24 + def fixed_length_secure_compare(a, b); end + + # pkg:gem/activesupport#lib/active_support/security_utils.rb:35 + def secure_compare(a, b); end + end +end + +# = \String Inquirer +# +# Wrapping a string in this class gives you a prettier way to test +# for equality. The value returned by Rails.env is wrapped +# in a StringInquirer object, so instead of calling this: +# +# Rails.env == 'production' +# +# you can call this: +# +# Rails.env.production? +# +# == Instantiating a new \StringInquirer +# +# vehicle = ActiveSupport::StringInquirer.new('car') +# vehicle.car? # => true +# vehicle.bike? # => false +# +# pkg:gem/activesupport#lib/active_support/string_inquirer.rb:21 +class ActiveSupport::StringInquirer < ::String + private + + # pkg:gem/activesupport#lib/active_support/string_inquirer.rb:27 + def method_missing(method_name, *, **, &); end + + # pkg:gem/activesupport#lib/active_support/string_inquirer.rb:23 + def respond_to_missing?(method_name, include_private = T.unsafe(nil)); end +end + +# = Active Support Structured Event \Subscriber +# +# +ActiveSupport::StructuredEventSubscriber+ consumes ActiveSupport::Notifications +# in order to emit structured events via +Rails.event+. +# +# An example would be the Action Controller structured event subscriber, responsible for +# emitting request processing events: +# +# module ActionController +# class StructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber +# attach_to :action_controller +# +# def start_processing(event) +# emit_event("controller.request_started", +# controller: event.payload[:controller], +# action: event.payload[:action], +# format: event.payload[:format] +# ) +# end +# end +# end +# +# After configured, whenever a "start_processing.action_controller" notification is published, +# it will properly dispatch the event (+ActiveSupport::Notifications::Event+) to the +start_processing+ method. +# The subscriber can then emit a structured event via the +emit_event+ method. +# +# pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:31 +class ActiveSupport::StructuredEventSubscriber < ::ActiveSupport::Subscriber + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:56 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:88 + def call(event); end + + # Like +emit_event+, but only emits when the event reporter is in debug mode + # + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:82 + def emit_debug_event(name, payload = T.unsafe(nil), caller_depth: T.unsafe(nil), **kwargs); end + + # Emit a structured event via Rails.event.notify. + # + # ==== Arguments + # + # * +name+ - The event name as a string or symbol + # * +payload+ - The event payload as a hash or object + # * +caller_depth+ - Stack depth for source location (default: 1) + # * +kwargs+ - Additional payload data merged with the payload hash + # + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:75 + def emit_event(name, payload = T.unsafe(nil), caller_depth: T.unsafe(nil), **kwargs); end + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:61 + def silenced?(event); end + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:65 + def silenced_events=(_arg0); end + + private + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:95 + def handle_event_error(name, error); end + + class << self + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:37 + def attach_to(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:32 + def debug_methods; end + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:32 + def debug_methods=(value); end + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:32 + def debug_methods?; end + + private + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:32 + def __class_attr_debug_methods; end + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:32 + def __class_attr_debug_methods=(new_value); end + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:50 + def debug_only(method); end + + # pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:44 + def set_silenced_events; end + end +end + +# pkg:gem/activesupport#lib/active_support/structured_event_subscriber.rb:34 +ActiveSupport::StructuredEventSubscriber::DEBUG_CHECK = T.let(T.unsafe(nil), Proc) + +# = Active Support \Subscriber +# +# +ActiveSupport::Subscriber+ is an object set to consume +# ActiveSupport::Notifications. The subscriber dispatches notifications to +# a registered object based on its given namespace. +# +# An example would be an Active Record subscriber responsible for collecting +# statistics about queries: +# +# module ActiveRecord +# class StatsSubscriber < ActiveSupport::Subscriber +# attach_to :active_record +# +# def sql(event) +# Statsd.timing("sql.#{event.payload[:name]}", event.duration) +# end +# end +# end +# +# After configured, whenever a "sql.active_record" notification is +# published, it will properly dispatch the event +# (ActiveSupport::Notifications::Event) to the +sql+ method. +# +# We can detach a subscriber as well: +# +# ActiveRecord::StatsSubscriber.detach_from(:active_record) +# +# pkg:gem/activesupport#lib/active_support/subscriber.rb:32 +class ActiveSupport::Subscriber + # pkg:gem/activesupport#lib/active_support/subscriber.rb:70 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:70 + def call(event); end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:70 + def patterns; end + + class << self + # Attach the subscriber to a namespace. + # + # pkg:gem/activesupport#lib/active_support/subscriber.rb:35 + def attach_to(namespace, subscriber = T.unsafe(nil), notifier = T.unsafe(nil), inherit_all: T.unsafe(nil)); end + + # Detach the subscriber from a namespace. + # + # pkg:gem/activesupport#lib/active_support/subscriber.rb:50 + def detach_from(namespace, notifier = T.unsafe(nil)); end + + # Adds event subscribers for all new methods added to the class. + # + # pkg:gem/activesupport#lib/active_support/subscriber.rb:69 + def method_added(event); end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:79 + def subscribers; end + + private + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:86 + def add_event_subscriber(event); end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:124 + def fetch_public_methods(subscriber, inherit_all); end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:108 + def find_attached_subscriber; end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:112 + def invalid_event?(event); end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:84 + def namespace; end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:84 + def notifier; end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:120 + def pattern_subscribed?(pattern); end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:116 + def prepare_pattern(event); end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:97 + def remove_event_subscriber(event); end + + # pkg:gem/activesupport#lib/active_support/subscriber.rb:84 + def subscriber; end + end +end + +# This is a class for wrapping syntax errors. The purpose of this class +# is to enhance the backtraces on SyntaxError exceptions to include the +# source location of the syntax error. That way we can display the error +# source on error pages in development. +# +# pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:10 +class ActiveSupport::SyntaxErrorProxy + # pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:11 + def backtrace; end + + # pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:41 + def backtrace_locations; end + + private + + # pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:54 + def parse_message_for_trace; end +end + +# pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:15 +class ActiveSupport::SyntaxErrorProxy::BacktraceLocation < ::Struct + # pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:25 + def absolute_path; end + + # pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:22 + def base_label; end + + # pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:19 + def label; end + + # pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:16 + def spot(_); end +end + +# pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:30 +class ActiveSupport::SyntaxErrorProxy::BacktraceLocationProxy + # pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:31 + def initialize(loc, ex); end + + # pkg:gem/activesupport#lib/active_support/syntax_error_proxy.rb:36 + def spot(_); end +end + +# pkg:gem/activesupport#lib/active_support/event_reporter.rb:6 +class ActiveSupport::TagStack + class << self + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:11 + def tags; end + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:15 + def with_tags(*args, **kwargs); end + + private + + # pkg:gem/activesupport#lib/active_support/event_reporter.rb:30 + def resolve_tags(args, kwargs); end + end +end + +# pkg:gem/activesupport#lib/active_support/event_reporter.rb:7 +ActiveSupport::TagStack::EMPTY_TAGS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/event_reporter.rb:8 +ActiveSupport::TagStack::FIBER_KEY = T.let(T.unsafe(nil), Symbol) + +# = Active Support Tagged Logging +# +# Wraps any standard Logger object to provide tagging capabilities. +# +# May be called with a block: +# +# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) +# logger.tagged('BCX') { logger.info 'Stuff' } # Logs "[BCX] Stuff" +# logger.tagged('BCX', "Jason") { |tagged_logger| tagged_logger.info 'Stuff' } # Logs "[BCX] [Jason] Stuff" +# logger.tagged('BCX') { logger.tagged('Jason') { logger.info 'Stuff' } } # Logs "[BCX] [Jason] Stuff" +# +# If called without a block, a new logger will be returned with applied tags: +# +# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) +# logger.tagged("BCX").info "Stuff" # Logs "[BCX] Stuff" +# logger.tagged("BCX", "Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" +# logger.tagged("BCX").tagged("Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" +# +# This is used by the default Rails.logger as configured by Railties to make +# it easy to stamp log lines with subdomains, request ids, and anything else +# to aid debugging of multi-user production applications. +# +# pkg:gem/activesupport#lib/active_support/tagged_logging.rb:29 +module ActiveSupport::TaggedLogging + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:139 + def clear_tags!(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:152 + def flush; end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:139 + def pop_tags(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:139 + def push_tags(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:141 + def tagged(*tags); end + + class << self + # Returns an `ActiveSupport::Logger` that has already been wrapped with tagged logging concern. + # + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:117 + def logger(*args, **kwargs); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:121 + def new(logger); end + end +end + +# pkg:gem/activesupport#lib/active_support/tagged_logging.rb:30 +module ActiveSupport::TaggedLogging::Formatter + # This method is invoked when a log event occurs. + # + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:32 + def call(severity, timestamp, progname, msg); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:51 + def clear_tags!; end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:61 + def current_tags; end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:47 + def pop_tags(count = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:43 + def push_tags(*tags); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:55 + def tag_stack; end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:36 + def tagged(*tags); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:65 + def tags_text; end +end + +# pkg:gem/activesupport#lib/active_support/tagged_logging.rb:108 +module ActiveSupport::TaggedLogging::LocalTagStorage + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:109 + def tag_stack; end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:109 + def tag_stack=(_arg0); end + + class << self + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:111 + def extended(base); end + end +end + +# pkg:gem/activesupport#lib/active_support/tagged_logging.rb:70 +class ActiveSupport::TaggedLogging::TagStack + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:73 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:91 + def clear; end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:96 + def format_message(message); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:86 + def pop_tags(count); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:78 + def push_tags(tags); end + + # pkg:gem/activesupport#lib/active_support/tagged_logging.rb:71 + def tags; end +end + +# pkg:gem/activesupport#lib/active_support/test_case.rb:23 +class ActiveSupport::TestCase < ::Minitest::Test + include ::ActiveSupport::Testing::SetupAndTeardown + include ::ActiveSupport::Testing::TestsWithoutAssertions + include ::ActiveSupport::Testing::TaggedLogging + include ::ActiveSupport::Callbacks + include ::ActiveSupport::Testing::Assertions + include ::ActiveSupport::Testing::ErrorReporterAssertions + include ::ActiveSupport::Testing::EventReporterAssertions + include ::ActiveSupport::Testing::NotificationAssertions + include ::ActiveSupport::Testing::Deprecation + include ::ActiveSupport::Testing::ConstantStubbing + include ::ActiveSupport::Testing::TimeHelpers + include ::ActiveSupport::Testing::FileFixtures + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + extend ::ActiveSupport::Testing::SetupAndTeardown::ClassMethods + extend ::ActiveSupport::Testing::Declarative + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def __callbacks; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _run_setup_callbacks; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _run_setup_callbacks!(&block); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _run_teardown_callbacks; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _run_teardown_callbacks!(&block); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _setup_callbacks; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _teardown_callbacks; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:302 + def assert_no_match(matcher, obj, msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:225 + def assert_not_empty(obj, msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:236 + def assert_not_equal(exp, act, msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:247 + def assert_not_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:258 + def assert_not_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:269 + def assert_not_includes(collection, obj, msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:280 + def assert_not_instance_of(cls, obj, msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:291 + def assert_not_kind_of(cls, obj, msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:313 + def assert_not_nil(obj, msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:324 + def assert_not_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:335 + def assert_not_predicate(o1, op, msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:346 + def assert_not_respond_to(obj, meth, msg = T.unsafe(nil), include_all: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:357 + def assert_not_same(exp, act, msg = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:213 + def file_fixture_path; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:213 + def file_fixture_path?; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:361 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:196 + def method_name; end + + # Returns the current parallel worker ID if tests are running in parallel + # + # pkg:gem/activesupport#lib/active_support/test_case.rb:199 + def parallel_worker_id; end + + class << self + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def __callbacks; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def __callbacks=(value); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _setup_callbacks; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _setup_callbacks=(value); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _teardown_callbacks; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def _teardown_callbacks=(value); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:213 + def file_fixture_path; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:213 + def file_fixture_path=(value); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:213 + def file_fixture_path?; end + + # Returns the current parallel worker ID if tests are running in parallel, + # nil otherwise. + # + # ActiveSupport::TestCase.parallel_worker_id # => 2 + # + # pkg:gem/activesupport#lib/active_support/test_case.rb:34 + def parallel_worker_id; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:38 + def parallel_worker_id=(value); end + + # Parallelizes the test suite. + # + # Takes a +workers+ argument that controls how many times the process + # is forked. For each process a new database will be created suffixed + # with the worker number. + # + # test-database_0 + # test-database_1 + # + # If ENV["PARALLEL_WORKERS"] is set the workers argument will be ignored + # and the environment variable will be used instead. This is useful for CI + # environments, or other environments where you may need more workers than + # you do for local testing. + # + # If the number of workers is set to +1+ or fewer, the tests will not be + # parallelized. + # + # If +workers+ is set to +:number_of_processors+, the number of workers will be + # set to the actual core count on the machine you are on. + # + # The default parallelization method is to fork processes. If you'd like to + # use threads instead you can pass with: :threads to the +parallelize+ + # method. Note the threaded parallelization does not create multiple + # databases and will not work with system tests. + # + # parallelize(workers: :number_of_processors, with: :threads) + # + # The threaded parallelization uses minitest's parallel executor directly. + # The processes parallelization uses a Ruby DRb server. + # + # Because parallelization presents an overhead, it is only enabled when the + # number of tests to run is above the +threshold+ param. The default value is + # 50, and it's configurable via +config.active_support.test_parallelization_threshold+. + # + # If you want to skip Rails default creation of one database per process in favor of + # writing your own implementation, you can set +parallelize_databases+, or configure it + # via +config.active_support.parallelize_test_databases+. + # + # parallelize(workers: :number_of_processors, parallelize_databases: false) + # + # Note that your test suite may deadlock if you attempt to use only one database + # with multiple processes. + # + # pkg:gem/activesupport#lib/active_support/test_case.rb:113 + def parallelize(workers: T.unsafe(nil), with: T.unsafe(nil), threshold: T.unsafe(nil), parallelize_databases: T.unsafe(nil)); end + + # Before fork hook for parallel testing. This can be used to run anything + # before the processes are forked. + # + # In your +test_helper.rb+ add the following: + # + # class ActiveSupport::TestCase + # parallelize_before_fork do + # # run this before fork + # end + # end + # + # pkg:gem/activesupport#lib/active_support/test_case.rb:138 + def parallelize_before_fork(&block); end + + # Setup hook for parallel testing. This can be used if you have multiple + # databases or any behavior that needs to be run after the process is forked + # but before the tests run. + # + # Note: this feature is not available with the threaded parallelization. + # + # In your +test_helper.rb+ add the following: + # + # class ActiveSupport::TestCase + # parallelize_setup do + # # create databases + # end + # end + # + # pkg:gem/activesupport#lib/active_support/test_case.rb:155 + def parallelize_setup(&block); end + + # Clean up hook for parallel testing. This can be used to drop databases + # if your app uses multiple write/read databases or other clean up before + # the tests finish. This runs before the forked process is closed. + # + # Note: this feature is not available with the threaded parallelization. + # + # In your +test_helper.rb+ add the following: + # + # class ActiveSupport::TestCase + # parallelize_teardown do + # # drop databases + # end + # end + # + # pkg:gem/activesupport#lib/active_support/test_case.rb:172 + def parallelize_teardown(&block); end + + # Returns the order in which test cases are run. + # + # ActiveSupport::TestCase.test_order # => :random + # + # Possible values are +:random+, +:parallel+, +:alpha+, +:sorted+. + # Defaults to +:random+. + # + # pkg:gem/activesupport#lib/active_support/test_case.rb:61 + def test_order; end + + # Sets the order in which test cases are run. + # + # ActiveSupport::TestCase.test_order = :random # => :random + # + # Valid values are: + # * +:random+ (to run tests in random order) + # * +:parallel+ (to run tests in parallel) + # * +:sorted+ (to run tests alphabetically by method name) + # * +:alpha+ (equivalent to +:sorted+) + # + # pkg:gem/activesupport#lib/active_support/test_case.rb:51 + def test_order=(new_order); end + + private + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def __class_attr___callbacks; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:204 + def __class_attr___callbacks=(new_value); end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:213 + def __class_attr_file_fixture_path; end + + # pkg:gem/activesupport#lib/active_support/test_case.rb:213 + def __class_attr_file_fixture_path=(new_value); end + end +end + +# pkg:gem/activesupport#lib/active_support/test_case.rb:24 +ActiveSupport::TestCase::Assertion = Minitest::Assertion + +# pkg:gem/activesupport#lib/active_support/testing/tagged_logging.rb:4 +module ActiveSupport::Testing; end + +# pkg:gem/activesupport#lib/active_support/testing/assertions.rb:7 +module ActiveSupport::Testing::Assertions + # Assertion that the result of evaluating an expression is changed before + # and after invoking the passed in block. + # + # assert_changes 'Status.all_good?' do + # post :create, params: { status: { ok: false } } + # end + # + # You can pass the block as a string to be evaluated in the context of + # the block. A lambda can be passed for the block as well. + # + # assert_changes -> { Status.all_good? } do + # post :create, params: { status: { ok: false } } + # end + # + # The assertion is useful to test side effects. The passed block can be + # anything that can be converted to string with #to_s. + # + # assert_changes :@object do + # @object = 42 + # end + # + # The keyword arguments +:from+ and +:to+ can be given to specify the + # expected initial value and the expected value after the block was + # executed. The comparison is done using case equality (===), which means + # you can specify patterns or classes: + # + # # Exact value match + # assert_changes :@object, from: nil, to: :foo do + # @object = :foo + # end + # + # # Case equality + # assert_changes -> { user.token }, to: /\w{32}/ do + # user.generate_token + # end + # + # # Type check + # assert_changes -> { current_error }, from: nil, to: RuntimeError do + # raise "Oops" + # end + # + # An error message can be specified. + # + # assert_changes -> { Status.all_good? }, 'Expected the status to be bad' do + # post :create, params: { status: { incident: true } } + # end + # + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:212 + def assert_changes(expression, message = T.unsafe(nil), from: T.unsafe(nil), to: T.unsafe(nil), &block); end + + # Test numeric difference between the return value of an expression as a + # result of what is evaluated in the yielded block. + # + # assert_difference 'Article.count' do + # post :create, params: { article: {...} } + # end + # + # An arbitrary expression is passed in and evaluated. + # + # assert_difference 'Article.last.comments(:reload).size' do + # post :create, params: { comment: {...} } + # end + # + # An arbitrary positive or negative difference can be specified. + # The default is +1+. + # + # assert_difference 'Article.count', -1 do + # post :delete, params: { id: ... } + # end + # + # An array of expressions can be passed in and evaluated. + # + # assert_difference [ 'Article.count', 'Post.count' ], 2 do + # post :create, params: { article: {...} } + # end + # + # A hash of expressions/numeric differences can be passed in and evaluated. + # + # assert_difference({ 'Article.count' => 1, 'Notification.count' => 2 }) do + # post :create, params: { article: {...} } + # end + # + # A lambda, a list of lambdas or a hash of lambdas/numeric differences can be passed in and evaluated: + # + # assert_difference ->{ Article.count }, 2 do + # post :create, params: { article: {...} } + # end + # + # assert_difference [->{ Article.count }, ->{ Post.count }], 2 do + # post :create, params: { article: {...} } + # end + # + # assert_difference ->{ Article.count } => 1, ->{ Notification.count } => 2 do + # post :create, params: { article: {...} } + # end + # + # An error message can be specified. + # + # assert_difference 'Article.count', -1, 'An Article should be destroyed' do + # post :delete, params: { id: ... } + # end + # + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:105 + def assert_difference(expression, *args, &block); end + + # Assertion that the result of evaluating an expression is not changed before + # and after invoking the passed in block. + # + # assert_no_changes 'Status.all_good?' do + # post :create, params: { status: { ok: true } } + # end + # + # Provide the optional keyword argument +:from+ to specify the expected + # initial value. The comparison is done using case equality (===), which means + # you can specify patterns or classes: + # + # # Exact value match + # assert_no_changes -> { Status.all_good? }, from: true do + # post :create, params: { status: { ok: true } } + # end + # + # # Case equality + # assert_no_changes -> { user.token }, from: /\w{32}/ do + # user.touch + # end + # + # # Type check + # assert_no_changes -> { current_error }, from: RuntimeError do + # retry_operation + # end + # + # An error message can be specified. + # + # assert_no_changes -> { Status.all_good? }, 'Expected the status to be good' do + # post :create, params: { status: { ok: false } } + # end + # + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:281 + def assert_no_changes(expression, message = T.unsafe(nil), from: T.unsafe(nil), &block); end + + # Assertion that the numeric result of evaluating an expression is not + # changed before and after invoking the passed in block. + # + # assert_no_difference 'Article.count' do + # post :create, params: { article: invalid_attributes } + # end + # + # A lambda can be passed in and evaluated. + # + # assert_no_difference -> { Article.count } do + # post :create, params: { article: invalid_attributes } + # end + # + # An error message can be specified. + # + # assert_no_difference 'Article.count', 'An Article should not be created' do + # post :create, params: { article: invalid_attributes } + # end + # + # An array of expressions can also be passed in and evaluated. + # + # assert_no_difference [ 'Article.count', -> { Post.count } ] do + # post :create, params: { article: invalid_attributes } + # end + # + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:162 + def assert_no_difference(expression, message = T.unsafe(nil), &block); end + + # Asserts that an expression is not truthy. Passes if +object+ is +nil+ or + # +false+. "Truthy" means "considered true in a conditional" like if + # foo. + # + # assert_not nil # => true + # assert_not false # => true + # assert_not 'foo' # => Expected "foo" to be nil or false + # + # An error message can be specified. + # + # assert_not foo, 'foo should be false' + # + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:21 + def assert_not(object, message = T.unsafe(nil)); end + + # Assertion that the block should not raise an exception. + # + # Passes if evaluated code in the yielded block raises no exception. + # + # assert_nothing_raised do + # perform_service(param: 'no_exception') + # end + # + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:48 + def assert_nothing_raised; end + + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:39 + def assert_raise(*exp, match: T.unsafe(nil), &block); end + + # Asserts that a block raises one of +exp+. This is an enhancement of the + # standard Minitest assertion method with the ability to test error + # messages. + # + # assert_raises(ArgumentError, match: /incorrect param/i) do + # perform_service(param: 'exception') + # end + # + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:34 + def assert_raises(*exp, match: T.unsafe(nil), &block); end + + private + + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:316 + def _assert_nothing_raised_or_warn(assertion, &block); end + + # pkg:gem/activesupport#lib/active_support/testing/assertions.rb:331 + def _callable_to_source_string(callable); end +end + +# pkg:gem/activesupport#lib/active_support/testing/assertions.rb:8 +ActiveSupport::Testing::Assertions::UNTRACKED = T.let(T.unsafe(nil), Object) + +# Resolves a constant from a minitest spec name. +# +# Given the following spec-style test: +# +# describe WidgetsController, :index do +# describe "authenticated user" do +# describe "returns widgets" do +# it "has a controller that exists" do +# assert_kind_of WidgetsController, @controller +# end +# end +# end +# end +# +# The test will have the following name: +# +# "WidgetsController::index::authenticated user::returns widgets" +# +# The constant WidgetsController can be resolved from the name. +# The following code will resolve the constant: +# +# controller = determine_constant_from_test_name(name) do |constant| +# Class === constant && constant < ::ActionController::Metal +# end +# +# pkg:gem/activesupport#lib/active_support/testing/constant_lookup.rb:32 +module ActiveSupport::Testing::ConstantLookup + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveSupport::Testing::ConstantLookup::ClassMethods +end + +# pkg:gem/activesupport#lib/active_support/testing/constant_lookup.rb:35 +module ActiveSupport::Testing::ConstantLookup::ClassMethods + # pkg:gem/activesupport#lib/active_support/testing/constant_lookup.rb:36 + def determine_constant_from_test_name(test_name); end +end + +# pkg:gem/activesupport#lib/active_support/testing/constant_stubbing.rb:5 +module ActiveSupport::Testing::ConstantStubbing + # Changes the value of a constant for the duration of a block. Example: + # + # # World::List::Import::LARGE_IMPORT_THRESHOLD = 5000 + # stub_const(World::List::Import, :LARGE_IMPORT_THRESHOLD, 1) do + # assert_equal 1, World::List::Import::LARGE_IMPORT_THRESHOLD + # end + # + # assert_equal 5000, World::List::Import::LARGE_IMPORT_THRESHOLD + # + # Using this method rather than forcing World::List::Import::LARGE_IMPORT_THRESHOLD = 5000 prevents + # warnings from being thrown, and ensures that the old value is returned after the test has completed. + # + # If the constant doesn't already exists, but you need it set for the duration of the block + # you can do so by passing `exists: false`. + # + # stub_const(object, :SOME_CONST, 1, exists: false) do + # assert_equal 1, SOME_CONST + # end + # + # Note: Stubbing a const will stub it across all threads. So if you have concurrent threads + # (like separate test suites running in parallel) that all depend on the same constant, it's possible + # divergent stubbing will trample on each other. + # + # pkg:gem/activesupport#lib/active_support/testing/constant_stubbing.rb:28 + def stub_const(mod, constant, new_value, exists: T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/testing/declarative.rb:5 +module ActiveSupport::Testing::Declarative + # Helper to define a test method using a String. Under the hood, it replaces + # spaces with underscores and defines the test method. + # + # test "verify something" do + # ... + # end + # + # pkg:gem/activesupport#lib/active_support/testing/declarative.rb:13 + def test(name, &block); end +end + +# pkg:gem/activesupport#lib/active_support/testing/deprecation.rb:7 +module ActiveSupport::Testing::Deprecation + # :call-seq: + # assert_deprecated(deprecator, &block) + # assert_deprecated(match, deprecator, &block) + # + # Asserts that a matching deprecation warning was emitted by the given deprecator during the execution of the yielded block. + # + # assert_deprecated(/foo/, CustomDeprecator) do + # CustomDeprecator.warn "foo should no longer be used" + # end + # + # The +match+ object may be a +Regexp+, or +String+ appearing in the message. + # + # assert_deprecated('foo', CustomDeprecator) do + # CustomDeprecator.warn "foo should no longer be used" + # end + # + # If the +match+ is omitted (or explicitly +nil+), any deprecation warning will match. + # + # assert_deprecated(CustomDeprecator) do + # CustomDeprecator.warn "foo should no longer be used" + # end + # + # pkg:gem/activesupport#lib/active_support/testing/deprecation.rb:30 + def assert_deprecated(match = T.unsafe(nil), deprecator = T.unsafe(nil), &block); end + + # Asserts that no deprecation warnings are emitted by the given deprecator during the execution of the yielded block. + # + # assert_not_deprecated(CustomDeprecator) do + # CustomDeprecator.warn "message" # fails assertion + # end + # + # assert_not_deprecated(ActiveSupport::Deprecation.new) do + # CustomDeprecator.warn "message" # passes assertion, different deprecator + # end + # + # pkg:gem/activesupport#lib/active_support/testing/deprecation.rb:55 + def assert_not_deprecated(deprecator, &block); end + + # Returns the return value of the block and an array of all the deprecation warnings emitted by the given + # +deprecator+ during the execution of the yielded block. + # + # collect_deprecations(CustomDeprecator) do + # CustomDeprecator.warn "message" + # ActiveSupport::Deprecation.new.warn "other message" + # :result + # end # => [:result, ["message"]] + # + # pkg:gem/activesupport#lib/active_support/testing/deprecation.rb:69 + def collect_deprecations(deprecator); end +end + +# pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:5 +module ActiveSupport::Testing::ErrorReporterAssertions + # Assertion that the block should cause at least one exception to be reported + # to +Rails.error+. + # + # Passes if the evaluated code in the yielded block reports a matching exception. + # + # assert_error_reported(IOError) do + # Rails.error.report(IOError.new("Oops")) + # end + # + # To test further details about the reported exception, you can use the return + # value. + # + # report = assert_error_reported(IOError) do + # # ... + # end + # assert_equal "Oops", report.error.message + # assert_equal "admin", report.context[:section] + # assert_equal :warning, report.severity + # assert_predicate report, :handled? + # + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:88 + def assert_error_reported(error_class = T.unsafe(nil), &block); end + + # Assertion that the block should not cause an exception to be reported + # to +Rails.error+. + # + # Passes if evaluated code in the yielded block reports no exception. + # + # assert_no_error_reported do + # perform_service(param: 'no_exception') + # end + # + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:62 + def assert_no_error_reported(&block); end + + # Captures reported errors from within the block that match the given + # error class. + # + # reports = capture_error_reports(IOError) do + # Rails.error.report(IOError.new("Oops")) + # Rails.error.report(IOError.new("Oh no")) + # Rails.error.report(StandardError.new) + # end + # + # assert_equal 2, reports.size + # assert_equal "Oops", reports.first.error.message + # assert_equal "Oh no", reports.last.error.message + # + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:118 + def capture_error_reports(error_class = T.unsafe(nil), &block); end +end + +# pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:6 +module ActiveSupport::Testing::ErrorReporterAssertions::ErrorCollector + class << self + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:16 + def record; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:29 + def report(error, **kwargs); end + + private + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:38 + def subscribe; end + end +end + +# pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 +class ActiveSupport::Testing::ErrorReporterAssertions::ErrorCollector::Report < ::Struct + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def context; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def context=(_); end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def error; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def error=(_); end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def handled; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def handled=(_); end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:12 + def handled?; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def severity; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def severity=(_); end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def source; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def source=(_); end + + class << self + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def [](*_arg0); end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def keyword_init?; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def members; end + + # pkg:gem/activesupport#lib/active_support/testing/error_reporter_assertions.rb:10 + def new(*_arg0); end + end +end + +# Provides test helpers for asserting on ActiveSupport::EventReporter events. +# +# pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:6 +module ActiveSupport::Testing::EventReporterAssertions + # Asserts that the block causes an event with the given name to be reported + # to +Rails.event+. + # + # Passes if the evaluated code in the yielded block reports a matching event. + # + # assert_event_reported("user.created") do + # Rails.event.notify("user.created", { id: 123 }) + # end + # + # To test further details about the reported event, you can specify payload and tag matchers. + # + # assert_event_reported("user.created", + # payload: { id: 123, name: "John Doe" }, + # tags: { request_id: /[0-9]+/ } + # ) do + # Rails.event.tagged(request_id: "123") do + # Rails.event.notify("user.created", { id: 123, name: "John Doe" }) + # end + # end + # + # The matchers support partial matching - only the specified keys need to match. + # + # assert_event_reported("user.created", payload: { id: 123 }) do + # Rails.event.notify("user.created", { id: 123, name: "John Doe" }) + # end + # + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:142 + def assert_event_reported(name, payload: T.unsafe(nil), tags: T.unsafe(nil), &block); end + + # Asserts that the provided events were reported, regardless of order. + # + # assert_events_reported([ + # { name: "user.created", payload: { id: 123 } }, + # { name: "email.sent", payload: { to: "user@example.com" } } + # ]) do + # create_user_and_send_welcome_email + # end + # + # Supports the same payload and tag matching as +assert_event_reported+. + # + # assert_events_reported([ + # { + # name: "process.started", + # payload: { id: 123 }, + # tags: { request_id: /[0-9]+/ } + # }, + # { name: "process.completed" } + # ]) do + # Rails.event.tagged(request_id: "456") do + # start_and_complete_process(123) + # end + # end + # + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:184 + def assert_events_reported(expected_events, &block); end + + # Asserts that the block does not cause an event to be reported to +Rails.event+. + # + # If no name is provided, passes if evaluated code in the yielded block reports no events. + # + # assert_no_event_reported do + # service_that_does_not_report_events.perform + # end + # + # If a name is provided, passes if evaluated code in the yielded block reports no events + # with that name. + # + # assert_no_event_reported("user.created") do + # service_that_does_not_report_events.perform + # end + # + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:101 + def assert_no_event_reported(name = T.unsafe(nil), payload: T.unsafe(nil), tags: T.unsafe(nil), &block); end + + # Allows debug events to be reported to +Rails.event+ for the duration of a given block. + # + # with_debug_event_reporting do + # service_that_reports_debug_events.perform + # end + # + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:222 + def with_debug_event_reporting(&block); end +end + +# pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:7 +module ActiveSupport::Testing::EventReporterAssertions::EventCollector + class << self + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:46 + def emit(event); end + + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:53 + def record; end + + private + + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:81 + def event_recorders; end + + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:66 + def subscribe; end + end +end + +# pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:11 +class ActiveSupport::Testing::EventReporterAssertions::EventCollector::Event + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:14 + def initialize(event_data); end + + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:12 + def event_data; end + + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:18 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:22 + def matches?(name, payload, tags); end + + private + + # pkg:gem/activesupport#lib/active_support/testing/event_reporter_assertions.rb:34 + def matches_hash?(expected_hash, event_key); end +end + +# Adds simple access to sample files called file fixtures. +# File fixtures are normal files stored in +# ActiveSupport::TestCase.file_fixture_path. +# +# File fixtures are represented as +Pathname+ objects. +# This makes it easy to extract specific information: +# +# file_fixture("example.txt").read # get the file's content +# file_fixture("example.mp3").size # get the file size +# +# pkg:gem/activesupport#lib/active_support/testing/file_fixtures.rb:16 +module ActiveSupport::Testing::FileFixtures + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + + # Returns a +Pathname+ to the fixture file named +fixture_name+. + # + # Raises +ArgumentError+ if +fixture_name+ can't be found. + # + # pkg:gem/activesupport#lib/active_support/testing/file_fixtures.rb:26 + def file_fixture(fixture_name); end + + module GeneratedClassMethods + def file_fixture_path; end + def file_fixture_path=(value); end + def file_fixture_path?; end + end + + module GeneratedInstanceMethods + def file_fixture_path; end + def file_fixture_path?; end + end +end + +# pkg:gem/activesupport#lib/active_support/testing/isolation.rb:7 +module ActiveSupport::Testing::Isolation + include ::ActiveSupport::Testing::Isolation::Forking + + # pkg:gem/activesupport#lib/active_support/testing/isolation.rb:20 + def run; end + + class << self + # pkg:gem/activesupport#lib/active_support/testing/isolation.rb:16 + def forking_env?; end + + # pkg:gem/activesupport#lib/active_support/testing/isolation.rb:10 + def included(klass); end + end +end + +# pkg:gem/activesupport#lib/active_support/testing/isolation.rb:35 +module ActiveSupport::Testing::Isolation::Forking + # pkg:gem/activesupport#lib/active_support/testing/isolation.rb:36 + def run_in_isolation(&blk); end +end + +# pkg:gem/activesupport#lib/active_support/testing/isolation.rb:73 +module ActiveSupport::Testing::Isolation::Subprocess + # Complicated H4X to get this working in Windows / JRuby with + # no forking. + # + # pkg:gem/activesupport#lib/active_support/testing/isolation.rb:78 + def run_in_isolation(&blk); end +end + +# pkg:gem/activesupport#lib/active_support/testing/isolation.rb:74 +ActiveSupport::Testing::Isolation::Subprocess::ORIG_ARGV = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/testing/isolation.rb:8 +class ActiveSupport::Testing::Isolation::SubprocessCrashed < ::StandardError; end + +# pkg:gem/activesupport#lib/active_support/testing/notification_assertions.rb:5 +module ActiveSupport::Testing::NotificationAssertions + # Assert no notifications were emitted for a given +pattern+. + # + # You can assert no notifications were emitted by passing a pattern, which accepts + # either a string or regexp, and a block. While the block is executed, if no + # matching notifications are emitted, the assertion will pass. + # + # assert_no_notifications("post.submitted") do + # post.destroy # => emits non-matching notification + # end + # + # pkg:gem/activesupport#lib/active_support/testing/notification_assertions.rb:66 + def assert_no_notifications(pattern = T.unsafe(nil), &block); end + + # Assert a notification was emitted with a given +pattern+ and optional +payload+. + # + # You can assert that a notification was emitted by passing a pattern, which accepts + # either a string or regexp, an optional payload, and a block. While the block + # is executed, if a matching notification is emitted, the assertion will pass + # and the notification will be returned. + # + # Note that the payload is matched as a subset, meaning that the notification must + # contain at least the specified keys and values, but may contain additional ones. + # + # assert_notification("post.submitted", title: "Cool Post") do + # post.submit(title: "Cool Post", body: "Cool Body") # => emits matching notification + # end + # + # Using the returned notification, you can make more customized assertions. + # + # notification = assert_notification("post.submitted", title: "Cool Post") do + # ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: Body.new("Cool Body")) + # end + # + # assert_instance_of(Body, notification.payload[:body]) + # + # pkg:gem/activesupport#lib/active_support/testing/notification_assertions.rb:28 + def assert_notification(pattern, payload = T.unsafe(nil), &block); end + + # Assert the number of notifications emitted with a given +pattern+. + # + # You can assert the number of notifications emitted by passing a pattern, which accepts + # either a string or regexp, a count, and a block. While the block is executed, + # the number of matching notifications emitted will be counted. After the block's + # execution completes, the assertion will pass if the count matches. + # + # assert_notifications_count("post.submitted", 1) do + # post.submit(title: "Cool Post") # => emits matching notification + # end + # + # pkg:gem/activesupport#lib/active_support/testing/notification_assertions.rb:51 + def assert_notifications_count(pattern, count, &block); end + + # Capture emitted notifications, optionally filtered by a +pattern+. + # + # You can capture emitted notifications, optionally filtered by a pattern, + # which accepts either a string or regexp, and a block. + # + # notifications = capture_notifications("post.submitted") do + # post.submit(title: "Cool Post") # => emits matching notification + # end + # + # pkg:gem/activesupport#lib/active_support/testing/notification_assertions.rb:85 + def capture_notifications(pattern = T.unsafe(nil), &block); end +end + +# pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:8 +class ActiveSupport::Testing::Parallelization + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:36 + def initialize(worker_count); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:54 + def <<(work); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:26 + def after_fork_hooks; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:43 + def before_fork; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:18 + def before_fork_hooks; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:34 + def run_cleanup_hooks; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:62 + def shutdown; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:58 + def size; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:47 + def start; end + + class << self + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:22 + def after_fork_hook(&blk); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:26 + def after_fork_hooks; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:14 + def before_fork_hook(&blk); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:18 + def before_fork_hooks; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:30 + def run_cleanup_hook(&blk); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization.rb:34 + def run_cleanup_hooks; end + end +end + +# pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:9 +class ActiveSupport::Testing::Parallelization::PrerecordResultClass < ::Struct + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:9 + def name; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:9 + def name=(_); end + + class << self + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:9 + def [](*_arg0); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:9 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:9 + def keyword_init?; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:9 + def members; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:9 + def new(*_arg0); end + end +end + +# pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:11 +class ActiveSupport::Testing::Parallelization::Server + include ::DRb::DRbUndumped + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:14 + def initialize; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:32 + def <<(o); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:64 + def active_workers?; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:68 + def interrupt; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:37 + def pop; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:21 + def record(reporter, result); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:54 + def remove_dead_workers(dead_pids); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:72 + def shutdown; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:44 + def start_worker(worker_id, worker_pid); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/server.rb:49 + def stop_worker(worker_id, worker_pid); end +end + +# pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:6 +class ActiveSupport::Testing::Parallelization::Worker + # pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:7 + def initialize(number, url); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:84 + def after_fork; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:42 + def perform_job(job); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:92 + def run_cleanup; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:60 + def safe_record(reporter, result); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:14 + def start; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:36 + def work_from_queue; end + + private + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:99 + def add_setup_exception(result); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelization/worker.rb:103 + def set_process_title(status); end +end + +# pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:5 +class ActiveSupport::Testing::ParallelizeExecutor + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:8 + def initialize(size:, with:, threshold: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:22 + def <<(work); end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:6 + def parallelize_with; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:26 + def shutdown; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:6 + def size; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:15 + def start; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:6 + def threshold; end + + private + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:35 + def build_parallel_executor; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:72 + def execution_info; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:60 + def many_workers?; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:31 + def parallel_executor; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:47 + def parallelize; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:52 + def parallelized?; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:56 + def should_parallelize?; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:68 + def show_execution_info; end + + # pkg:gem/activesupport#lib/active_support/testing/parallelize_executor.rb:64 + def tests_count; end +end + +# Adds support for +setup+ and +teardown+ callbacks. +# These callbacks serve as a replacement to overwriting the +# #setup and #teardown methods of your TestCase. +# +# class ExampleTest < ActiveSupport::TestCase +# setup do +# # ... +# end +# +# teardown do +# # ... +# end +# end +# +# pkg:gem/activesupport#lib/active_support/testing/setup_and_teardown.rb:20 +module ActiveSupport::Testing::SetupAndTeardown + # pkg:gem/activesupport#lib/active_support/testing/setup_and_teardown.rb:44 + def after_teardown; end + + # pkg:gem/activesupport#lib/active_support/testing/setup_and_teardown.rb:39 + def before_setup; end + + class << self + # pkg:gem/activesupport#lib/active_support/testing/setup_and_teardown.rb:21 + def prepended(klass); end + end +end + +# pkg:gem/activesupport#lib/active_support/testing/setup_and_teardown.rb:27 +module ActiveSupport::Testing::SetupAndTeardown::ClassMethods + # Add a callback, which runs before TestCase#setup. + # + # pkg:gem/activesupport#lib/active_support/testing/setup_and_teardown.rb:29 + def setup(*args, &block); end + + # Add a callback, which runs after TestCase#teardown. + # + # pkg:gem/activesupport#lib/active_support/testing/setup_and_teardown.rb:34 + def teardown(*args, &block); end +end + +# Manages stubs for TimeHelpers +# +# pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:9 +class ActiveSupport::Testing::SimpleStubs + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:12 + def initialize; end + + # Stubs object.method_name with the given block + # If the method is already stubbed, remove that stub + # so that removing this stub will restore the original implementation. + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # target = Time.zone.local(2004, 11, 24, 1, 4, 44) + # simple_stubs.stub_object(Time, :now) { at(target.to_i) } + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:23 + def stub_object(object, method_name, &block); end + + # Returns true if any stubs are set, false if there are none + # + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:53 + def stubbed?; end + + # Returns the Stub for object#method_name + # (nil if it is not stubbed) + # + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:48 + def stubbing(object, method_name); end + + # Remove all object-method stubs held by this instance + # + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:37 + def unstub_all!; end + + private + + # Restores the original object.method described by the Stub + # + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:59 + def unstub_object(stub); end +end + +# pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 +class ActiveSupport::Testing::SimpleStubs::Stub < ::Struct + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def method_name; end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def method_name=(_); end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def object; end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def object=(_); end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def original_method; end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def original_method=(_); end + + class << self + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def [](*_arg0); end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def keyword_init?; end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def members; end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:10 + def new(*_arg0); end + end +end + +# Logs a "PostsControllerTest: test name" heading before each test to +# make test.log easier to search and follow along with. +# +# pkg:gem/activesupport#lib/active_support/testing/tagged_logging.rb:7 +module ActiveSupport::Testing::TaggedLogging + # pkg:gem/activesupport#lib/active_support/testing/tagged_logging.rb:10 + def before_setup; end + + # pkg:gem/activesupport#lib/active_support/testing/tagged_logging.rb:8 + def tagged_logger=(_arg0); end + + private + + # pkg:gem/activesupport#lib/active_support/testing/tagged_logging.rb:22 + def tagged_logger; end +end + +# Warns when a test case does not perform any assertions. +# +# This is helpful in detecting broken tests that do not perform intended assertions. +# +# pkg:gem/activesupport#lib/active_support/testing/tests_without_assertions.rb:8 +module ActiveSupport::Testing::TestsWithoutAssertions + # pkg:gem/activesupport#lib/active_support/testing/tests_without_assertions.rb:9 + def after_teardown; end +end + +# Contains helpers that help you test passage of time. +# +# pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:68 +module ActiveSupport::Testing::TimeHelpers + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:69 + def after_teardown; end + + # Calls +travel_to+ with +date_or_time+, which defaults to +Time.now+. + # Forwards optional with_usec argument. + # + # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00 + # freeze_time + # sleep(1) + # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00 + # freeze_time Time.current + 1.day + # sleep(1) + # Time.current # => Mon, 10 Jul 2017 15:34:49 EST -05:00 + # + # This method also accepts a block, which will return the current time back to its original + # state at the end of the block: + # + # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00 + # freeze_time do + # sleep(1) + # User.create.created_at # => Sun, 09 Jul 2017 15:34:49 EST -05:00 + # end + # Time.current # => Sun, 09 Jul 2017 15:34:50 EST -05:00 + # + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:261 + def freeze_time(date_or_time = T.unsafe(nil), with_usec: T.unsafe(nil), &block); end + + # Changes current time to the time in the future or in the past by a given time difference by + # stubbing +Time.now+, +Date.today+, and +DateTime.now+. The stubs are automatically removed + # at the end of the test. + # + # Note that the usec for the resulting time will be set to 0 to prevent rounding + # errors with external services, like MySQL (which will round instead of floor, + # leading to off-by-one-second errors), unless the with_usec argument + # is set to true. + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # travel 1.day + # Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00 + # Date.current # => Sun, 10 Nov 2013 + # DateTime.current # => Sun, 10 Nov 2013 15:34:49 -0500 + # + # This method also accepts a block, which will return the current time back to its original + # state at the end of the block: + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # travel 1.day do + # User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00 + # end + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:97 + def travel(duration, with_usec: T.unsafe(nil), &block); end + + # Returns the current time back to its original state, by removing the stubs added by + # +travel+, +travel_to+, and +freeze_time+. + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # travel_back + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # This method also accepts a block, which brings the stubs back at the end of the block: + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # travel_back do + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # end + # + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:231 + def travel_back; end + + # Changes current time to the given time by stubbing +Time.now+, +Time.new+, + # +Date.today+, and +DateTime.now+ to return the time or date passed into this method. + # The stubs are automatically removed at the end of the test. + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # Date.current # => Wed, 24 Nov 2004 + # DateTime.current # => Wed, 24 Nov 2004 01:04:44 -0500 + # + # Dates are taken as their timestamp at the beginning of the day in the + # application time zone. Time.current returns said timestamp, + # and Time.now its equivalent in the system time zone. Similarly, + # Date.current returns a date equal to the argument, and + # Date.today the date according to Time.now, which may + # be different. (Note that you rarely want to deal with Time.now, + # or Date.today, in order to honor the application time zone + # please always use Time.current and Date.current.) + # + # Note that the usec for the time passed will be set to 0 to prevent rounding + # errors with external services, like MySQL (which will round instead of floor, + # leading to off-by-one-second errors), unless the with_usec argument + # is set to true. + # + # This method also accepts a block, which will return the current time back to its original + # state at the end of the block: + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) do + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # end + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:133 + def travel_to(date_or_time, with_usec: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:239 + def unfreeze_time; end + + private + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:270 + def in_block; end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:270 + def in_block=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/testing/time_helpers.rb:266 + def simple_stubs; end +end + +# = Active Support \Time With Zone +# +# A Time-like class that can represent a time in any time zone. Necessary +# because standard Ruby Time instances are limited to UTC and the +# system's ENV['TZ'] zone. +# +# You shouldn't ever need to create a TimeWithZone instance directly via +new+. +# Instead use methods +local+, +parse+, +at+, and +now+ on TimeZone instances, +# and +in_time_zone+ on Time and DateTime instances. +# +# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' +# Time.zone.local(2007, 2, 10, 15, 30, 45) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 +# Time.zone.parse('2007-02-10 15:30:45') # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 +# Time.zone.at(1171139445) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 +# Time.zone.now # => Sun, 18 May 2008 13:07:55.754107581 EDT -04:00 +# Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 +# +# See Time and TimeZone for further documentation of these methods. +# +# TimeWithZone instances implement the same API as Ruby Time instances, so +# that Time and TimeWithZone instances are interchangeable. +# +# t = Time.zone.now # => Sun, 18 May 2008 13:27:25.031505668 EDT -04:00 +# t.hour # => 13 +# t.dst? # => true +# t.utc_offset # => -14400 +# t.zone # => "EDT" +# t.to_fs(:rfc822) # => "Sun, 18 May 2008 13:27:25 -0400" +# t + 1.day # => Mon, 19 May 2008 13:27:25.031505668 EDT -04:00 +# t.beginning_of_year # => Tue, 01 Jan 2008 00:00:00.000000000 EST -05:00 +# t > Time.utc(1999) # => true +# t.is_a?(Time) # => true +# t.is_a?(ActiveSupport::TimeWithZone) # => true +# +# pkg:gem/activesupport#lib/active_support/time_with_zone.rb:44 +class ActiveSupport::TimeWithZone + include ::DateAndTime::Compatibility + include ::Comparable + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:51 + def initialize(utc_time, time_zone, local_time = T.unsafe(nil), period = T.unsafe(nil)); end + + # Adds an interval of time to the current object's time and returns that + # value as a new TimeWithZone object. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 + # now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00 + # + # If we're adding a Duration of variable length (i.e., years, months, days), + # move forward from #time, otherwise move forward from #utc, for accuracy + # when moving across DST boundaries. + # + # For instance, a time + 24.hours will advance exactly 24 hours, while a + # time + 1.day will advance 23-25 hours, depending on the day. + # + # now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 + # now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00 + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:314 + def +(other); end + + # Subtracts an interval of time and returns a new TimeWithZone object unless + # the other value +acts_like?+ time. In which case, it will subtract the + # other time and return the difference in seconds as a Float. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 + # now - 1000 # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00 + # + # If subtracting a Duration of variable length (i.e., years, months, days), + # move backward from #time, otherwise move backward from #utc, for accuracy + # when moving across DST boundaries. + # + # For instance, a time - 24.hours will go subtract exactly 24 hours, while a + # time - 1.day will subtract 23-25 hours, depending on the day. + # + # now - 24.hours # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 + # now - 1.day # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00 + # + # If both the TimeWithZone object and the other value act like Time, a Float + # will be returned. + # + # Time.zone.now - 1.day.ago # => 86399.999967 + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:349 + def -(other); end + + # Use the time in UTC for comparisons. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:247 + def <=>(other); end + + # So that +self+ acts_like?(:time). + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:506 + def acts_like_time?; end + + # Uses Date to provide precise Time calculations for years, months, and days + # according to the proleptic Gregorian calendar. The result is returned as a + # new TimeWithZone object. + # + # The +options+ parameter takes a hash with any of these keys: + # :years, :months, :weeks, :days, + # :hours, :minutes, :seconds. + # + # If advancing by a value of variable length (i.e., years, weeks, months, + # days), move forward from #time, otherwise move forward from #utc, for + # accuracy when moving across DST boundaries. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.558049687 EDT -04:00 + # now.advance(seconds: 1) # => Sun, 02 Nov 2014 01:26:29.558049687 EDT -04:00 + # now.advance(minutes: 1) # => Sun, 02 Nov 2014 01:27:28.558049687 EDT -04:00 + # now.advance(hours: 1) # => Sun, 02 Nov 2014 01:26:28.558049687 EST -05:00 + # now.advance(days: 1) # => Mon, 03 Nov 2014 01:26:28.558049687 EST -05:00 + # now.advance(weeks: 1) # => Sun, 09 Nov 2014 01:26:28.558049687 EST -05:00 + # now.advance(months: 1) # => Tue, 02 Dec 2014 01:26:28.558049687 EST -05:00 + # now.advance(years: 1) # => Mon, 02 Nov 2015 01:26:28.558049687 EST -05:00 + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:438 + def advance(options); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:251 + def after?(_arg0); end + + # Subtracts an interval of time from the current object's time and returns + # the result as a new TimeWithZone object. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 + # now.ago(1000) # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00 + # + # If we're subtracting a Duration of variable length (i.e., years, months, + # days), move backward from #time, otherwise move backward from #utc, for + # accuracy when moving across DST boundaries. + # + # For instance, time.ago(24.hours) will move back exactly 24 hours, + # while time.ago(1.day) will move back 23-25 hours, depending on + # the day. + # + # now.ago(24.hours) # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 + # now.ago(1.day) # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00 + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:377 + def ago(other); end + + # Coerces time to a string for JSON encoding. The default format is ISO 8601. + # You can get %Y/%m/%d %H:%M:%S +offset style by setting + # ActiveSupport::JSON::Encoding.use_standard_json_time_format + # to +false+. + # + # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = true + # Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").as_json + # # => "2005-02-01T05:15:10.000-10:00" + # + # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false + # Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").as_json + # # => "2005/02/01 05:15:10 -1000" + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:182 + def as_json(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:250 + def before?(_arg0); end + + # Returns true if the current object's time is within the specified + # +min+ and +max+ time. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:255 + def between?(min, max); end + + # An instance of ActiveSupport::TimeWithZone is never blank + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:517 + def blank?; end + + # Returns a new +ActiveSupport::TimeWithZone+ where one or more of the elements have + # been changed according to the +options+ parameter. The time options (:hour, + # :min, :sec, :usec, :nsec) reset cascadingly, + # so if only the hour is passed, then minute, sec, usec, and nsec is set to 0. If the + # hour and minute is passed, then sec, usec, and nsec is set to 0. The +options+ + # parameter takes a hash with any of these keys: :year, :month, + # :day, :hour, :min, :sec, :usec, + # :nsec, :offset, :zone. Pass either :usec + # or :nsec, not both. Similarly, pass either :zone or + # :offset, not both. + # + # t = Time.zone.now # => Fri, 14 Apr 2017 11:45:15.116992711 EST -05:00 + # t.change(year: 2020) # => Tue, 14 Apr 2020 11:45:15.116992711 EST -05:00 + # t.change(hour: 12) # => Fri, 14 Apr 2017 12:00:00.000000000 EST -05:00 + # t.change(min: 30) # => Fri, 14 Apr 2017 11:30:00.000000000 EST -05:00 + # t.change(offset: "-10:00") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 + # t.change(zone: "Hawaii") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:398 + def change(options); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:72 + def comparable_time; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def day; end + + # Returns true if the current time is within Daylight Savings \Time for the + # specified time zone. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # Time.zone.parse("2012-5-30").dst? # => true + # Time.zone.parse("2012-11-30").dst? # => false + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:100 + def dst?; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:194 + def encode_with(coder); end + + # Returns +true+ if +other+ is equal to current object. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:290 + def eql?(other); end + + # Returns a formatted string of the offset from UTC, or an alternative + # string if the time zone is already UTC. + # + # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)" + # Time.zone.now.formatted_offset(true) # => "-05:00" + # Time.zone.now.formatted_offset(false) # => "-0500" + # Time.zone = 'UTC' # => "UTC" + # Time.zone.now.formatted_offset(true, "0") # => "0" + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:131 + def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:525 + def freeze; end + + # Returns true if the current object's time is in the future. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:285 + def future?; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:73 + def getgm; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:92 + def getlocal(utc_offset = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:74 + def getutc; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:114 + def gmt?; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:120 + def gmt_offset; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:75 + def gmtime; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:121 + def gmtoff; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:294 + def hash; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def hour; end + + # Returns a string of the object's date and time in the format used by + # HTTP requests. + # + # Time.zone.now.httpdate # => "Tue, 01 Jan 2013 04:39:43 GMT" + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:202 + def httpdate; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:324 + def in(other); end + + # Returns the simultaneous time in Time.zone, or the specified zone. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:83 + def in_time_zone(new_zone = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:190 + def init_with(coder); end + + # Returns a string of the object's date, time, zone, and offset from UTC. + # + # Time.zone.now.inspect # => "2024-11-13 07:00:10.528054960 UTC +00:00" + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:146 + def inspect; end + + # Say we're a Time to thwart type checking. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:511 + def is_a?(klass); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:103 + def isdst; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:167 + def iso8601(fraction_digits = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:514 + def kind_of?(klass); end + + # Returns a Time instance of the simultaneous time in the system timezone. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:89 + def localtime(utc_offset = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:531 + def marshal_dump; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:535 + def marshal_load(variables); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def mday; end + + # Send the missing method to +time+ instance, and wrap result in a new + # TimeWithZone with the existing +time_zone+. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:555 + def method_missing(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def min; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def mon; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def month; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:275 + def next_day?; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def nsec; end + + # Returns true if the current object's time is in the past. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:260 + def past?; end + + # Returns the underlying +TZInfo::TimezonePeriod+. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:78 + def period; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:521 + def present?; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:282 + def prev_day?; end + + # respond_to_missing? is not called in some cases, such as when type conversion is + # performed with Kernel#String + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:541 + def respond_to?(sym, include_priv = T.unsafe(nil)); end + + # Returns a string of the object's date and time in the RFC 2822 standard + # format. + # + # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000" + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:210 + def rfc2822; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:168 + def rfc3339(fraction_digits = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:213 + def rfc822; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def sec; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:323 + def since(other); end + + # Replaces %Z directive with +zone before passing to Time#strftime, + # so that zone information is correct. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:241 + def strftime(format); end + + # Returns a Time instance that represents the time in +time_zone+. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:64 + def time; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:49 + def time_zone; end + + # Returns Array of parts of Time in sequence of + # [seconds, minutes, hours, day, month, year, weekday, yearday, dst?, zone]. + # + # now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27.485278555 UTC +00:00 + # now.to_a # => [27, 29, 2, 18, 8, 2015, 2, 230, false, "UTC"] + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:461 + def to_a; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def to_date; end + + # Returns an instance of DateTime with the timezone's UTC offset + # + # Time.zone.now.to_datetime # => Tue, 18 Aug 2015 02:32:20 +0000 + # Time.current.in_time_zone('Hawaii').to_datetime # => Mon, 17 Aug 2015 16:32:20 -1000 + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:494 + def to_datetime; end + + # Returns the object's date and time as a floating-point number of seconds + # since the Epoch (January 1, 1970 00:00 UTC). + # + # Time.zone.now.to_f # => 1417709320.285418 + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:469 + def to_f; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:237 + def to_formatted_s(format = T.unsafe(nil)); end + + # Returns a string of the object's date and time. + # + # This method is aliased to to_formatted_s. + # + # Accepts an optional format: + # * :default - default value, mimics Ruby Time#to_s format. + # * :db - format outputs time in UTC :db time. See Time#to_fs(:db). + # * Any key in +Time::DATE_FORMATS+ can be used. See active_support/core_ext/time/conversions.rb. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:228 + def to_fs(format = T.unsafe(nil)); end + + # Returns the object's date and time as an integer number of seconds + # since the Epoch (January 1, 1970 00:00 UTC). + # + # Time.zone.now.to_i # => 1417709320 + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:477 + def to_i; end + + # Returns the object's date and time as a rational number of seconds + # since the Epoch (January 1, 1970 00:00 UTC). + # + # Time.zone.now.to_r # => (708854548642709/500000) + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:486 + def to_r; end + + # Returns a string of the object's date and time. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:216 + def to_s; end + + # Returns an instance of +Time+, either with the same timezone as +self+, + # with the same UTC offset as +self+ or in the local system timezone + # depending on the setting of +ActiveSupport.to_time_preserves_timezone+. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:501 + def to_time; end + + # Returns true if the current object's time falls within + # the current day. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:266 + def today?; end + + # Returns true if the current object's time falls within + # the next day (tomorrow). + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:272 + def tomorrow?; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:480 + def tv_sec; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def usec; end + + # Returns a Time instance of the simultaneous time in the UTC timezone. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:69 + def utc; end + + # Returns true if the current time zone is set to UTC. + # + # Time.zone = 'UTC' # => 'UTC' + # Time.zone.now.utc? # => true + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # Time.zone.now.utc? # => false + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:111 + def utc?; end + + # Returns the offset from current time to UTC time in seconds. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:117 + def utc_offset; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def wday; end + + # Returns a string of the object's date and time in the ISO 8601 standard + # format. + # + # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00" + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:154 + def xmlschema(fraction_digits = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def yday; end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:449 + def year; end + + # Returns true if the current object's time falls within + # the previous day (yesterday). + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:279 + def yesterday?; end + + # Returns the time zone abbreviation. + # + # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)" + # Time.zone.now.zone # => "EST" + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:139 + def zone; end + + private + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:593 + def duration_of_variable_length?(obj); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:574 + def get_period_and_ensure_valid_local_time(period); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:564 + def incorporate_utc_offset(time, offset); end + + # Ensure proxy class responds to all methods that underlying time instance + # responds to. + # + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:549 + def respond_to_missing?(sym, include_priv); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:587 + def transfer_time_values_to_utc_constructor(time); end + + # pkg:gem/activesupport#lib/active_support/time_with_zone.rb:597 + def wrap_with_time_zone(time); end +end + +# pkg:gem/activesupport#lib/active_support/time_with_zone.rb:45 +ActiveSupport::TimeWithZone::PRECISIONS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/time_with_zone.rb:562 +ActiveSupport::TimeWithZone::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer) + +# = Active Support \Time Zone +# +# The TimeZone class serves as a wrapper around +TZInfo::Timezone+ instances. +# It allows us to do the following: +# +# * Limit the set of zones provided by TZInfo to a meaningful subset of 134 +# zones. +# * Retrieve and display zones with a friendlier name +# (e.g., "Eastern \Time (US & Canada)" instead of "America/New_York"). +# * Lazily load +TZInfo::Timezone+ instances only when they're needed. +# * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+, +# +parse+, +at+, and +now+ methods. +# +# If you set config.time_zone in the \Rails Application, you can +# access this TimeZone object via Time.zone: +# +# # application.rb: +# class Application < Rails::Application +# config.time_zone = 'Eastern Time (US & Canada)' +# end +# +# Time.zone # => # +# Time.zone.name # => "Eastern Time (US & Canada)" +# Time.zone.now # => Sun, 18 May 2008 14:30:44 EDT -04:00 +# +# pkg:gem/activesupport#lib/active_support/values/time_zone.rb:31 +class ActiveSupport::TimeZone + include ::Comparable + + # :stopdoc: + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:310 + def initialize(name, utc_offset = T.unsafe(nil), tzinfo = T.unsafe(nil)); end + + # Compare this time zone to the parameter. The two are compared first on + # their offsets, and then by name. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:340 + def <=>(zone); end + + # Compare #name and TZInfo identifier to a supplied regexp, returning +true+ + # if a match is found. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:349 + def =~(re); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:574 + def abbr(time); end + + # \Method for creating new ActiveSupport::TimeWithZone instance in time zone + # of +self+ from number of seconds since the Unix epoch. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.utc(2000).to_f # => 946684800.0 + # Time.zone.at(946684800.0) # => Fri, 31 Dec 1999 14:00:00 HST -10:00 + # + # A second argument can be supplied to specify sub-second precision. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.at(946684800, 123456.789).nsec # => 123456789 + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:386 + def at(*args); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:578 + def dst?(time); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:586 + def encode_with(coder); end + + # Returns a formatted string of the offset from UTC, or an alternative + # string if the time zone is already UTC. + # + # zone = ActiveSupport::TimeZone['Central Time (US & Canada)'] + # zone.formatted_offset # => "-06:00" + # zone.formatted_offset(false) # => "-0600" + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:334 + def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:582 + def init_with(coder); end + + # \Method for creating new ActiveSupport::TimeWithZone instance in time zone + # of +self+ from an ISO 8601 string. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.iso8601('1999-12-31T14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 + # + # If the time components are missing then they will be set to zero. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.iso8601('1999-12-31') # => Fri, 31 Dec 1999 00:00:00 HST -10:00 + # + # If the string is invalid then an +ArgumentError+ will be raised unlike +parse+ + # which usually returns +nil+ when given an invalid date string. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:403 + def iso8601(str); end + + # \Method for creating new ActiveSupport::TimeWithZone instance in time zone + # of +self+ from given values. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.local(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00 + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:370 + def local(*args); end + + # Adjust the given time to the simultaneous time in UTC. Returns a + # Time.utc() instance. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:558 + def local_to_utc(time, dst = T.unsafe(nil)); end + + # Compare #name and TZInfo identifier to a supplied regexp, returning +true+ + # if a match is found. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:355 + def match?(re); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:297 + def name; end + + # Returns an ActiveSupport::TimeWithZone instance representing the current + # time in the time zone represented by +self+. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00 + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:523 + def now; end + + # \Method for creating new ActiveSupport::TimeWithZone instance in time zone + # of +self+ from parsed string. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 + # + # If upper components are missing from the string, they are supplied from + # TimeZone#now: + # + # Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00 + # Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00 + # + # However, if the date component is not provided, but any other upper + # components are supplied, then the day of the month defaults to 1: + # + # Time.zone.parse('Mar 2000') # => Wed, 01 Mar 2000 00:00:00 HST -10:00 + # + # If the string is invalid then an +ArgumentError+ could be raised. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:460 + def parse(str, now = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:566 + def period_for_local(time, dst = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:562 + def period_for_utc(time); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:570 + def periods_for_local(time); end + + # \Method for creating new ActiveSupport::TimeWithZone instance in time zone + # of +self+ from an RFC 3339 string. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.rfc3339('2000-01-01T00:00:00Z') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 + # + # If the time or zone components are missing then an +ArgumentError+ will + # be raised. This is much stricter than either +parse+ or +iso8601+ which + # allow for missing components. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.rfc3339('1999-12-31') # => ArgumentError: invalid date + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:476 + def rfc3339(str); end + + # Returns a standard time zone name defined by IANA + # https://www.iana.org/time-zones + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:319 + def standard_name; end + + # Parses +str+ according to +format+ and returns an ActiveSupport::TimeWithZone. + # + # Assumes that +str+ is a time in the time zone +self+, + # unless +format+ includes an explicit time zone. + # (This is the same behavior as +parse+.) + # In either case, the returned TimeWithZone has the timezone of +self+. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.strptime('1999-12-31 14:00:00', '%Y-%m-%d %H:%M:%S') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 + # + # If upper components are missing from the string, they are supplied from + # TimeZone#now: + # + # Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00 + # Time.zone.strptime('22:30:00', '%H:%M:%S') # => Fri, 31 Dec 1999 22:30:00 HST -10:00 + # + # However, if the date component is not provided, but any other upper + # components are supplied, then the day of the month defaults to 1: + # + # Time.zone.strptime('Mar 2000', '%b %Y') # => Wed, 01 Mar 2000 00:00:00 HST -10:00 + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:514 + def strptime(str, format, now = T.unsafe(nil)); end + + # Returns a textual representation of this time zone. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:361 + def to_s; end + + # Returns the current date in this time zone. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:528 + def today; end + + # Returns the next date in this time zone. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:533 + def tomorrow; end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:298 + def tzinfo; end + + # Returns the offset of this time zone from UTC in seconds. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:324 + def utc_offset; end + + # Adjust the given time to the simultaneous time in the time zone + # represented by +self+. Returns a local time with the appropriate offset + # -- if you want an ActiveSupport::TimeWithZone instance, use + # Time#in_time_zone() instead. + # + # As of tzinfo 2, utc_to_local returns a Time with a non-zero utc_offset. + # See the +utc_to_local_returns_utc_offset_times+ config for more info. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:549 + def utc_to_local(time); end + + # Returns the previous date in this time zone. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:538 + def yesterday; end + + private + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:592 + def parts_to_time(parts, now); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:617 + def time_now; end + + class << self + # Locate a specific time zone object. If the argument is a string, it + # is interpreted to mean the name of the timezone to locate. If it is a + # numeric value it is either the hour offset, or the second offset, of the + # timezone to find. (The first one with that offset will be returned.) + # Returns +nil+ if no such time zone is known to the system. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:233 + def [](arg); end + + # Returns an array of all TimeZone objects. There are multiple + # TimeZone objects per time zone, in many cases, to make it easier + # for users to find their own time zone. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:224 + def all; end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:266 + def clear; end + + # A convenience method for returning a collection of TimeZone objects + # for time zones in the country specified by its ISO 3166-1 Alpha2 code. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:261 + def country_zones(country_code); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:212 + def create(*_arg0); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:208 + def find_tzinfo(name); end + + # Returns a TimeZone instance with the given name, or +nil+ if no + # such TimeZone instance exists. (This exists to support the use of + # this class with the +composed_of+ macro.) + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:217 + def new(name); end + + # Assumes self represents an offset from UTC in seconds (as returned from + # Time#utc_offset) and turns this into an +HH:MM formatted string. + # + # ActiveSupport::TimeZone.seconds_to_utc_offset(-21_600) # => "-06:00" + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:200 + def seconds_to_utc_offset(seconds, colon = T.unsafe(nil)); end + + # A convenience method for returning a collection of TimeZone objects + # for time zones in the USA. + # + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:255 + def us_zones; end + + private + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:274 + def load_country_zones(code); end + + # pkg:gem/activesupport#lib/active_support/values/time_zone.rb:288 + def zones_map; end + end +end + +# Keys are \Rails TimeZone names, values are TZInfo identifiers. +# +# pkg:gem/activesupport#lib/active_support/values/time_zone.rb:33 +ActiveSupport::TimeZone::MAPPING = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/values/time_zone.rb:189 +ActiveSupport::TimeZone::UTC_OFFSET_WITHOUT_COLON = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/values/time_zone.rb:188 +ActiveSupport::TimeZone::UTC_OFFSET_WITH_COLON = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:35 +module ActiveSupport::ToJsonWithActiveSupportEncoder + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:36 + def to_json(options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/try.rb:6 +module ActiveSupport::Tryable + # pkg:gem/activesupport#lib/active_support/core_ext/object/try.rb:7 + def try(*args, **, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/try.rb:20 + def try!(*args, **, &block); end +end + +# pkg:gem/activesupport#lib/active_support/gem_version.rb:9 +module ActiveSupport::VERSION; end + +# pkg:gem/activesupport#lib/active_support/gem_version.rb:10 +ActiveSupport::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/gem_version.rb:11 +ActiveSupport::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/gem_version.rb:13 +ActiveSupport::VERSION::PRE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/gem_version.rb:15 +ActiveSupport::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/gem_version.rb:12 +ActiveSupport::VERSION::TINY = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:140 +class ActiveSupport::XMLConverter + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:151 + def initialize(xml, disallowed_types = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:156 + def to_h; end + + private + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:222 + def become_array?(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:218 + def become_content?(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:226 + def become_empty_string?(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:232 + def become_hash?(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:172 + def deep_to_h(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:241 + def garbage?(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:161 + def normalize_keys(params); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:236 + def nothing?(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:257 + def process_array(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:248 + def process_content(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:185 + def process_hash(value); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:149 +ActiveSupport::XMLConverter::DISALLOWED_TYPES = T.let(T.unsafe(nil), Array) + +# Raised if the XML contains attributes with type="yaml" or +# type="symbol". Read Hash#from_xml for more details. +# +# pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:143 +class ActiveSupport::XMLConverter::DisallowedType < ::StandardError + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:144 + def initialize(type); end +end + +# = \XmlMini +# +# To use the much faster libxml parser: +# gem "libxml-ruby" +# XmlMini.backend = 'LibXML' +# +# pkg:gem/activesupport#lib/active_support/xml_mini.rb:17 +module ActiveSupport::XmlMini + extend ::ActiveSupport::XmlMini + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:102 + def backend; end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:106 + def backend=(name); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:97 + def depth; end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:97 + def depth=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:100 + def parse(*, **, &); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:153 + def rename_key(key, options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:120 + def to_tag(key, value, options); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:112 + def with_backend(name); end + + private + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:164 + def _dasherize(key); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:170 + def _parse_binary(bin, entity); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:181 + def _parse_file(file, entity); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:189 + def _parse_hex_binary(bin); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:201 + def cast_backend_name_to_module(name); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:193 + def current_thread_backend; end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:197 + def current_thread_backend=(name); end +end + +# pkg:gem/activesupport#lib/active_support/xml_mini.rb:34 +ActiveSupport::XmlMini::DEFAULT_ENCODINGS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/xml_mini.rb:56 +ActiveSupport::XmlMini::FORMATTING = T.let(T.unsafe(nil), Hash) + +# This module decorates files deserialized using Hash.from_xml with +# the original_filename and content_type methods. +# +# pkg:gem/activesupport#lib/active_support/xml_mini.rb:22 +module ActiveSupport::XmlMini::FileLike + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:29 + def content_type; end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:23 + def content_type=(_arg0); end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:25 + def original_filename; end + + # pkg:gem/activesupport#lib/active_support/xml_mini.rb:23 + def original_filename=(_arg0); end +end + +# pkg:gem/activesupport#lib/active_support/xml_mini.rb:66 +ActiveSupport::XmlMini::PARSING = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/xml_mini.rb:39 +ActiveSupport::XmlMini::TYPE_NAMES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:8 +module ActiveSupport::XmlMini_REXML + extend ::ActiveSupport::XmlMini_REXML + + # Parse an XML Document string or IO into a simple hash. + # + # Same as XmlSimple::xml_in but doesn't shoot itself in the foot, + # and uses the defaults from Active Support. + # + # data:: + # XML Document string or IO to parse + # + # pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:20 + def parse(data); end + + private + + # Actually converts an XML document element into a data structure. + # + # element:: + # The document element to be collapsed. + # + # pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:63 + def collapse(element, depth); end + + # Determines if a document element has text content + # + # element:: + # XML element to be checked. + # + # pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:133 + def empty_content?(element); end + + # Converts the attributes array of an XML element into a hash. + # Returns an empty Hash if node has no attributes. + # + # element:: + # XML element to extract attributes from. + # + # pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:123 + def get_attributes(element); end + + # Adds a new key/value pair to an existing Hash. If the key to be added + # already exists and the existing value associated with key is not + # an Array, it will be wrapped in an Array. Then the new value is + # appended to that Array. + # + # hash:: + # Hash to add key/value pair to. + # key:: + # Key to be added. + # value:: + # Value to be associated with key. + # + # pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:103 + def merge!(hash, key, value); end + + # Convert an XML element and merge into the hash + # + # hash:: + # Hash to merge the converted element into. + # element:: + # XML element to merge into hash + # + # pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:54 + def merge_element!(hash, element, depth); end + + # Merge all the texts of an element into the hash + # + # hash:: + # Hash to add the converted element to. + # element:: + # XML element whose texts are to me merged into the hash + # + # pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:81 + def merge_texts!(hash, element); end + + # pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:41 + def require_rexml; end +end + +# pkg:gem/activesupport#lib/active_support/xml_mini/rexml.rb:11 +ActiveSupport::XmlMini_REXML::CONTENT_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/core_ext/array/extract.rb:3 +class Array + include ::Enumerable + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:164 + def as_json(options = T.unsafe(nil)); end + + # An array is blank if it's empty: + # + # [].blank? # => true + # [1,2,3].blank? # => false + # + # @return [true, false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:102 + def blank?; end + + # Removes all blank elements from the +Array+ in place and returns self. + # Uses Object#blank? for determining if an item is blank. + # + # a = [1, "", nil, 2, " ", [], {}, false, true] + # a.compact_blank! + # # => [1, 2, true] + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:275 + def compact_blank!; end + + # Returns a deep copy of array. + # + # array = [1, [2, 3]] + # dup = array.deep_dup + # dup[1][2] = 4 + # + # array[1][2] # => nil + # dup[1][2] # => 4 + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/deep_dup.rb:29 + def deep_dup; end + + # Returns a copy of the Array excluding the specified elements. + # + # ["David", "Rafael", "Aaron", "Todd"].excluding("Aaron", "Todd") # => ["David", "Rafael"] + # [ [ 0, 1 ], [ 1, 0 ] ].excluding([ [ 1, 0 ] ]) # => [ [ 0, 1 ] ] + # + # Note: This is an optimization of Enumerable#excluding that uses Array#- + # instead of Array#reject for performance reasons. + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:47 + def excluding(*elements); end + + # Removes and returns the elements for which the block returns a true value. + # If no block is given, an Enumerator is returned instead. + # + # numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + # odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9] + # numbers # => [0, 2, 4, 6, 8] + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/extract.rb:10 + def extract!; end + + # Extracts options from a set of arguments. Removes and returns the last + # element in the array if it's a hash, otherwise returns a blank hash. + # + # def options(*args) + # args.extract_options! + # end + # + # options(1, 2) # => {} + # options(1, 2, a: :b) # => {:a=>:b} + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/extract_options.rb:24 + def extract_options!; end + + # Equal to self[4]. + # + # %w( a b c d e ).fifth # => "e" + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:76 + def fifth; end + + # Equal to self[41]. Also known as accessing "the reddit". + # + # (1..42).to_a.forty_two # => 42 + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:83 + def forty_two; end + + # Equal to self[3]. + # + # %w( a b c d e ).fourth # => "d" + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:69 + def fourth; end + + # Returns the tail of the array from +position+. + # + # %w( a b c d ).from(0) # => ["a", "b", "c", "d"] + # %w( a b c d ).from(2) # => ["c", "d"] + # %w( a b c d ).from(10) # => [] + # %w().from(0) # => [] + # %w( a b c d ).from(-2) # => ["c", "d"] + # %w( a b c ).from(-10) # => [] + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:12 + def from(position); end + + # Splits or iterates over the array in +number+ of groups, padding any + # remaining slots with +fill_with+ unless it is +false+. + # + # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3) {|group| p group} + # ["1", "2", "3", "4"] + # ["5", "6", "7", nil] + # ["8", "9", "10", nil] + # + # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3, ' ') {|group| p group} + # ["1", "2", "3", "4"] + # ["5", "6", "7", " "] + # ["8", "9", "10", " "] + # + # %w(1 2 3 4 5 6 7).in_groups(3, false) {|group| p group} + # ["1", "2", "3"] + # ["4", "5"] + # ["6", "7"] + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/grouping.rb:62 + def in_groups(number, fill_with = T.unsafe(nil), &block); end + + # Splits or iterates over the array in groups of size +number+, + # padding any remaining slots with +fill_with+ unless it is +false+. + # + # %w(1 2 3 4 5 6 7 8 9 10).in_groups_of(3) {|group| p group} + # ["1", "2", "3"] + # ["4", "5", "6"] + # ["7", "8", "9"] + # ["10", nil, nil] + # + # %w(1 2 3 4 5).in_groups_of(2, ' ') {|group| p group} + # ["1", "2"] + # ["3", "4"] + # ["5", " "] + # + # %w(1 2 3 4 5).in_groups_of(2, false) {|group| p group} + # ["1", "2"] + # ["3", "4"] + # ["5"] + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/grouping.rb:22 + def in_groups_of(number, fill_with = T.unsafe(nil), &block); end + + # Returns a new array that includes the passed elements. + # + # [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ] + # [ [ 0, 1 ] ].including([ [ 1, 0 ] ]) # => [ [ 0, 1 ], [ 1, 0 ] ] + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:36 + def including(*elements); end + + # Wraps the array in an ActiveSupport::ArrayInquirer object, which gives a + # friendlier way to check its string-like contents. + # + # pets = [:cat, :dog].inquiry + # + # pets.cat? # => true + # pets.ferret? # => false + # + # pets.any?(:cat, :ferret) # => true + # pets.any?(:ferret, :alligator) # => false + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/inquiry.rb:16 + def inquiry; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:104 + def present?; end + + # Equal to self[1]. + # + # %w( a b c d e ).second # => "b" + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:55 + def second; end + + # Equal to self[-2]. + # + # %w( a b c d e ).second_to_last # => "d" + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:97 + def second_to_last; end + + # Divides the array into one or more subarrays based on a delimiting +value+ + # or the result of an optional block. + # + # [1, 2, 3, 4, 5].split(3) # => [[1, 2], [4, 5]] + # (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]] + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/grouping.rb:93 + def split(value = T.unsafe(nil), &block); end + + # Equal to self[2]. + # + # %w( a b c d e ).third # => "c" + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:62 + def third; end + + # Equal to self[-3]. + # + # %w( a b c d e ).third_to_last # => "c" + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:90 + def third_to_last; end + + # Returns the beginning of the array up to +position+. + # + # %w( a b c d ).to(0) # => ["a"] + # %w( a b c d ).to(2) # => ["a", "b", "c"] + # %w( a b c d ).to(10) # => ["a", "b", "c", "d"] + # %w().to(0) # => [] + # %w( a b c d ).to(-2) # => ["a", "b", "c"] + # %w( a b c ).to(-10) # => [] + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:24 + def to(position); end + + # pkg:gem/activesupport#lib/active_support/core_ext/array/conversions.rb:106 + def to_formatted_s(format = T.unsafe(nil)); end + + # Extends Array#to_s to convert a collection of elements into a + # comma separated id list if :db argument is given as the format. + # + # This method is aliased to to_formatted_s. + # + # Blog.all.to_fs(:db) # => "1,2,3" + # Blog.none.to_fs(:db) # => "null" + # [1,2].to_fs # => "[1, 2]" + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/conversions.rb:94 + def to_fs(format = T.unsafe(nil)); end + + # Calls to_param on all its elements and joins the result with + # slashes. This is used by url_for in Action Pack. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:48 + def to_param; end + + # Converts an array into a string suitable for use as a URL query string, + # using the given +key+ as the param name. + # + # ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding" + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:56 + def to_query(key); end + + # Converts the array to a comma-separated sentence where the last element is + # joined by the connector word. + # + # You can pass the following options to change the default behavior. If you + # pass an option key that doesn't exist in the list below, it will raise an + # ArgumentError. + # + # ==== Options + # + # * :words_connector - The sign or word used to join all but the last + # element in arrays with three or more elements (default: ", "). + # * :last_word_connector - The sign or word used to join the last element + # in arrays with three or more elements (default: ", and "). + # * :two_words_connector - The sign or word used to join the elements + # in arrays with two elements (default: " and "). + # * :locale - If +i18n+ is available, you can set a locale and use + # the connector options defined on the 'support.array' namespace in the + # corresponding dictionary file. + # + # ==== Examples + # + # [].to_sentence # => "" + # ['one'].to_sentence # => "one" + # ['one', 'two'].to_sentence # => "one and two" + # ['one', 'two', 'three'].to_sentence # => "one, two, and three" + # + # ['one', 'two'].to_sentence(passing: 'invalid option') + # # => ArgumentError: Unknown key: :passing. Valid keys are: :words_connector, :two_words_connector, :last_word_connector, :locale + # + # ['one', 'two'].to_sentence(two_words_connector: '-') + # # => "one-two" + # + # ['one', 'two', 'three'].to_sentence(words_connector: ' or ', last_word_connector: ' or at least ') + # # => "one or two or at least three" + # + # Using :locale option: + # + # # Given this locale dictionary: + # # + # # es: + # # support: + # # array: + # # words_connector: " o " + # # two_words_connector: " y " + # # last_word_connector: " o al menos " + # + # ['uno', 'dos'].to_sentence(locale: :es) + # # => "uno y dos" + # + # ['uno', 'dos', 'tres'].to_sentence(locale: :es) + # # => "uno o dos o al menos tres" + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/conversions.rb:60 + def to_sentence(options = T.unsafe(nil)); end + + # Returns a string that represents the array in XML by invoking +to_xml+ + # on each element. Active Record collections delegate their representation + # in XML to this method. + # + # All elements are expected to respond to +to_xml+, if any of them does + # not then an exception is raised. + # + # The root node reflects the class name of the first element in plural + # if all elements belong to the same type and that's not Hash: + # + # customer.projects.to_xml + # + # + # + # + # 20000.0 + # 1567 + # 2008-04-09 + # ... + # + # + # 57230.0 + # 1567 + # 2008-04-15 + # ... + # + # + # + # Otherwise the root element is "objects": + # + # [{ foo: 1, bar: 2}, { baz: 3}].to_xml + # + # + # + # + # 2 + # 1 + # + # + # 3 + # + # + # + # If the collection is empty the root element is "nil-classes" by default: + # + # [].to_xml + # + # + # + # + # To ensure a meaningful root element use the :root option: + # + # customer_with_no_projects.projects.to_xml(root: 'projects') + # + # + # + # + # By default name of the node for the children of root is root.singularize. + # You can change it with the :children option. + # + # The +options+ hash is passed downwards: + # + # Message.all.to_xml(skip_types: true) + # + # + # + # + # 2008-03-07T09:58:18+01:00 + # 1 + # 1 + # 2008-03-07T09:58:18+01:00 + # 1 + # + # + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/conversions.rb:183 + def to_xml(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/array/access.rb:50 + def without(*elements); end + + class << self + # Wraps its argument in an array unless it is already an array (or array-like). + # + # Specifically: + # + # * If the argument is +nil+ an empty array is returned. + # * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned. + # * Otherwise, returns an array with the argument as its single element. + # + # Array.wrap(nil) # => [] + # Array.wrap([1, 2, 3]) # => [1, 2, 3] + # Array.wrap(0) # => [0] + # + # This method is similar in purpose to Kernel#Array, but there are some differences: + # + # * If the argument responds to +to_ary+ the method is invoked. Kernel#Array + # moves on to try +to_a+ if the returned value is +nil+, but Array.wrap returns + # an array with the argument as its single element right away. + # * If the returned value from +to_ary+ is neither +nil+ nor an +Array+ object, Kernel#Array + # raises an exception, while Array.wrap does not, it just returns the value. + # * It does not call +to_a+ on the argument, if the argument does not respond to +to_ary+ + # it returns an array with the argument as its single element. + # + # The last point is easily explained with some enumerables: + # + # Array(foo: :bar) # => [[:foo, :bar]] + # Array.wrap(foo: :bar) # => [{:foo=>:bar}] + # + # There's also a related idiom that uses the splat operator: + # + # [*object] + # + # which returns [] for +nil+, but calls to Array(object) otherwise. + # + # The differences with Kernel#Array explained above + # apply to the rest of objects. + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/wrap.rb:39 + def wrap(object); end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:124 +class BigDecimal < ::Numeric + include ::ActiveSupport::BigDecimalWithDefaultFormat + include ::ActiveSupport::NumericWithFormat + + # A BigDecimal would be naturally represented as a JSON number. Most libraries, + # however, parse non-integer JSON numbers directly as floats. Clients using + # those libraries would get in general a wrong number and no way to recover + # other than manually inspecting the string with the JSON code itself. + # + # That's why a JSON string is returned. The JSON literal is not numeric, but + # if the other end knows by contract that the data is supposed to be a + # BigDecimal, it still has the chance to post-process the string and get the + # real value. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:134 + def as_json(options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/class/attribute.rb:6 +class Class < ::Module + include ::ActiveSupport::DescendantsTracker::ReloadedClassesFiltering + + # Declare a class-level attribute whose value is inheritable by subclasses. + # Subclasses can change their own value and it will not impact parent class. + # + # ==== Options + # + # * :instance_reader - Sets the instance reader method (defaults to true). + # * :instance_writer - Sets the instance writer method (defaults to true). + # * :instance_accessor - Sets both instance methods (defaults to true). + # * :instance_predicate - Sets a predicate method (defaults to true). + # * :default - Sets a default value for the attribute (defaults to nil). + # + # ==== Examples + # + # class Base + # class_attribute :setting + # end + # + # class Subclass < Base + # end + # + # Base.setting = true + # Subclass.setting # => true + # Subclass.setting = false + # Subclass.setting # => false + # Base.setting # => true + # + # In the above case as long as Subclass does not assign a value to setting + # by performing Subclass.setting = _something_, Subclass.setting + # would read value assigned to parent class. Once Subclass assigns a value then + # the value assigned by Subclass would be returned. + # + # This matches normal Ruby method inheritance: think of writing an attribute + # on a subclass as overriding the reader method. However, you need to be aware + # when using +class_attribute+ with mutable structures as +Array+ or +Hash+. + # In such cases, you don't want to do changes in place. Instead use setters: + # + # Base.setting = [] + # Base.setting # => [] + # Subclass.setting # => [] + # + # # Appending in child changes both parent and child because it is the same object: + # Subclass.setting << :foo + # Base.setting # => [:foo] + # Subclass.setting # => [:foo] + # + # # Use setters to not propagate changes: + # Base.setting = [] + # Subclass.setting += [:foo] + # Base.setting # => [] + # Subclass.setting # => [:foo] + # + # For convenience, an instance predicate method is defined as well. + # To skip it, pass instance_predicate: false. + # + # Subclass.setting? # => false + # + # Instances may overwrite the class value in the same way: + # + # Base.setting = true + # object = Base.new + # object.setting # => true + # object.setting = false + # object.setting # => false + # Base.setting # => true + # + # To opt out of the instance reader method, pass instance_reader: false. + # + # object.setting # => NoMethodError + # object.setting? # => NoMethodError + # + # To opt out of the instance writer method, pass instance_writer: false. + # + # object.setting = false # => NoMethodError + # + # To opt out of both instance methods, pass instance_accessor: false. + # + # To set a default value for the attribute, pass default:, like so: + # + # class_attribute :settings, default: {} + # + # pkg:gem/activesupport#lib/active_support/core_ext/class/attribute.rb:86 + def class_attribute(*attrs, instance_accessor: T.unsafe(nil), instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_predicate: T.unsafe(nil), default: T.unsafe(nil)); end + + # Returns an array with all classes that are < than its receiver. + # + # class C; end + # C.descendants # => [] + # + # class B < C; end + # C.descendants # => [B] + # + # class A < B; end + # C.descendants # => [B, A] + # + # class D < C; end + # C.descendants # => [B, A, D] + # + # pkg:gem/activesupport#lib/active_support/core_ext/class/subclasses.rb:19 + def descendants; end + + # pkg:gem/activesupport#lib/active_support/descendants_tracker.rb:59 + def subclasses; end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:68 +class Data + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:69 + def as_json(options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/date/zones.rb:6 +class Date + include ::Comparable + include ::DateAndTime::Zones + include ::DateAndTime::Calculations + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:98 + def +(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:108 + def -(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:160 + def <=>(other); end + + # Duck-types as a Date-like class. See Object#acts_like?. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/acts_like.rb:7 + def acts_like_date?; end + + # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with + # any of these keys: :years, :months, :weeks, :days. + # + # The increments are applied in order of time units from largest to smallest. + # In other words, the date is incremented first by +:years+, then by + # +:months+, then by +:weeks+, then by +:days+. This order can affect the + # result around the end of a month. For example, incrementing first by months + # then by days: + # + # Date.new(2004, 9, 30).advance(months: 1, days: 1) + # # => Sun, 31 Oct 2004 + # + # Whereas incrementing first by days then by months yields a different result: + # + # Date.new(2004, 9, 30).advance(days: 1).advance(months: 1) + # # => Mon, 01 Nov 2004 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:127 + def advance(options); end + + # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) + # and then subtracts the specified number of seconds. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:55 + def ago(seconds); end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:211 + def as_json(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:72 + def at_beginning_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:88 + def at_end_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:80 + def at_midday; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:82 + def at_middle_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:71 + def at_midnight; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:81 + def at_noon; end + + # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:67 + def beginning_of_day; end + + # No Date is blank: + # + # Date.today.blank? # => false + # + # @return [false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/blank.rb:11 + def blank?; end + + # Returns a new Date where one or more of the elements have been changed according to the +options+ parameter. + # The +options+ parameter is a hash with a combination of these keys: :year, :month, :day. + # + # Date.new(2007, 5, 12).change(day: 1) # => Date.new(2007, 5, 1) + # Date.new(2007, 5, 12).change(year: 2005, month: 1) # => Date.new(2005, 1, 12) + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:143 + def change(options); end + + # Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:152 + def compare_with_coercion(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:159 + def compare_without_coercion(_arg0); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/conversions.rb:66 + def default_inspect; end + + # Converts Date to a Time (or DateTime if necessary) with the time portion set to the end of the day (23:59:59) + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:85 + def end_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:64 + def in(seconds); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/conversions.rb:67 + def inspect; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:78 + def midday; end + + # Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00) + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:75 + def middle_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:70 + def midnight; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:100 + def minus_with_duration(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:107 + def minus_without_duration(_arg0); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:79 + def noon; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:90 + def plus_with_duration(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:97 + def plus_without_duration(_arg0); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/blank.rb:15 + def present?; end + + # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005" + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/conversions.rb:63 + def readable_inspect; end + + # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) + # and then adds the specified number of seconds + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:61 + def since(seconds); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/conversions.rb:60 + def to_formatted_s(format = T.unsafe(nil)); end + + # Convert to a formatted string. See DATE_FORMATS for predefined formats. + # + # This method is aliased to to_formatted_s. + # + # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 + # + # date.to_fs(:db) # => "2007-11-10" + # date.to_formatted_s(:db) # => "2007-11-10" + # + # date.to_fs(:short) # => "10 Nov" + # date.to_fs(:number) # => "20071110" + # date.to_fs(:long) # => "November 10, 2007" + # date.to_fs(:long_ordinal) # => "November 10th, 2007" + # date.to_fs(:rfc822) # => "10 Nov 2007" + # date.to_fs(:rfc2822) # => "10 Nov 2007" + # date.to_fs(:iso8601) # => "2007-11-10" + # + # == Adding your own date formats to to_fs + # You can add your own formats to the Date::DATE_FORMATS hash. + # Use the format name as the hash key and either a strftime string + # or Proc instance that takes a date argument as the value. + # + # # config/initializers/date_formats.rb + # Date::DATE_FORMATS[:month_and_year] = '%B %Y' + # Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") } + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/conversions.rb:49 + def to_fs(format = T.unsafe(nil)); end + + # Converts a Date instance to a Time, where the time is set to the beginning of the day. + # The timezone can be either +:local+ or +:utc+ (default +:local+). + # + # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 + # + # date.to_time # => 2007-11-10 00:00:00 0800 + # date.to_time(:local) # => 2007-11-10 00:00:00 0800 + # + # date.to_time(:utc) # => 2007-11-10 00:00:00 UTC + # + # NOTE: The +:local+ timezone is Ruby's *process* timezone, i.e. ENV['TZ']. + # If the application's timezone is needed, then use +in_time_zone+ instead. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/conversions.rb:69 + def to_time(form = T.unsafe(nil)); end + + # Returns a string which represents the time in used time zone as DateTime + # defined by XML Schema: + # + # date = Date.new(2015, 05, 23) # => Sat, 23 May 2015 + # date.xmlschema # => "2015-05-23T00:00:00+04:00" + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/conversions.rb:88 + def xmlschema; end + + class << self + # Returns the week start (e.g. +:monday+) for the current request, if this has been set (via Date.beginning_of_week=). + # If Date.beginning_of_week has not been set for the current request, returns the week start specified in config.beginning_of_week. + # If no +config.beginning_of_week+ was specified, returns +:monday+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:19 + def beginning_of_week; end + + # Sets Date.beginning_of_week to a week start (e.g. +:monday+) for current request/thread. + # + # This method accepts any of the following day symbols: + # +:monday+, +:tuesday+, +:wednesday+, +:thursday+, +:friday+, +:saturday+, +:sunday+ + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:27 + def beginning_of_week=(week_start); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:14 + def beginning_of_week_default; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:14 + def beginning_of_week_default=(_arg0); end + + # Returns Time.zone.today when Time.zone or config.time_zone are set, otherwise just returns Date.today. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:48 + def current; end + + # Returns week start day symbol (e.g. +:monday+), or raises an +ArgumentError+ for invalid day symbol. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:32 + def find_beginning_of_week!(week_start); end + + # Returns a new Date representing the date 1 day after today (i.e. tomorrow's date). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:43 + def tomorrow; end + + # Returns a new Date representing the date 1 day ago (i.e. yesterday's date). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date/calculations.rb:38 + def yesterday; end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/date/conversions.rb:9 +Date::DATE_FORMATS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/compatibility.rb:6 +module DateAndTime; end + +# pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:7 +module DateAndTime::Calculations + # Returns true if the date/time falls after date_or_time. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:72 + def after?(date_or_time); end + + # Returns a Range representing the whole day of the current date/time. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:310 + def all_day; end + + # Returns a Range representing the whole month of the current date/time. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:321 + def all_month; end + + # Returns a Range representing the whole quarter of the current date/time. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:326 + def all_quarter; end + + # Returns a Range representing the whole week of the current date/time. + # Week starts on start_day, default is Date.beginning_of_week or config.beginning_of_week when set. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:316 + def all_week(start_day = T.unsafe(nil)); end + + # Returns a Range representing the whole year of the current date/time. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:331 + def all_year; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:128 + def at_beginning_of_month; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:143 + def at_beginning_of_quarter; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:271 + def at_beginning_of_week(start_day = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:182 + def at_beginning_of_year; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:300 + def at_end_of_month; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:158 + def at_end_of_quarter; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:286 + def at_end_of_week(start_day = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:307 + def at_end_of_year; end + + # Returns true if the date/time falls before date_or_time. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:67 + def before?(date_or_time); end + + # Returns a new date/time at the start of the month. + # + # today = Date.today # => Thu, 18 Jun 2015 + # today.beginning_of_month # => Mon, 01 Jun 2015 + # + # +DateTime+ objects will have a time set to 0:00. + # + # now = DateTime.current # => Thu, 18 Jun 2015 15:23:13 +0000 + # now.beginning_of_month # => Mon, 01 Jun 2015 00:00:00 +0000 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:125 + def beginning_of_month; end + + # Returns a new date/time at the start of the quarter. + # + # today = Date.today # => Fri, 10 Jul 2015 + # today.beginning_of_quarter # => Wed, 01 Jul 2015 + # + # +DateTime+ objects will have a time set to 0:00. + # + # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 + # now.beginning_of_quarter # => Wed, 01 Jul 2015 00:00:00 +0000 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:139 + def beginning_of_quarter; end + + # Returns a new date/time representing the start of this week on the given day. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # +DateTime+ objects have their time set to 0:00. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:267 + def beginning_of_week(start_day = T.unsafe(nil)); end + + # Returns a new date/time at the beginning of the year. + # + # today = Date.today # => Fri, 10 Jul 2015 + # today.beginning_of_year # => Thu, 01 Jan 2015 + # + # +DateTime+ objects will have a time set to 0:00. + # + # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 + # now.beginning_of_year # => Thu, 01 Jan 2015 00:00:00 +0000 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:179 + def beginning_of_year; end + + # Returns a new date/time the specified number of days ago. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:77 + def days_ago(days); end + + # Returns a new date/time the specified number of days in the future. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:82 + def days_since(days); end + + # Returns the number of days to the start of the week on the given day. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:258 + def days_to_week_start(start_day = T.unsafe(nil)); end + + # Returns a new date/time representing the end of the month. + # DateTime objects will have a time set to 23:59:59. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:296 + def end_of_month; end + + # Returns a new date/time at the end of the quarter. + # + # today = Date.today # => Fri, 10 Jul 2015 + # today.end_of_quarter # => Wed, 30 Sep 2015 + # + # +DateTime+ objects will have a time set to 23:59:59. + # + # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 + # now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:154 + def end_of_quarter; end + + # Returns a new date/time representing the end of this week on the given day. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # DateTime objects have their time set to 23:59:59. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:283 + def end_of_week(start_day = T.unsafe(nil)); end + + # Returns a new date/time representing the end of the year. + # DateTime objects will have a time set to 23:59:59. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:304 + def end_of_year; end + + # Returns true if the date/time is in the future. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:52 + def future?; end + + # Short-hand for months_ago(1). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:240 + def last_month; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:248 + def last_quarter; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:227 + def last_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:237 + def last_weekday; end + + # Short-hand for years_ago(1). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:251 + def last_year; end + + # Returns Monday of this week assuming that week starts on Monday. + # +DateTime+ objects have their time set to 0:00. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:275 + def monday; end + + # Returns a new date/time the specified number of months ago. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:97 + def months_ago(months); end + + # Returns a new date/time the specified number of months in the future. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:102 + def months_since(months); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:38 + def next_day?; end + + # Returns a new date/time representing the next occurrence of the specified day of week. + # + # today = Date.today # => Thu, 14 Dec 2017 + # today.next_occurring(:monday) # => Mon, 18 Dec 2017 + # today.next_occurring(:thursday) # => Thu, 21 Dec 2017 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:340 + def next_occurring(day_of_week); end + + # Short-hand for months_since(3). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:215 + def next_quarter; end + + # Returns a new date/time representing the given day in the next week. + # + # today = Date.today # => Thu, 07 May 2015 + # today.next_week # => Mon, 11 May 2015 + # + # The +given_day_in_next_week+ defaults to the beginning of the week + # which is determined by +Date.beginning_of_week+ or +config.beginning_of_week+ + # when set. + # + # today = Date.today # => Thu, 07 May 2015 + # today.next_week(:friday) # => Fri, 15 May 2015 + # + # +DateTime+ objects have their time set to 0:00 unless +same_time+ is true. + # + # now = DateTime.current # => Thu, 07 May 2015 13:31:16 +0000 + # now.next_week # => Mon, 11 May 2015 00:00:00 +0000 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:200 + def next_week(given_day_in_next_week = T.unsafe(nil), same_time: T.unsafe(nil)); end + + # Returns a new date/time representing the next weekday. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:206 + def next_weekday; end + + # Returns true if the date/time does not fall on a Saturday or Sunday. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:62 + def on_weekday?; end + + # Returns true if the date/time falls on a Saturday or Sunday. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:57 + def on_weekend?; end + + # Returns true if the date/time is in the past. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:47 + def past?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:44 + def prev_day?; end + + # Returns a new date/time representing the previous occurrence of the specified day of week. + # + # today = Date.today # => Thu, 14 Dec 2017 + # today.prev_occurring(:monday) # => Mon, 11 Dec 2017 + # today.prev_occurring(:thursday) # => Thu, 07 Dec 2017 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:351 + def prev_occurring(day_of_week); end + + # Short-hand for months_ago(3). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:245 + def prev_quarter; end + + # Returns a new date/time representing the given day in the previous week. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # DateTime objects have their time set to 0:00 unless +same_time+ is true. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:223 + def prev_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end + + # Returns a new date/time representing the previous weekday. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:230 + def prev_weekday; end + + # Returns the quarter for a date/time. + # + # Date.new(2010, 1, 31).quarter # => 1 + # Date.new(2010, 4, 12).quarter # => 2 + # Date.new(2010, 9, 15).quarter # => 3 + # Date.new(2010, 12, 25).quarter # => 4 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:166 + def quarter; end + + # Returns Sunday of this week assuming that week starts on Monday. + # +DateTime+ objects have their time set to 23:59:59. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:290 + def sunday; end + + # Returns true if the date/time is today. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:30 + def today?; end + + # Returns a new date/time representing tomorrow. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:25 + def tomorrow; end + + # Returns true if the date/time is tomorrow. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:35 + def tomorrow?; end + + # Returns a new date/time the specified number of weeks ago. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:87 + def weeks_ago(weeks); end + + # Returns a new date/time the specified number of weeks in the future. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:92 + def weeks_since(weeks); end + + # Returns a new date/time the specified number of years ago. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:107 + def years_ago(years); end + + # Returns a new date/time the specified number of years in the future. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:112 + def years_since(years); end + + # Returns a new date/time representing yesterday. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:20 + def yesterday; end + + # Returns true if the date/time is yesterday. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:41 + def yesterday?; end + + private + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:370 + def copy_time_to(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:366 + def days_span(day); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:358 + def first_hour(date_or_time); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:362 + def last_hour(date_or_time); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:8 +DateAndTime::Calculations::DAYS_INTO_WEEK = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/calculations.rb:17 +DateAndTime::Calculations::WEEKEND_DAYS = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/compatibility.rb:7 +module DateAndTime::Compatibility + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/compatibility.rb:21 + def utc_to_local_returns_utc_offset_times; end + + class << self + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/compatibility.rb:21 + def utc_to_local_returns_utc_offset_times; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/compatibility.rb:21 + def utc_to_local_returns_utc_offset_times=(val); end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/zones.rb:4 +module DateAndTime::Zones + # Returns the simultaneous time in Time.zone if a zone is given or + # if Time.zone_default is set. Otherwise, it returns the current time. + # + # Time.zone = 'Hawaii' # => 'Hawaii' + # Time.utc(2000).in_time_zone # => Fri, 31 Dec 1999 14:00:00 HST -10:00 + # Date.new(2000).in_time_zone # => Sat, 01 Jan 2000 00:00:00 HST -10:00 + # + # This method is similar to Time#localtime, except that it uses Time.zone as the local zone + # instead of the operating system's time zone. + # + # You can also pass in a TimeZone instance or string that identifies a TimeZone as an argument, + # and the conversion will be based on that zone instead of Time.zone. + # + # Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00 + # Date.new(2000).in_time_zone('Alaska') # => Sat, 01 Jan 2000 00:00:00 AKST -09:00 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/zones.rb:20 + def in_time_zone(zone = T.unsafe(nil)); end + + private + + # pkg:gem/activesupport#lib/active_support/core_ext/date_and_time/zones.rb:32 + def time_with_zone(time, zone); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:5 +class DateTime < ::Date + include ::DateAndTime::Compatibility + + # Layers additional behavior on DateTime#<=> so that Time and + # ActiveSupport::TimeWithZone instances can be compared with a DateTime. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:209 + def <=>(other); end + + # Duck-types as a Date-like class. See Object#acts_like?. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/acts_like.rb:8 + def acts_like_date?; end + + # Duck-types as a Time-like class. See Object#acts_like?. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/acts_like.rb:13 + def acts_like_time?; end + + # Uses Date to provide precise Time calculations for years, months, and days. + # The +options+ parameter takes a hash with any of these keys: :years, + # :months, :weeks, :days, :hours, + # :minutes, :seconds. + # + # Just like Date#advance, increments are applied in order of time units from + # largest to smallest. This order can affect the result around the end of a + # month. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:82 + def advance(options); end + + # Returns a new DateTime representing the time a number of seconds ago. + # Do not use this method in combination with x.months, use months_ago instead! + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:110 + def ago(seconds); end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:221 + def as_json(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:128 + def at_beginning_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:150 + def at_beginning_of_hour; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:162 + def at_beginning_of_minute; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:144 + def at_end_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:156 + def at_end_of_hour; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:168 + def at_end_of_minute; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:136 + def at_midday; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:138 + def at_middle_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:127 + def at_midnight; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:137 + def at_noon; end + + # Returns a new DateTime representing the start of the day (0:00). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:123 + def beginning_of_day; end + + # Returns a new DateTime representing the start of the hour (hh:00:00). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:147 + def beginning_of_hour; end + + # Returns a new DateTime representing the start of the minute (hh:mm:00). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:159 + def beginning_of_minute; end + + # No DateTime is ever blank: + # + # DateTime.now.blank? # => false + # + # @return [false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/blank.rb:11 + def blank?; end + + # Returns a new DateTime where one or more of the elements have been changed + # according to the +options+ parameter. The time options (:hour, + # :min, :sec) reset cascadingly, so if only the hour is + # passed, then minute and sec is set to 0. If the hour and minute is passed, + # then sec is set to 0. The +options+ parameter takes a hash with any of these + # keys: :year, :month, :day, :hour, + # :min, :sec, :offset, :start. + # + # DateTime.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => DateTime.new(2012, 8, 1, 22, 35, 0) + # DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => DateTime.new(1981, 8, 1, 22, 35, 0) + # DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => DateTime.new(1981, 8, 29, 0, 0, 0) + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:51 + def change(options); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:61 + def default_inspect; end + + # Returns a new DateTime representing the end of the day (23:59:59). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:141 + def end_of_day; end + + # Returns a new DateTime representing the end of the hour (hh:59:59). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:153 + def end_of_hour; end + + # Returns a new DateTime representing the end of the minute (hh:mm:59). + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:165 + def end_of_minute; end + + # Returns a formatted string of the offset from UTC, or an alternative + # string if the time zone is already UTC. + # + # datetime = DateTime.civil(2000, 1, 1, 0, 0, 0, Rational(-6, 24)) + # datetime.formatted_offset # => "-06:00" + # datetime.formatted_offset(false) # => "-0600" + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:53 + def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:193 + def getgm; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:179 + def getlocal(utc_offset = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:194 + def getutc; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:195 + def gmtime; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:120 + def in(seconds); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:62 + def inspect; end + + # Returns a Time instance of the simultaneous time in the system timezone. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:171 + def localtime(utc_offset = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:134 + def midday; end + + # Returns a new DateTime representing the middle of the day (12:00) + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:131 + def middle_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:126 + def midnight; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:135 + def noon; end + + # Returns the fraction of a second as nanoseconds + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:96 + def nsec; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/blank.rb:15 + def present?; end + + # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000". + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:58 + def readable_inspect; end + + # Returns the number of seconds since 00:00:00. + # + # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0 + # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296 + # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:20 + def seconds_since_midnight; end + + # Returns the number of seconds until 23:59:59. + # + # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399 + # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103 + # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:29 + def seconds_until_end_of_day; end + + # Returns a new DateTime representing the time a number of seconds since the + # instance time. Do not use this method in combination with x.months, use + # months_since instead! + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:117 + def since(seconds); end + + # Returns the fraction of a second as a +Rational+ + # + # DateTime.new(2012, 8, 29, 0, 0, 0.5).subsec # => (1/2) + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:36 + def subsec; end + + # Converts +self+ to a floating-point number of seconds, including fractional microseconds, since the Unix epoch. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:81 + def to_f; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:44 + def to_formatted_s(format = T.unsafe(nil)); end + + # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats. + # + # This method is aliased to to_formatted_s. + # + # ==== Examples + # + # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000 + # + # datetime.to_fs(:db) # => "2007-12-04 00:00:00" + # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00" + # datetime.to_fs(:number) # => "20071204000000" + # datetime.to_fs(:short) # => "04 Dec 00:00" + # datetime.to_fs(:long) # => "December 04, 2007 00:00" + # datetime.to_fs(:long_ordinal) # => "December 4th, 2007 00:00" + # datetime.to_fs(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000" + # datetime.to_fs(:iso8601) # => "2007-12-04T00:00:00+00:00" + # + # ==== Adding your own datetime formats to +to_fs+ + # + # DateTime formats are shared with Time. You can add your own to the + # Time::DATE_FORMATS hash. Use the format name as the hash key and + # either a strftime string or Proc instance that takes a time or + # datetime argument as the value. + # + # # config/initializers/time_formats.rb + # Time::DATE_FORMATS[:month_and_year] = '%B %Y' + # Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") } + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:37 + def to_fs(format = T.unsafe(nil)); end + + # Converts +self+ to an integer number of seconds since the Unix epoch. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:86 + def to_i; end + + # Return an instance of +Time+ with the same UTC offset + # as +self+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/compatibility.rb:9 + def to_time; end + + # Returns the fraction of a second as microseconds + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:91 + def usec; end + + # Returns a Time instance of the simultaneous time in the UTC timezone. + # + # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600 + # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:185 + def utc; end + + # Returns +true+ if offset == 0. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:198 + def utc?; end + + # Returns the offset value in seconds. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:203 + def utc_offset; end + + private + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:101 + def offset_in_seconds; end + + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:105 + def seconds_since_unix_epoch; end + + class << self + # Returns DateTime with local offset for given year if format is local else + # offset is zero. + # + # DateTime.civil_from_format :local, 2012 + # # => Sun, 01 Jan 2012 00:00:00 +0300 + # DateTime.civil_from_format :local, 2012, 12, 17 + # # => Mon, 17 Dec 2012 00:00:00 +0000 + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/conversions.rb:71 + def civil_from_format(utc_or_local, year, month = T.unsafe(nil), day = T.unsafe(nil), hour = T.unsafe(nil), min = T.unsafe(nil), sec = T.unsafe(nil)); end + + # Returns Time.zone.now.to_datetime when Time.zone or + # config.time_zone are set, otherwise returns + # Time.now.to_datetime. + # + # pkg:gem/activesupport#lib/active_support/core_ext/date_time/calculations.rb:10 + def current; end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/try.rb:117 +class Delegator < ::BasicObject + include ::ActiveSupport::Tryable +end + +# pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:7 +module Digest::UUID + class << self + # Returns the nil UUID. This is a special form of UUID that is specified to + # have all 128 bits set to zero. + # + # pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:58 + def nil_uuid; end + + # Generates a v5 non-random UUID (Universally Unique IDentifier). + # + # Using OpenSSL::Digest::MD5 generates version 3 UUIDs; OpenSSL::Digest::SHA1 generates version 5 UUIDs. + # uuid_from_hash always generates the same UUID for a given name and namespace combination. + # + # See RFC 4122 for details of UUID at: https://www.ietf.org/rfc/rfc4122.txt + # + # pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:19 + def uuid_from_hash(hash_class, namespace, name); end + + # Convenience method for uuid_from_hash using OpenSSL::Digest::MD5. + # + # pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:42 + def uuid_v3(uuid_namespace, name); end + + # Convenience method for SecureRandom.uuid. + # + # pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:52 + def uuid_v4; end + + # Convenience method for uuid_from_hash using OpenSSL::Digest::SHA1. + # + # pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:47 + def uuid_v5(uuid_namespace, name); end + + private + + # pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:62 + def pack_uuid_namespace(namespace); end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:8 +Digest::UUID::DNS_NAMESPACE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:10 +Digest::UUID::OID_NAMESPACE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:9 +Digest::UUID::URL_NAMESPACE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/core_ext/digest/uuid.rb:11 +Digest::UUID::X500_NAMESPACE = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:39 +module ERB::Util + include ::ActiveSupport::CoreExt::ERBUtil + include ::ActiveSupport::CoreExt::ERBUtilPrivate + extend ::ActiveSupport::CoreExt::ERBUtil + + private + + # A utility method for escaping HTML without affecting existing escaped entities. + # + # html_escape_once('1 < 2 & 3') + # # => "1 < 2 & 3" + # + # html_escape_once('<< Accept & Checkout') + # # => "<< Accept & Checkout" + # + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:63 + def html_escape_once(s); end + + # A utility method for escaping HTML entities in JSON strings. Specifically, the + # &, > and < characters are replaced with their equivalent unicode escaped form - + # \u0026, \u003e, and \u003c. The Unicode sequences \u2028 and \u2029 are also + # escaped as they are treated as newline characters in some JavaScript engines. + # These sequences have identical meaning as the original characters inside the + # context of a JSON string, so assuming the input is a valid and well-formed + # JSON value, the output will have equivalent meaning when parsed: + # + # json = JSON.generate({ name: ""}) + # # => "{\"name\":\"\"}" + # + # json_escape(json) + # # => "{\"name\":\"\\u003C/script\\u003E\\u003Cscript\\u003Ealert('PWNED!!!')\\u003C/script\\u003E\"}" + # + # JSON.parse(json) == JSON.parse(json_escape(json)) + # # => true + # + # The intended use case for this method is to escape JSON strings before including + # them inside a script tag to avoid XSS vulnerability: + # + # + # + # It is necessary to +raw+ the result of +json_escape+, so that quotation marks + # don't get converted to " entities. +json_escape+ doesn't + # automatically flag the result as HTML safe, since the raw value is unsafe to + # use inside HTML attributes. + # + # If your JSON is being used downstream for insertion into the DOM, be aware of + # whether or not it is being inserted via html(). Most jQuery plugins do this. + # If that is the case, be sure to +html_escape+ or +sanitize+ any user-generated + # content returned by your JSON. + # + # If you need to output JSON elsewhere in your HTML, you can just do something + # like this, as any unsafe characters (including quotation marks) will be + # automatically escaped for you: + # + #
    ...
    + # + # WARNING: this helper only works with valid JSON. Using this on non-JSON values + # will open up serious XSS vulnerabilities. For example, if you replace the + # +current_user.to_json+ in the example above with user input instead, the browser + # will happily eval() that string as JavaScript. + # + # The escaping performed in this method is identical to those performed in the + # Active Support JSON encoder when +ActiveSupport.escape_html_entities_in_json+ is + # set to true. Because this transformation is idempotent, this helper can be + # applied even if +ActiveSupport.escape_html_entities_in_json+ is already true. + # + # Therefore, when you are unsure if +ActiveSupport.escape_html_entities_in_json+ + # is enabled, or if you are unsure where your JSON string originated from, it + # is recommended that you always apply this helper (other libraries, such as the + # JSON gem, do not provide this kind of protection by default; also some gems + # might override +to_json+ to bypass Active Support's encoder). + # + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:124 + def json_escape(s); end + + # A utility method for escaping XML names of tags and names of attributes. + # + # xml_name_escape('1 < 2 & 3') + # # => "1___2___3" + # + # It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name + # + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:142 + def xml_name_escape(name); end + + class << self + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:67 + def html_escape_once(s); end + + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:134 + def json_escape(s); end + + # Tokenizes a line of ERB. This is really just for error reporting and + # nobody should use it. + # + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:161 + def tokenize(source); end + + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:10 + def unwrapped_html_escape(s); end + + # pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:157 + def xml_name_escape(name); end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:40 +ERB::Util::HTML_ESCAPE = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:41 +ERB::Util::HTML_ESCAPE_ONCE_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:49 +ERB::Util::INVALID_TAG_NAME_FOLLOWING_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:47 +ERB::Util::INVALID_TAG_NAME_START_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:50 +ERB::Util::SAFE_XML_TAG_NAME_REGEXP = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:48 +ERB::Util::TAG_NAME_FOLLOWING_CODEPOINTS = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:51 +ERB::Util::TAG_NAME_REPLACEMENT_CHAR = T.let(T.unsafe(nil), String) + +# Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name +# +# pkg:gem/activesupport#lib/active_support/core_ext/erb/util.rb:44 +ERB::Util::TAG_NAME_START_CODEPOINTS = T.let(T.unsafe(nil), String) + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:145 +module Enumerable + include ::ActiveSupport::ToJsonWithActiveSupportEncoder + extend ::ActiveSupport::EnumerableCoreExt::Constants + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:146 + def as_json(options = T.unsafe(nil)); end + + # Returns a new +Array+ without the blank items. + # Uses Object#blank? for determining if an item is blank. + # + # [1, "", nil, 2, " ", [], {}, false, true].compact_blank + # # => [1, 2, true] + # + # Set.new([nil, "", 1, false]).compact_blank + # # => [1] + # + # When called on a +Hash+, returns a new +Hash+ without the blank values. + # + # { a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank + # # => { b: 1, f: true } + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:184 + def compact_blank; end + + # The negative of the Enumerable#include?. Returns +true+ if the + # collection does not include the object. + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:118 + def exclude?(object); end + + # Returns a copy of the enumerable excluding the specified elements. + # + # ["David", "Rafael", "Aaron", "Todd"].excluding "Aaron", "Todd" + # # => ["David", "Rafael"] + # + # ["David", "Rafael", "Aaron", "Todd"].excluding %w[ Aaron Todd ] + # # => ["David", "Rafael"] + # + # {foo: 1, bar: 2, baz: 3}.excluding :bar + # # => {foo: 1, baz: 3} + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:132 + def excluding(*elements); end + + # Returns a new +Array+ where the order has been set to that provided in the +series+, based on the +key+ of the + # objects in the original enumerable. + # + # [ Person.find(5), Person.find(3), Person.find(1) ].in_order_of(:id, [ 1, 5, 3 ]) + # # => [ Person.find(1), Person.find(5), Person.find(3) ] + # + # If the +series+ include keys that have no corresponding element in the Enumerable, these are ignored. + # If the Enumerable has additional elements that aren't named in the +series+, these are not included in the result, unless + # the +filter+ option is set to +false+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:197 + def in_order_of(key, series, filter: T.unsafe(nil)); end + + # Returns a new array that includes the passed elements. + # + # [ 1, 2, 3 ].including(4, 5) + # # => [ 1, 2, 3, 4, 5 ] + # + # ["David", "Rafael"].including %w[ Aaron Todd ] + # # => ["David", "Rafael", "Aaron", "Todd"] + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:112 + def including(*elements); end + + # Convert an enumerable to a hash, using the block result as the key and the + # element as the value. + # + # people.index_by(&:login) + # # => { "nextangle" => , "chade-" => , ...} + # + # people.index_by { |person| "#{person.first_name} #{person.last_name}" } + # # => { "Chade- Fowlersburg-e" => , "David Heinemeier Hansson" => , ...} + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:52 + def index_by; end + + # Convert an enumerable to a hash, using the element as the key and the block + # result as the value. + # + # post = Post.new(title: "hey there", body: "what's up?") + # + # %i( title body ).index_with { |attr_name| post.public_send(attr_name) } + # # => { title: "hey there", body: "what's up?" } + # + # If an argument is passed instead of a block, it will be used as the value + # for all elements: + # + # %i( created_at updated_at ).index_with(Time.now) + # # => { created_at: 2020-03-09 22:31:47, updated_at: 2020-03-09 22:31:47 } + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:75 + def index_with(default = T.unsafe(nil)); end + + # Returns +true+ if the enumerable has more than 1 element. Functionally + # equivalent to enum.to_a.size > 1. Can be called with a block too, + # much like any?, so people.many? { |p| p.age > 26 } returns +true+ + # if more than one person is over 26. + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:93 + def many?; end + + # Calculates the maximum from the extracted elements. + # + # payments = [Payment.new(5), Payment.new(15), Payment.new(10)] + # payments.maximum(:price) # => 15 + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:40 + def maximum(key); end + + # Calculates the minimum from the extracted elements. + # + # payments = [Payment.new(5), Payment.new(15), Payment.new(10)] + # payments.minimum(:price) # => 5 + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:32 + def minimum(key); end + + # Extract the given key from the first element in the enumerable. + # + # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pick(:name) + # # => "David" + # + # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pick(:id, :name) + # # => [1, "David"] + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:161 + def pick(*keys); end + + # Extract the given key from each element in the enumerable. + # + # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pluck(:name) + # # => ["David", "Rafael", "Aaron"] + # + # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pluck(:id, :name) + # # => [[1, "David"], [2, "Rafael"]] + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:145 + def pluck(*keys); end + + # Returns the sole item in the enumerable. If there are no items, or more + # than one item, raises Enumerable::SoleItemExpectedError. + # + # ["x"].sole # => "x" + # Set.new.sole # => Enumerable::SoleItemExpectedError: no item found + # { a: 1, b: 2 }.sole # => Enumerable::SoleItemExpectedError: multiple items found + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:211 + def sole; end + + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:136 + def without(*elements); end +end + +# Error generated by +sole+ when called on an enumerable that doesn't have +# exactly one item. +# +# pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:21 +class Enumerable::SoleItemExpectedError < ::StandardError; end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:263 +class Exception + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:264 + def as_json(options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:65 +class FalseClass + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:87 + def as_json(options = T.unsafe(nil)); end + + # +false+ is blank: + # + # false.blank? # => true + # + # @return [true] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:71 + def blank?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:75 + def present?; end + + # Returns +self+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:40 + def to_param; end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/file/atomic.rb:5 +class File < ::IO + class << self + # Write to a file atomically. Useful for situations where you don't + # want other processes or threads to see half-written files. + # + # File.atomic_write('important.file') do |file| + # file.write('hello') + # end + # + # This method needs to create a temporary file. By default it will create it + # in the same directory as the destination file. If you don't like this + # behavior you can provide a different directory but it must be on the + # same physical filesystem as the file you're trying to write. + # + # File.atomic_write('/data/something.important', '/data/tmp') do |file| + # file.write('hello') + # end + # + # pkg:gem/activesupport#lib/active_support/core_ext/file/atomic.rb:21 + def atomic_write(file_name, temp_dir = T.unsafe(nil)); end + + # Private utility method. + # + # pkg:gem/activesupport#lib/active_support/core_ext/file/atomic.rb:56 + def probe_stat_in(dir); end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:116 +class Float < ::Numeric + include ::ActiveSupport::NumericWithFormat + + # Encoding Infinity or NaN to JSON should return "null". The default returns + # "Infinity" or "NaN" which are not valid JSON. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:119 + def as_json(options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/hash/deep_merge.rb:5 +class Hash + include ::Enumerable + include ::ActiveSupport::DeepMergeable + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:175 + def as_json(options = T.unsafe(nil)); end + + # Validates all keys in a hash match *valid_keys, raising + # +ArgumentError+ on a mismatch. + # + # Note that keys are treated differently than HashWithIndifferentAccess, + # meaning that string and symbol keys will not match. + # + # { name: 'Rob', years: '28' }.assert_valid_keys(:name, :age) # => raises "ArgumentError: Unknown key: :years. Valid keys are: :name, :age" + # { name: 'Rob', age: '28' }.assert_valid_keys('name', 'age') # => raises "ArgumentError: Unknown key: :name. Valid keys are: 'name', 'age'" + # { name: 'Rob', age: '28' }.assert_valid_keys(:name, :age) # => passes, raises nothing + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:48 + def assert_valid_keys(*valid_keys); end + + # A hash is blank if it's empty: + # + # {}.blank? # => true + # { key: 'value' }.blank? # => false + # + # @return [true, false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:116 + def blank?; end + + # Hash#reject has its own definition, so this needs one too. + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:234 + def compact_blank; end + + # Removes all blank values from the +Hash+ in place and returns self. + # Uses Object#blank? for determining if a value is blank. + # + # h = { a: "", b: 1, c: nil, d: [], e: false, f: true } + # h.compact_blank! + # # => { b: 1, f: true } + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:244 + def compact_blank!; end + + # Returns a deep copy of hash. + # + # hash = { a: { b: 'b' } } + # dup = hash.deep_dup + # dup[:a][:c] = 'c' + # + # hash[:a][:c] # => nil + # dup[:a][:c] # => "c" + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/deep_dup.rb:43 + def deep_dup; end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/deep_merge.rb:40 + def deep_merge?(other); end + + # Returns a new hash with all keys converted to strings. + # This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # hash = { person: { name: 'Rob', age: '28' } } + # + # hash.deep_stringify_keys + # # => {"person"=>{"name"=>"Rob", "age"=>"28"}} + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:84 + def deep_stringify_keys; end + + # Destructively converts all keys to strings. + # This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:91 + def deep_stringify_keys!; end + + # Returns a new hash with all keys converted to symbols, as long as + # they respond to +to_sym+. This includes the keys from the root hash + # and from all nested hashes and arrays. + # + # hash = { 'person' => { 'name' => 'Rob', 'age' => '28' } } + # + # hash.deep_symbolize_keys + # # => {:person=>{:name=>"Rob", :age=>"28"}} + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:103 + def deep_symbolize_keys; end + + # Destructively converts all keys to symbols, as long as they respond + # to +to_sym+. This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:110 + def deep_symbolize_keys!; end + + # Returns a new hash with all keys converted by the block operation. + # This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # hash = { person: { name: 'Rob', age: '28' } } + # + # hash.deep_transform_keys{ |key| key.to_s.upcase } + # # => {"PERSON"=>{"NAME"=>"Rob", "AGE"=>"28"}} + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:65 + def deep_transform_keys(&block); end + + # Destructively converts all keys by using the block operation. + # This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:72 + def deep_transform_keys!(&block); end + + # Returns a new hash with all values converted by the block operation. + # This includes the values from the root hash and from all + # nested hashes and arrays. + # + # hash = { person: { name: 'Rob', age: '28' } } + # + # hash.deep_transform_values{ |value| value.to_s.upcase } + # # => {person: {name: "ROB", age: "28"}} + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/deep_transform_values.rb:12 + def deep_transform_values(&block); end + + # Destructively converts all values by using the block operation. + # This includes the values from the root hash and from all + # nested hashes and arrays. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/deep_transform_values.rb:19 + def deep_transform_values!(&block); end + + # Removes the given keys from hash and returns it. + # hash = { a: true, b: false, c: nil } + # hash.except!(:c) # => { a: true, b: false } + # hash # => { a: true, b: false } + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/except.rb:8 + def except!(*keys); end + + # Removes and returns the key/value pairs matching the given keys. + # + # hash = { a: 1, b: 2, c: 3, d: 4 } + # hash.extract!(:a, :b) # => {:a=>1, :b=>2} + # hash # => {:c=>3, :d=>4} + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/slice.rb:24 + def extract!(*keys); end + + # By default, only instances of Hash itself are extractable. + # Subclasses of Hash may implement this method and return + # true to declare themselves as extractable. If a Hash + # is extractable, Array#extract_options! pops it from + # the Array when it is the last element of the Array. + # + # pkg:gem/activesupport#lib/active_support/core_ext/array/extract_options.rb:9 + def extractable_options?; end + + # Called when object is nested under an object that receives + # #with_indifferent_access. This method will be called on the current object + # by the enclosing object and is aliased to #with_indifferent_access by + # default. Subclasses of Hash may override this method to return +self+ if + # converting to an ActiveSupport::HashWithIndifferentAccess would not be + # desirable. + # + # b = { b: 1 } + # { a: b }.with_indifferent_access['a'] # calls b.nested_under_indifferent_access + # # => {"b"=>1} + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/indifferent_access.rb:23 + def nested_under_indifferent_access; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:118 + def present?; end + + # Merges the caller into +other_hash+. For example, + # + # options = options.reverse_merge(size: 25, velocity: 10) + # + # is equivalent to + # + # options = { size: 25, velocity: 10 }.merge(options) + # + # This is particularly useful for initializing an options hash + # with default values. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/reverse_merge.rb:14 + def reverse_merge(other_hash); end + + # Destructive +reverse_merge+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/reverse_merge.rb:20 + def reverse_merge!(other_hash); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/reverse_merge.rb:23 + def reverse_update(other_hash); end + + # Replaces the hash with only the given keys. + # Returns a hash containing the removed key/value pairs. + # + # hash = { a: 1, b: 2, c: 3, d: 4 } + # hash.slice!(:a, :b) # => {:c=>3, :d=>4} + # hash # => {:a=>1, :b=>2} + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/slice.rb:10 + def slice!(*keys); end + + # Returns a new hash with all keys converted to strings. + # + # hash = { name: 'Rob', age: '28' } + # + # hash.stringify_keys + # # => {"name"=>"Rob", "age"=>"28"} + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:10 + def stringify_keys; end + + # Destructively converts all keys to strings. Same as + # +stringify_keys+, but modifies +self+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:16 + def stringify_keys!; end + + # Returns a new hash with all keys converted to symbols, as long as + # they respond to +to_sym+. + # + # hash = { 'name' => 'Rob', 'age' => '28' } + # + # hash.symbolize_keys + # # => {:name=>"Rob", :age=>"28"} + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:27 + def symbolize_keys; end + + # Destructively converts all keys to symbols, as long as they respond + # to +to_sym+. Same as +symbolize_keys+, but modifies +self+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:34 + def symbolize_keys!; end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:30 + def to_options; end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:37 + def to_options!; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:92 + def to_param(namespace = T.unsafe(nil)); end + + # Returns a string representation of the receiver suitable for use as a URL + # query string: + # + # {name: 'David', nationality: 'Danish'}.to_query + # # => "name=David&nationality=Danish" + # + # An optional namespace can be passed to enclose key names: + # + # {name: 'David', nationality: 'Danish'}.to_query('user') + # # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish" + # + # The string pairs "key=value" that conform the query string + # are sorted lexicographically in ascending order. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:81 + def to_query(namespace = T.unsafe(nil)); end + + # Returns a string containing an XML representation of its receiver: + # + # { foo: 1, bar: 2 }.to_xml + # # => + # # + # # + # # 1 + # # 2 + # # + # + # To do so, the method loops over the pairs and builds nodes that depend on + # the _values_. Given a pair +key+, +value+: + # + # * If +value+ is a hash there's a recursive call with +key+ as :root. + # + # * If +value+ is an array there's a recursive call with +key+ as :root, + # and +key+ singularized as :children. + # + # * If +value+ is a callable object it must expect one or two arguments. Depending + # on the arity, the callable is invoked with the +options+ hash as first argument + # with +key+ as :root, and +key+ singularized as second argument. The + # callable can add nodes by using options[:builder]. + # + # {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml + # # => "foo" + # + # * If +value+ responds to +to_xml+ the method is invoked with +key+ as :root. + # + # class Foo + # def to_xml(options) + # options[:builder].bar 'fooing!' + # end + # end + # + # { foo: Foo.new }.to_xml(skip_instruct: true) + # # => + # # + # # fooing! + # # + # + # * Otherwise, a node with +key+ as tag is created with a string representation of + # +value+ as text node. If +value+ is +nil+ an attribute "nil" set to "true" is added. + # Unless the option :skip_types exists and is true, an attribute "type" is + # added as well according to the following mapping: + # + # XML_TYPE_NAMES = { + # "Symbol" => "symbol", + # "Integer" => "integer", + # "BigDecimal" => "decimal", + # "Float" => "float", + # "TrueClass" => "boolean", + # "FalseClass" => "boolean", + # "Date" => "date", + # "DateTime" => "dateTime", + # "Time" => "dateTime" + # } + # + # By default the root node is "hash", but that's configurable via the :root option. + # + # The default XML builder is a fresh instance of +Builder::XmlMarkup+. You can + # configure your own builder with the :builder option. The method also accepts + # options like :dasherize and friends, they are forwarded to the builder. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:74 + def to_xml(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/reverse_merge.rb:17 + def with_defaults(other_hash); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/reverse_merge.rb:24 + def with_defaults!(other_hash); end + + # Returns an ActiveSupport::HashWithIndifferentAccess out of its receiver: + # + # { a: 1 }.with_indifferent_access['a'] # => 1 + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/indifferent_access.rb:9 + def with_indifferent_access; end + + private + + # Support methods for deep transforming nested hashes and arrays. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:116 + def _deep_transform_keys_in_object(object, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/keys.rb:129 + def _deep_transform_keys_in_object!(object, &block); end + + # Support methods for deep transforming nested hashes and arrays. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/deep_transform_values.rb:25 + def _deep_transform_values_in_object(object, &block); end + + # pkg:gem/activesupport#lib/active_support/core_ext/hash/deep_transform_values.rb:36 + def _deep_transform_values_in_object!(object, &block); end + + class << self + # Builds a Hash from XML just like Hash.from_xml, but also allows Symbol and YAML. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:133 + def from_trusted_xml(xml); end + + # Returns a Hash containing a collection of pairs when the key is the node name and the value is + # its content + # + # xml = <<-XML + # + # + # 1 + # 2 + # + # XML + # + # hash = Hash.from_xml(xml) + # # => {"hash"=>{"foo"=>1, "bar"=>2}} + # + # +DisallowedType+ is raised if the XML contains attributes with type="yaml" or + # type="symbol". Use Hash.from_trusted_xml to + # parse this XML. + # + # Custom +disallowed_types+ can also be passed in the form of an + # array. + # + # xml = <<-XML + # + # + # 1 + # "David" + # + # XML + # + # hash = Hash.from_xml(xml, ['integer']) + # # => ActiveSupport::XMLConverter::DisallowedType: Disallowed type attribute: "integer" + # + # Note that passing custom disallowed types will override the default types, + # which are Symbol and YAML. + # + # pkg:gem/activesupport#lib/active_support/core_ext/hash/conversions.rb:128 + def from_xml(xml, disallowed_types = T.unsafe(nil)); end + end +end + +# :stopdoc: +# +# pkg:gem/activesupport#lib/active_support/hash_with_indifferent_access.rb:465 +HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess + +# :enddoc: +# +# pkg:gem/activesupport#lib/active_support/i18n_railtie.rb:9 +module I18n; end + +# pkg:gem/activesupport#lib/active_support/i18n_railtie.rb:10 +class I18n::Railtie < ::Rails::Railtie + class << self + # pkg:gem/activesupport#lib/active_support/i18n_railtie.rb:103 + def include_fallbacks_module; end + + # pkg:gem/activesupport#lib/active_support/i18n_railtie.rb:107 + def init_fallbacks(fallbacks); end + + # Setup i18n configuration. + # + # pkg:gem/activesupport#lib/active_support/i18n_railtie.rb:36 + def initialize_i18n(app); end + + # pkg:gem/activesupport#lib/active_support/i18n_railtie.rb:84 + def setup_raise_on_missing_translations_config(app, strict); end + + # pkg:gem/activesupport#lib/active_support/i18n_railtie.rb:123 + def validate_fallbacks(fallbacks); end + + # pkg:gem/activesupport#lib/active_support/i18n_railtie.rb:134 + def watched_dirs_with_extensions(paths); end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:151 +class IO + include ::Enumerable + include ::File::Constants + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:152 + def as_json(options = T.unsafe(nil)); end +end + +class IO::Buffer + include ::Comparable + + def initialize(*_arg0); end + + def &(_arg0); end + def <=>(_arg0); end + def ^(_arg0); end + def and!(_arg0); end + def clear(*_arg0); end + def copy(*_arg0); end + def each(*_arg0); end + def each_byte(*_arg0); end + def empty?; end + def external?; end + def free; end + def get_string(*_arg0); end + def get_value(_arg0, _arg1); end + def get_values(_arg0, _arg1); end + def hexdump(*_arg0); end + def inspect; end + def internal?; end + def locked; end + def locked?; end + def mapped?; end + def not!; end + def null?; end + def or!(_arg0); end + def pread(*_arg0); end + def private?; end + def pwrite(*_arg0); end + def read(*_arg0); end + def readonly?; end + def resize(_arg0); end + def set_string(*_arg0); end + def set_value(_arg0, _arg1, _arg2); end + def set_values(_arg0, _arg1, _arg2); end + def shared?; end + def size; end + def slice(*_arg0); end + def to_s; end + def transfer; end + def valid?; end + def values(*_arg0); end + def write(*_arg0); end + def xor!(_arg0); end + def |(_arg0); end + def ~; end + + private + + def initialize_copy(_arg0); end + + class << self + def for(_arg0); end + def map(*_arg0); end + def size_of(_arg0); end + def string(_arg0); end + end +end + +class IO::Buffer::AccessError < ::RuntimeError; end +class IO::Buffer::AllocationError < ::RuntimeError; end +IO::Buffer::BIG_ENDIAN = T.let(T.unsafe(nil), Integer) +IO::Buffer::DEFAULT_SIZE = T.let(T.unsafe(nil), Integer) +IO::Buffer::EXTERNAL = T.let(T.unsafe(nil), Integer) +IO::Buffer::HOST_ENDIAN = T.let(T.unsafe(nil), Integer) +IO::Buffer::INTERNAL = T.let(T.unsafe(nil), Integer) +class IO::Buffer::InvalidatedError < ::RuntimeError; end +IO::Buffer::LITTLE_ENDIAN = T.let(T.unsafe(nil), Integer) +IO::Buffer::LOCKED = T.let(T.unsafe(nil), Integer) +class IO::Buffer::LockedError < ::RuntimeError; end +IO::Buffer::MAPPED = T.let(T.unsafe(nil), Integer) +class IO::Buffer::MaskError < ::ArgumentError; end +IO::Buffer::NETWORK_ENDIAN = T.let(T.unsafe(nil), Integer) +IO::Buffer::PAGE_SIZE = T.let(T.unsafe(nil), Integer) +IO::Buffer::PRIVATE = T.let(T.unsafe(nil), Integer) +IO::Buffer::READONLY = T.let(T.unsafe(nil), Integer) +IO::Buffer::SHARED = T.let(T.unsafe(nil), Integer) + +class IO::EAGAINWaitReadable < ::Errno::EAGAIN + include ::IO::WaitReadable +end + +class IO::EAGAINWaitWritable < ::Errno::EAGAIN + include ::IO::WaitWritable +end + +class IO::EINPROGRESSWaitReadable < ::Errno::EINPROGRESS + include ::IO::WaitReadable +end + +class IO::EINPROGRESSWaitWritable < ::Errno::EINPROGRESS + include ::IO::WaitWritable +end + +IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable +IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable +IO::PRIORITY = T.let(T.unsafe(nil), Integer) +IO::READABLE = T.let(T.unsafe(nil), Integer) +IO::WRITABLE = T.let(T.unsafe(nil), Integer) + +# Use `IPAddr#as_json` from the IPAddr gem if the version is 1.2.7 or higher. +# +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:244 +class IPAddr + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:245 + def as_json(options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/integer/time.rb:6 +class Integer < ::Numeric + include ::ActiveSupport::NumericWithFormat + + # pkg:gem/activesupport#lib/active_support/core_ext/integer/time.rb:13 + def month; end + + # Returns a Duration instance matching the number of months provided. + # + # 2.months # => 2 months + # + # pkg:gem/activesupport#lib/active_support/core_ext/integer/time.rb:10 + def months; end + + # pkg:gem/activesupport#lib/active_support/core_ext/integer/time.rb:21 + def year; end + + # Returns a Duration instance matching the number of years provided. + # + # 2.years # => 2 years + # + # pkg:gem/activesupport#lib/active_support/core_ext/integer/time.rb:18 + def years; end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/kernel/reporting.rb:3 +module Kernel + private + + # Sets $VERBOSE to +true+ for the duration of the block and back to its + # original value afterwards. + # + # pkg:gem/activesupport#lib/active_support/core_ext/kernel/reporting.rb:20 + def enable_warnings(&block); end + + # Sets $VERBOSE to +nil+ for the duration of the block and back to its original + # value afterwards. + # + # silence_warnings do + # value = noisy_call # no warning voiced + # end + # + # noisy_call # warning voiced + # + # pkg:gem/activesupport#lib/active_support/core_ext/kernel/reporting.rb:14 + def silence_warnings(&block); end + + # Blocks and ignores any exception passed as argument if raised within the block. + # + # suppress(ZeroDivisionError) do + # 1/0 + # puts 'This code is NOT reached' + # end + # + # puts 'This code gets executed and nothing related to ZeroDivisionError was seen' + # + # pkg:gem/activesupport#lib/active_support/core_ext/kernel/reporting.rb:41 + def suppress(*exception_classes); end + + # Sets $VERBOSE for the duration of the block and back to its original + # value afterwards. + # + # pkg:gem/activesupport#lib/active_support/core_ext/kernel/reporting.rb:26 + def with_warnings(flag); end + + class << self + # Sets $VERBOSE to +true+ for the duration of the block and back to its + # original value afterwards. + # + # pkg:gem/activesupport#lib/active_support/core_ext/kernel/reporting.rb:20 + def enable_warnings(&block); end + + # Sets $VERBOSE to +nil+ for the duration of the block and back to its original + # value afterwards. + # + # silence_warnings do + # value = noisy_call # no warning voiced + # end + # + # noisy_call # warning voiced + # + # pkg:gem/activesupport#lib/active_support/core_ext/kernel/reporting.rb:14 + def silence_warnings(&block); end + + # Blocks and ignores any exception passed as argument if raised within the block. + # + # suppress(ZeroDivisionError) do + # 1/0 + # puts 'This code is NOT reached' + # end + # + # puts 'This code gets executed and nothing related to ZeroDivisionError was seen' + # + # pkg:gem/activesupport#lib/active_support/core_ext/kernel/reporting.rb:41 + def suppress(*exception_classes); end + + # Sets $VERBOSE for the duration of the block and back to its original + # value afterwards. + # + # pkg:gem/activesupport#lib/active_support/core_ext/kernel/reporting.rb:26 + def with_warnings(flag); end + end +end + +# == Attribute Accessors +# +# Extends the module object with class/module and instance accessors for +# class/module attributes, just like the native attr* accessors for instance +# attributes. +# == Attribute Accessors per Thread +# +# Extends the module object with class/module and instance accessors for +# class/module attributes, just like the native attr* accessors for instance +# attributes, but does so on a per-thread basis. +# +# So the values are scoped within the Thread.current space under the class name +# of the module. +# +# Note that it can also be scoped per-fiber if +Rails.application.config.active_support.isolation_level+ +# is set to +:fiber+. +# +# pkg:gem/activesupport#lib/active_support/core_ext/module/delegation.rb:3 +class Module + include ::Module::Concerning + + # Allows you to make aliases for attributes, which includes + # getter, setter, and a predicate. + # + # class Content < ActiveRecord::Base + # # has a title attribute + # end + # + # class Email < Content + # alias_attribute :subject, :title + # end + # + # e = Email.find(1) + # e.title # => "Superstars" + # e.subject # => "Superstars" + # e.subject? # => true + # e.subject = "Megastars" + # e.title # => "Megastars" + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/aliasing.rb:21 + def alias_attribute(new_name, old_name); end + + # A module may or may not have a name. + # + # module M; end + # M.name # => "M" + # + # m = Module.new + # m.name # => nil + # + # +anonymous?+ method returns true if module does not have a name, false otherwise: + # + # Module.new.anonymous? # => true + # + # module M; end + # M.anonymous? # => false + # + # A module gets a name when it is first assigned to a constant. Either + # via the +module+ or +class+ keyword or by an explicit assignment: + # + # m = Module.new # creates an anonymous module + # m.anonymous? # => true + # M = m # m gets a name here as a side-effect + # m.name # => "M" + # m.anonymous? # => false + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/anonymous.rb:27 + def anonymous?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:53 + def as_json(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/module/attr_internal.rb:20 + def attr_internal(*attrs); end + + # Declares an attribute reader and writer backed by an internally-named instance + # variable. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/attr_internal.rb:16 + def attr_internal_accessor(*attrs); end + + # Declares an attribute reader backed by an internally-named instance variable. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/attr_internal.rb:5 + def attr_internal_reader(*attrs); end + + # Declares an attribute writer backed by an internally-named instance variable. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/attr_internal.rb:10 + def attr_internal_writer(*attrs); end + + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors.rb:213 + def cattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), &blk); end + + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors.rb:75 + def cattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors.rb:140 + def cattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end + + # Returns a copy of module or class if it's anonymous. If it's + # named, returns +self+. + # + # Object.deep_dup == Object # => true + # klass = Class.new + # klass.deep_dup == klass # => false + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/deep_dup.rb:64 + def deep_dup; end + + # Provides a +delegate+ class method to easily expose contained objects' + # public methods as your own. + # + # ==== Options + # * :to - Specifies the target object name as a symbol or string + # * :prefix - Prefixes the new method with the target name or a custom prefix + # * :allow_nil - If set to true, prevents a +ActiveSupport::DelegationError+ + # from being raised + # * :private - If set to true, changes method visibility to private + # + # The macro receives one or more method names (specified as symbols or + # strings) and the name of the target object via the :to option + # (also a symbol or string). + # + # Delegation is particularly useful with Active Record associations: + # + # class Greeter < ActiveRecord::Base + # def hello + # 'hello' + # end + # + # def goodbye + # 'goodbye' + # end + # end + # + # class Foo < ActiveRecord::Base + # belongs_to :greeter + # delegate :hello, to: :greeter + # end + # + # Foo.new.hello # => "hello" + # Foo.new.goodbye # => NoMethodError: undefined method `goodbye' for # + # + # Multiple delegates to the same target are allowed: + # + # class Foo < ActiveRecord::Base + # belongs_to :greeter + # delegate :hello, :goodbye, to: :greeter + # end + # + # Foo.new.goodbye # => "goodbye" + # + # Methods can be delegated to instance variables, class variables, or constants + # by providing them as a symbols: + # + # class Foo + # CONSTANT_ARRAY = [0,1,2,3] + # @@class_array = [4,5,6,7] + # + # def initialize + # @instance_array = [8,9,10,11] + # end + # delegate :sum, to: :CONSTANT_ARRAY + # delegate :min, to: :@@class_array + # delegate :max, to: :@instance_array + # end + # + # Foo.new.sum # => 6 + # Foo.new.min # => 4 + # Foo.new.max # => 11 + # + # It's also possible to delegate a method to the class by using +:class+: + # + # class Foo + # def self.hello + # "world" + # end + # + # delegate :hello, to: :class + # end + # + # Foo.new.hello # => "world" + # + # Delegates can optionally be prefixed using the :prefix option. If the value + # is true, the delegate methods are prefixed with the name of the object being + # delegated to. + # + # Person = Struct.new(:name, :address) + # + # class Invoice < Struct.new(:client) + # delegate :name, :address, to: :client, prefix: true + # end + # + # john_doe = Person.new('John Doe', 'Vimmersvej 13') + # invoice = Invoice.new(john_doe) + # invoice.client_name # => "John Doe" + # invoice.client_address # => "Vimmersvej 13" + # + # It is also possible to supply a custom prefix. + # + # class Invoice < Struct.new(:client) + # delegate :name, :address, to: :client, prefix: :customer + # end + # + # invoice = Invoice.new(john_doe) + # invoice.customer_name # => 'John Doe' + # invoice.customer_address # => 'Vimmersvej 13' + # + # The delegated methods are public by default. + # Pass private: true to change that. + # + # class User < ActiveRecord::Base + # has_one :profile + # delegate :first_name, to: :profile + # delegate :date_of_birth, to: :profile, private: true + # + # def age + # Date.today.year - date_of_birth.year + # end + # end + # + # User.new.first_name # => "Tomas" + # User.new.date_of_birth # => NoMethodError: private method `date_of_birth' called for # + # User.new.age # => 2 + # + # If the target is +nil+ and does not respond to the delegated method a + # +ActiveSupport::DelegationError+ is raised. If you wish to instead return +nil+, + # use the :allow_nil option. + # + # class User < ActiveRecord::Base + # has_one :profile + # delegate :age, to: :profile + # end + # + # User.new.age + # # => ActiveSupport::DelegationError: User#age delegated to profile.age, but profile is nil + # + # But if not having a profile yet is fine and should not be an error + # condition: + # + # class User < ActiveRecord::Base + # has_one :profile + # delegate :age, to: :profile, allow_nil: true + # end + # + # User.new.age # nil + # + # Note that if the target is not +nil+ then the call is attempted regardless of the + # :allow_nil option, and thus an exception is still raised if said object + # does not respond to the method: + # + # class Foo + # def initialize(bar) + # @bar = bar + # end + # + # delegate :name, to: :@bar, allow_nil: true + # end + # + # Foo.new("Bar").name # raises NoMethodError: undefined method `name' + # + # The target method must be public, otherwise it will raise +NoMethodError+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/delegation.rb:160 + def delegate(*methods, to: T.unsafe(nil), prefix: T.unsafe(nil), allow_nil: T.unsafe(nil), private: T.unsafe(nil)); end + + # When building decorators, a common pattern may emerge: + # + # class Partition + # def initialize(event) + # @event = event + # end + # + # def person + # detail.person || creator + # end + # + # private + # def respond_to_missing?(name, include_private = false) + # @event.respond_to?(name, include_private) + # end + # + # def method_missing(method, *args, &block) + # @event.send(method, *args, &block) + # end + # end + # + # With Module#delegate_missing_to, the above is condensed to: + # + # class Partition + # delegate_missing_to :@event + # + # def initialize(event) + # @event = event + # end + # + # def person + # detail.person || creator + # end + # end + # + # The target can be anything callable within the object, e.g. instance + # variables, methods, constants, etc. + # + # The delegated method must be public on the target, otherwise it will + # raise +ActiveSupport::DelegationError+. If you wish to instead return +nil+, + # use the :allow_nil option. + # + # The marshal_dump and _dump methods are exempt from + # delegation due to possible interference when calling + # Marshal.dump(object), should the delegation target method + # of object add or remove instance variables. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/delegation.rb:218 + def delegate_missing_to(target, allow_nil: T.unsafe(nil)); end + + # deprecate :foo, deprecator: MyLib.deprecator + # deprecate :foo, bar: "warning!", deprecator: MyLib.deprecator + # + # A deprecator is typically an instance of ActiveSupport::Deprecation, but you can also pass any object that responds + # to deprecation_warning(deprecated_method_name, message, caller_backtrace) where you can implement your + # custom warning behavior. + # + # class MyLib::Deprecator + # def deprecation_warning(deprecated_method_name, message, caller_backtrace = nil) + # message = "#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}" + # Kernel.warn message + # end + # end + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/deprecation.rb:17 + def deprecate(*method_names, deprecator:, **options); end + + # Defines both class and instance accessors for class attributes. + # All class and instance methods created will be public, even if + # this method is called with a private or protected access modifier. + # + # module HairColors + # mattr_accessor :hair_colors + # end + # + # class Person + # include HairColors + # end + # + # HairColors.hair_colors = [:brown, :black, :blonde, :red] + # HairColors.hair_colors # => [:brown, :black, :blonde, :red] + # Person.new.hair_colors # => [:brown, :black, :blonde, :red] + # + # If a subclass changes the value then that would also change the value for + # parent class. Similarly if parent class changes the value then that would + # change the value of subclasses too. + # + # class Citizen < Person + # end + # + # Citizen.new.hair_colors << :blue + # Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue] + # + # To omit the instance writer method, pass instance_writer: false. + # To omit the instance reader method, pass instance_reader: false. + # + # module HairColors + # mattr_accessor :hair_colors, instance_writer: false, instance_reader: false + # end + # + # class Person + # include HairColors + # end + # + # Person.new.hair_colors = [:brown] # => NoMethodError + # Person.new.hair_colors # => NoMethodError + # + # Or pass instance_accessor: false, to omit both instance methods. + # + # module HairColors + # mattr_accessor :hair_colors, instance_accessor: false + # end + # + # class Person + # include HairColors + # end + # + # Person.new.hair_colors = [:brown] # => NoMethodError + # Person.new.hair_colors # => NoMethodError + # + # You can set a default value for the attribute. + # + # module HairColors + # mattr_accessor :hair_colors, default: [:brown, :black, :blonde, :red] + # mattr_accessor(:hair_styles) { [:long, :short] } + # end + # + # class Person + # include HairColors + # end + # + # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] + # Person.class_variable_get("@@hair_styles") # => [:long, :short] + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors.rb:208 + def mattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), &blk); end + + # Defines a class attribute and creates a class and instance reader methods. + # The underlying class variable is set to +nil+, if it is not previously + # defined. All class and instance methods created will be public, even if + # this method is called with a private or protected access modifier. + # + # module HairColors + # mattr_reader :hair_colors + # end + # + # HairColors.hair_colors # => nil + # HairColors.class_variable_set("@@hair_colors", [:brown, :black]) + # HairColors.hair_colors # => [:brown, :black] + # + # The attribute name must be a valid method name in Ruby. + # + # module Foo + # mattr_reader :"1_Badname" + # end + # # => NameError: invalid attribute name: 1_Badname + # + # To omit the instance reader method, pass + # instance_reader: false or instance_accessor: false. + # + # module HairColors + # mattr_reader :hair_colors, instance_reader: false + # end + # + # class Person + # include HairColors + # end + # + # Person.new.hair_colors # => NoMethodError + # + # You can set a default value for the attribute. + # + # module HairColors + # mattr_reader :hair_colors, default: [:brown, :black, :blonde, :red] + # mattr_reader(:hair_styles) { [:long, :short] } + # end + # + # class Person + # include HairColors + # end + # + # Person.new.hair_colors # => [:brown, :black, :blonde, :red] + # Person.new.hair_styles # => [:long, :short] + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors.rb:55 + def mattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end + + # Defines a class attribute and creates a class and instance writer methods to + # allow assignment to the attribute. All class and instance methods created + # will be public, even if this method is called with a private or protected + # access modifier. + # + # module HairColors + # mattr_writer :hair_colors + # end + # + # class Person + # include HairColors + # end + # + # HairColors.hair_colors = [:brown, :black] + # Person.class_variable_get("@@hair_colors") # => [:brown, :black] + # Person.new.hair_colors = [:blonde, :red] + # HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red] + # + # To omit the instance writer method, pass + # instance_writer: false or instance_accessor: false. + # + # module HairColors + # mattr_writer :hair_colors, instance_writer: false + # end + # + # class Person + # include HairColors + # end + # + # Person.new.hair_colors = [:blonde, :red] # => NoMethodError + # + # You can set a default value for the attribute. + # + # module HairColors + # mattr_writer :hair_colors, default: [:brown, :black, :blonde, :red] + # mattr_writer(:hair_styles) { [:long, :short] } + # end + # + # class Person + # include HairColors + # end + # + # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] + # Person.class_variable_get("@@hair_styles") # => [:long, :short] + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors.rb:121 + def mattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/module/redefine_method.rb:30 + def method_visibility(method); end + + # Returns the module which contains this one according to its name. + # + # module M + # module N + # end + # end + # X = M::N + # + # M::N.module_parent # => M + # X.module_parent # => M + # + # The parent of top-level and anonymous modules is Object. + # + # M.module_parent # => Object + # Module.new.module_parent # => Object + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/introspection.rb:37 + def module_parent; end + + # Returns the name of the module containing this one. + # + # M::N.module_parent_name # => "M" + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/introspection.rb:9 + def module_parent_name; end + + # Returns all the parents of this module according to its name, ordered from + # nested outwards. The receiver is not contained within the result. + # + # module M + # module N + # end + # end + # X = M::N + # + # M.module_parents # => [Object] + # M::N.module_parents # => [M, Object] + # X.module_parents # => [M, Object] + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/introspection.rb:53 + def module_parents; end + + # Replaces the existing method definition, if there is one, with the passed + # block as its body. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/redefine_method.rb:17 + def redefine_method(method, &block); end + + # Replaces the existing singleton method definition, if there is one, with + # the passed block as its body. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/redefine_method.rb:26 + def redefine_singleton_method(method, &block); end + + # Removes the named method, if it exists. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/remove_method.rb:7 + def remove_possible_method(method); end + + # Removes the named singleton method, if it exists. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/remove_method.rb:14 + def remove_possible_singleton_method(method); end + + # Marks the named method as intended to be redefined, if it exists. + # Suppresses the Ruby method redefinition warning. Prefer + # #redefine_method where possible. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/redefine_method.rb:7 + def silence_redefinition_of_method(method); end + + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:174 + def thread_cattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:81 + def thread_cattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:123 + def thread_cattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil)); end + + # Defines both class and instance accessors for class attributes. + # + # class Account + # thread_mattr_accessor :user + # end + # + # Account.user = "DHH" + # Account.user # => "DHH" + # Account.new.user # => "DHH" + # + # Unlike +mattr_accessor+, values are *not* shared with subclasses or parent classes. + # If a subclass changes the value, the parent class' value is not changed. + # If the parent class changes the value, the value of subclasses is not changed. + # + # class Customer < Account + # end + # + # Account.user # => "DHH" + # Customer.user # => nil + # Customer.user = "Rafael" + # Customer.user # => "Rafael" + # Account.user # => "DHH" + # + # To omit the instance writer method, pass instance_writer: false. + # To omit the instance reader method, pass instance_reader: false. + # + # class Current + # thread_mattr_accessor :user, instance_writer: false, instance_reader: false + # end + # + # Current.new.user = "DHH" # => NoMethodError + # Current.new.user # => NoMethodError + # + # Or pass instance_accessor: false, to omit both instance methods. + # + # class Current + # thread_mattr_accessor :user, instance_accessor: false + # end + # + # Current.new.user = "DHH" # => NoMethodError + # Current.new.user # => NoMethodError + # + # A default value may be specified using the +:default+ option. Because + # multiple threads can access the default value, non-frozen default values + # will be duped and frozen. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:170 + def thread_mattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end + + # Defines a per-thread class attribute and creates class and instance reader methods. + # The underlying per-thread class variable is set to +nil+, if it is not previously defined. + # + # module Current + # thread_mattr_reader :user + # end + # + # Current.user = "DHH" + # Current.user # => "DHH" + # Thread.new { Current.user }.value # => nil + # + # The attribute name must be a valid method name in Ruby. + # + # module Foo + # thread_mattr_reader :"1_Badname" + # end + # # => NameError: invalid attribute name: 1_Badname + # + # To omit the instance reader method, pass + # instance_reader: false or instance_accessor: false. + # + # class Current + # thread_mattr_reader :user, instance_reader: false + # end + # + # Current.new.user # => NoMethodError + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:41 + def thread_mattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end + + # Defines a per-thread class attribute and creates a class and instance writer methods to + # allow assignment to the attribute. + # + # module Current + # thread_mattr_writer :user + # end + # + # Current.user = "DHH" + # Thread.current[:attr_Current_user] # => "DHH" + # + # To omit the instance writer method, pass + # instance_writer: false or instance_accessor: false. + # + # class Current + # thread_mattr_writer :user, instance_writer: false + # end + # + # Current.new.user = "DHH" # => NoMethodError + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:101 + def thread_mattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil)); end + + private + + # pkg:gem/activesupport#lib/active_support/core_ext/module/attr_internal.rb:40 + def attr_internal_define(attr_name, type); end + + class << self + # pkg:gem/activesupport#lib/active_support/core_ext/module/attr_internal.rb:23 + def attr_internal_naming_format; end + + # pkg:gem/activesupport#lib/active_support/core_ext/module/attr_internal.rb:25 + def attr_internal_naming_format=(format); end + end +end + +# == Bite-sized separation of concerns +# +# We often find ourselves with a medium-sized chunk of behavior that we'd +# like to extract, but only mix in to a single class. +# +# Extracting a plain old Ruby object to encapsulate it and collaborate or +# delegate to the original object is often a good choice, but when there's +# no additional state to encapsulate or we're making DSL-style declarations +# about the parent class, introducing new collaborators can obfuscate rather +# than simplify. +# +# The typical route is to just dump everything in a monolithic class, perhaps +# with a comment, as a least-bad alternative. Using modules in separate files +# means tedious sifting to get a big-picture view. +# +# == Dissatisfying ways to separate small concerns +# +# === Using comments: +# +# class Todo < ApplicationRecord +# # Other todo implementation +# # ... +# +# ## Event tracking +# has_many :events +# +# before_create :track_creation +# +# private +# def track_creation +# # ... +# end +# end +# +# === With an inline module: +# +# Noisy syntax. +# +# class Todo < ApplicationRecord +# # Other todo implementation +# # ... +# +# module EventTracking +# extend ActiveSupport::Concern +# +# included do +# has_many :events +# before_create :track_creation +# end +# +# private +# def track_creation +# # ... +# end +# end +# include EventTracking +# end +# +# === Mix-in noise exiled to its own file: +# +# Once our chunk of behavior starts pushing the scroll-to-understand-it +# boundary, we give in and move it to a separate file. At this size, the +# increased overhead can be a reasonable tradeoff even if it reduces our +# at-a-glance perception of how things work. +# +# class Todo < ApplicationRecord +# # Other todo implementation +# # ... +# +# include TodoEventTracking +# end +# +# == Introducing Module#concerning +# +# By quieting the mix-in noise, we arrive at a natural, low-ceremony way to +# separate bite-sized concerns. +# +# class Todo < ApplicationRecord +# # Other todo implementation +# # ... +# +# concerning :EventTracking do +# included do +# has_many :events +# before_create :track_creation +# end +# +# private +# def track_creation +# # ... +# end +# end +# end +# +# Todo.ancestors +# # => [Todo, Todo::EventTracking, ApplicationRecord, Object] +# +# This small step has some wonderful ripple effects. We can +# * grok the behavior of our class in one glance, +# * clean up monolithic junk-drawer classes by separating their concerns, and +# * stop leaning on protected/private for crude "this is internal stuff" modularity. +# +# === Prepending concerning +# +# concerning supports a prepend: true argument which will prepend the +# concern instead of using include for it. +# +# pkg:gem/activesupport#lib/active_support/core_ext/module/concerning.rb:112 +module Module::Concerning + # A low-cruft shortcut to define a concern. + # + # concern :EventTracking do + # ... + # end + # + # is equivalent to + # + # module EventTracking + # extend ActiveSupport::Concern + # + # ... + # end + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/concerning.rb:132 + def concern(topic, &module_definition); end + + # Define a new concern and mix it in. + # + # pkg:gem/activesupport#lib/active_support/core_ext/module/concerning.rb:114 + def concerning(topic, prepend: T.unsafe(nil), &block); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/module/delegation.rb:5 +Module::DelegationError = ActiveSupport::DelegationError + +# pkg:gem/activesupport#lib/active_support/core_ext/name_error.rb:3 +class NameError < ::StandardError + include ::ErrorHighlight::CoreExt + include ::DidYouMean::Correctable + + # Extract the name of the missing constant from the exception message. + # + # begin + # HelloWorld + # rescue NameError => e + # e.missing_name + # end + # # => "HelloWorld" + # + # pkg:gem/activesupport#lib/active_support/core_ext/name_error.rb:12 + def missing_name; end + + # Was this exception raised because the given name was missing? + # + # begin + # HelloWorld + # rescue NameError => e + # e.missing_name?("HelloWorld") + # end + # # => true + # + # pkg:gem/activesupport#lib/active_support/core_ext/name_error.rb:44 + def missing_name?(name); end + + private + + # pkg:gem/activesupport#lib/active_support/core_ext/name_error.rb:56 + def real_mod_name(mod); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/name_error.rb:53 +NameError::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod) + +# pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:50 +class NilClass + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:93 + def as_json(options = T.unsafe(nil)); end + + # +nil+ is blank: + # + # nil.blank? # => true + # + # @return [true] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:56 + def blank?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:60 + def present?; end + + # Returns +self+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:26 + def to_param; end + + # Returns a CGI-escaped +key+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:21 + def to_query(key); end + + # Calling +try+ on +nil+ always returns +nil+. + # It becomes especially helpful when navigating through associations that may return +nil+. + # + # nil.try(:name) # => nil + # + # Without +try+ + # @person && @person.children.any? && @person.children.first.name + # + # With +try+ + # @person.try(:children).try(:first).try(:name) + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/try.rb:148 + def try(*, &); end + + # Calling +try!+ on +nil+ always returns +nil+. + # + # nil.try!(:name) # => nil + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/try.rb:155 + def try!(*, &); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:170 +class Numeric + include ::Comparable + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:111 + def as_json(options = T.unsafe(nil)); end + + # No number is blank: + # + # 1.blank? # => false + # 0.blank? # => false + # + # @return [false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:177 + def blank?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:18 + def byte; end + + # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes + # + # 2.bytes # => 2 + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:15 + def bytes; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:40 + def day; end + + # Returns a Duration instance matching the number of days provided. + # + # 2.days # => 2 days + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:37 + def days; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:66 + def exabyte; end + + # Returns the number of bytes equivalent to the exabytes provided. + # + # 2.exabytes # => 2_305_843_009_213_693_952 + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:63 + def exabytes; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:56 + def fortnight; end + + # Returns a Duration instance matching the number of fortnights provided. + # + # 2.fortnights # => 4 weeks + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:53 + def fortnights; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:42 + def gigabyte; end + + # Returns the number of bytes equivalent to the gigabytes provided. + # + # 2.gigabytes # => 2_147_483_648 + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:39 + def gigabytes; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:32 + def hour; end + + # Returns a Duration instance matching the number of hours provided. + # + # 2.hours # => 2 hours + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:29 + def hours; end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:13 + def html_safe?; end + + # Returns the number of milliseconds equivalent to the seconds provided. + # Used with the standard time durations. + # + # 2.in_milliseconds # => 2000 + # 1.hour.in_milliseconds # => 3600000 + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:63 + def in_milliseconds; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:26 + def kilobyte; end + + # Returns the number of bytes equivalent to the kilobytes provided. + # + # 2.kilobytes # => 2048 + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:23 + def kilobytes; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:34 + def megabyte; end + + # Returns the number of bytes equivalent to the megabytes provided. + # + # 2.megabytes # => 2_097_152 + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:31 + def megabytes; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:24 + def minute; end + + # Returns a Duration instance matching the number of minutes provided. + # + # 2.minutes # => 2 minutes + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:21 + def minutes; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:58 + def petabyte; end + + # Returns the number of bytes equivalent to the petabytes provided. + # + # 2.petabytes # => 2_251_799_813_685_248 + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:55 + def petabytes; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:181 + def present?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:16 + def second; end + + # Returns a Duration instance matching the number of seconds provided. + # + # 2.seconds # => 2 seconds + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:13 + def seconds; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:50 + def terabyte; end + + # Returns the number of bytes equivalent to the terabytes provided. + # + # 2.terabytes # => 2_199_023_255_552 + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:47 + def terabytes; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:48 + def week; end + + # Returns a Duration instance matching the number of weeks provided. + # + # 2.weeks # => 2 weeks + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/time.rb:45 + def weeks; end + + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:74 + def zettabyte; end + + # Returns the number of bytes equivalent to the zettabytes provided. + # + # 2.zettabytes # => 2_361_183_241_434_822_606_848 + # + # pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:71 + def zettabytes; end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:9 +Numeric::EXABYTE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:6 +Numeric::GIGABYTE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:4 +Numeric::KILOBYTE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:5 +Numeric::MEGABYTE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:8 +Numeric::PETABYTE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:7 +Numeric::TERABYTE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/activesupport#lib/active_support/core_ext/numeric/bytes.rb:10 +Numeric::ZETTABYTE = T.let(T.unsafe(nil), Integer) + +# -- +# Most objects are cloneable, but not all. For example you can't dup methods: +# +# method(:puts).dup # => TypeError: allocator undefined for Method +# +# Classes may signal their instances are not duplicable removing +dup+/+clone+ +# or raising exceptions from them. So, to dup an arbitrary object you normally +# use an optimistic approach and are ready to catch an exception, say: +# +# arbitrary_object.dup rescue object +# +# Rails dups objects in a few critical spots where they are not that arbitrary. +# That rescue is very expensive (like 40 times slower than a predicate), and it +# is often triggered. +# +# That's why we hardcode the following cases and check duplicable? instead of +# using that rescue idiom. +# ++ +# +# pkg:gem/activesupport#lib/active_support/core_ext/object/duplicable.rb:21 +class Object < ::BasicObject + include ::ActiveSupport::Dependencies::RequireDependency + include ::Kernel + include ::PP::ObjectMixin + include ::ActiveSupport::Tryable + include ::ActiveSupport::ToJsonWithActiveSupportEncoder + + # Provides a way to check whether some class acts like some other class based on the existence of + # an appropriately-named marker method. + # + # A class that provides the same interface as SomeClass may define a marker method named + # acts_like_some_class? to signal its compatibility to callers of + # acts_like?(:some_class). + # + # For example, Active Support extends Date to define an acts_like_date? method, + # and extends Time to define acts_like_time?. As a result, developers can call + # x.acts_like?(:time) and x.acts_like?(:date) to test duck-type compatibility, + # and classes that are able to act like Time can also define an acts_like_time? + # method to interoperate. + # + # Note that the marker method is only expected to exist. It isn't called, so its body or return + # value are irrelevant. + # + # ==== Example: A class that provides the same interface as String + # + # This class may define: + # + # class Stringish + # def acts_like_string? + # end + # end + # + # Then client code can query for duck-type-safeness this way: + # + # Stringish.new.acts_like?(:string) # => true + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/acts_like.rb:33 + def acts_like?(duck); end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:59 + def as_json(options = T.unsafe(nil)); end + + # An object is blank if it's false, empty, or a whitespace string. + # For example, +nil+, '', ' ', [], {}, and +false+ are all blank. + # + # This simplifies + # + # !address || address.empty? + # + # to + # + # address.blank? + # + # @return [true, false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:18 + def blank?; end + + # Returns a deep copy of object if it's duplicable. If it's + # not duplicable, returns +self+. + # + # object = Object.new + # dup = object.deep_dup + # dup.instance_variable_set(:@a, 1) + # + # object.instance_variable_defined?(:@a) # => false + # dup.instance_variable_defined?(:@a) # => true + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/deep_dup.rb:15 + def deep_dup; end + + # Can you safely dup this object? + # + # False for method objects; + # true otherwise. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/duplicable.rb:26 + def duplicable?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:7 + def html_safe?; end + + # Returns true if this object is included in the argument. + # + # When argument is a +Range+, +#cover?+ is used to properly handle inclusion + # check within open ranges. Otherwise, argument must be any object which responds + # to +#include?+. Usage: + # + # characters = ["Konata", "Kagami", "Tsukasa"] + # "Konata".in?(characters) # => true + # + # For non +Range+ arguments, this will throw an +ArgumentError+ if the argument + # doesn't respond to +#include?+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/inclusion.rb:15 + def in?(another_object); end + + # Returns a hash with string keys that maps instance variable names without "@" to their + # corresponding values. + # + # class C + # def initialize(x, y) + # @x, @y = x, y + # end + # end + # + # C.new(0, 1).instance_values # => {"x" => 0, "y" => 1} + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/instance_variables.rb:14 + def instance_values; end + + # Returns an array of instance variable names as strings including "@". + # + # class C + # def initialize(x, y) + # @x, @y = x, y + # end + # end + # + # C.new(0, 1).instance_variable_names # => ["@x", "@y"] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/instance_variables.rb:29 + def instance_variable_names; end + + # Returns the receiver if it's present otherwise returns +nil+. + # object.presence is equivalent to + # + # object.present? ? object : nil + # + # For example, something like + # + # state = params[:state] if params[:state].present? + # country = params[:country] if params[:country].present? + # region = state || country || 'US' + # + # becomes + # + # region = params[:state].presence || params[:country].presence || 'US' + # + # @return [Object] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:45 + def presence; end + + # Returns the receiver if it's included in the argument otherwise returns +nil+. + # Argument must be any object which responds to +#include?+. Usage: + # + # params[:bucket_type].presence_in %w( project calendar ) + # + # This will throw an +ArgumentError+ if the argument doesn't respond to +#include?+. + # + # @return [Object] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/inclusion.rb:34 + def presence_in(another_object); end + + # An object is present if it's not blank. + # + # @return [true, false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:25 + def present?; end + + # Alias of to_s. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:8 + def to_param; end + + # Converts an object into a string suitable for use as a URL query string, + # using the given key as the param name. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:14 + def to_query(key); end + + # Set and restore public attributes around a block. + # + # client.timeout # => 5 + # client.with(timeout: 1) do |c| + # c.timeout # => 1 + # end + # client.timeout # => 5 + # + # The receiver is yielded to the provided block. + # + # This method is a shorthand for the common begin/ensure pattern: + # + # old_value = object.attribute + # begin + # object.attribute = new_value + # # do things + # ensure + # object.attribute = old_value + # end + # + # It can be used on any object as long as both the reader and writer methods + # are public. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/with.rb:26 + def with(**attributes); end + + # An elegant way to factor duplication out of options passed to a series of + # method calls. Each method called in the block, with the block variable as + # the receiver, will have its options merged with the default +options+ + # Hash or Hash-like object provided. Each method called on + # the block variable must take an options hash as its final argument. + # + # Without with_options, this code contains duplication: + # + # class Account < ActiveRecord::Base + # has_many :customers, dependent: :destroy + # has_many :products, dependent: :destroy + # has_many :invoices, dependent: :destroy + # has_many :expenses, dependent: :destroy + # end + # + # Using with_options, we can remove the duplication: + # + # class Account < ActiveRecord::Base + # with_options dependent: :destroy do |assoc| + # assoc.has_many :customers + # assoc.has_many :products + # assoc.has_many :invoices + # assoc.has_many :expenses + # end + # end + # + # It can also be used with an explicit receiver: + # + # I18n.with_options locale: user.locale, scope: 'newsletter' do |i18n| + # subject i18n.t :subject + # body i18n.t :body, user_name: user.name + # end + # + # When you don't pass an explicit receiver, it executes the whole block + # in merging options context: + # + # class Account < ActiveRecord::Base + # with_options dependent: :destroy do + # has_many :customers + # has_many :products + # has_many :invoices + # has_many :expenses + # end + # end + # + # with_options can also be nested since the call is forwarded to its receiver. + # + # NOTE: Each nesting level will merge inherited defaults in addition to their own. + # + # class Post < ActiveRecord::Base + # with_options if: :persisted?, length: { minimum: 50 } do + # validates :content, if: -> { content.present? } + # end + # end + # + # The code is equivalent to: + # + # validates :content, length: { minimum: 50 }, if: -> { content.present? } + # + # Hence the inherited default for +if+ key is ignored. + # + # NOTE: You cannot call class methods implicitly inside of +with_options+. + # You can access these methods using the class name instead: + # + # class Phone < ActiveRecord::Base + # enum :phone_number_type, { home: 0, office: 1, mobile: 2 } + # + # with_options presence: true do + # validates :phone_number_type, inclusion: { in: Phone.phone_number_types.keys } + # end + # end + # + # When the block argument is omitted, the decorated Object instance is returned: + # + # module MyStyledHelpers + # def styled + # with_options style: "color: red;" + # end + # end + # + # styled.link_to "I'm red", "/" + # # => I'm red + # + # styled.button_tag "I'm red too!" + # # => + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/with_options.rb:92 + def with_options(options, &block); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:236 +class Pathname + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:237 + def as_json(options = T.unsafe(nil)); end +end + +module Process + extend ::Sass::ForkTracker::CoreExt + extend ::RedisClient::PIDCache::CoreExt + extend ::ConnectionPool::ForkTracker + extend ::ActiveSupport::ForkTracker::CoreExt + + class << self + # pkg:gem/activesupport#lib/active_support/fork_tracker.rb:6 + def _fork; end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:257 +class Process::Status + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:258 + def as_json(options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:157 +class Range + include ::ActiveSupport::RangeWithFormat + include ::ActiveSupport::CompareWithRange + include ::Enumerable + + # pkg:gem/activesupport#lib/active_support/core_ext/range/compare_range.rb:16 + def ===(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:158 + def as_json(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/range/compare_range.rb:35 + def include?(value); end + + # pkg:gem/activesupport#lib/active_support/core_ext/range/overlap.rb:39 + def overlaps?(_arg0); end + + # Returns the sole item in the range. If there are no items, or more + # than one item, raises Enumerable::SoleItemExpectedError. + # + # (1..1).sole # => 1 + # (2..1).sole # => Enumerable::SoleItemExpectedError: no item found + # (..1).sole # => Enumerable::SoleItemExpectedError: infinite range cannot represent a sole item + # + # pkg:gem/activesupport#lib/active_support/core_ext/range/sole.rb:12 + def sole; end + + # Optimize range sum to use arithmetic progression if a block is not given and + # we have a range of numeric values. + # + # pkg:gem/activesupport#lib/active_support/core_ext/enumerable.rb:253 + def sum(initial_value = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:139 +class Regexp + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:140 + def as_json(options = T.unsafe(nil)); end + + # Returns +true+ if the regexp has the multiline flag set. + # + # (/./).multiline? # => false + # (/./m).multiline? # => true + # + # Regexp.new(".").multiline? # => false + # Regexp.new(".", Regexp::MULTILINE).multiline? # => true + # + # pkg:gem/activesupport#lib/active_support/core_ext/regexp.rb:11 + def multiline?; end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/securerandom.rb:5 +module SecureRandom + class << self + # Remove check when Ruby 3.3 is the minimum supported version + # + # pkg:gem/activesupport#lib/active_support/core_ext/securerandom.rb:45 + def base36(n = T.unsafe(nil)); end + + # Remove check when Ruby 3.3 is the minimum supported version + # + # pkg:gem/activesupport#lib/active_support/core_ext/securerandom.rb:20 + def base58(n = T.unsafe(nil)); end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/securerandom.rb:7 +SecureRandom::BASE36_ALPHABET = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/core_ext/securerandom.rb:6 +SecureRandom::BASE58_ALPHABET = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/core_ext/object/duplicable.rb:62 +module Singleton + mixes_in_class_methods ::Singleton::SingletonClassMethods + + # Singleton instances are not duplicable: + # + # Class.new.include(Singleton).instance.dup # TypeError (can't dup instance of singleton + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/duplicable.rb:66 + def duplicable?; end +end + +# String inflections define new methods on the String class to transform names for different purposes. +# For instance, you can figure out the name of a table from the name of a class. +# +# 'ScaleScore'.tableize # => "scale_scores" +# +# pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:135 +class String + include ::Comparable + + # Enables more predictable duck-typing on String-like classes. See Object#acts_like?. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/behavior.rb:5 + def acts_like_string?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:99 + def as_json(options = T.unsafe(nil)); end + + # If you pass a single integer, returns a substring of one character at that + # position. The first character of the string is at position 0, the next at + # position 1, and so on. If a range is supplied, a substring containing + # characters at offsets given by the range is returned. In both cases, if an + # offset is negative, it is counted from the end of the string. Returns +nil+ + # if the initial offset falls outside the string. Returns an empty string if + # the beginning of the range is greater than the end of the string. + # + # str = "hello" + # str.at(0) # => "h" + # str.at(1..3) # => "ell" + # str.at(-2) # => "l" + # str.at(-2..-1) # => "lo" + # str.at(5) # => nil + # str.at(5..-1) # => "" + # + # If a Regexp is given, the matching portion of the string is returned. + # If a String is given, that given string is returned if it occurs in + # the string. In both cases, +nil+ is returned if there is no match. + # + # str = "hello" + # str.at(/lo/) # => "lo" + # str.at(/ol/) # => nil + # str.at("lo") # => "lo" + # str.at("ol") # => nil + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/access.rb:29 + def at(position); end + + # A string is blank if it's empty or contains whitespaces only: + # + # ''.blank? # => true + # ' '.blank? # => true + # "\t\n\r".blank? # => true + # ' blah '.blank? # => false + # + # Unicode whitespace is supported: + # + # "\u00a0".blank? # => true + # + # @return [true, false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:153 + def blank?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:111 + def camelcase(first_letter = T.unsafe(nil)); end + + # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize + # is set to :lower then camelize produces lowerCamelCase. + # + # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces. + # + # 'active_record'.camelize # => "ActiveRecord" + # 'active_record'.camelize(:lower) # => "activeRecord" + # 'active_record/errors'.camelize # => "ActiveRecord::Errors" + # 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors" + # + # See ActiveSupport::Inflector.camelize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:101 + def camelize(first_letter = T.unsafe(nil)); end + + # Creates a class name from a plural table name like \Rails does for table names to models. + # Note that this returns a string and not a class. (To convert to an actual class + # follow +classify+ with +constantize+.) + # + # 'ham_and_eggs'.classify # => "HamAndEgg" + # 'posts'.classify # => "Post" + # + # See ActiveSupport::Inflector.classify. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:239 + def classify; end + + # +constantize+ tries to find a declared constant with the name specified + # in the string. It raises a NameError when the name is not in CamelCase + # or is not initialized. + # + # 'Module'.constantize # => Module + # 'Class'.constantize # => Class + # 'blargle'.constantize # => NameError: wrong constant name blargle + # + # See ActiveSupport::Inflector.constantize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:73 + def constantize; end + + # Replaces underscores with dashes in the string. + # + # 'puni_puni'.dasherize # => "puni-puni" + # + # See ActiveSupport::Inflector.dasherize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:148 + def dasherize; end + + # Removes the rightmost segment from the constant expression in the string. + # + # 'Net::HTTP'.deconstantize # => "Net" + # '::Net::HTTP'.deconstantize # => "::Net" + # 'String'.deconstantize # => "" + # '::String'.deconstantize # => "" + # ''.deconstantize # => "" + # + # See ActiveSupport::Inflector.deconstantize. + # + # See also +demodulize+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:177 + def deconstantize; end + + # Removes the module part from the constant expression in the string. + # + # 'ActiveSupport::Inflector::Inflections'.demodulize # => "Inflections" + # 'Inflections'.demodulize # => "Inflections" + # '::Inflections'.demodulize # => "Inflections" + # ''.demodulize # => '' + # + # See ActiveSupport::Inflector.demodulize. + # + # See also +deconstantize+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:162 + def demodulize; end + + # Converts the first character to lowercase. + # + # 'If they enjoyed The Matrix'.downcase_first # => "if they enjoyed The Matrix" + # 'I'.downcase_first # => "i" + # ''.downcase_first # => "" + # + # See ActiveSupport::Inflector.downcase_first. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:284 + def downcase_first; end + + # Returns the first character. If a limit is supplied, returns a substring + # from the beginning of the string until it reaches the limit value. If the + # given limit is greater than or equal to the string length, returns a copy of self. + # + # str = "hello" + # str.first # => "h" + # str.first(1) # => "h" + # str.first(2) # => "he" + # str.first(0) # => "" + # str.first(6) # => "hello" + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/access.rb:78 + def first(limit = T.unsafe(nil)); end + + # Creates a foreign key name from a class name. + # +separate_class_name_and_id_with_underscore+ sets whether + # the method should put '_' between the name and 'id'. + # + # 'Message'.foreign_key # => "message_id" + # 'Message'.foreign_key(false) # => "messageid" + # 'Admin::Post'.foreign_key # => "post_id" + # + # See ActiveSupport::Inflector.foreign_key. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:297 + def foreign_key(separate_class_name_and_id_with_underscore = T.unsafe(nil)); end + + # Returns a substring from the given position to the end of the string. + # If the position is negative, it is counted from the end of the string. + # + # str = "hello" + # str.from(0) # => "hello" + # str.from(3) # => "lo" + # str.from(-2) # => "lo" + # + # You can mix it with +to+ method and do fun things like: + # + # str = "hello" + # str.from(0).to(-1) # => "hello" + # str.from(1).to(-2) # => "ell" + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/access.rb:46 + def from(position); end + + # Marks a string as trusted safe. It will be inserted into HTML with no + # additional escaping performed. It is your responsibility to ensure that the + # string contains no malicious content. This method is equivalent to the + # +raw+ helper in views. It is recommended that you use +sanitize+ instead of + # this method. It should never be called on user input. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/output_safety.rb:241 + def html_safe; end + + # Capitalizes the first word, turns underscores into spaces, and (by default) strips a + # trailing '_id' if present. + # Like +titleize+, this is meant for creating pretty output. + # + # The capitalization of the first word can be turned off by setting the + # optional parameter +capitalize+ to false. + # By default, this parameter is true. + # + # The trailing '_id' can be kept by setting the + # optional parameter +keep_id_suffix+ to true. + # By default, this parameter is false. + # + # 'employee_salary'.humanize # => "Employee salary" + # 'author_id'.humanize # => "Author" + # 'author_id'.humanize(capitalize: false) # => "author" + # '_id'.humanize # => "Id" + # 'author_id'.humanize(keep_id_suffix: true) # => "Author id" + # + # See ActiveSupport::Inflector.humanize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:262 + def humanize(capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end + + # Converts String to a TimeWithZone in the current zone if Time.zone or Time.zone_default + # is set, otherwise converts String to a Time via String#to_time + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/zones.rb:9 + def in_time_zone(zone = T.unsafe(nil)); end + + # Wraps the current string in the ActiveSupport::StringInquirer class, + # which gives you a prettier way to test for equality. + # + # env = 'production'.inquiry + # env.production? # => true + # env.development? # => false + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inquiry.rb:13 + def inquiry; end + + # Returns +true+ if string has utf_8 encoding. + # + # utf_8_str = "some string".encode "UTF-8" + # iso_str = "some string".encode "ISO-8859-1" + # + # utf_8_str.is_utf8? # => true + # iso_str.is_utf8? # => false + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/multibyte.rb:57 + def is_utf8?; end + + # Returns the last character of the string. If a limit is supplied, returns a substring + # from the end of the string until it reaches the limit value (counting backwards). If + # the given limit is greater than or equal to the string length, returns a copy of self. + # + # str = "hello" + # str.last # => "o" + # str.last(1) # => "o" + # str.last(2) # => "lo" + # str.last(0) # => "" + # str.last(6) # => "hello" + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/access.rb:92 + def last(limit = T.unsafe(nil)); end + + # == Multibyte proxy + # + # +mb_chars+ is a multibyte safe proxy for string methods. + # + # It creates and returns an instance of the ActiveSupport::Multibyte::Chars class which + # encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy + # class. If the proxy class doesn't respond to a certain method, it's forwarded to the encapsulated string. + # + # >> "lj".mb_chars.upcase.to_s + # # => "LJ" + # + # NOTE: Ruby 2.4 and later support native Unicode case mappings: + # + # >> "lj".upcase + # # => "LJ" + # + # == \Method chaining + # + # All the methods on the Chars proxy which normally return a string will return a Chars object. This allows + # method chaining on the result of any of these methods. + # + # name.mb_chars.reverse.length # => 12 + # + # == Interoperability and configuration + # + # The Chars object tries to be as interchangeable with String objects as possible: sorting and comparing between + # String and Char work like expected. The bang! methods change the internal string representation in the Chars + # object. Interoperability problems can be resolved easily with a +to_s+ call. + # + # For more information about the methods defined on the Chars proxy see ActiveSupport::Multibyte::Chars. For + # information about how to change the default Multibyte behavior see ActiveSupport::Multibyte. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/multibyte.rb:37 + def mb_chars; end + + # Replaces special characters in a string so that it may be used as part of a 'pretty' URL. + # + # If the optional parameter +locale+ is specified, + # the word will be parameterized as a word of that language. + # By default, this parameter is set to nil and it will use + # the configured I18n.locale. + # + # class Person + # def to_param + # "#{id}-#{name.parameterize}" + # end + # end + # + # @person = Person.find(1) + # # => # + # + # <%= link_to(@person.name, person_path) %> + # # => Donald E. Knuth + # + # To preserve the case of the characters in a string, use the +preserve_case+ argument. + # + # class Person + # def to_param + # "#{id}-#{name.parameterize(preserve_case: true)}" + # end + # end + # + # @person = Person.find(1) + # # => # + # + # <%= link_to(@person.name, person_path) %> + # # => Donald E. Knuth + # + # See ActiveSupport::Inflector.parameterize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:215 + def parameterize(separator: T.unsafe(nil), preserve_case: T.unsafe(nil), locale: T.unsafe(nil)); end + + # Returns the plural form of the word in the string. + # + # If the optional parameter +count+ is specified, + # the singular form will be returned if count == 1. + # For any other value of +count+ the plural will be returned. + # + # If the optional parameter +locale+ is specified, + # the word will be pluralized as a word of that language. + # By default, this parameter is set to :en. + # You must define your own inflection rules for languages other than English. + # + # 'post'.pluralize # => "posts" + # 'octopus'.pluralize # => "octopi" + # 'sheep'.pluralize # => "sheep" + # 'words'.pluralize # => "words" + # 'the blue mailman'.pluralize # => "the blue mailmen" + # 'CamelOctopus'.pluralize # => "CamelOctopi" + # 'apple'.pluralize(1) # => "apple" + # 'apple'.pluralize(2) # => "apples" + # 'ley'.pluralize(:es) # => "leyes" + # 'ley'.pluralize(1, :es) # => "ley" + # + # See ActiveSupport::Inflector.pluralize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:35 + def pluralize(count = T.unsafe(nil), locale = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:165 + def present?; end + + # Returns a new string with all occurrences of the patterns removed. + # str = "foo bar test" + # str.remove(" test") # => "foo bar" + # str.remove(" test", /bar/) # => "foo " + # str # => "foo bar test" + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/filters.rb:32 + def remove(*patterns); end + + # Alters the string by removing all occurrences of the patterns. + # str = "foo bar test" + # str.remove!(" test", /bar/) # => "foo " + # str # => "foo " + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/filters.rb:40 + def remove!(*patterns); end + + # +safe_constantize+ tries to find a declared constant with the name specified + # in the string. It returns +nil+ when the name is not in CamelCase + # or is not initialized. + # + # 'Module'.safe_constantize # => Module + # 'Class'.safe_constantize # => Class + # 'blargle'.safe_constantize # => nil + # + # See ActiveSupport::Inflector.safe_constantize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:86 + def safe_constantize; end + + # The reverse of +pluralize+, returns the singular form of a word in a string. + # + # If the optional parameter +locale+ is specified, + # the word will be singularized as a word of that language. + # By default, this parameter is set to :en. + # You must define your own inflection rules for languages other than English. + # + # 'posts'.singularize # => "post" + # 'octopi'.singularize # => "octopus" + # 'sheep'.singularize # => "sheep" + # 'word'.singularize # => "word" + # 'the blue mailmen'.singularize # => "the blue mailman" + # 'CamelOctopi'.singularize # => "CamelOctopus" + # 'leyes'.singularize(:es) # => "ley" + # + # See ActiveSupport::Inflector.singularize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:60 + def singularize(locale = T.unsafe(nil)); end + + # Returns the string, first removing all whitespace on both ends of + # the string, and then changing remaining consecutive whitespace + # groups into one space each. + # + # Note that it handles both ASCII and Unicode whitespace. + # + # %{ Multi-line + # string }.squish # => "Multi-line string" + # " foo bar \n \t boo".squish # => "foo bar boo" + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/filters.rb:13 + def squish; end + + # Performs a destructive squish. See String#squish. + # str = " foo bar \n \t boo" + # str.squish! # => "foo bar boo" + # str # => "foo bar boo" + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/filters.rb:21 + def squish!; end + + # Creates the name of a table like \Rails does for models to table names. This method + # uses the +pluralize+ method on the last word in the string. + # + # 'RawScaledScorer'.tableize # => "raw_scaled_scorers" + # 'ham_and_egg'.tableize # => "ham_and_eggs" + # 'fancyCategory'.tableize # => "fancy_categories" + # + # See ActiveSupport::Inflector.tableize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:227 + def tableize; end + + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:129 + def titlecase(keep_id_suffix: T.unsafe(nil)); end + + # Capitalizes all the words and replaces some characters in the string to create + # a nicer looking title. +titleize+ is meant for creating pretty output. It is not + # used in the \Rails internals. + # + # The trailing '_id','Id'.. can be kept and capitalized by setting the + # optional parameter +keep_id_suffix+ to true. + # By default, this parameter is false. + # + # 'man from the boondocks'.titleize # => "Man From The Boondocks" + # 'x-men: the last stand'.titleize # => "X Men: The Last Stand" + # 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id" + # + # See ActiveSupport::Inflector.titleize. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:126 + def titleize(keep_id_suffix: T.unsafe(nil)); end + + # Returns a substring from the beginning of the string to the given position. + # If the position is negative, it is counted from the end of the string. + # + # str = "hello" + # str.to(0) # => "h" + # str.to(3) # => "hell" + # str.to(-2) # => "hell" + # + # You can mix it with +from+ method and do fun things like: + # + # str = "hello" + # str.from(0).to(-1) # => "hello" + # str.from(1).to(-2) # => "ell" + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/access.rb:63 + def to(position); end + + # Converts a string to a Date value. + # + # "1-1-2012".to_date # => Sun, 01 Jan 2012 + # "01/01/2012".to_date # => Sun, 01 Jan 2012 + # "2012-12-13".to_date # => Thu, 13 Dec 2012 + # "12/13/2012".to_date # => ArgumentError: invalid date + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/conversions.rb:47 + def to_date; end + + # Converts a string to a DateTime value. + # + # "1-1-2012".to_datetime # => Sun, 01 Jan 2012 00:00:00 +0000 + # "01/01/2012 23:59:59".to_datetime # => Sun, 01 Jan 2012 23:59:59 +0000 + # "2012-12-13 12:50".to_datetime # => Thu, 13 Dec 2012 12:50:00 +0000 + # "12/13/2012".to_datetime # => ArgumentError: invalid date + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/conversions.rb:57 + def to_datetime; end + + # Converts a string to a Time value. + # The +form+ can be either +:utc+ or +:local+ (default +:local+). + # + # The time is parsed using Time.parse method. + # If +form+ is +:local+, then the time is in the system timezone. + # If the date part is missing then the current date is used and if + # the time part is missing then it is assumed to be 00:00:00. + # + # "13-12-2012".to_time # => 2012-12-13 00:00:00 +0100 + # "06:12".to_time # => 2012-12-13 06:12:00 +0100 + # "2012-12-13 06:12".to_time # => 2012-12-13 06:12:00 +0100 + # "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100 + # "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 06:12:00 UTC + # "12/13/2012".to_time # => ArgumentError: argument out of range + # "1604326192".to_time # => ArgumentError: argument out of range + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/conversions.rb:22 + def to_time(form = T.unsafe(nil)); end + + # Truncates a given +text+ to length truncate_to if +text+ is longer than truncate_to: + # + # 'Once upon a time in a world far far away'.truncate(27) + # # => "Once upon a time in a wo..." + # + # Pass a string or regexp :separator to truncate +text+ at a natural break: + # + # 'Once upon a time in a world far far away'.truncate(27, separator: ' ') + # # => "Once upon a time in a..." + # + # 'Once upon a time in a world far far away'.truncate(27, separator: /\s/) + # # => "Once upon a time in a..." + # + # The last characters will be replaced with the :omission string (defaults to "..."). + # The total length will not exceed truncate_to unless both +text+ and :omission + # are longer than truncate_to: + # + # 'And they found that many people were sleeping better.'.truncate(25, omission: '... (continued)') + # # => "And they f... (continued)" + # + # 'And they found that many people were sleeping better.'.truncate(4, omission: '... (continued)') + # # => "... (continued)" + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/filters.rb:70 + def truncate(truncate_to, options = T.unsafe(nil)); end + + # Truncates +text+ to at most truncate_to bytes in length without + # breaking string encoding by splitting multibyte characters or breaking + # grapheme clusters ("perceptual characters") by truncating at combining + # characters. + # + # >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".size + # # => 20 + # >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".bytesize + # # => 80 + # >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".truncate_bytes(20) + # # => "🔪🔪🔪🔪…" + # + # The truncated text ends with the :omission string, defaulting + # to "…", for a total length not exceeding truncate_to. + # + # Raises +ArgumentError+ when the bytesize of :omission exceeds truncate_to. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/filters.rb:103 + def truncate_bytes(truncate_to, omission: T.unsafe(nil)); end + + # Truncates a given +text+ after a given number of words (words_count): + # + # 'Once upon a time in a world far far away'.truncate_words(4) + # # => "Once upon a time..." + # + # Pass a string or regexp :separator to specify a different separator of words: + # + # 'Once
    upon
    a
    time
    in
    a
    world'.truncate_words(5, separator: '
    ') + # # => "Once
    upon
    a
    time
    in..." + # + # The last characters will be replaced with the :omission string (defaults to "..."): + # + # 'And they found that many people were sleeping better.'.truncate_words(5, omission: '... (continued)') + # # => "And they found that many... (continued)" + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/filters.rb:144 + def truncate_words(words_count, options = T.unsafe(nil)); end + + # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string. + # + # +underscore+ will also change '::' to '/' to convert namespaces to paths. + # + # 'ActiveModel'.underscore # => "active_model" + # 'ActiveModel::Errors'.underscore # => "active_model/errors" + # + # See ActiveSupport::Inflector.underscore. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:139 + def underscore; end + + # Converts the first character to uppercase. + # + # 'what a Lovely Day'.upcase_first # => "What a Lovely Day" + # 'w'.upcase_first # => "W" + # ''.upcase_first # => "" + # + # See ActiveSupport::Inflector.upcase_first. + # + # pkg:gem/activesupport#lib/active_support/core_ext/string/inflections.rb:273 + def upcase_first; end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:136 +String::BLANK_RE = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:137 +String::ENCODED_BLANKS = T.let(T.unsafe(nil), Concurrent::Map) + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:74 +class Struct + include ::Enumerable + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:75 + def as_json(options = T.unsafe(nil)); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:123 +class Symbol + include ::Comparable + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:105 + def as_json(options = T.unsafe(nil)); end + + # A Symbol is blank if it's empty: + # + # :''.blank? # => true + # :symbol.blank? # => false + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:128 + def blank?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:130 + def present?; end +end + +class Thread + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:7 + def active_support_execution_state; end + + # pkg:gem/activesupport#lib/active_support/isolated_execution_state.rb:7 + def active_support_execution_state=(_arg0); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/thread/backtrace/location.rb:3 +class Thread::Backtrace::Location + # pkg:gem/activesupport#lib/active_support/core_ext/thread/backtrace/location.rb:4 + def spot(ex); end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:186 +class Time + include ::Comparable + include ::DateAndTime::Zones + include ::DateAndTime::Calculations + include ::DateAndTime::Compatibility + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:302 + def +(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:312 + def -(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:342 + def <=>(other); end + + # Duck-types as a Time-like class. See Object#acts_like?. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/acts_like.rb:7 + def acts_like_time?; end + + # Uses Date to provide precise Time calculations for years, months, and days + # according to the proleptic Gregorian calendar. The +options+ parameter + # takes a hash with any of these keys: :years, :months, + # :weeks, :days, :hours, :minutes, + # :seconds. + # + # Time.new(2015, 8, 1, 14, 35, 0).advance(seconds: 1) # => 2015-08-01 14:35:01 -0700 + # Time.new(2015, 8, 1, 14, 35, 0).advance(minutes: 1) # => 2015-08-01 14:36:00 -0700 + # Time.new(2015, 8, 1, 14, 35, 0).advance(hours: 1) # => 2015-08-01 15:35:00 -0700 + # Time.new(2015, 8, 1, 14, 35, 0).advance(days: 1) # => 2015-08-02 14:35:00 -0700 + # Time.new(2015, 8, 1, 14, 35, 0).advance(weeks: 1) # => 2015-08-08 14:35:00 -0700 + # + # Just like Date#advance, increments are applied in order of time units from + # largest to smallest. This order can affect the result around the end of a + # month. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:197 + def advance(options); end + + # Returns a new Time representing the time a number of seconds ago, this is basically a wrapper around the Numeric extension + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:224 + def ago(seconds); end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:201 + def as_json(options = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:240 + def at_beginning_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:267 + def at_beginning_of_hour; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:283 + def at_beginning_of_minute; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:261 + def at_end_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:277 + def at_end_of_hour; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:292 + def at_end_of_minute; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:248 + def at_midday; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:250 + def at_middle_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:239 + def at_midnight; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:249 + def at_noon; end + + # Returns a new Time representing the start of the day (0:00) + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:235 + def beginning_of_day; end + + # Returns a new Time representing the start of the hour (x:00) + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:264 + def beginning_of_hour; end + + # Returns a new Time representing the start of the minute (x:xx:00) + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:280 + def beginning_of_minute; end + + # No Time is blank: + # + # Time.now.blank? # => false + # + # @return [false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:192 + def blank?; end + + # Returns a new Time where one or more of the elements have been changed according + # to the +options+ parameter. The time options (:hour, :min, + # :sec, :usec, :nsec) reset cascadingly, so if only + # the hour is passed, then minute, sec, usec, and nsec is set to 0. If the hour + # and minute is passed, then sec, usec, and nsec is set to 0. The +options+ parameter + # takes a hash with any of these keys: :year, :month, :day, + # :hour, :min, :sec, :usec, :nsec, + # :offset. Pass either :usec or :nsec, not both. + # + # Time.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => Time.new(2012, 8, 1, 22, 35, 0) + # Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => Time.new(1981, 8, 1, 22, 35, 0) + # Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => Time.new(1981, 8, 29, 0, 0, 0) + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:126 + def change(options); end + + # Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances + # can be chronologically compared with a Time + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:326 + def compare_with_coercion(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:341 + def compare_without_coercion(_arg0); end + + # Returns a new Time representing the end of the day, 23:59:59.999999 + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:253 + def end_of_day; end + + # Returns a new Time representing the end of the hour, x:59:59.999999 + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:270 + def end_of_hour; end + + # Returns a new Time representing the end of the minute, x:xx:59.999999 + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:286 + def end_of_minute; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:352 + def eql?(other); end + + # Layers additional behavior on Time#eql? so that ActiveSupport::TimeWithZone instances + # can be eql? to an equivalent Time + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:346 + def eql_with_coercion(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:351 + def eql_without_coercion(_arg0); end + + # Returns a formatted string of the offset from UTC, or an alternative + # string if the time zone is already UTC. + # + # Time.local(2000).formatted_offset # => "-06:00" + # Time.local(2000).formatted_offset(false) # => "-0600" + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/conversions.rb:69 + def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:232 + def in(seconds); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:246 + def midday; end + + # Returns a new Time representing the middle of the day (12:00) + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:243 + def middle_of_day; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:238 + def midnight; end + + # Time#- can also be used to determine the number of seconds between two Time instances. + # We're layering on additional behavior so that ActiveSupport::TimeWithZone instances + # are coerced into values that Time#- will recognize + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:317 + def minus_with_coercion(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:304 + def minus_with_duration(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:321 + def minus_without_coercion(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:311 + def minus_without_duration(_arg0); end + + # Returns a new time the specified number of days in the future. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:360 + def next_day(days = T.unsafe(nil)); end + + # Returns a new time the specified number of months in the future. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:370 + def next_month(months = T.unsafe(nil)); end + + # Returns a new time the specified number of years in the future. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:380 + def next_year(years = T.unsafe(nil)); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:247 + def noon; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:294 + def plus_with_duration(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:301 + def plus_without_duration(_arg0); end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:196 + def present?; end + + # Returns a new time the specified number of days ago. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:355 + def prev_day(days = T.unsafe(nil)); end + + # Returns a new time the specified number of months ago. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:365 + def prev_month(months = T.unsafe(nil)); end + + # Returns a new time the specified number of years ago. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:375 + def prev_year(years = T.unsafe(nil)); end + + # Aliased to +xmlschema+ for compatibility with +DateTime+ + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/conversions.rb:74 + def rfc3339(fraction_digits = T.unsafe(nil)); end + + # Returns the fraction of a second as a +Rational+ + # + # Time.new(2012, 8, 29, 0, 0, 0.5).sec_fraction # => (1/2) + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:110 + def sec_fraction; end + + # Returns the number of seconds since 00:00:00. + # + # Time.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0.0 + # Time.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296.0 + # Time.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399.0 + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:94 + def seconds_since_midnight; end + + # Returns the number of seconds until 23:59:59. + # + # Time.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399 + # Time.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103 + # Time.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0 + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:103 + def seconds_until_end_of_day; end + + # Returns a new Time representing the time a number of seconds since the instance time + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:229 + def since(seconds); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/conversions.rb:62 + def to_formatted_s(format = T.unsafe(nil)); end + + # Converts to a formatted string. See DATE_FORMATS for built-in formats. + # + # This method is aliased to to_formatted_s. + # + # time = Time.now # => 2007-01-18 06:10:17 -06:00 + # + # time.to_fs(:time) # => "06:10" + # time.to_formatted_s(:time) # => "06:10" + # + # time.to_fs(:db) # => "2007-01-18 06:10:17" + # time.to_fs(:number) # => "20070118061017" + # time.to_fs(:short) # => "18 Jan 06:10" + # time.to_fs(:long) # => "January 18, 2007 06:10" + # time.to_fs(:long_ordinal) # => "January 18th, 2007 06:10" + # time.to_fs(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600" + # time.to_fs(:rfc2822) # => "Thu, 18 Jan 2007 06:10:17 -0600" + # time.to_fs(:iso8601) # => "2007-01-18T06:10:17-06:00" + # + # == Adding your own time formats to +to_fs+ + # You can add your own formats to the Time::DATE_FORMATS hash. + # Use the format name as the hash key and either a strftime string + # or Proc instance that takes a time argument as the value. + # + # # config/initializers/time_formats.rb + # Time::DATE_FORMATS[:month_and_year] = '%B %Y' + # Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") } + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/conversions.rb:55 + def to_fs(format = T.unsafe(nil)); end + + # Return +self+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/compatibility.rb:9 + def to_time; end + + class << self + # Overriding case equality method so that it returns true for ActiveSupport::TimeWithZone instances + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:19 + def ===(other); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:61 + def at(time_or_number, *args, **); end + + # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime + # instances can be used when called with a single argument + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:46 + def at_with_coercion(time_or_number, *args, **); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:60 + def at_without_coercion(time, subsec = T.unsafe(nil), unit = T.unsafe(nil), in: T.unsafe(nil)); end + + # Returns Time.zone.now when Time.zone or config.time_zone are set, otherwise just returns Time.now. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:40 + def current; end + + # Returns the number of days in the given month. + # If no year is specified, it will use the current year. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:25 + def days_in_month(month, year = T.unsafe(nil)); end + + # Returns the number of days in the given year. + # If no year is specified, it will use the current year. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:35 + def days_in_year(year = T.unsafe(nil)); end + + # Returns a TimeZone instance matching the time zone provided. + # Accepts the time zone in any format supported by Time.zone=. + # Returns +nil+ for invalid time zones. + # + # Time.find_zone "America/New_York" # => # + # Time.find_zone "NOT-A-TIMEZONE" # => nil + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/zones.rb:93 + def find_zone(time_zone); end + + # Returns a TimeZone instance matching the time zone provided. + # Accepts the time zone in any format supported by Time.zone=. + # Raises an +ArgumentError+ for invalid time zones. + # + # Time.find_zone! "America/New_York" # => # + # Time.find_zone! "EST" # => # + # Time.find_zone! -5.hours # => # + # Time.find_zone! nil # => nil + # Time.find_zone! false # => false + # Time.find_zone! "NOT-A-TIMEZONE" # => ArgumentError: Invalid Timezone: NOT-A-TIMEZONE + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/zones.rb:81 + def find_zone!(time_zone); end + + # Creates a +Time+ instance from an RFC 3339 string. + # + # Time.rfc3339('1999-12-31T14:00:00-10:00') # => 2000-01-01 00:00:00 -1000 + # + # If the time or offset components are missing then an +ArgumentError+ will be raised. + # + # Time.rfc3339('1999-12-31') # => ArgumentError: invalid date + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:72 + def rfc3339(str); end + + # Allows override of Time.zone locally inside supplied block; + # resets Time.zone to existing value when done. + # + # class ApplicationController < ActionController::Base + # around_action :set_time_zone + # + # private + # def set_time_zone + # Time.use_zone(current_user.timezone) { yield } + # end + # end + # + # NOTE: This won't affect any ActiveSupport::TimeWithZone + # objects that have already been created, e.g. any model timestamp + # attributes that have been read before the block will remain in + # the application's default timezone. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/zones.rb:61 + def use_zone(time_zone); end + + # Returns the TimeZone for the current request, if this has been set (via Time.zone=). + # If Time.zone has not been set for the current request, returns the TimeZone specified in config.time_zone. + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/zones.rb:14 + def zone; end + + # Sets Time.zone to a TimeZone object for the current request/thread. + # + # This method accepts any of the following: + # + # * A \Rails TimeZone object. + # * An identifier for a \Rails TimeZone object (e.g., "Eastern \Time (US & Canada)", -5.hours). + # * A +TZInfo::Timezone+ object. + # * An identifier for a +TZInfo::Timezone+ object (e.g., "America/New_York"). + # + # Here's an example of how you might set Time.zone on a per request basis and reset it when the request is done. + # current_user.time_zone just needs to return a string identifying the user's preferred time zone: + # + # class ApplicationController < ActionController::Base + # around_action :set_time_zone + # + # def set_time_zone + # if logged_in? + # Time.use_zone(current_user.time_zone) { yield } + # else + # yield + # end + # end + # end + # + # pkg:gem/activesupport#lib/active_support/core_ext/time/zones.rb:41 + def zone=(time_zone); end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/zones.rb:10 + def zone_default; end + + # pkg:gem/activesupport#lib/active_support/core_ext/time/zones.rb:10 + def zone_default=(_arg0); end + end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/time/calculations.rb:15 +Time::COMMON_YEAR_DAYS_IN_MONTH = T.let(T.unsafe(nil), Array) + +# pkg:gem/activesupport#lib/active_support/core_ext/time/conversions.rb:8 +Time::DATE_FORMATS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:80 +class TrueClass + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:81 + def as_json(options = T.unsafe(nil)); end + + # +true+ is not blank: + # + # true.blank? # => false + # + # @return [false] + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:86 + def blank?; end + + # pkg:gem/activesupport#lib/active_support/core_ext/object/blank.rb:90 + def present?; end + + # Returns +self+. + # + # pkg:gem/activesupport#lib/active_support/core_ext/object/to_query.rb:33 + def to_param; end +end + +# pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:230 +class URI::Generic + # pkg:gem/activesupport#lib/active_support/core_ext/object/json.rb:231 + def as_json(options = T.unsafe(nil)); end +end diff --git a/sorbet/rbi/gems/addressable@2.9.2.rbi b/sorbet/rbi/gems/addressable@2.9.2.rbi new file mode 100644 index 000000000..9695f43f3 --- /dev/null +++ b/sorbet/rbi/gems/addressable@2.9.2.rbi @@ -0,0 +1,2081 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `addressable` gem. +# Please instead update this file by running `bin/tapioca gem addressable`. + + +# Addressable is a library for processing links and URIs. +# +# pkg:gem/addressable#lib/addressable/version.rb:22 +module Addressable; end + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:21 +module Addressable::IDNA + class << self + # pkg:gem/addressable#lib/addressable/idna/pure.rb:170 + def _deprecated_unicode_normalize_kc(value); end + + # Converts from a Unicode internationalized domain name to an ASCII + # domain name as described in RFC 3490. + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:101 + def to_ascii(input); end + + # Converts from an ASCII domain name to a Unicode internationalized + # domain name as described in RFC 3490. + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:127 + def to_unicode(input); end + + # @deprecated Use {String#unicode_normalize(:nfkc)} instead + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:165 + def unicode_normalize_kc(*args, **, &block); end + + private + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:188 + def lookup_unicode_lowercase(codepoint); end + + # Bias adaptation method + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4742 + def punycode_adapt(delta, numpoints, firsttime); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4710 + def punycode_basic?(codepoint); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4588 + def punycode_decode(punycode); end + + # Returns the numeric value of a basic codepoint + # (for use in representing integers) in the range 0 to + # base - 1, or PUNYCODE_BASE if codepoint does not represent a value. + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4728 + def punycode_decode_digit(codepoint); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4715 + def punycode_delimiter?(codepoint); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4471 + def punycode_encode(unicode); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4720 + def punycode_encode_digit(d); end + + # Unicode aware downcase method. + # + # @api private + # @param [String] input + # The input string. + # @return [String] The downcased result. + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:180 + def unicode_downcase(input); end + end +end + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4441 +Addressable::IDNA::ACE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) + +# This module is loosely based on idn_actionmailer by Mick Staugaard, +# the unicode library by Yoshida Masato, and the punycode implementation +# by Kazuhiro Nishiyama. Most of the code was copied verbatim, but +# some reformatting was done, and some translation from C was done. +# +# Without their code to work from as a base, we'd all still be relying +# on the presence of libidn. Which nobody ever seems to have installed. +# +# Original sources: +# http://github.com/staugaard/idn_actionmailer +# http://www.yoshidam.net/Ruby.html#unicode +# http://rubyforge.org/frs/?group_id=2550 +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:35 +Addressable::IDNA::ACE_PREFIX = T.let(T.unsafe(nil), String) + +# Characters that change how a label displays without being visible +# themselves: controls, format characters such as bidi overrides and +# isolates, and default ignorable code points. libidn rejects most of +# them, but not those added to Unicode after the version it checks +# against, such as U+2066 to U+2069. Format characters that are also +# default ignorable are left out of the second set, since Ruby warns about +# a duplicated range in a character class. +# Characters that change how a label displays without being visible +# themselves: controls, format characters such as bidi overrides and +# isolates, and default ignorable code points, including those added to +# Unicode after the version nameprep is based on. Format characters that +# are also default ignorable are left out of the second set, since Ruby +# warns about a duplicated range in a character class. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:95 +Addressable::IDNA::DISPLAY_CHANGING = T.let(T.unsafe(nil), Regexp) + +# Characters that nameprep doesn't allow in a label (Section 5 of +# RFC 3491), or that it maps to nothing, so they can't be in a label that +# toASCII produces. Some code points are in more than one table; they're +# listed only under the first, since Ruby warns about a duplicated range +# in a character class. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:63 +Addressable::IDNA::NAMEPREP_PROHIBITED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4443 +Addressable::IDNA::PUNYCODE_BASE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4447 +Addressable::IDNA::PUNYCODE_DAMP = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4450 +Addressable::IDNA::PUNYCODE_DELIMITER = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4448 +Addressable::IDNA::PUNYCODE_INITIAL_BIAS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4449 +Addressable::IDNA::PUNYCODE_INITIAL_N = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4452 +Addressable::IDNA::PUNYCODE_MAXINT = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4454 +Addressable::IDNA::PUNYCODE_PRINT_ASCII = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4446 +Addressable::IDNA::PUNYCODE_SKEW = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4445 +Addressable::IDNA::PUNYCODE_TMAX = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4444 +Addressable::IDNA::PUNYCODE_TMIN = T.let(T.unsafe(nil), Integer) + +# Input is invalid. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4465 +class Addressable::IDNA::PunycodeBadInput < ::StandardError; end + +# Output would exceed the space provided. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4467 +class Addressable::IDNA::PunycodeBigOutput < ::StandardError; end + +# Input needs wider integers to process. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4469 +class Addressable::IDNA::PunycodeOverflow < ::StandardError; end + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:204 +Addressable::IDNA::UNICODE_DATA = T.let(T.unsafe(nil), Hash) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:198 +Addressable::IDNA::UNICODE_DATA_CANONICAL = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:196 +Addressable::IDNA::UNICODE_DATA_COMBINING_CLASS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:199 +Addressable::IDNA::UNICODE_DATA_COMPATIBILITY = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:197 +Addressable::IDNA::UNICODE_DATA_EXCLUSION = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:201 +Addressable::IDNA::UNICODE_DATA_LOWERCASE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:202 +Addressable::IDNA::UNICODE_DATA_TITLECASE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:200 +Addressable::IDNA::UNICODE_DATA_UPPERCASE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4440 +Addressable::IDNA::UNICODE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:37 +Addressable::IDNA::UTF8_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:48 +Addressable::IDNA::UTF8_REGEX_MULTIBYTE = T.let(T.unsafe(nil), Regexp) + +# This is an implementation of a URI template based on +# RFC 6570 (http://tools.ietf.org/html/rfc6570). +# +# pkg:gem/addressable#lib/addressable/template.rb:27 +class Addressable::Template + # Creates a new Addressable::Template object. + # + # @param [#to_str] pattern The URI Template pattern. + # + # @return [Addressable::Template] The initialized Template object. + # + # pkg:gem/addressable#lib/addressable/template.rb:236 + def initialize(pattern); end + + # Returns true if the Template objects are equal. This method + # does NOT normalize either Template before doing the comparison. + # + # @param [Object] template The Template to compare. + # + # @return [TrueClass, FalseClass] + # true if the Templates are equivalent, false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/template.rb:276 + def ==(template); end + + # Addressable::Template makes no distinction between `==` and `eql?`. + # + # @see #== + # + # pkg:gem/addressable#lib/addressable/template.rb:285 + def eql?(template); end + + # Expands a URI template into a full URI. + # + # @param [Hash] mapping The mapping that corresponds to the pattern. + # @param [#validate, #transform] processor + # An optional processor object may be supplied. + # @param [Boolean] normalize_values + # Optional flag to enable/disable unicode normalization. Default: true + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError + # exception will be raised if the value is invalid. The transform + # method should return the transformed variable value as a String. + # If a transform method is used, the value will not be percent + # encoded automatically. Unicode normalization will be performed both + # before and after sending the value to the transform method. + # + # @return [Addressable::URI] The expanded URI template. + # + # @example + # class ExampleProcessor + # def self.validate(name, value) + # return !!(value =~ /^[\w ]+$/) if name == "query" + # return true + # end + # + # def self.transform(name, value) + # return value.gsub(/ /, "+") if name == "query" + # return value + # end + # end + # + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).expand( + # {"query" => "an example search query"}, + # ExampleProcessor + # ).to_str + # #=> "http://example.com/search/an+example+search+query/" + # + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).expand( + # {"query" => "an example search query"} + # ).to_str + # #=> "http://example.com/search/an%20example%20search%20query/" + # + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).expand( + # {"query" => "bogus!"}, + # ExampleProcessor + # ).to_str + # #=> Addressable::Template::InvalidTemplateValueError + # + # pkg:gem/addressable#lib/addressable/template.rb:603 + def expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end + + # Extracts a mapping from the URI using a URI Template pattern. + # + # @param [Addressable::URI, #to_str] uri + # The URI to extract from. + # + # @param [#restore, #match] processor + # A template processor object may optionally be supplied. + # + # The object should respond to either the restore or + # match messages or both. The restore method should + # take two parameters: `[String] name` and `[String] value`. + # The restore method should reverse any transformations that + # have been performed on the value to ensure a valid URI. + # The match method should take a single + # parameter: `[String] name`. The match method should return + # a String containing a regular expression capture group for + # matching on that particular variable. The default value is `".*?"`. + # The match method has no effect on multivariate operator + # expansions. + # + # @return [Hash, NilClass] + # The Hash mapping that was extracted from the URI, or + # nil if the URI didn't match the template. + # + # @example + # class ExampleProcessor + # def self.restore(name, value) + # return value.gsub(/\+/, " ") if name == "query" + # return value + # end + # + # def self.match(name) + # return ".*?" if name == "first" + # return ".*" + # end + # end + # + # uri = Addressable::URI.parse( + # "http://example.com/search/an+example+search+query/" + # ) + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).extract(uri, ExampleProcessor) + # #=> {"query" => "an example search query"} + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # Addressable::Template.new( + # "http://example.com/{first}/{second}/" + # ).extract(uri, ExampleProcessor) + # #=> {"first" => "a", "second" => "b/c"} + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # Addressable::Template.new( + # "http://example.com/{first}/{-list|/|second}/" + # ).extract(uri) + # #=> {"first" => "a", "second" => ["b", "c"]} + # + # pkg:gem/addressable#lib/addressable/template.rb:344 + def extract(uri, processor = T.unsafe(nil)); end + + # Freeze URI, initializing instance variables. + # + # @return [Addressable::URI] The frozen URI object. + # + # pkg:gem/addressable#lib/addressable/template.rb:247 + def freeze; end + + # Returns a String representation of the Template object's state. + # + # @return [String] The Template object's state, as a String. + # + # pkg:gem/addressable#lib/addressable/template.rb:262 + def inspect; end + + # pkg:gem/addressable#lib/addressable/template.rb:622 + def keys; end + + # Extracts match data from the URI using a URI Template pattern. + # + # @param [Addressable::URI, #to_str] uri + # The URI to extract from. + # + # @param [#restore, #match] processor + # A template processor object may optionally be supplied. + # + # The object should respond to either the restore or + # match messages or both. The restore method should + # take two parameters: `[String] name` and `[String] value`. + # The restore method should reverse any transformations that + # have been performed on the value to ensure a valid URI. + # The match method should take a single + # parameter: `[String] name`. The match method should return + # a String containing a regular expression capture group for + # matching on that particular variable. The default value is `".*?"`. + # The match method has no effect on multivariate operator + # expansions. + # + # @return [Hash, NilClass] + # The Hash mapping that was extracted from the URI, or + # nil if the URI didn't match the template. + # + # @example + # class ExampleProcessor + # def self.restore(name, value) + # return value.gsub(/\+/, " ") if name == "query" + # return value + # end + # + # def self.match(name) + # return ".*?" if name == "first" + # return ".*" + # end + # end + # + # uri = Addressable::URI.parse( + # "http://example.com/search/an+example+search+query/" + # ) + # match = Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).match(uri, ExampleProcessor) + # match.variables + # #=> ["query"] + # match.captures + # #=> ["an example search query"] + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # match = Addressable::Template.new( + # "http://example.com/{first}/{+second}/" + # ).match(uri, ExampleProcessor) + # match.variables + # #=> ["first", "second"] + # match.captures + # #=> ["a", "b/c"] + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # match = Addressable::Template.new( + # "http://example.com/{first}{/second*}/" + # ).match(uri) + # match.variables + # #=> ["first", "second"] + # match.captures + # #=> ["a", ["b", "c"]] + # + # pkg:gem/addressable#lib/addressable/template.rb:415 + def match(uri, processor = T.unsafe(nil)); end + + # Returns the named captures of the coerced `Regexp`. + # + # @return [Hash] The named captures of the `Regexp` given by {#to_regexp}. + # + # @api private + # + # pkg:gem/addressable#lib/addressable/template.rb:663 + def named_captures; end + + # pkg:gem/addressable#lib/addressable/template.rb:623 + def names; end + + # Expands a URI template into another URI template. + # + # @param [Hash] mapping The mapping that corresponds to the pattern. + # @param [#validate, #transform] processor + # An optional processor object may be supplied. + # @param [Boolean] normalize_values + # Optional flag to enable/disable unicode normalization. Default: true + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError + # exception will be raised if the value is invalid. The transform + # method should return the transformed variable value as a String. + # If a transform method is used, the value will not be percent + # encoded automatically. Unicode normalization will be performed both + # before and after sending the value to the transform method. + # + # @return [Addressable::Template] The partially expanded URI template. + # + # @example + # Addressable::Template.new( + # "http://example.com/{one}/{two}/" + # ).partial_expand({"one" => "1"}).pattern + # #=> "http://example.com/1/{two}/" + # + # Addressable::Template.new( + # "http://example.com/{?one,two}/" + # ).partial_expand({"one" => "1"}).pattern + # #=> "http://example.com/?one=1{&two}/" + # + # Addressable::Template.new( + # "http://example.com/{?one,two,three}/" + # ).partial_expand({"one" => "1", "three" => 3}).pattern + # #=> "http://example.com/?one=1{&two}&three=3" + # + # pkg:gem/addressable#lib/addressable/template.rb:536 + def partial_expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end + + # @return [String] The Template object's pattern. + # + # pkg:gem/addressable#lib/addressable/template.rb:256 + def pattern; end + + # Returns the source of the coerced `Regexp`. + # + # @return [String] The source of the `Regexp` given by {#to_regexp}. + # + # @api private + # + # pkg:gem/addressable#lib/addressable/template.rb:653 + def source; end + + # Coerces a template into a `Regexp` object. This regular expression will + # behave very similarly to the actual template, and should match the same + # URI values, but it cannot fully handle, for example, values that would + # extract to an `Array`. + # + # @return [Regexp] A regular expression which should match the template. + # + # pkg:gem/addressable#lib/addressable/template.rb:642 + def to_regexp; end + + # Returns a mapping of variables to their default values specified + # in the template. Variables without defaults are not returned. + # + # @return [Hash] Mapping of template variables to their defaults + # + # pkg:gem/addressable#lib/addressable/template.rb:630 + def variable_defaults; end + + # Returns an Array of variables used within the template pattern. + # The variables are listed in the Array in the order they appear within + # the pattern. Multiple occurrences of a variable within a pattern are + # not represented in this Array. + # + # @return [Array] The variables present in the template's pattern. + # + # pkg:gem/addressable#lib/addressable/template.rb:619 + def variables; end + + private + + # Whether an expression, followed directly by another one, could only + # match characters that the other one could also match, in any amount. + # + # @param [MatchData] following The expression that follows. + # @param [String, nil] operator The operator of the first expression. + # @param [Array] varspecs The varspecs of the first expression. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:1019 + def absorbed_by?(following, operator, varspecs); end + + # Describes what follows each expression in a template pattern. + # + # @param [String] escaped_pattern The escaped URI template pattern. + # + # @return [Array] For each expression, the MatchData of + # the expression directly after it (or nil), and whether the + # text after it could start with a comma. + # + # pkg:gem/addressable#lib/addressable/template.rb:979 + def expression_followers(escaped_pattern); end + + # Takes a set of values, and joins them together based on the + # operator. + # + # @param [String, Nil] operator One of the operators from the set + # (?,&,+,#,;,/,.), or nil if there wasn't one. + # @param [Array] return_value + # The set of return values (as [variable_name, value] tuples) that will + # be joined together. + # + # @return [String] The transformed mapped value + # + # pkg:gem/addressable#lib/addressable/template.rb:873 + def join_values(operator, return_value); end + + # Whether an expression could match a string that starts with a comma. + # + # @param [String, nil] operator The expression's operator. + # @param [String] varlist The expression's variable list. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:1005 + def may_start_with_comma?(operator, varlist); end + + # Generates a hash with string keys + # + # @param [Hash] mapping A mapping hash to normalize + # + # @return [Hash] + # A hash with stringified keys + # + # pkg:gem/addressable#lib/addressable/template.rb:936 + def normalize_keys(mapping); end + + # Takes a set of values, and joins them together based on the + # operator. + # + # @param [Hash, Array, String] value + # Normalizes unicode keys and values with String#unicode_normalize (NFC) + # + # @return [Hash, Array, String] The normalized values + # + # pkg:gem/addressable#lib/addressable/template.rb:910 + def normalize_value(value); end + + # pkg:gem/addressable#lib/addressable/template.rb:668 + def ordered_variable_defaults; end + + # Generates the Regexp that parses a template pattern. + # + # @param [String] pattern The URI template pattern. + # @param [#match] processor The template processor to use. + # + # @return [Array, Regexp] + # An array of expansion variables nad a regular expression which may be + # used to parse a template pattern + # + # pkg:gem/addressable#lib/addressable/template.rb:1051 + def parse_new_template_pattern(pattern, processor = T.unsafe(nil)); end + + # Generates the Regexp that parses a template pattern. Memoizes the + # value if template processor not set (processors may not be deterministic) + # + # @param [String] pattern The URI template pattern. + # @param [#match] processor The template processor to use. + # + # @return [Array, Regexp] + # An array of expansion variables nad a regular expression which may be + # used to parse a template pattern + # + # pkg:gem/addressable#lib/addressable/template.rb:962 + def parse_template_pattern(pattern, processor = T.unsafe(nil)); end + + # Transforms a mapped value so that values can be substituted into the + # template. + # + # @param [Hash] mapping The mapping to replace captures + # @param [String] capture + # The expression to replace + # @param [#validate, #transform] processor + # An optional processor object may be supplied. + # @param [Boolean] normalize_values + # Optional flag to enable/disable unicode normalization. Default: true + # + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError exception + # will be raised if the value is invalid. The transform method + # should return the transformed variable value as a String. If a + # transform method is used, the value will not be percent encoded + # automatically. Unicode normalization will be performed both before and + # after sending the value to the transform method. + # + # @return [String] The expanded expression + # + # pkg:gem/addressable#lib/addressable/template.rb:765 + def transform_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end + + # Loops through each capture and expands any values available in mapping + # + # @param [Hash] mapping + # Set of keys to expand + # @param [String] capture + # The expression to expand + # @param [#validate, #transform] processor + # An optional processor object may be supplied. + # @param [Boolean] normalize_values + # Optional flag to enable/disable unicode normalization. Default: true + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError exception + # will be raised if the value is invalid. The transform method + # should return the transformed variable value as a String. If a + # transform method is used, the value will not be percent encoded + # automatically. Unicode normalization will be performed both before and + # after sending the value to the transform method. + # + # @return [String] The expanded expression + # + # pkg:gem/addressable#lib/addressable/template.rb:706 + def transform_partial_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end +end + +# pkg:gem/addressable#lib/addressable/template.rb:60 +Addressable::Template::EXPRESSION = T.let(T.unsafe(nil), Regexp) + +# Raised if an invalid template operator is used in a pattern. +# +# pkg:gem/addressable#lib/addressable/template.rb:87 +class Addressable::Template::InvalidTemplateOperatorError < ::StandardError; end + +# Raised if an invalid template value is supplied. +# +# pkg:gem/addressable#lib/addressable/template.rb:82 +class Addressable::Template::InvalidTemplateValueError < ::StandardError; end + +# pkg:gem/addressable#lib/addressable/template.rb:72 +Addressable::Template::JOINERS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/addressable#lib/addressable/template.rb:64 +Addressable::Template::LEADERS = T.let(T.unsafe(nil), Hash) + +# This class represents the data that is extracted when a Template +# is matched against a URI. +# +# pkg:gem/addressable#lib/addressable/template.rb:98 +class Addressable::Template::MatchData + # Creates a new MatchData object. + # MatchData objects should never be instantiated directly. + # + # @param [Addressable::URI] uri + # The URI that the template was matched against. + # + # pkg:gem/addressable#lib/addressable/template.rb:105 + def initialize(uri, template, mapping); end + + # Accesses captured values by name or by index. + # + # @param [String, Symbol, Fixnum] key + # Capture index or name. Note that when accessing by with index + # of 0, the full URI will be returned. The intention is to mimic + # the ::MatchData#[] behavior. + # + # @param [#to_int, nil] len + # If provided, an array of values will be returned with the given + # parameter used as length. + # + # @return [Array, String, nil] + # The captured value corresponding to the index or name. If the + # value was not provided or the key is unknown, nil will be + # returned. + # + # If the second parameter is provided, an array of that length will + # be returned instead. + # + # pkg:gem/addressable#lib/addressable/template.rb:172 + def [](key, len = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/template.rb:151 + def captures; end + + # Returns a String representation of the MatchData's state. + # + # @return [String] The MatchData's state, as a String. + # + # pkg:gem/addressable#lib/addressable/template.rb:215 + def inspect; end + + # pkg:gem/addressable#lib/addressable/template.rb:137 + def keys; end + + # @return [Hash] + # The mapping that resulted from the match. + # Note that this mapping does not include keys or values for + # variables that appear in the Template, but are not present + # in the URI. + # + # pkg:gem/addressable#lib/addressable/template.rb:127 + def mapping; end + + # pkg:gem/addressable#lib/addressable/template.rb:138 + def names; end + + # pkg:gem/addressable#lib/addressable/template.rb:227 + def post_match; end + + # Dummy method for code expecting a ::MatchData instance + # + # @return [String] An empty string. + # + # pkg:gem/addressable#lib/addressable/template.rb:224 + def pre_match; end + + # pkg:gem/addressable#lib/addressable/template.rb:196 + def string; end + + # @return [Addressable::Template] + # The Template used for the match. + # + # pkg:gem/addressable#lib/addressable/template.rb:119 + def template; end + + # @return [Array] + # Array with the matched URI as first element followed by the captured + # values. + # + # pkg:gem/addressable#lib/addressable/template.rb:186 + def to_a; end + + # @return [String] + # The matched URI as String. + # + # pkg:gem/addressable#lib/addressable/template.rb:193 + def to_s; end + + # @return [Addressable::URI] + # The URI that the Template was matched against. + # + # pkg:gem/addressable#lib/addressable/template.rb:114 + def uri; end + + # @return [Array] + # The list of values that were captured by the Template. + # Note that this list will include nils for any variables which + # were in the Template, but did not appear in the URI. + # + # pkg:gem/addressable#lib/addressable/template.rb:145 + def values; end + + # Returns multiple captured values at once. + # + # @param [String, Symbol, Fixnum] *indexes + # Indices of the captures to be returned + # + # @return [Array] + # Values corresponding to given indices. + # + # @see Addressable::Template::MatchData#[] + # + # pkg:gem/addressable#lib/addressable/template.rb:207 + def values_at(*indexes); end + + # @return [Array] + # The list of variables that were present in the Template. + # Note that this list will include variables which do not appear + # in the mapping because they were not present in URI. + # + # pkg:gem/addressable#lib/addressable/template.rb:134 + def variables; end +end + +# pkg:gem/addressable#lib/addressable/template.rb:40 +Addressable::Template::RESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/template.rb:42 +Addressable::Template::RESERVED_NO_COMMA = T.let(T.unsafe(nil), String) + +# Raised if an invalid template operator is used in a pattern. +# +# pkg:gem/addressable#lib/addressable/template.rb:92 +class Addressable::Template::TemplateOperatorAbortedError < ::StandardError; end + +# pkg:gem/addressable#lib/addressable/template.rb:44 +Addressable::Template::UNRESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/template.rb:56 +Addressable::Template::VARIABLE_LIST = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/template.rb:52 +Addressable::Template::VARNAME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/template.rb:54 +Addressable::Template::VARSPEC = T.let(T.unsafe(nil), Regexp) + +# This is an implementation of a URI parser based on +# RFC 3986, +# RFC 3987. +# +# pkg:gem/addressable#lib/addressable/uri.rb:31 +class Addressable::URI + # Creates a new uri object from component parts. + # + # @option [String, #to_str] scheme The scheme component. + # @option [String, #to_str] user The user component. + # @option [String, #to_str] password The password component. + # @option [String, #to_str] userinfo + # The userinfo component. If this is supplied, the user and password + # components must be omitted. + # @option [String, #to_str] host The host component. + # @option [String, #to_str] port The port component. + # @option [String, #to_str] authority + # The authority component. If this is supplied, the user, password, + # userinfo, host, and port components must be omitted. + # @option [String, #to_str] path The path component. + # @option [String, #to_str] query The query component. + # @option [String, #to_str] fragment The fragment component. + # + # @return [Addressable::URI] The constructed URI object. + # + # pkg:gem/addressable#lib/addressable/uri.rb:830 + def initialize(options = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:1991 + def +(uri); end + + # Returns true if the URI objects are equal. This method + # normalizes both URIs before doing the comparison. + # + # @param [Object] uri The URI to compare. + # + # @return [TrueClass, FalseClass] + # true if the URIs are equivalent, false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2253 + def ==(uri); end + + # Returns true if the URI objects are equal. This method + # normalizes both URIs before doing the comparison, and allows comparison + # against Strings. + # + # @param [Object] uri The URI to compare. + # + # @return [TrueClass, FalseClass] + # true if the URIs are equivalent, false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2231 + def ===(uri); end + + # Determines if the URI is absolute. + # + # @return [TrueClass, FalseClass] + # true if the URI is absolute. false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1888 + def absolute?; end + + # The authority component for this URI. + # Combines the user, password, host, and port components. + # + # @return [String] The authority component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1241 + def authority; end + + # Sets the authority component for this URI. + # + # @param [String, #to_str] new_authority The new authority component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1281 + def authority=(new_authority); end + + # The basename, if any, of the file in the path component. + # + # @return [String] The path's basename. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1599 + def basename; end + + # The default port for this URI's scheme. + # This method will always returns the default port for the URI's scheme + # regardless of the presence of an explicit port in the URI. + # + # @return [Integer] The default port. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1465 + def default_port; end + + # This method allows you to make several changes to a URI simultaneously, + # which separately would cause validation errors, but in conjunction, + # are valid. The URI will be revalidated as soon as the entire block has + # been executed. + # + # @param [Proc] block + # A set of operations to perform on a given URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2410 + def defer_validation; end + + # Creates a URI suitable for display to users. If semantic attacks are + # likely, the application should try to detect these and warn the user. + # See RFC 3986, + # section 7.6 for more information. + # + # @return [Addressable::URI] A URI suitable for display purposes. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2215 + def display_uri; end + + # Returns the public suffix domain for this host. + # + # @example + # Addressable::URI.parse("http://www.example.co.uk").domain # => "example.co.uk" + # + # pkg:gem/addressable#lib/addressable/uri.rb:1232 + def domain; end + + # Clones the URI object. + # + # @return [Addressable::URI] The cloned URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2285 + def dup; end + + # Determines if the URI is an empty string. + # + # @return [TrueClass, FalseClass] + # Returns true if empty, false otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2347 + def empty?; end + + # pkg:gem/addressable#lib/addressable/uri.rb:2422 + def encode_with(coder); end + + # Returns true if the URI objects are equal. This method + # does NOT normalize either URI before doing the comparison. + # + # @param [Object] uri The URI to compare. + # + # @return [TrueClass, FalseClass] + # true if the URIs are equivalent, false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2267 + def eql?(uri); end + + # The extname, if any, of the file in the path component. + # Empty string if there is no extension. + # + # @return [String] The path's extname. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1609 + def extname; end + + # The fragment component for this URI. + # + # @return [String] The fragment component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1819 + def fragment; end + + # Sets the fragment component for this URI. + # + # @param [String, #to_str] new_fragment The new fragment component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1844 + def fragment=(new_fragment); end + + # Freeze URI, initializing instance variables. + # + # @return [Addressable::URI] The frozen URI object. + # + # pkg:gem/addressable#lib/addressable/uri.rb:870 + def freeze; end + + # A hash value that will make a URI equivalent to its normalized + # form. + # + # @return [Integer] A hash of the URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2277 + def hash; end + + # The host component for this URI. + # + # @return [String] The host component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1127 + def host; end + + # Sets the host component for this URI. + # + # @param [String, #to_str] new_host The new host component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1163 + def host=(new_host); end + + # This method is same as URI::Generic#host except + # brackets for IPv6 (and 'IPvFuture') addresses are removed. + # + # @see Addressable::URI#host + # + # @return [String] The hostname for this URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1185 + def hostname; end + + # This method is same as URI::Generic#host= except + # the argument can be a bare IPv6 address (or 'IPvFuture'). + # + # @see Addressable::URI#host= + # + # @param [String, #to_str] new_hostname The new hostname for this URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1197 + def hostname=(new_hostname); end + + # The inferred port component for this URI. + # This method will normalize to the default port for the URI's scheme if + # the port isn't explicitly specified in the URI. + # + # @return [Integer] The inferred port component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1451 + def inferred_port; end + + # pkg:gem/addressable#lib/addressable/uri.rb:2433 + def init_with(coder); end + + # Returns a String representation of the URI object's state. + # + # @return [String] The URI object's state, as a String. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2398 + def inspect; end + + # Determines if the scheme indicates an IP-based protocol. + # + # @return [TrueClass, FalseClass] + # true if the scheme indicates an IP-based protocol. + # false otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1864 + def ip_based?; end + + # Joins two URIs together. + # + # @param [String, Addressable::URI, #to_str] The URI to join with. + # + # @return [Addressable::URI] The joined URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1898 + def join(uri); end + + # Destructive form of join. + # + # @param [String, Addressable::URI, #to_str] The URI to join with. + # + # @return [Addressable::URI] The joined URI. + # + # @see Addressable::URI#join + # + # pkg:gem/addressable#lib/addressable/uri.rb:2001 + def join!(uri); end + + # Merges a URI with a Hash of components. + # This method has different behavior from join. Any + # components present in the hash parameter will override the + # original components. The path component is not treated specially. + # + # @param [Hash, Addressable::URI, #to_hash] The components to merge with. + # + # @return [Addressable::URI] The merged URI. + # + # @see Hash#merge + # + # pkg:gem/addressable#lib/addressable/uri.rb:2016 + def merge(hash); end + + # Destructive form of merge. + # + # @param [Hash, Addressable::URI, #to_hash] The components to merge with. + # + # @return [Addressable::URI] The merged URI. + # + # @see Addressable::URI#merge + # + # pkg:gem/addressable#lib/addressable/uri.rb:2081 + def merge!(uri); end + + # Returns a normalized URI object. + # + # NOTE: This method does not attempt to fully conform to specifications. + # It exists largely to correct other people's failures to read the + # specifications, and also to deal with caching issues since several + # different URIs may represent the same resource and should not be + # cached multiple times. + # + # @return [Addressable::URI] The normalized URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2178 + def normalize; end + + # Destructively normalizes this URI object. + # + # @return [Addressable::URI] The normalized URI. + # + # @see Addressable::URI#normalize + # + # pkg:gem/addressable#lib/addressable/uri.rb:2204 + def normalize!; end + + # The authority component for this URI, normalized. + # + # @return [String] The authority component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1259 + def normalized_authority; end + + # The fragment component for this URI, normalized. + # + # @return [String] The fragment component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1825 + def normalized_fragment; end + + # The host component for this URI, normalized. + # + # @return [String] The host component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1133 + def normalized_host; end + + # The password component for this URI, normalized. + # + # @return [String] The password component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1008 + def normalized_password; end + + # The path component for this URI, normalized. + # + # @return [String] The path component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1546 + def normalized_path; end + + # The port component for this URI, normalized. + # + # @return [Integer] The port component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1403 + def normalized_port; end + + # The query component for this URI, normalized. + # + # @return [String] The query component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1624 + def normalized_query(*flags); end + + # The scheme component for this URI, normalized. + # + # @return [String] The scheme component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:896 + def normalized_scheme; end + + # The normalized combination of components that represent a site. + # Combines the scheme, user, password, host, and port components. + # Primarily useful for HTTP and HTTPS. + # + # For example, "http://example.com/path?query" would have a + # site value of "http://example.com". + # + # @return [String] The normalized components that identify a site. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1496 + def normalized_site; end + + # The user component for this URI, normalized. + # + # @return [String] The user component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:952 + def normalized_user; end + + # The userinfo component for this URI, normalized. + # + # @return [String] The userinfo component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1075 + def normalized_userinfo; end + + # Omits components from a URI. + # + # @param [Symbol] *components The components to be omitted. + # + # @return [Addressable::URI] The URI with components omitted. + # + # @example + # uri = Addressable::URI.parse("http://example.com/path?query") + # #=> # + # uri.omit(:scheme, :authority) + # #=> # + # + # pkg:gem/addressable#lib/addressable/uri.rb:2311 + def omit(*components); end + + # Destructive form of omit. + # + # @param [Symbol] *components The components to be omitted. + # + # @return [Addressable::URI] The URI with components omitted. + # + # @see Addressable::URI#omit + # + # pkg:gem/addressable#lib/addressable/uri.rb:2338 + def omit!(*components); end + + # The origin for this URI, serialized to ASCII, as per + # RFC 6454, section 6.2. + # + # @return [String] The serialized origin. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1321 + def origin; end + + # Sets the origin for this URI, serialized to ASCII, as per + # RFC 6454, section 6.2. This assignment will reset the `userinfo` + # component. + # + # @param [String, #to_str] new_origin The new origin component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1340 + def origin=(new_origin); end + + # The password component for this URI. + # + # @return [String] The password component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1002 + def password; end + + # Sets the password component for this URI. + # + # @param [String, #to_str] new_password The new password component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1031 + def password=(new_password); end + + # The path component for this URI. + # + # @return [String] The path component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1539 + def path; end + + # Sets the path component for this URI. + # + # @param [String, #to_str] new_path The new path component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1578 + def path=(new_path); end + + # The port component for this URI. + # This is the port number actually given in the URI. This does not + # infer port numbers from default values. + # + # @return [Integer] The port component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1397 + def port; end + + # Sets the port component for this URI. + # + # @param [String, Integer, #to_s] new_port The new port component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1419 + def port=(new_port); end + + # The query component for this URI. + # + # @return [String] The query component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1618 + def query; end + + # Sets the query component for this URI. + # + # @param [String, #to_str] new_query The new query component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1650 + def query=(new_query); end + + # Converts the query component to a Hash value. + # + # @param [Class] return_type The return type desired. Value must be either + # `Hash` or `Array`. + # + # @return [Hash, Array, nil] The query string parsed as a Hash or Array + # or nil if the query string is blank. + # + # @example + # Addressable::URI.parse("?one=1&two=2&three=3").query_values + # #=> {"one" => "1", "two" => "2", "three" => "3"} + # Addressable::URI.parse("?one=two&one=three").query_values(Array) + # #=> [["one", "two"], ["one", "three"]] + # Addressable::URI.parse("?one=two&one=three").query_values(Hash) + # #=> {"one" => "three"} + # Addressable::URI.parse("?").query_values + # #=> {} + # Addressable::URI.parse("").query_values + # #=> nil + # + # pkg:gem/addressable#lib/addressable/uri.rb:1681 + def query_values(return_type = T.unsafe(nil)); end + + # Sets the query component for this URI from a Hash object. + # An empty Hash or Array will result in an empty query string. + # + # @param [Hash, #to_hash, Array] new_query_values The new query values. + # + # @example + # uri.query_values = {:a => "a", :b => ["c", "d", "e"]} + # uri.query + # # => "a=a&b=c&b=d&b=e" + # uri.query_values = [['a', 'a'], ['b', 'c'], ['b', 'd'], ['b', 'e']] + # uri.query + # # => "a=a&b=c&b=d&b=e" + # uri.query_values = [['a', 'a'], ['b', ['c', 'd', 'e']]] + # uri.query + # # => "a=a&b=c&b=d&b=e" + # uri.query_values = [['flag'], ['key', 'value']] + # uri.query + # # => "flag&key=value" + # + # pkg:gem/addressable#lib/addressable/uri.rb:1732 + def query_values=(new_query_values); end + + # Determines if the URI is relative. + # + # @return [TrueClass, FalseClass] + # true if the URI is relative. false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1878 + def relative?; end + + # The HTTP request URI for this URI. This is the path and the + # query string. + # + # @return [String] The request URI required for an HTTP request. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1783 + def request_uri; end + + # Sets the HTTP request URI for this URI. + # + # @param [String, #to_str] new_request_uri The new HTTP request URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1795 + def request_uri=(new_request_uri); end + + # Returns the shortest normalized relative form of this URI that uses the + # supplied URI as a base for resolution. Returns an absolute URI if + # necessary. This is effectively the opposite of route_to. + # + # @param [String, Addressable::URI, #to_str] uri The URI to route from. + # + # @return [Addressable::URI] + # The normalized relative URI that is equivalent to the original URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2094 + def route_from(uri); end + + # Returns the shortest normalized relative form of the supplied URI that + # uses this URI as a base for resolution. Returns an absolute URI if + # necessary. This is effectively the opposite of route_from. + # + # @param [String, Addressable::URI, #to_str] uri The URI to route to. + # + # @return [Addressable::URI] + # The normalized relative URI that is equivalent to the supplied URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2164 + def route_to(uri); end + + # The scheme component for this URI. + # + # @return [String] The scheme component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:890 + def scheme; end + + # Sets the scheme component for this URI. + # + # @param [String, #to_str] new_scheme The new scheme component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:917 + def scheme=(new_scheme); end + + # The combination of components that represent a site. + # Combines the scheme, user, password, host, and port components. + # Primarily useful for HTTP and HTTPS. + # + # For example, "http://example.com/path?query" would have a + # site value of "http://example.com". + # + # @return [String] The components that identify a site. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1478 + def site; end + + # Sets the site value for this URI. + # + # @param [String, #to_str] new_site The new site value. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1517 + def site=(new_site); end + + # Returns the top-level domain for this host. + # + # @example + # Addressable::URI.parse("http://www.example.co.uk").tld # => "co.uk" + # + # pkg:gem/addressable#lib/addressable/uri.rb:1214 + def tld; end + + # Sets the top-level domain for this URI. + # + # @param [String, #to_str] new_tld The new top-level domain. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1222 + def tld=(new_tld); end + + # Returns a Hash of the URI components. + # + # @return [Hash] The URI as a Hash of components. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2381 + def to_hash; end + + # Converts the URI to a String. + # + # @return [String] The URI's String representation. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2355 + def to_s; end + + # URI's are glorified Strings. Allow implicit conversion. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2375 + def to_str; end + + # The user component for this URI. + # + # @return [String] The user component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:946 + def user; end + + # Sets the user component for this URI. + # + # @param [String, #to_str] new_user The new user component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:975 + def user=(new_user); end + + # The userinfo component for this URI. + # Combines the user and password components. + # + # @return [String] The userinfo component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1059 + def userinfo; end + + # Sets the userinfo component for this URI. + # + # @param [String, #to_str] new_userinfo The new userinfo component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1098 + def userinfo=(new_userinfo); end + + protected + + # Converts the string to be UTF-8 if it is not already UTF-8 + # + # @api private + # + # pkg:gem/addressable#lib/addressable/uri.rb:2599 + def force_utf8_encoding_if_needed(str); end + + # Resets composite values for the entire URI + # + # @api private + # + # pkg:gem/addressable#lib/addressable/uri.rb:2587 + def remove_composite_values; end + + # Replaces the internal state of self with the specified URI's state. + # Used in destructive operations to avoid massive code repetition. + # + # @param [Addressable::URI] uri The URI to replace self with. + # + # @return [Addressable::URI] self. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2554 + def replace_self(uri); end + + # Splits path string with "/" (slash). + # It is considered that there is empty string after last slash when + # path ends with slash. + # + # @param [String] path The path to split. + # + # @return [Array] An array of parts of path. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2577 + def split_path(path); end + + # Ensures that the URI is valid. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2511 + def validate; end + + private + + # pkg:gem/addressable#lib/addressable/uri.rb:2607 + def initialize_copy(other); end + + # Resets instance variables + # + # @api private + # + # pkg:gem/addressable#lib/addressable/uri.rb:2619 + def reset_ivs; end + + class << self + # Converts a path to a file scheme URI. If the path supplied is + # relative, it will be returned as a relative URI. If the path supplied + # is actually a non-file URI, it will parse the URI as if it had been + # parsed with Addressable::URI.parse. Handles all of the + # various Microsoft-specific formats for specifying paths. + # + # @param [String, Addressable::URI, #to_str] path + # Typically a String path to a file or directory, but + # will return a sensible return value if an absolute URI is supplied + # instead. + # + # @return [Addressable::URI] + # The parsed file scheme URI or the original URI if some other URI + # scheme was provided. + # + # @example + # base = Addressable::URI.convert_path("/absolute/path/") + # uri = Addressable::URI.convert_path("relative/path") + # (base + uri).to_s + # #=> "file:///absolute/path/relative/path" + # + # Addressable::URI.convert_path( + # "c:\\windows\\My Documents 100%20\\foo.txt" + # ).to_s + # #=> "file:///c:/windows/My%20Documents%20100%20/foo.txt" + # + # Addressable::URI.convert_path("http://example.com/").to_s + # #=> "http://example.com/" + # + # pkg:gem/addressable#lib/addressable/uri.rb:292 + def convert_path(path); end + + # Percent encodes any special characters in the URI. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI to encode. + # + # @param [Class] return_type + # The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # + # @return [String, Addressable::URI] + # The encoded URI. + # The return type is determined by the return_type + # parameter. + # + # pkg:gem/addressable#lib/addressable/uri.rb:616 + def encode(uri, return_type = T.unsafe(nil)); end + + # Percent encodes a URI component. + # + # @param [String, #to_str] component The URI component to encode. + # + # @param [String, Regexp] character_class + # The characters which are not percent encoded. If a String + # is passed, the String must be formatted as a regular + # expression character class. (Do not include the surrounding square + # brackets.) For example, "b-zB-Z0-9" would cause + # everything but the letters 'b' through 'z' and the numbers '0' through + # '9' to be percent encoded. If a Regexp is passed, the + # value /[^b-zB-Z0-9]/ would have the same effect. A set of + # useful String values may be found in the + # Addressable::URI::CharacterClasses module. The default + # value is the reserved plus unreserved character classes specified in + # RFC 3986. + # + # @param [Regexp] upcase_encoded + # A string of characters that may already be percent encoded, and whose + # encodings should be upcased. This allows normalization of percent + # encodings for characters not included in the + # character_class. + # + # @return [String] The encoded component. + # + # @example + # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9") + # => "simple%2Fex%61mple" + # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/) + # => "simple%2Fex%61mple" + # Addressable::URI.encode_component( + # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED + # ) + # => "simple%2Fexample" + # + # pkg:gem/addressable#lib/addressable/uri.rb:403 + def encode_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:651 + def escape(uri, return_type = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:446 + def escape_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end + + # Encodes a set of key/value pairs according to the rules for the + # application/x-www-form-urlencoded MIME type. + # + # @param [#to_hash, #to_ary] form_values + # The form values to encode. + # + # @param [TrueClass, FalseClass] sort + # Sort the key/value pairs prior to encoding. + # Defaults to false. + # + # @return [String] + # The encoded value. + # + # pkg:gem/addressable#lib/addressable/uri.rb:740 + def form_encode(form_values, sort = T.unsafe(nil)); end + + # Decodes a String according to the rules for the + # application/x-www-form-urlencoded MIME type. + # + # @param [String, #to_str] encoded_value + # The form values to decode. + # + # @return [Array] + # The decoded values. + # This is not a Hash because of the possibility for + # duplicate keys. + # + # pkg:gem/addressable#lib/addressable/uri.rb:793 + def form_unencode(encoded_value); end + + # Converts an input to a URI. The input does not have to be a valid + # URI — the method will use heuristics to guess what URI was intended. + # This is not standards-compliant, merely user-friendly. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI string to parse. + # No parsing is performed if the object is already an + # Addressable::URI. + # @param [Hash] hints + # A Hash of hints to the heuristic parser. + # Defaults to {:scheme => "http"}. + # + # @return [Addressable::URI] The parsed URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:191 + def heuristic_parse(uri, hints = T.unsafe(nil)); end + + # Returns an array of known ip-based schemes. These schemes typically + # use a similar URI form: + # //:@:/ + # + # pkg:gem/addressable#lib/addressable/uri.rb:1380 + def ip_based_schemes; end + + # Joins several URIs together. + # + # @param [String, Addressable::URI, #to_str] *uris + # The URIs to join. + # + # @return [Addressable::URI] The joined URI. + # + # @example + # base = "http://example.com/" + # uri = Addressable::URI.parse("relative/path") + # Addressable::URI.join(base, uri) + # #=> # + # + # pkg:gem/addressable#lib/addressable/uri.rb:343 + def join(*uris); end + + # Normalizes the encoding of a URI component. + # + # @param [String, #to_str] component The URI component to encode. + # + # @param [String, Regexp] character_class + # The characters which are not percent encoded. If a String + # is passed, the String must be formatted as a regular + # expression character class. (Do not include the surrounding square + # brackets.) For example, "b-zB-Z0-9" would cause + # everything but the letters 'b' through 'z' and the numbers '0' + # through '9' to be percent encoded. If a Regexp is passed, + # the value /[^b-zB-Z0-9]/ would have the same effect. A + # set of useful String values may be found in the + # Addressable::URI::CharacterClasses module. The default + # value is the reserved plus unreserved character classes specified in + # RFC 3986. + # + # @param [String] leave_encoded + # When character_class is a String then + # leave_encoded is a string of characters that should remain + # percent encoded while normalizing the component; if they appear percent + # encoded in the original component, then they will be upcased ("%2f" + # normalized to "%2F") but otherwise left alone. + # + # @return [String] The normalized component. + # + # @example + # Addressable::URI.normalize_component("simpl%65/%65xampl%65", "b-zB-Z") + # => "simple%2Fex%61mple" + # Addressable::URI.normalize_component( + # "simpl%65/%65xampl%65", /[^b-zB-Z]/ + # ) + # => "simple%2Fex%61mple" + # Addressable::URI.normalize_component( + # "simpl%65/%65xampl%65", + # Addressable::URI::CharacterClasses::UNRESERVED + # ) + # => "simple%2Fexample" + # Addressable::URI.normalize_component( + # "one%20two%2fthree%26four", + # "0-9a-zA-Z &/", + # "/" + # ) + # => "one two%2Fthree&four" + # + # pkg:gem/addressable#lib/addressable/uri.rb:552 + def normalize_component(component, character_class = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # Resolves paths to their simplest form. + # + # @param [String] path The path to normalize. + # + # @return [String] The normalized path. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2460 + def normalize_path(path); end + + # Normalizes the encoding of a URI. Characters within a hostname are + # not percent encoded to allow for internationalized domain names. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI to encode. + # + # @param [Class] return_type + # The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # + # @return [String, Addressable::URI] + # The encoded URI. + # The return type is determined by the return_type + # parameter. + # + # pkg:gem/addressable#lib/addressable/uri.rb:671 + def normalized_encode(uri, return_type = T.unsafe(nil)); end + + # Returns a URI object based on the parsed string. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI string to parse. + # No parsing is performed if the object is already an + # Addressable::URI. + # + # @return [Addressable::URI] The parsed URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:114 + def parse(uri); end + + # Returns a hash of common IP-based schemes and their default port + # numbers. Adding new schemes to this hash, as necessary, will allow + # for better URI normalization. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1387 + def port_mapping; end + + # Unencodes any percent encoded characters within a URI component. + # This method may be used for unencoding either components or full URIs, + # however, it is recommended to use the unencode_component + # alias when unencoding components. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI or component to unencode. + # + # @param [Class] return_type + # The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # + # @param [String] leave_encoded + # A string of characters to leave encoded. If a percent encoded character + # in this list is encountered then it will remain percent encoded. + # + # @return [String, Addressable::URI] + # The unencoded component or URI. + # The return type is determined by the return_type + # parameter. + # + # pkg:gem/addressable#lib/addressable/uri.rb:472 + def unencode(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:502 + def unencode_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:501 + def unescape(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:503 + def unescape_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + end +end + +# Container for the character classes specified in +# RFC 3986. +# +# Note: Concatenated and interpolated `String`s are not affected by the +# `frozen_string_literal` directive and must be frozen explicitly. +# +# Interpolated `String`s *were* frozen this way before Ruby 3.0: +# https://bugs.ruby-lang.org/issues/17104 +# +# pkg:gem/addressable#lib/addressable/uri.rb:46 +module Addressable::URI::CharacterClasses; end + +# pkg:gem/addressable#lib/addressable/uri.rb:47 +Addressable::URI::CharacterClasses::ALPHA = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:57 +Addressable::URI::CharacterClasses::AUTHORITY = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:48 +Addressable::URI::CharacterClasses::DIGIT = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:60 +Addressable::URI::CharacterClasses::FRAGMENT = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:49 +Addressable::URI::CharacterClasses::GEN_DELIMS = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:56 +Addressable::URI::CharacterClasses::HOST = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:58 +Addressable::URI::CharacterClasses::PATH = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:54 +Addressable::URI::CharacterClasses::PCHAR = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:59 +Addressable::URI::CharacterClasses::QUERY = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:51 +Addressable::URI::CharacterClasses::RESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:53 +Addressable::URI::CharacterClasses::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:55 +Addressable::URI::CharacterClasses::SCHEME = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:50 +Addressable::URI::CharacterClasses::SUB_DELIMS = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:52 +Addressable::URI::CharacterClasses::UNRESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:72 +module Addressable::URI::CharacterClassesRegexps; end + +# pkg:gem/addressable#lib/addressable/uri.rb:73 +Addressable::URI::CharacterClassesRegexps::AUTHORITY = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:74 +Addressable::URI::CharacterClassesRegexps::FRAGMENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:75 +Addressable::URI::CharacterClassesRegexps::HOST = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:76 +Addressable::URI::CharacterClassesRegexps::PATH = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:77 +Addressable::URI::CharacterClassesRegexps::QUERY = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:78 +Addressable::URI::CharacterClassesRegexps::RESERVED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:79 +Addressable::URI::CharacterClassesRegexps::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:80 +Addressable::URI::CharacterClassesRegexps::SCHEME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:81 +Addressable::URI::CharacterClassesRegexps::UNRESERVED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:85 +Addressable::URI::EMPTY_STR = T.let(T.unsafe(nil), String) + +# Raised if something other than a uri is supplied. +# +# pkg:gem/addressable#lib/addressable/uri.rb:34 +class Addressable::URI::InvalidURIError < ::StandardError; end + +# pkg:gem/addressable#lib/addressable/uri.rb:2646 +module Addressable::URI::NONE; end + +# pkg:gem/addressable#lib/addressable/uri.rb:1541 +Addressable::URI::NORMPATH = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:63 +module Addressable::URI::NormalizeCharacterClasses; end + +# pkg:gem/addressable#lib/addressable/uri.rb:68 +Addressable::URI::NormalizeCharacterClasses::FRAGMENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:64 +Addressable::URI::NormalizeCharacterClasses::HOST = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:66 +Addressable::URI::NormalizeCharacterClasses::PCHAR = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:69 +Addressable::URI::NormalizeCharacterClasses::QUERY = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:67 +Addressable::URI::NormalizeCharacterClasses::SCHEME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:65 +Addressable::URI::NormalizeCharacterClasses::UNRESERVED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:2443 +Addressable::URI::PARENT = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:89 +Addressable::URI::PORT_MAPPING = T.let(T.unsafe(nil), Hash) + +# Deprecated. No longer used by normalize_path; will be removed in 2.10.0. +# +# pkg:gem/addressable#lib/addressable/uri.rb:2446 +Addressable::URI::RULE_2A = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:2447 +Addressable::URI::RULE_2B_2C = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:2448 +Addressable::URI::RULE_2D = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:2449 +Addressable::URI::RULE_PREFIXED_PARENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:2442 +Addressable::URI::SELF_REF = T.let(T.unsafe(nil), String) + +# Tables used to optimize encoding operations in `self.encode_component` +# and `self.normalize_component` +# +# pkg:gem/addressable#lib/addressable/uri.rb:360 +Addressable::URI::SEQUENCE_ENCODING_TABLE = T.let(T.unsafe(nil), Array) + +# pkg:gem/addressable#lib/addressable/uri.rb:364 +Addressable::URI::SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE = T.let(T.unsafe(nil), Array) + +# pkg:gem/addressable#lib/addressable/uri.rb:84 +Addressable::URI::SLASH = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:87 +Addressable::URI::URIREGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/version.rb:23 +module Addressable::VERSION; end + +# pkg:gem/addressable#lib/addressable/version.rb:24 +Addressable::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/version.rb:25 +Addressable::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/version.rb:28 +Addressable::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/version.rb:26 +Addressable::VERSION::TINY = T.let(T.unsafe(nil), Integer) diff --git a/sorbet/rbi/gems/argon2@2.3.3.rbi b/sorbet/rbi/gems/argon2@2.3.3.rbi new file mode 100644 index 000000000..007dccae3 --- /dev/null +++ b/sorbet/rbi/gems/argon2@2.3.3.rbi @@ -0,0 +1,231 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `argon2` gem. +# Please instead update this file by running `bin/tapioca gem argon2`. + + +# Defines an array of errors that matches the enum list of errors from +# argon2.h. This allows return values to propagate errors through the FFI. +# Standard Gem version constant. +# +# pkg:gem/argon2#lib/argon2/constants.rb:3 +module Argon2; end + +# pkg:gem/argon2#lib/argon2/errors.rb:7 +class Argon2::ArgonHashFail < ::StandardError; end + +# Constants utilised in several parts of the Argon2 module +# SALT_LEN is a standard recommendation from the Argon2 spec. +# +# pkg:gem/argon2#lib/argon2/constants.rb:7 +module Argon2::Constants; end + +# Binary, unencoded output +# +# pkg:gem/argon2#lib/argon2/constants.rb:10 +Argon2::Constants::ENCODE_LEN = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2/constants.rb:9 +Argon2::Constants::OUT_LEN = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2/constants.rb:8 +Argon2::Constants::SALT_LEN = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2/errors.rb:8 +Argon2::ERRORS = T.let(T.unsafe(nil), Array) + +# Generates a random, binary string for use as a salt. +# The engine class shields users from the FFI interface. +# It is generally not advised to directly use this class. +# +# pkg:gem/argon2#lib/argon2/ffi_engine.rb:48 +class Argon2::Engine + class << self + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:98 + def argon2_verify(pwd, hash, secret); end + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:49 + def hash_argon2i(password, salt, t_cost, m_cost, out_len = T.unsafe(nil)); end + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:65 + def hash_argon2id(password, salt, t_cost, m_cost, p_cost, out_len = T.unsafe(nil)); end + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:81 + def hash_argon2id_encode(password, salt, t_cost, m_cost, p_cost, secret); end + + # pkg:gem/argon2#lib/argon2/engine.rb:8 + def saltgen; end + end +end + +# Direct external bindings. Call these methods via the Engine class to ensure points are dealt with +# +# pkg:gem/argon2#lib/argon2/ffi_engine.rb:8 +module Argon2::Ext + extend ::FFI::Library + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:35 + def argon2_wrap(*_arg0); end + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:17 + def argon2i_hash_raw(*_arg0); end + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:26 + def argon2id_hash_raw(*_arg0); end + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:42 + def wrap_argon2_verify(*_arg0); end + + class << self + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:35 + def argon2_wrap(*_arg0); end + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:17 + def argon2i_hash_raw(*_arg0); end + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:26 + def argon2id_hash_raw(*_arg0); end + + # pkg:gem/argon2#lib/argon2/ffi_engine.rb:42 + def wrap_argon2_verify(*_arg0); end + end +end + +# Get the values from an Argon2 compatible string. +# +# pkg:gem/argon2#lib/argon2/hash_format.rb:7 +class Argon2::HashFormat + # FIXME: Reduce complexity/AbcSize + # + # pkg:gem/argon2#lib/argon2/hash_format.rb:12 + def initialize(digest); end + + # pkg:gem/argon2#lib/argon2/hash_format.rb:8 + def checksum; end + + # pkg:gem/argon2#lib/argon2/hash_format.rb:8 + def m_cost; end + + # pkg:gem/argon2#lib/argon2/hash_format.rb:8 + def p_cost; end + + # pkg:gem/argon2#lib/argon2/hash_format.rb:8 + def salt; end + + # pkg:gem/argon2#lib/argon2/hash_format.rb:8 + def t_cost; end + + # pkg:gem/argon2#lib/argon2/hash_format.rb:8 + def variant; end + + # pkg:gem/argon2#lib/argon2/hash_format.rb:8 + def version; end + + class << self + # Checks whether a given digest is a valid Argon2 hash. + # + # Supports 1 and argon2id formats. + # + # pkg:gem/argon2#lib/argon2/hash_format.rb:45 + def valid_hash?(digest); end + end +end + +# Front-end API for the Argon2 module. +# +# pkg:gem/argon2#lib/argon2.rb:13 +class Argon2::Password + # pkg:gem/argon2#lib/argon2.rb:25 + def initialize(options = T.unsafe(nil)); end + + # pkg:gem/argon2#lib/argon2.rb:34 + def create(pass); end + + protected + + # pkg:gem/argon2#lib/argon2.rb:63 + def init_costs(options = T.unsafe(nil)); end + + class << self + # Helper class, just creates defaults and calls hash() + # + # pkg:gem/argon2#lib/argon2.rb:46 + def create(pass, options = T.unsafe(nil)); end + + # pkg:gem/argon2#lib/argon2.rb:51 + def valid_hash?(hash); end + + # pkg:gem/argon2#lib/argon2.rb:55 + def verify_password(pass, hash, secret = T.unsafe(nil)); end + end +end + +# pkg:gem/argon2#lib/argon2.rb:16 +Argon2::Password::DEFAULT_M_COST = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2.rb:17 +Argon2::Password::DEFAULT_P_COST = T.let(T.unsafe(nil), Integer) + +# Expose constants for the options supported and default used for passwords. +# +# pkg:gem/argon2#lib/argon2.rb:15 +Argon2::Password::DEFAULT_T_COST = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2.rb:21 +Argon2::Password::MAX_M_COST = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2.rb:23 +Argon2::Password::MAX_P_COST = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2.rb:19 +Argon2::Password::MAX_T_COST = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2.rb:20 +Argon2::Password::MIN_M_COST = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2.rb:22 +Argon2::Password::MIN_P_COST = T.let(T.unsafe(nil), Integer) + +# pkg:gem/argon2#lib/argon2.rb:18 +Argon2::Password::MIN_T_COST = T.let(T.unsafe(nil), Integer) + +# Contains named profiles of different common cost parameter sets +# +# pkg:gem/argon2#lib/argon2/profiles.rb:5 +class Argon2::Profiles + class << self + # pkg:gem/argon2#lib/argon2/profiles.rb:6 + def [](name); end + + # pkg:gem/argon2#lib/argon2/profiles.rb:13 + def to_a; end + + # pkg:gem/argon2#lib/argon2/profiles.rb:17 + def to_h; end + end +end + +# The default values ruby-argon2 had before using RFC 9106 recommendations +# +# pkg:gem/argon2#lib/argon2/profiles.rb:37 +Argon2::Profiles::PRE_RFC_9106 = T.let(T.unsafe(nil), Hash) + +# https://datatracker.ietf.org/doc/html/rfc9106#name-argon2-algorithm +# FIRST RECOMMENDED option per RFC 9106. +# +# pkg:gem/argon2#lib/argon2/profiles.rb:23 +Argon2::Profiles::RFC_9106_HIGH_MEMORY = T.let(T.unsafe(nil), Hash) + +# SECOND RECOMMENDED option per RFC 9106. +# +# pkg:gem/argon2#lib/argon2/profiles.rb:30 +Argon2::Profiles::RFC_9106_LOW_MEMORY = T.let(T.unsafe(nil), Hash) + +# Only use for fast testing. Insecure otherwise! +# +# pkg:gem/argon2#lib/argon2/profiles.rb:44 +Argon2::Profiles::UNSAFE_CHEAPEST = T.let(T.unsafe(nil), Hash) + +# pkg:gem/argon2#lib/argon2/version.rb:6 +Argon2::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/ast@2.4.3.rbi b/sorbet/rbi/gems/ast@2.4.3.rbi new file mode 100644 index 000000000..e946b0083 --- /dev/null +++ b/sorbet/rbi/gems/ast@2.4.3.rbi @@ -0,0 +1,550 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `ast` gem. +# Please instead update this file by running `bin/tapioca gem ast`. + + +# {AST} is a library for manipulating abstract syntax trees. +# +# It embraces immutability; each AST node is inherently frozen at +# creation, and updating a child node requires recreating that node +# and its every parent, recursively. +# This is a design choice. It does create some pressure on +# garbage collector, but completely eliminates all concurrency +# and aliasing problems. +# +# See also {AST::Node}, {AST::Processor::Mixin} and {AST::Sexp} for +# additional recommendations and design patterns. +# +# pkg:gem/ast#lib/ast.rb:13 +module AST; end + +# Node is an immutable class, instances of which represent abstract +# syntax tree nodes. It combines semantic information (i.e. anything +# that affects the algorithmic properties of a program) with +# meta-information (line numbers or compiler intermediates). +# +# Notes on inheritance +# ==================== +# +# The distinction between semantics and metadata is important. Complete +# semantic information should be contained within just the {#type} and +# {#children} of a Node instance; in other words, if an AST was to be +# stripped of all meta-information, it should remain a valid AST which +# could be successfully processed to yield a result with the same +# algorithmic properties. +# +# Thus, Node should never be inherited in order to define methods which +# affect or return semantic information, such as getters for `class_name`, +# `superclass` and `body` in the case of a hypothetical `ClassNode`. The +# correct solution is to use a generic Node with a {#type} of `:class` +# and three children. See also {Processor} for tips on working with such +# ASTs. +# +# On the other hand, Node can and should be inherited to define +# application-specific metadata (see also {#initialize}) or customize the +# printing format. It is expected that an application would have one or two +# such classes and use them across the entire codebase. +# +# The rationale for this pattern is extensibility and maintainability. +# Unlike static ones, dynamic languages do not require the presence of a +# predefined, rigid structure, nor does it improve dispatch efficiency, +# and while such a structure can certainly be defined, it does not add +# any value but incurs a maintaining cost. +# For example, extending the AST even with a transformation-local +# temporary node type requires making globally visible changes to +# the codebase. +# +# pkg:gem/ast#lib/ast/node.rb:40 +class AST::Node + # Constructs a new instance of Node. + # + # The arguments `type` and `children` are converted with `to_sym` and + # `to_a` respectively. Additionally, the result of converting `children` + # is frozen. While mutating the arguments is generally considered harmful, + # the most common case is to pass an array literal to the constructor. If + # your code does not expect the argument to be frozen, use `#dup`. + # + # The `properties` hash is passed to {#assign_properties}. + # + # pkg:gem/ast#lib/ast/node.rb:72 + def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end + + # pkg:gem/ast#lib/ast/node.rb:172 + def +(array); end + + # pkg:gem/ast#lib/ast/node.rb:181 + def <<(element); end + + # Compares `self` to `other`, possibly converting with `to_ast`. Only + # `type` and `children` are compared; metadata is deliberately ignored. + # + # @return [Boolean] + # + # pkg:gem/ast#lib/ast/node.rb:153 + def ==(other); end + + # Appends `element` to `children` and returns the resulting node. + # + # @return [AST::Node] + # + # pkg:gem/ast#lib/ast/node.rb:177 + def append(element); end + + # Returns the children of this node. + # The returned value is frozen. + # The to_a alias is useful for decomposing nodes concisely. + # For example: + # + # node = s(:gasgn, :$foo, s(:integer, 1)) + # var_name, value = *node + # p var_name # => :$foo + # p value # => (integer 1) + # + # @return [Array] + # + # pkg:gem/ast#lib/ast/node.rb:56 + def children; end + + # pkg:gem/ast#lib/ast/node.rb:118 + def clone; end + + # Concatenates `array` with `children` and returns the resulting node. + # + # @return [AST::Node] + # + # pkg:gem/ast#lib/ast/node.rb:168 + def concat(array); end + + # Enables matching for Node, where type is the first element + # and the children are remaining items. + # + # @return [Array] + # + # pkg:gem/ast#lib/ast/node.rb:253 + def deconstruct; end + + # Nodes are already frozen, so there is no harm in returning the + # current node as opposed to initializing from scratch and freezing + # another one. + # + # @return self + # + # pkg:gem/ast#lib/ast/node.rb:115 + def dup; end + + # Test if other object is equal to + # @param [Object] other + # @return [Boolean] + # + # pkg:gem/ast#lib/ast/node.rb:85 + def eql?(other); end + + # Returns the precomputed hash value for this node + # @return [Integer] + # + # pkg:gem/ast#lib/ast/node.rb:61 + def hash; end + + # Converts `self` to a s-expression ruby string. + # The code return will recreate the node, using the sexp module s() + # + # @param [Integer] indent Base indentation level. + # @return [String] + # + # pkg:gem/ast#lib/ast/node.rb:211 + def inspect(indent = T.unsafe(nil)); end + + # pkg:gem/ast#lib/ast/node.rb:57 + def to_a; end + + # @return [AST::Node] self + # + # pkg:gem/ast#lib/ast/node.rb:229 + def to_ast; end + + # pkg:gem/ast#lib/ast/node.rb:204 + def to_s(indent = T.unsafe(nil)); end + + # Converts `self` to a pretty-printed s-expression. + # + # @param [Integer] indent Base indentation level. + # @return [String] + # + # pkg:gem/ast#lib/ast/node.rb:187 + def to_sexp(indent = T.unsafe(nil)); end + + # Converts `self` to an Array where the first element is the type as a Symbol, + # and subsequent elements are the same representation of its children. + # + # @return [Array] + # + # pkg:gem/ast#lib/ast/node.rb:237 + def to_sexp_array; end + + # Returns the type of this node. + # @return [Symbol] + # + # pkg:gem/ast#lib/ast/node.rb:43 + def type; end + + # Returns a new instance of Node where non-nil arguments replace the + # corresponding fields of `self`. + # + # For example, `Node.new(:foo, [ 1, 2 ]).updated(:bar)` would yield + # `(bar 1 2)`, and `Node.new(:foo, [ 1, 2 ]).updated(nil, [])` would + # yield `(foo)`. + # + # If the resulting node would be identical to `self`, does nothing. + # + # @param [Symbol, nil] type + # @param [Array, nil] children + # @param [Hash, nil] properties + # @return [AST::Node] + # + # pkg:gem/ast#lib/ast/node.rb:133 + def updated(type = T.unsafe(nil), children = T.unsafe(nil), properties = T.unsafe(nil)); end + + protected + + # By default, each entry in the `properties` hash is assigned to + # an instance variable in this instance of Node. A subclass should define + # attribute readers for such variables. The values passed in the hash + # are not frozen or whitelisted; such behavior can also be implemented + # by subclassing Node and overriding this method. + # + # @return [nil] + # + # pkg:gem/ast#lib/ast/node.rb:98 + def assign_properties(properties); end + + # Returns `@type` with all underscores replaced by dashes. This allows + # to write symbol literals without quotes in Ruby sources and yet have + # nicely looking s-expressions. + # + # @return [String] + # + # pkg:gem/ast#lib/ast/node.rb:264 + def fancy_type; end + + private + + # pkg:gem/ast#lib/ast/node.rb:107 + def original_dup; end +end + +# This class includes {AST::Processor::Mixin}; however, it is +# deprecated, since the module defines all of the behaviors that +# the processor includes. Any new libraries should use +# {AST::Processor::Mixin} instead of subclassing this. +# +# @deprecated Use {AST::Processor::Mixin} instead. +# +# pkg:gem/ast#lib/ast/processor.rb:8 +class AST::Processor + include ::AST::Processor::Mixin +end + +# The processor module is a module which helps transforming one +# AST into another. In a nutshell, the {#process} method accepts +# a {Node} and dispatches it to a handler corresponding to its +# type, and returns a (possibly) updated variant of the node. +# +# The processor module has a set of associated design patterns. +# They are best explained with a concrete example. Let's define a +# simple arithmetic language and an AST format for it: +# +# Terminals (AST nodes which do not have other AST nodes inside): +# +# * `(integer )`, +# +# Nonterminals (AST nodes with other nodes as children): +# +# * `(add )`, +# * `(multiply )`, +# * `(divide )`, +# * `(negate )`, +# * `(store )`: stores value of `` +# into a variable named ``, +# * `(load )`: loads value of a variable named +# ``, +# * `(each ...)`: computes each of the ``s and +# prints the result. +# +# All AST nodes have the same Ruby class, and therefore they don't +# know how to traverse themselves. (A solution which dynamically +# checks the type of children is possible, but is slow and +# error-prone.) So, a class including the module which knows how +# to traverse the entire tree should be defined. Such classes +# have a handler for each nonterminal node which recursively +# processes children nodes: +# +# require 'ast' +# +# class ArithmeticsProcessor +# include AST::Processor::Mixin +# # This method traverses any binary operators such as (add) +# # or (multiply). +# def process_binary_op(node) +# # Children aren't decomposed automatically; it is +# # suggested to use Ruby multiple assignment expansion, +# # as it is very convenient here. +# left_expr, right_expr = *node +# +# # AST::Node#updated won't change node type if nil is +# # passed as a first argument, which allows to reuse the +# # same handler for multiple node types using `alias' +# # (below). +# node.updated(nil, [ +# process(left_expr), +# process(right_expr) +# ]) +# end +# alias_method :on_add, :process_binary_op +# alias_method :on_multiply, :process_binary_op +# alias_method :on_divide, :process_binary_op +# +# def on_negate(node) +# # It is also possible to use #process_all for more +# # compact code if every child is a Node. +# node.updated(nil, process_all(node)) +# end +# +# def on_store(node) +# expr, variable_name = *node +# +# # Note that variable_name is not a Node and thus isn't +# # passed to #process. +# node.updated(nil, [ +# process(expr), +# variable_name +# ]) +# end +# +# # (load) is effectively a terminal node, and so it does +# # not need an explicit handler, as the following is the +# # default behavior. Essentially, for any nodes that don't +# # have a defined handler, the node remains unchanged. +# def on_load(node) +# nil +# end +# +# def on_each(node) +# node.updated(nil, process_all(node)) +# end +# end +# +# Let's test our ArithmeticsProcessor: +# +# include AST::Sexp +# expr = s(:add, s(:integer, 2), s(:integer, 2)) +# +# p ArithmeticsProcessor.new.process(expr) == expr # => true +# +# As expected, it does not change anything at all. This isn't +# actually very useful, so let's now define a Calculator, which +# will compute the expression values: +# +# # This Processor folds nonterminal nodes and returns an +# # (integer) terminal node. +# class ArithmeticsCalculator < ArithmeticsProcessor +# def compute_op(node) +# # First, node children are processed and then unpacked +# # to local variables. +# nodes = process_all(node) +# +# if nodes.all? { |node| node.type == :integer } +# # If each of those nodes represents a literal, we can +# # fold this node! +# values = nodes.map { |node| node.children.first } +# AST::Node.new(:integer, [ +# yield(values) +# ]) +# else +# # Otherwise, we can just leave the current node in the +# # tree and only update it with processed children +# # nodes, which can be partially folded. +# node.updated(nil, nodes) +# end +# end +# +# def on_add(node) +# compute_op(node) { |left, right| left + right } +# end +# +# def on_multiply(node) +# compute_op(node) { |left, right| left * right } +# end +# end +# +# Let's check: +# +# p ArithmeticsCalculator.new.process(expr) # => (integer 4) +# +# Excellent, the calculator works! Now, a careful reader could +# notice that the ArithmeticsCalculator does not know how to +# divide numbers. What if we pass an expression with division to +# it? +# +# expr_with_division = \ +# s(:add, +# s(:integer, 1), +# s(:divide, +# s(:add, s(:integer, 8), s(:integer, 4)), +# s(:integer, 3))) # 1 + (8 + 4) / 3 +# +# folded_expr_with_division = ArithmeticsCalculator.new.process(expr_with_division) +# p folded_expr_with_division +# # => (add +# # (integer 1) +# # (divide +# # (integer 12) +# # (integer 3))) +# +# As you can see, the expression was folded _partially_: the inner +# `(add)` node which could be computed was folded to +# `(integer 12)`, the `(divide)` node is left as-is because there +# is no computing handler for it, and the root `(add)` node was +# also left as it is because some of its children were not +# literals. +# +# Note that this partial folding is only possible because the +# _data_ format, i.e. the format in which the computed values of +# the nodes are represented, is the same as the AST itself. +# +# Let's extend our ArithmeticsCalculator class further. +# +# class ArithmeticsCalculator +# def on_divide(node) +# compute_op(node) { |left, right| left / right } +# end +# +# def on_negate(node) +# # Note how #compute_op works regardless of the operator +# # arity. +# compute_op(node) { |value| -value } +# end +# end +# +# Now, let's apply our renewed ArithmeticsCalculator to a partial +# result of previous evaluation: +# +# p ArithmeticsCalculator.new.process(expr_with_division) # => (integer 5) +# +# Five! Excellent. This is also pretty much how CRuby 1.8 executed +# its programs. +# +# Now, let's do some automated bug searching. Division by zero is +# an error, right? So if we could detect that someone has divided +# by zero before the program is even run, that could save some +# debugging time. +# +# class DivisionByZeroVerifier < ArithmeticsProcessor +# class VerificationFailure < Exception; end +# +# def on_divide(node) +# # You need to process the children to handle nested divisions +# # such as: +# # (divide +# # (integer 1) +# # (divide (integer 1) (integer 0)) +# left, right = process_all(node) +# +# if right.type == :integer && +# right.children.first == 0 +# raise VerificationFailure, "Ouch! This code divides by zero." +# end +# end +# +# def divides_by_zero?(ast) +# process(ast) +# false +# rescue VerificationFailure +# true +# end +# end +# +# nice_expr = \ +# s(:divide, +# s(:add, s(:integer, 10), s(:integer, 2)), +# s(:integer, 4)) +# +# p DivisionByZeroVerifier.new.divides_by_zero?(nice_expr) +# # => false. Good. +# +# bad_expr = \ +# s(:add, s(:integer, 10), +# s(:divide, s(:integer, 1), s(:integer, 0))) +# +# p DivisionByZeroVerifier.new.divides_by_zero?(bad_expr) +# # => true. WHOOPS. DO NOT RUN THIS. +# +# Of course, this won't detect more complex cases... unless you +# use some partial evaluation before! The possibilites are +# endless. Have fun. +# +# pkg:gem/ast#lib/ast/processor/mixin.rb:240 +module AST::Processor::Mixin + # Default handler. Does nothing. + # + # @param [AST::Node] node + # @return [AST::Node, nil] + # + # pkg:gem/ast#lib/ast/processor/mixin.rb:284 + def handler_missing(node); end + + # Dispatches `node`. If a node has type `:foo`, then a handler + # named `on_foo` is invoked with one argument, the `node`; if + # there isn't such a handler, {#handler_missing} is invoked + # with the same argument. + # + # If the handler returns `nil`, `node` is returned; otherwise, + # the return value of the handler is passed along. + # + # @param [AST::Node, nil] node + # @return [AST::Node, nil] + # + # pkg:gem/ast#lib/ast/processor/mixin.rb:251 + def process(node); end + + # {#process}es each node from `nodes` and returns an array of + # results. + # + # @param [Array] nodes + # @return [Array] + # + # pkg:gem/ast#lib/ast/processor/mixin.rb:274 + def process_all(nodes); end +end + +# This simple module is very useful in the cases where one needs +# to define deeply nested ASTs from Ruby code, for example, in +# tests. It should be used like this: +# +# describe YourLanguage do +# include ::AST::Sexp +# +# it "should correctly parse expressions" do +# YourLanguage.parse("1 + 2 * 3").should == +# s(:add, +# s(:integer, 1), +# s(:multiply, +# s(:integer, 2), +# s(:integer, 3))) +# end +# end +# +# This way the amount of boilerplate code is greatly reduced. +# +# pkg:gem/ast#lib/ast/sexp.rb:20 +module AST::Sexp + # Creates a {Node} with type `type` and children `children`. + # Note that the resulting node is of the type AST::Node and not a + # subclass. + # This would not pose a problem with comparisons, as {Node#==} + # ignores metadata. + # + # pkg:gem/ast#lib/ast/sexp.rb:26 + def s(type, *children); end +end diff --git a/sorbet/rbi/gems/autoprefixer-rails@10.6.1.0.rbi b/sorbet/rbi/gems/autoprefixer-rails@10.6.1.0.rbi new file mode 100644 index 000000000..5ef668a41 --- /dev/null +++ b/sorbet/rbi/gems/autoprefixer-rails@10.6.1.0.rbi @@ -0,0 +1,177 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `autoprefixer-rails` gem. +# Please instead update this file by running `bin/tapioca gem autoprefixer-rails`. + + +# pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/railtie.rb:10 +module AutoprefixedRails; end + +# pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/railtie.rb:11 +class AutoprefixedRails::Railtie < ::Rails::Railtie + # Read browsers requirements from application or engine config + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/railtie.rb:28 + def config; end + + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/railtie.rb:49 + def roots; end +end + +# Ruby integration with Autoprefixer JS library, which parse CSS and adds +# only actual prefixed +# +# pkg:gem/autoprefixer-rails#lib/autoprefixer-rails.rb:5 +module AutoprefixerRails + class << self + # Add Autoprefixer for Sprockets environment in `assets`. + # You can specify `browsers` actual in your project. + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails.rb:21 + def install(assets, params = T.unsafe(nil)); end + + # Add prefixes to `css`. See `Processor#process` for options. + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails.rb:9 + def process(css, opts = T.unsafe(nil)); end + + # Cache processor instances + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails.rb:32 + def processor(params = T.unsafe(nil)); end + + # Disable installed Autoprefixer + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails.rb:27 + def uninstall(assets); end + end +end + +# pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:8 +AutoprefixerRails::IS_SECTION = T.let(T.unsafe(nil), Regexp) + +# Ruby to JS wrapper for Autoprefixer processor instance +# +# pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:11 +class AutoprefixerRails::Processor + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:14 + def initialize(params = T.unsafe(nil)); end + + # Return, which browsers and prefixes will be used + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:52 + def info; end + + # Parse Browserslist config + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:57 + def parse_config(config); end + + # Process `css` and return result. + # + # Options can be: + # * `from` with input CSS file name. Will be used in error messages. + # * `to` with output CSS file name. + # * `map` with true to generate new source map or with previous map. + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:24 + def process(css, opts = T.unsafe(nil)); end + + private + + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:159 + def build_js; end + + # Convert ruby_options to jsOptions + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:99 + def convert_options(opts); end + + # Try to find Browserslist config + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:114 + def find_config(file); end + + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:77 + def params_with_browsers(from = T.unsafe(nil)); end + + # Lazy load for JS library + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:131 + def runtime; end +end + +# pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/processor.rb:12 +AutoprefixerRails::Processor::SUPPORTED_RUNTIMES = T.let(T.unsafe(nil), Array) + +# Container of prefixed CSS and source map with changes +# +# pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/result.rb:5 +class AutoprefixerRails::Result + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/result.rb:15 + def initialize(css, map, warnings); end + + # Prefixed CSS after Autoprefixer + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/result.rb:7 + def css; end + + # Source map of changes + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/result.rb:10 + def map; end + + # Stringify prefixed CSS + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/result.rb:22 + def to_s; end + + # Warnings from Autoprefixer + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/result.rb:13 + def warnings; end +end + +# Register autoprefixer postprocessor in Sprockets and fix common issues +# +# pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/sprockets.rb:7 +class AutoprefixerRails::Sprockets + # Sprockets 2 API new and render + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/sprockets.rb:54 + def initialize(filename); end + + # Sprockets 2 API new and render + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/sprockets.rb:60 + def render(*); end + + class << self + # Sprockets 3 and 4 API + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/sprockets.rb:13 + def call(input); end + + # Register postprocessor in Sprockets depend on issues with other gems + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/sprockets.rb:32 + def install(env); end + + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/sprockets.rb:8 + def register_processor(processor); end + + # Add prefixes to `css` + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/sprockets.rb:20 + def run(filename, css); end + + # Register postprocessor in Sprockets depend on issues with other gems + # + # pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/sprockets.rb:43 + def uninstall(env); end + end +end + +# pkg:gem/autoprefixer-rails#lib/autoprefixer-rails/version.rb:4 +AutoprefixerRails::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/base64@0.3.0.rbi b/sorbet/rbi/gems/base64@0.3.0.rbi new file mode 100644 index 000000000..9995f72b3 --- /dev/null +++ b/sorbet/rbi/gems/base64@0.3.0.rbi @@ -0,0 +1,545 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `base64` gem. +# Please instead update this file by running `bin/tapioca gem base64`. + + +# \Module \Base64 provides methods for: +# +# - \Encoding a binary string (containing non-ASCII characters) +# as a string of printable ASCII characters. +# - Decoding such an encoded string. +# +# \Base64 is commonly used in contexts where binary data +# is not allowed or supported: +# +# - Images in HTML or CSS files, or in URLs. +# - Email attachments. +# +# A \Base64-encoded string is about one-third larger that its source. +# See the {Wikipedia article}[https://en.wikipedia.org/wiki/Base64] +# for more information. +# +# This module provides three pairs of encode/decode methods. +# Your choices among these methods should depend on: +# +# - Which character set is to be used for encoding and decoding. +# - Whether "padding" is to be used. +# - Whether encoded strings are to contain newlines. +# +# Note: Examples on this page assume that the including program has executed: +# +# require 'base64' +# +# == \Encoding Character Sets +# +# A \Base64-encoded string consists only of characters from a 64-character set: +# +# - ('A'..'Z'). +# - ('a'..'z'). +# - ('0'..'9'). +# - =, the 'padding' character. +# - Either: +# - %w[+ /]: +# {RFC-2045-compliant}[https://datatracker.ietf.org/doc/html/rfc2045]; +# _not_ safe for URLs. +# - %w[- _]: +# {RFC-4648-compliant}[https://datatracker.ietf.org/doc/html/rfc4648]; +# safe for URLs. +# +# If you are working with \Base64-encoded strings that will come from +# or be put into URLs, you should choose this encoder-decoder pair +# of RFC-4648-compliant methods: +# +# - Base64.urlsafe_encode64 and Base64.urlsafe_decode64. +# +# Otherwise, you may choose any of the pairs in this module, +# including the pair above, or the RFC-2045-compliant pairs: +# +# - Base64.encode64 and Base64.decode64. +# - Base64.strict_encode64 and Base64.strict_decode64. +# +# == Padding +# +# \Base64-encoding changes a triplet of input bytes +# into a quartet of output characters. +# +# Padding in Encode Methods +# +# Padding -- extending an encoded string with zero, one, or two trailing +# = characters -- is performed by methods Base64.encode64, +# Base64.strict_encode64, and, by default, Base64.urlsafe_encode64: +# +# Base64.encode64('s') # => "cw==\n" +# Base64.strict_encode64('s') # => "cw==" +# Base64.urlsafe_encode64('s') # => "cw==" +# Base64.urlsafe_encode64('s', padding: false) # => "cw" +# +# When padding is performed, the encoded string is always of length 4n, +# where +n+ is a non-negative integer: +# +# - Input bytes of length 3n generate unpadded output characters +# of length 4n: +# +# # n = 1: 3 bytes => 4 characters. +# Base64.strict_encode64('123') # => "MDEy" +# # n = 2: 6 bytes => 8 characters. +# Base64.strict_encode64('123456') # => "MDEyMzQ1" +# +# - Input bytes of length 3n+1 generate padded output characters +# of length 4(n+1), with two padding characters at the end: +# +# # n = 1: 4 bytes => 8 characters. +# Base64.strict_encode64('1234') # => "MDEyMw==" +# # n = 2: 7 bytes => 12 characters. +# Base64.strict_encode64('1234567') # => "MDEyMzQ1Ng==" +# +# - Input bytes of length 3n+2 generate padded output characters +# of length 4(n+1), with one padding character at the end: +# +# # n = 1: 5 bytes => 8 characters. +# Base64.strict_encode64('12345') # => "MDEyMzQ=" +# # n = 2: 8 bytes => 12 characters. +# Base64.strict_encode64('12345678') # => "MDEyMzQ1Njc=" +# +# When padding is suppressed, for a positive integer n: +# +# - Input bytes of length 3n generate unpadded output characters +# of length 4n: +# +# # n = 1: 3 bytes => 4 characters. +# Base64.urlsafe_encode64('123', padding: false) # => "MDEy" +# # n = 2: 6 bytes => 8 characters. +# Base64.urlsafe_encode64('123456', padding: false) # => "MDEyMzQ1" +# +# - Input bytes of length 3n+1 generate unpadded output characters +# of length 4n+2, with two padding characters at the end: +# +# # n = 1: 4 bytes => 6 characters. +# Base64.urlsafe_encode64('1234', padding: false) # => "MDEyMw" +# # n = 2: 7 bytes => 10 characters. +# Base64.urlsafe_encode64('1234567', padding: false) # => "MDEyMzQ1Ng" +# +# - Input bytes of length 3n+2 generate unpadded output characters +# of length 4n+3, with one padding character at the end: +# +# # n = 1: 5 bytes => 7 characters. +# Base64.urlsafe_encode64('12345', padding: false) # => "MDEyMzQ" +# # m = 2: 8 bytes => 11 characters. +# Base64.urlsafe_encode64('12345678', padding: false) # => "MDEyMzQ1Njc" +# +# Padding in Decode Methods +# +# All of the \Base64 decode methods support (but do not require) padding. +# +# \Method Base64.decode64 does not check the size of the padding: +# +# Base64.decode64("MDEyMzQ1Njc") # => "01234567" +# Base64.decode64("MDEyMzQ1Njc=") # => "01234567" +# Base64.decode64("MDEyMzQ1Njc==") # => "01234567" +# +# \Method Base64.strict_decode64 strictly enforces padding size: +# +# Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError +# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567" +# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError +# +# \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: +# +# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567" +# Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567" +# Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError. +# +# == Newlines +# +# An encoded string returned by Base64.encode64 or Base64.urlsafe_encode64 +# has an embedded newline character +# after each 60-character sequence, and, if non-empty, at the end: +# +# # No newline if empty. +# encoded = Base64.encode64("\x00" * 0) +# encoded.index("\n") # => nil +# +# # Newline at end of short output. +# encoded = Base64.encode64("\x00" * 1) +# encoded.size # => 4 +# encoded.index("\n") # => 4 +# +# # Newline at end of longer output. +# encoded = Base64.encode64("\x00" * 45) +# encoded.size # => 60 +# encoded.index("\n") # => 60 +# +# # Newlines embedded and at end of still longer output. +# encoded = Base64.encode64("\x00" * 46) +# encoded.size # => 65 +# encoded.rindex("\n") # => 65 +# encoded.split("\n").map {|s| s.size } # => [60, 4] +# +# The string to be encoded may itself contain newlines, +# which are encoded as \Base64: +# +# # Base64.encode64("\n\n\n") # => "CgoK\n" +# s = "This is line 1\nThis is line 2\n" +# Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" +# +# pkg:gem/base64#lib/base64.rb:184 +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 +encoded_string+: + # + # s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" + # Base64.decode64(s) # => "This is line 1\nThis is line 2\n" + # + # 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 - and /: + # + # Base64.decode64("\x00\n-_") # => "" + # + # Padding in +encoded_string+ (even if incorrect) is ignored: + # + # Base64.decode64("MDEyMzQ1Njc") # => "01234567" + # Base64.decode64("MDEyMzQ1Njc=") # => "01234567" + # Base64.decode64("MDEyMzQ1Njc==") # => "01234567" + # + # pkg:gem/base64#lib/base64.rb:247 + def decode64(str); end + + # :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 + # + or /; + # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: + # + # Base64.encode64("\xFB\xEF\xBE") # => "++++\n" + # Base64.encode64("\xFF\xFF\xFF") # => "////\n" + # + # The returned string may include padding; + # see {Padding}[Base64.html#module-Base64-label-Padding] above. + # + # Base64.encode64('*') # => "Kg==\n" + # + # The returned string ends with a newline character, and if sufficiently long + # will have one or more embedded newline characters; + # see {Newlines}[Base64.html#module-Base64-label-Newlines] above: + # + # Base64.encode64('*') # => "Kg==\n" + # Base64.encode64('*' * 46) + # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq\nKg==\n" + # + # The string to be encoded may itself contain newlines, + # which will be encoded as ordinary \Base64: + # + # Base64.encode64("\n\n\n") # => "CgoK\n" + # s = "This is line 1\nThis is line 2\n" + # Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" + # + # pkg:gem/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 +encoded_string+: + # + # s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK" + # Base64.strict_decode64(s) # => "This is line 1\nThis is line 2\n" + # + # 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 - and /: + # + # Base64.strict_decode64("\n") # Raises ArgumentError + # Base64.strict_decode64('-') # Raises ArgumentError + # Base64.strict_decode64('_') # Raises ArgumentError + # + # 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 + # + # pkg:gem/base64#lib/base64.rb:309 + def strict_decode64(str); end + + # :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 + # + or /; + # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: + # + # Base64.strict_encode64("\xFB\xEF\xBE") # => "++++\n" + # Base64.strict_encode64("\xFF\xFF\xFF") # => "////\n" + # + # The returned string may include padding; + # see {Padding}[Base64.html#module-Base64-label-Padding] above. + # + # Base64.strict_encode64('*') # => "Kg==\n" + # + # The returned string will have no newline characters, regardless of its length; + # see {Newlines}[Base64.html#module-Base64-label-Newlines] above: + # + # Base64.strict_encode64('*') # => "Kg==" + # Base64.strict_encode64('*' * 46) + # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg==" + # + # The string to be encoded may itself contain newlines, + # which will be encoded as ordinary \Base64: + # + # Base64.strict_encode64("\n\n\n") # => "CgoK" + # s = "This is line 1\nThis is line 2\n" + # Base64.strict_encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK" + # + # pkg:gem/base64#lib/base64.rb:282 + def strict_encode64(bin); end + + # :call-seq: + # Base64.urlsafe_decode64(encoded_string) -> decoded_string + # + # 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 +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. + # + # pkg:gem/base64#lib/base64.rb:369 + def urlsafe_decode64(str); end + + # :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 + # + or /, + # but instead may contain the URL-safe characters + # - and _; + # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: + # + # Base64.urlsafe_encode64("\xFB\xEF\xBE") # => "----" + # Base64.urlsafe_encode64("\xFF\xFF\xFF") # => "____" + # + # By default, the returned string may have padding; + # see {Padding}[Base64.html#module-Base64-label-Padding], above: + # + # Base64.urlsafe_encode64('*') # => "Kg==" + # + # Optionally, you can suppress padding: + # + # Base64.urlsafe_encode64('*', padding: false) # => "Kg" + # + # The returned string will have no newline characters, regardless of its length; + # see {Newlines}[Base64.html#module-Base64-label-Newlines] above: + # + # Base64.urlsafe_encode64('*') # => "Kg==" + # Base64.urlsafe_encode64('*' * 46) + # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg==" + # + # pkg:gem/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 +encoded_string+: + # + # s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" + # Base64.decode64(s) # => "This is line 1\nThis is line 2\n" + # + # 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 - and /: + # + # Base64.decode64("\x00\n-_") # => "" + # + # Padding in +encoded_string+ (even if incorrect) is ignored: + # + # Base64.decode64("MDEyMzQ1Njc") # => "01234567" + # Base64.decode64("MDEyMzQ1Njc=") # => "01234567" + # Base64.decode64("MDEyMzQ1Njc==") # => "01234567" + # + # pkg:gem/base64#lib/base64.rb:247 + def decode64(str); end + + # :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 + # + or /; + # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: + # + # Base64.encode64("\xFB\xEF\xBE") # => "++++\n" + # Base64.encode64("\xFF\xFF\xFF") # => "////\n" + # + # The returned string may include padding; + # see {Padding}[Base64.html#module-Base64-label-Padding] above. + # + # Base64.encode64('*') # => "Kg==\n" + # + # The returned string ends with a newline character, and if sufficiently long + # will have one or more embedded newline characters; + # see {Newlines}[Base64.html#module-Base64-label-Newlines] above: + # + # Base64.encode64('*') # => "Kg==\n" + # Base64.encode64('*' * 46) + # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq\nKg==\n" + # + # The string to be encoded may itself contain newlines, + # which will be encoded as ordinary \Base64: + # + # Base64.encode64("\n\n\n") # => "CgoK\n" + # s = "This is line 1\nThis is line 2\n" + # Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" + # + # pkg:gem/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 +encoded_string+: + # + # s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK" + # Base64.strict_decode64(s) # => "This is line 1\nThis is line 2\n" + # + # 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 - and /: + # + # Base64.strict_decode64("\n") # Raises ArgumentError + # Base64.strict_decode64('-') # Raises ArgumentError + # Base64.strict_decode64('_') # Raises ArgumentError + # + # 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 + # + # pkg:gem/base64#lib/base64.rb:309 + def strict_decode64(str); end + + # :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 + # + or /; + # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: + # + # Base64.strict_encode64("\xFB\xEF\xBE") # => "++++\n" + # Base64.strict_encode64("\xFF\xFF\xFF") # => "////\n" + # + # The returned string may include padding; + # see {Padding}[Base64.html#module-Base64-label-Padding] above. + # + # Base64.strict_encode64('*') # => "Kg==\n" + # + # The returned string will have no newline characters, regardless of its length; + # see {Newlines}[Base64.html#module-Base64-label-Newlines] above: + # + # Base64.strict_encode64('*') # => "Kg==" + # Base64.strict_encode64('*' * 46) + # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg==" + # + # The string to be encoded may itself contain newlines, + # which will be encoded as ordinary \Base64: + # + # Base64.strict_encode64("\n\n\n") # => "CgoK" + # s = "This is line 1\nThis is line 2\n" + # Base64.strict_encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK" + # + # pkg:gem/base64#lib/base64.rb:282 + def strict_encode64(bin); end + + # :call-seq: + # Base64.urlsafe_decode64(encoded_string) -> decoded_string + # + # 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 +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. + # + # pkg:gem/base64#lib/base64.rb:369 + def urlsafe_decode64(str); end + + # :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 + # + or /, + # but instead may contain the URL-safe characters + # - and _; + # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: + # + # Base64.urlsafe_encode64("\xFB\xEF\xBE") # => "----" + # Base64.urlsafe_encode64("\xFF\xFF\xFF") # => "____" + # + # By default, the returned string may have padding; + # see {Padding}[Base64.html#module-Base64-label-Padding], above: + # + # Base64.urlsafe_encode64('*') # => "Kg==" + # + # Optionally, you can suppress padding: + # + # Base64.urlsafe_encode64('*', padding: false) # => "Kg" + # + # The returned string will have no newline characters, regardless of its length; + # see {Newlines}[Base64.html#module-Base64-label-Newlines] above: + # + # Base64.urlsafe_encode64('*') # => "Kg==" + # Base64.urlsafe_encode64('*' * 46) + # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg==" + # + # pkg:gem/base64#lib/base64.rb:343 + def urlsafe_encode64(bin, padding: T.unsafe(nil)); end + end +end + +# pkg:gem/base64#lib/base64.rb:186 +Base64::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/benchmark@0.5.0.rbi b/sorbet/rbi/gems/benchmark@0.5.0.rbi new file mode 100644 index 000000000..26ac079ab --- /dev/null +++ b/sorbet/rbi/gems/benchmark@0.5.0.rbi @@ -0,0 +1,495 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `benchmark` gem. +# Please instead update this file by running `bin/tapioca gem benchmark`. + + +# The Benchmark module provides methods to measure and report the time +# used to execute Ruby code. +# +# * Measure the time to construct the string given by the expression +# "a"*1_000_000_000: +# +# require 'benchmark' +# +# puts Benchmark.measure { "a"*1_000_000_000 } +# +# On my machine (OSX 10.8.3 on i5 1.7 GHz) this generates: +# +# 0.350000 0.400000 0.750000 ( 0.835234) +# +# 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: +# +# require 'benchmark' +# +# n = 5000000 +# Benchmark.bm do |x| +# x.report { for i in 1..n; a = "1"; end } +# x.report { n.times do ; a = "1"; end } +# x.report { 1.upto(n) do ; a = "1"; end } +# end +# +# The result: +# +# user system total real +# 1.010000 0.000000 1.010000 ( 1.014479) +# 1.000000 0.000000 1.000000 ( 0.998261) +# 0.980000 0.000000 0.980000 ( 0.981335) +# +# * Continuing the previous example, put a label in each report: +# +# require 'benchmark' +# +# n = 5000000 +# Benchmark.bm(7) do |x| +# x.report("for:") { for i in 1..n; a = "1"; end } +# x.report("times:") { n.times do ; a = "1"; end } +# x.report("upto:") { 1.upto(n) do ; a = "1"; end } +# end +# +# The result: +# +# user system total real +# for: 1.010000 0.000000 1.010000 ( 1.015688) +# times: 1.000000 0.000000 1.000000 ( 1.003611) +# upto: 1.030000 0.000000 1.030000 ( 1.028098) +# +# * The times for some benchmarks depend on the order in which items +# are run. These differences are due to the cost of memory +# allocation and garbage collection. To avoid these discrepancies, +# the #bmbm method is provided. For example, to compare ways to +# sort an array of floats: +# +# require 'benchmark' +# +# array = (1..1000000).map { rand } +# +# Benchmark.bmbm do |x| +# x.report("sort!") { array.dup.sort! } +# x.report("sort") { array.dup.sort } +# end +# +# The result: +# +# Rehearsal ----------------------------------------- +# sort! 1.490000 0.010000 1.500000 ( 1.490520) +# sort 1.460000 0.000000 1.460000 ( 1.463025) +# -------------------------------- total: 2.960000sec +# +# user system total real +# sort! 1.460000 0.000000 1.460000 ( 1.460465) +# sort 1.450000 0.010000 1.460000 ( 1.448327) +# +# * Report statistics of sequential experiments with unique labels, +# using the #benchmark method: +# +# require 'benchmark' +# include Benchmark # we need the CAPTION and FORMAT constants +# +# n = 5000000 +# Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| +# tf = x.report("for:") { for i in 1..n; a = "1"; end } +# tt = x.report("times:") { n.times do ; a = "1"; end } +# tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } +# [tf+tt+tu, (tf+tt+tu)/3] +# end +# +# The result: +# +# user system total real +# for: 0.950000 0.000000 0.950000 ( 0.952039) +# times: 0.980000 0.000000 0.980000 ( 0.984938) +# upto: 0.950000 0.000000 0.950000 ( 0.946787) +# >total: 2.880000 0.000000 2.880000 ( 2.883764) +# >avg: 0.960000 0.000000 0.960000 ( 0.961255) +# +# pkg:gem/benchmark#lib/benchmark.rb:123 +module Benchmark + private + + # Invokes the block with a Benchmark::Report object, which + # may be used to collect and report on the results of individual + # benchmark tests. Reserves +label_width+ leading spaces for + # labels on each line. Prints +caption+ at the top of the + # report, and uses +format+ to format each line. + # (Note: +caption+ must contain a terminating newline character, + # see the default Benchmark::Tms::CAPTION for an example.) + # + # Returns an array of Benchmark::Tms objects. + # + # If the block returns an array of + # Benchmark::Tms objects, these will be used to format + # additional lines of output. If +labels+ parameter are + # given, these are used to label these extra lines. + # + # _Note_: Other methods provide a simpler interface to this one, and are + # suitable for nearly all benchmarking requirements. See the examples in + # Benchmark, and the #bm and #bmbm methods. + # + # Example: + # + # require 'benchmark' + # include Benchmark # we need the CAPTION and FORMAT constants + # + # n = 5000000 + # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| + # tf = x.report("for:") { for i in 1..n; a = "1"; end } + # tt = x.report("times:") { n.times do ; a = "1"; end } + # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # [tf+tt+tu, (tf+tt+tu)/3] + # end + # + # Generates: + # + # user system total real + # for: 0.970000 0.000000 0.970000 ( 0.970493) + # times: 0.990000 0.000000 0.990000 ( 0.989542) + # upto: 0.970000 0.000000 0.970000 ( 0.972854) + # >total: 2.930000 0.000000 2.930000 ( 2.932889) + # >avg: 0.976667 0.000000 0.976667 ( 0.977630) + # + # pkg:gem/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 + # reports with labels. +label_width+ and +labels+ parameters have the same + # meaning as for #benchmark. + # + # require 'benchmark' + # + # n = 5000000 + # Benchmark.bm(7) do |x| + # x.report("for:") { for i in 1..n; a = "1"; end } + # x.report("times:") { n.times do ; a = "1"; end } + # x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # end + # + # Generates: + # + # user system total real + # for: 0.960000 0.000000 0.960000 ( 0.957966) + # times: 0.960000 0.000000 0.960000 ( 0.960423) + # upto: 0.950000 0.000000 0.950000 ( 0.954864) + # + # pkg:gem/benchmark#lib/benchmark.rb:216 + def bm(label_width = T.unsafe(nil), *labels, &blk); end + + # Sometimes benchmark results are skewed because code executed + # earlier encounters different garbage collection overheads than + # that run later. #bmbm attempts to minimize this effect by running + # the tests twice, the first time as a rehearsal in order to get the + # runtime environment stable, the second time for + # real. GC.start is executed before the start of each of + # the real timings; the cost of this is not included in the + # timings. In reality, though, there's only so much that #bmbm can + # do, and the results are not guaranteed to be isolated from garbage + # collection and other effects. + # + # Because #bmbm takes two passes through the tests, it can + # calculate the required label width. + # + # require 'benchmark' + # + # array = (1..1000000).map { rand } + # + # Benchmark.bmbm do |x| + # x.report("sort!") { array.dup.sort! } + # x.report("sort") { array.dup.sort } + # end + # + # Generates: + # + # Rehearsal ----------------------------------------- + # sort! 1.440000 0.010000 1.450000 ( 1.446833) + # sort 1.440000 0.000000 1.440000 ( 1.448257) + # -------------------------------- total: 2.890000sec + # + # user system total real + # sort! 1.460000 0.000000 1.460000 ( 1.458065) + # sort 1.450000 0.000000 1.450000 ( 1.455963) + # + # #bmbm yields a Benchmark::Job object and returns an array of + # Benchmark::Tms objects. + # + # pkg:gem/benchmark#lib/benchmark.rb:258 + def bmbm(width = T.unsafe(nil)); end + + # Returns the time used to execute the given block as a + # Benchmark::Tms object. Takes +label+ option. + # + # require 'benchmark' + # + # n = 1000000 + # + # time = Benchmark.measure do + # n.times { a = "1" } + # end + # puts time + # + # Generates: + # + # 0.220000 0.000000 0.220000 ( 0.227313) + # + # pkg:gem/benchmark#lib/benchmark.rb:303 + def measure(label = T.unsafe(nil)); end + + # Returns the elapsed real time used to execute the given block. + # The unit of time is milliseconds. + # + # Benchmark.ms { "a" * 1_000_000_000 } + # #=> 509.8029999935534 + # + # pkg:gem/benchmark#lib/benchmark.rb:335 + def ms; end + + # Returns the elapsed real time used to execute the given block. + # The unit of time is seconds. + # + # Benchmark.realtime { "a" * 1_000_000_000 } + # #=> 0.5098029999935534 + # + # pkg:gem/benchmark#lib/benchmark.rb:322 + def realtime; end + + class << self + # pkg:gem/benchmark#lib/benchmark.rb:341 + def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end + + # pkg:gem/benchmark#lib/benchmark.rb:341 + def bm(label_width = T.unsafe(nil), *labels, &blk); end + + # pkg:gem/benchmark#lib/benchmark.rb:341 + def bmbm(width = T.unsafe(nil)); end + + # pkg:gem/benchmark#lib/benchmark.rb:341 + def measure(label = T.unsafe(nil)); end + + # pkg:gem/benchmark#lib/benchmark.rb:341 + def ms; end + + # pkg:gem/benchmark#lib/benchmark.rb:341 + def realtime; end + end +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. +# +# pkg:gem/benchmark#lib/benchmark.rb:347 +class Benchmark::Job + # Returns an initialized Job instance. + # Usually, one doesn't call this method directly, as new + # Job objects are created by the #bmbm method. + # +width+ is a initial value for the label offset used in formatting; + # the #bmbm method passes its +width+ argument to this constructor. + # + # pkg:gem/benchmark#lib/benchmark.rb:355 + def initialize(width); end + + # Registers the given label and block pair in the job list. + # + # pkg:gem/benchmark#lib/benchmark.rb:363 + def item(label = T.unsafe(nil), &blk); end + + # An array of 2-element arrays, consisting of label and block pairs. + # + # pkg:gem/benchmark#lib/benchmark.rb:375 + def list; end + + # pkg:gem/benchmark#lib/benchmark.rb:372 + def report(label = T.unsafe(nil), &blk); end + + # Length of the widest label in the #list. + # + # pkg:gem/benchmark#lib/benchmark.rb:378 + 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. +# +# pkg:gem/benchmark#lib/benchmark.rb:385 +class Benchmark::Report + # Returns an initialized Report instance. + # Usually, one doesn't call this method directly, as new + # Report objects are created by the #benchmark and #bm methods. + # +width+ and +format+ are the label offset and + # format string used by Tms#format. + # + # pkg:gem/benchmark#lib/benchmark.rb:393 + def initialize(width = T.unsafe(nil), format = T.unsafe(nil)); end + + # An array of Benchmark::Tms objects representing each item. + # + # pkg:gem/benchmark#lib/benchmark.rb:412 + def format; end + + # Prints the +label+ and measured time for the block, + # formatted by +format+. See Tms#format for the + # formatting rules. + # + # pkg:gem/benchmark#lib/benchmark.rb:402 + def item(label = T.unsafe(nil), *format, &blk); end + + # An array of Benchmark::Tms objects representing each item. + # + # pkg:gem/benchmark#lib/benchmark.rb:412 + def list; end + + # pkg:gem/benchmark#lib/benchmark.rb:409 + def report(label = T.unsafe(nil), *format, &blk); end + + # An array of Benchmark::Tms objects representing each item. + # + # pkg:gem/benchmark#lib/benchmark.rb:412 + def width; end +end + +# A data object, representing the times associated with a benchmark +# measurement. +# +# pkg:gem/benchmark#lib/benchmark.rb:421 +class Benchmark::Tms + # Returns an initialized Tms object which has + # +utime+ as the user CPU time, +stime+ as the system CPU time, + # +cutime+ as the children's user CPU time, +cstime+ as the children's + # system CPU time, +real+ as the elapsed real time and +label+ as the label. + # + # pkg:gem/benchmark#lib/benchmark.rb:456 + 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+. + # + # pkg:gem/benchmark#lib/benchmark.rb:504 + def *(x); end + + # Returns a new Tms object obtained by memberwise summation + # of the individual times for this Tms object with those of the +other+ + # Tms object. + # This method and #/() are useful for taking statistics. + # + # pkg:gem/benchmark#lib/benchmark.rb:491 + 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. + # + # pkg:gem/benchmark#lib/benchmark.rb:498 + 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. + # + # pkg:gem/benchmark#lib/benchmark.rb:511 + 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+). + # + # pkg:gem/benchmark#lib/benchmark.rb:465 + def add(&blk); end + + # An in-place version of #add. + # Changes the times of this Tms object by making it the sum of the times + # for this Tms object, plus the time required to execute + # the code block (+blk+). + # + # pkg:gem/benchmark#lib/benchmark.rb:475 + def add!(&blk); end + + # System CPU time of children + # + # pkg:gem/benchmark#lib/benchmark.rb:439 + def cstime; end + + # User CPU time of children + # + # pkg:gem/benchmark#lib/benchmark.rb:436 + def cutime; end + + # Returns the contents of this Tms object as + # a formatted string, according to a +format+ string + # like that passed to Kernel.format. In addition, #format + # accepts the following extensions: + # + # %u:: Replaced by the user CPU time, as reported by Tms#utime. + # %y:: Replaced by the system CPU time, as reported by Tms#stime (Mnemonic: y of "s*y*stem") + # %U:: Replaced by the children's user CPU time, as reported by Tms#cutime + # %Y:: Replaced by the children's system CPU time, as reported by Tms#cstime + # %t:: Replaced by the total CPU time, as reported by Tms#total + # %r:: Replaced by the elapsed real time, as reported by Tms#real + # %n:: 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, total and real elapsed time. + # + # pkg:gem/benchmark#lib/benchmark.rb:530 + def format(format = T.unsafe(nil), *args); end + + # Label + # + # pkg:gem/benchmark#lib/benchmark.rb:448 + def label; end + + # Elapsed real time + # + # pkg:gem/benchmark#lib/benchmark.rb:442 + def real; end + + # System CPU time + # + # pkg:gem/benchmark#lib/benchmark.rb:433 + def stime; end + + # Returns a new 6-element array, consisting of the + # label, user CPU time, system CPU time, children's + # user CPU time, children's system CPU time and elapsed + # real time. + # + # pkg:gem/benchmark#lib/benchmark.rb:555 + def to_a; end + + # Returns a hash containing the same data as `to_a`. + # + # pkg:gem/benchmark#lib/benchmark.rb:562 + def to_h; end + + # Same as #format. + # + # pkg:gem/benchmark#lib/benchmark.rb:545 + def to_s; end + + # Total time, that is +utime+ + +stime+ + +cutime+ + +cstime+ + # + # pkg:gem/benchmark#lib/benchmark.rb:445 + def total; end + + # User CPU time + # + # pkg:gem/benchmark#lib/benchmark.rb:430 + def utime; end + + protected + + # Returns a new Tms object obtained by memberwise operation +op+ + # of the individual times for this Tms object with those of the other + # Tms object (+x+). + # + # +op+ can be a mathematical operation such as +, -, + # *, / + # + # pkg:gem/benchmark#lib/benchmark.rb:583 + def memberwise(op, x); end +end + +# pkg:gem/benchmark#lib/benchmark.rb:125 +Benchmark::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/bigdecimal@4.1.3.rbi b/sorbet/rbi/gems/bigdecimal@4.1.3.rbi new file mode 100644 index 000000000..f4111c55a --- /dev/null +++ b/sorbet/rbi/gems/bigdecimal@4.1.3.rbi @@ -0,0 +1,478 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `bigdecimal` gem. +# Please instead update this file by running `bin/tapioca gem bigdecimal`. + + +# pkg:gem/bigdecimal#lib/bigdecimal.rb:10 +class BigDecimal < ::Numeric + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def %(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def *(_arg0); end + + # call-seq: + # self ** other -> bigdecimal + # + # Returns the \BigDecimal value of +self+ raised to power +other+: + # + # b = BigDecimal('3.14') + # b ** 2 # => 0.98596e1 + # b ** 2.0 # => 0.98596e1 + # b ** Rational(2, 1) # => 0.98596e1 + # + # Related: BigDecimal#power. + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:127 + def **(y); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def +(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def +@; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def -(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def -@; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def /(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def <(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def <=(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def <=>(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def ==(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def ===(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def >(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def >=(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def _decimal_shift(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def _dump(*_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def abs; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def add(_arg0, _arg1); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def ceil(*_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def clone; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def coerce(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def div(*_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def divmod(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def dup; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def eql?(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def exponent; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def finite?; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def fix; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def floor(*_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def frac; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def hash; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def infinite?; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def inspect; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def modulo(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def mult(_arg0, _arg1); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def n_significant_digits; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def nan?; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def nonzero?; end + + # call-seq: + # power(n) + # power(n, prec) + # + # Returns the value raised to the power of n. + # + # Also available as the operator **. + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:147 + def power(y, prec = T.unsafe(nil)); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def precision; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def precision_scale; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def quo(*_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def remainder(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def round(*_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def scale; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def sign; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def split; end + + # Returns the square root of the value. + # + # Result has at least prec significant digits. + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:262 + def sqrt(prec); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def sub(_arg0, _arg1); end + + # call-seq: + # a.to_d -> bigdecimal + # + # Returns self. + # + # require 'bigdecimal/util' + # + # d = BigDecimal("3.14") + # d.to_d # => 0.314e1 + # + # pkg:gem/bigdecimal#lib/bigdecimal/util.rb:110 + def to_d; end + + # call-seq: + # a.to_digits -> string + # + # Converts a BigDecimal to a String of the form "nnnnnn.mmm". + # This method is deprecated; use BigDecimal#to_s("F") instead. + # + # require 'bigdecimal/util' + # + # d = BigDecimal("3.14") + # d.to_digits # => "3.14" + # + # pkg:gem/bigdecimal#lib/bigdecimal/util.rb:90 + def to_digits; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def to_f; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def to_i; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def to_int; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def to_r; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def to_s(format = T.unsafe(nil)); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def truncate(*_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def zero?; end + + class << self + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def _load(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def double_fig; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def interpret_loosely(_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def limit(*_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def mode(*_arg0); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def save_exception_mode; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def save_limit; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:10 + def save_rounding_mode; end + end +end + +# pkg:gem/bigdecimal#lib/bigdecimal.rb:14 +module BigDecimal::Internal + class << self + # Coerce x to BigDecimal with the specified precision. + # TODO: some methods (example: BigMath.exp) require more precision than specified to coerce. + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:21 + def coerce_to_bigdecimal(x, prec, method_name); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:33 + def coerce_validate_prec(prec, method_name, accept_zero: T.unsafe(nil)); end + + # Calculates Math.log(x.to_f) considering large or small exponent + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:87 + def float_log(x); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:53 + def infinity_computation_result; end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:67 + def nan_computation_result; end + + # Iteration for Newton's method with increasing precision + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:75 + def newton_loop(prec, initial_precision: T.unsafe(nil), safe_margin: T.unsafe(nil)); end + + # Calculating Taylor series sum using binary splitting method + # Calculates f(x) = (x/d0)*(1+(x/d1)*(1+(x/d2)*(1+(x/d3)*(1+...)))) + # x.n_significant_digits or ds.size must be small to be performant. + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:94 + def taylor_sum_binary_splitting(x, ds, prec); end + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:60 + def underflow_computation_result; end + end +end + +# Default extra precision for intermediate calculations +# This value is currently the same as BigDecimal.double_fig, but defined separately for future changes. +# +# pkg:gem/bigdecimal#lib/bigdecimal.rb:17 +BigDecimal::Internal::EXTRA_PREC = T.let(T.unsafe(nil), Integer) + +BigDecimal::VERSION = T.let(T.unsafe(nil), String) + +# Core BigMath methods for BigDecimal (log, exp) are defined here. +# Other methods (sin, cos, atan) are defined in 'bigdecimal/math.rb'. +# +# -- +# Contents: +# sqrt(x, prec) +# cbrt(x, prec) +# hypot(x, y, prec) +# sin (x, prec) +# cos (x, prec) +# tan (x, prec) +# asin(x, prec) +# acos(x, prec) +# atan(x, prec) +# atan2(y, x, prec) +# sinh (x, prec) +# cosh (x, prec) +# tanh (x, prec) +# asinh(x, prec) +# acosh(x, prec) +# atanh(x, prec) +# log2 (x, prec) +# log10(x, prec) +# log1p(x, prec) +# expm1(x, prec) +# erf (x, prec) +# erfc(x, prec) +# gamma(x, prec) +# lgamma(x, prec) +# frexp(x) +# ldexp(x, exponent) +# PI (prec) +# E (prec) == exp(1.0,prec) +# +# where: +# x, y ... BigDecimal number to be computed. +# prec ... Number of digits to be obtained. +# ++ +# +# Provides mathematical functions. +# +# Example: +# +# require "bigdecimal/math" +# +# include BigMath +# +# a = BigDecimal((PI(49)/2).to_s) +# puts sin(a,100) # => 0.9999999999...9999999986e0 +# +# pkg:gem/bigdecimal#lib/bigdecimal.rb:288 +module BigMath + private + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:336 + def _exp_binary_splitting(x, prec); end + + # call-seq: + # BigMath.exp(decimal, numeric) -> BigDecimal + # + # Computes the value of e (the base of natural logarithms) raised to the + # power of +decimal+, to the specified number of digits of precision. + # + # If +decimal+ is infinity, returns Infinity. + # + # If +decimal+ is NaN, returns NaN. + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:356 + def exp(x, prec); end + + # call-seq: + # BigMath.log(decimal, numeric) -> BigDecimal + # + # Computes the natural logarithm of +decimal+ to the specified number of + # digits of precision, +numeric+. + # + # If +decimal+ is zero or negative, raises Math::DomainError. + # + # If +decimal+ is positive infinity, returns Infinity. + # + # If +decimal+ is NaN, returns NaN. + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:303 + def log(x, prec); end + + class << self + # call-seq: + # BigMath.exp(decimal, numeric) -> BigDecimal + # + # Computes the value of e (the base of natural logarithms) raised to the + # power of +decimal+, to the specified number of digits of precision. + # + # If +decimal+ is infinity, returns Infinity. + # + # If +decimal+ is NaN, returns NaN. + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:356 + def exp(x, prec); end + + # call-seq: + # BigMath.log(decimal, numeric) -> BigDecimal + # + # Computes the natural logarithm of +decimal+ to the specified number of + # digits of precision, +numeric+. + # + # If +decimal+ is zero or negative, raises Math::DomainError. + # + # If +decimal+ is positive infinity, returns Infinity. + # + # If +decimal+ is NaN, returns NaN. + # + # pkg:gem/bigdecimal#lib/bigdecimal.rb:303 + def log(x, prec); end + + private + + # pkg:gem/bigdecimal#lib/bigdecimal.rb:336 + def _exp_binary_splitting(x, prec); end + end +end + +# pkg:gem/bigdecimal#lib/bigdecimal/util.rb:141 +class Complex < ::Numeric + # call-seq: + # cmp.to_d -> bigdecimal + # cmp.to_d(precision) -> bigdecimal + # + # Returns the value as a BigDecimal. + # If the imaginary part is not +0+, an error is raised + # + # The +precision+ parameter is used to determine the number of + # significant digits for the result. When +precision+ is set to +0+, + # the number of digits to represent the float being converted is determined + # automatically. + # The default +precision+ is +0+. + # + # require 'bigdecimal' + # require 'bigdecimal/util' + # + # Complex(0.1234567, 0).to_d(4) # => 0.1235e0 + # Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1 + # Complex(1, 1).to_d # raises ArgumentError + # + # See also Kernel.BigDecimal. + # + # pkg:gem/bigdecimal#lib/bigdecimal/util.rb:164 + def to_d(precision = T.unsafe(nil)); end +end + +# pkg:gem/bigdecimal#lib/bigdecimal/util.rb:116 +class Rational < ::Numeric + # call-seq: + # rat.to_d(precision) -> bigdecimal + # + # Returns the value as a BigDecimal. + # + # The +precision+ parameter is used to determine the number of + # significant digits for the result. When +precision+ is set to +0+, + # the number of digits to represent the float being converted is determined + # automatically. + # The default +precision+ is +0+. + # + # require 'bigdecimal' + # require 'bigdecimal/util' + # + # Rational(22, 7).to_d(3) # => 0.314e1 + # + # See also Kernel.BigDecimal. + # + # pkg:gem/bigdecimal#lib/bigdecimal/util.rb:135 + def to_d(precision = T.unsafe(nil)); end +end diff --git a/sorbet/rbi/gems/bootstrap@4.6.2.1.rbi b/sorbet/rbi/gems/bootstrap@4.6.2.1.rbi new file mode 100644 index 000000000..5aa6d20cc --- /dev/null +++ b/sorbet/rbi/gems/bootstrap@4.6.2.1.rbi @@ -0,0 +1,64 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `bootstrap` gem. +# Please instead update this file by running `bin/tapioca gem bootstrap`. + + +# pkg:gem/bootstrap#lib/bootstrap/version.rb:3 +module Bootstrap + class << self + # pkg:gem/bootstrap#lib/bootstrap.rb:41 + def assets_path; end + + # Paths + # + # pkg:gem/bootstrap#lib/bootstrap.rb:29 + def gem_path; end + + # pkg:gem/bootstrap#lib/bootstrap.rb:54 + def hanami?; end + + # pkg:gem/bootstrap#lib/bootstrap.rb:37 + def javascripts_path; end + + # Inspired by Kaminari + # + # pkg:gem/bootstrap#lib/bootstrap.rb:9 + def load!; end + + # pkg:gem/bootstrap#lib/bootstrap.rb:50 + def rails?; end + + # Environment detection helpers + # + # pkg:gem/bootstrap#lib/bootstrap.rb:46 + def sprockets?; end + + # pkg:gem/bootstrap#lib/bootstrap.rb:33 + def stylesheets_path; end + + private + + # pkg:gem/bootstrap#lib/bootstrap.rb:69 + def register_hanami; end + + # pkg:gem/bootstrap#lib/bootstrap.rb:60 + def register_rails_engine; end + + # pkg:gem/bootstrap#lib/bootstrap.rb:64 + def register_sprockets; end + end +end + +# pkg:gem/bootstrap#lib/bootstrap/version.rb:5 +Bootstrap::BOOTSTRAP_SHA = T.let(T.unsafe(nil), String) + +# pkg:gem/bootstrap#lib/bootstrap/engine.rb:23 +module Bootstrap::Rails; end + +# pkg:gem/bootstrap#lib/bootstrap/engine.rb:24 +class Bootstrap::Rails::Engine < ::Rails::Engine; end + +# pkg:gem/bootstrap#lib/bootstrap/version.rb:4 +Bootstrap::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/brakeman@8.1.0.rbi b/sorbet/rbi/gems/brakeman@8.1.0.rbi new file mode 100644 index 000000000..31130b9b4 --- /dev/null +++ b/sorbet/rbi/gems/brakeman@8.1.0.rbi @@ -0,0 +1,410 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `brakeman` gem. +# Please instead update this file by running `bin/tapioca gem brakeman`. + + +# pkg:gem/brakeman#lib/brakeman/logger.rb:1 +module Brakeman + class << self + # pkg:gem/brakeman#lib/brakeman.rb:644 + def add_external_checks(options); end + + # pkg:gem/brakeman#lib/brakeman.rb:544 + def alert(message); end + + # pkg:gem/brakeman#lib/brakeman.rb:540 + def announce(message); end + + # pkg:gem/brakeman#lib/brakeman.rb:650 + def check_for_missing_checks(included_checks, excluded_checks, enabled_checks); end + + # pkg:gem/brakeman#lib/brakeman.rb:122 + def cleanup(newline = T.unsafe(nil)); end + + # Compare JSON output from a previous scan and return the diff of the two scans + # + # pkg:gem/brakeman#lib/brakeman.rb:553 + def compare(options); end + + # pkg:gem/brakeman#lib/brakeman.rb:218 + def config_file(custom_location, app_path); end + + # pkg:gem/brakeman#lib/brakeman.rb:548 + def debug(message); end + + # pkg:gem/brakeman#lib/brakeman.rb:660 + def debug=(val); end + + # Default set of options + # + # pkg:gem/brakeman#lib/brakeman.rb:225 + def default_options; end + + # Output configuration to YAML + # + # pkg:gem/brakeman#lib/brakeman.rb:384 + def dump_config(options); end + + # Returns quit message unless the latest version + # of Brakeman matches the current version. + # + # Optionally checks that the latest version is at least + # the specified number of days old. + # + # pkg:gem/brakeman#lib/brakeman.rb:422 + def ensure_latest(days_old: T.unsafe(nil)); end + + # pkg:gem/brakeman#lib/brakeman.rb:614 + def filter_warnings(tracker, options); end + + # Determine output formats based on options[:output_formats] + # or options[:output_files] + # + # pkg:gem/brakeman#lib/brakeman.rb:256 + def get_output_formats(options); end + + # Returns an array of alert fingerprints for any ignored warnings without + # notes found in the specified ignore file (if it exists). + # + # pkg:gem/brakeman#lib/brakeman.rb:604 + def ignore_file_entries_with_empty_notes(file); end + + # Output list of checks (for `-k` option) + # + # pkg:gem/brakeman#lib/brakeman.rb:362 + def list_checks(options); end + + # pkg:gem/brakeman#lib/brakeman.rb:576 + def load_brakeman_dependency(name, allow_fail = T.unsafe(nil)); end + + # Load options from YAML file + # + # pkg:gem/brakeman#lib/brakeman.rb:168 + def load_options(line_options); end + + # pkg:gem/brakeman#lib/brakeman.rb:110 + def logger; end + + # pkg:gem/brakeman#lib/brakeman.rb:114 + def logger=(log); end + + # pkg:gem/brakeman#lib/brakeman.rb:668 + def process_step(description, &); end + + # pkg:gem/brakeman#lib/brakeman.rb:664 + def quiet=(val); end + + # Rescan a subset of files in a Rails application. + # + # A full scan must have been run already to use this method. + # The returned Tracker object from Brakeman.run is used as a starting point + # for the rescan. + # + # Options may be given as a hash with the same values as Brakeman.run. + # Note that these options will be merged into the Tracker. + # + # This method returns a RescanReport object with information about the scan. + # However, the Tracker object will also be modified as the scan is run. + # + # pkg:gem/brakeman#lib/brakeman.rb:529 + def rescan(tracker, files, options = T.unsafe(nil)); end + + # Run Brakeman scan. Returns Tracker object. + # + # Options: + # + # * :app_path - path to root of Rails app (required) + # * :additional_checks_path - array of additional directories containing additional out-of-tree checks to run + # * :additional_libs_path - array of additional application relative lib directories (ex. app/mailers) to process + # * :assume_all_routes - assume all methods are routes (default: true) + # * :check_arguments - check arguments of methods (default: true) + # * :collapse_mass_assignment - report unprotected models in single warning (default: false) + # * :combine_locations - combine warning locations (default: true) + # * :config_file - configuration file + # * :escape_html - escape HTML by default (automatic) + # * :exit_on_error - only affects Commandline module (default: true) + # * :exit_on_warn - only affects Commandline module (default: true) + # * :github_repo - github repo to use for file links (user/repo[/path][@ref]) + # * :highlight_user_input - highlight user input in reported warnings (default: true) + # * :html_style - path to CSS file + # * :ignore_model_output - consider models safe (default: false) + # * :interprocedural - limited interprocedural processing of method calls (default: false) + # * :message_limit - limit length of messages + # * :min_confidence - minimum confidence (0-2, 0 is highest) + # * :output_files - files for output + # * :output_formats - formats for output (:to_s, :to_tabs, :to_csv, :to_html) + # * :parallel_checks - run checks in parallel (default: true) + # * :parser_timeout - set timeout for parsing an individual file (default: 10 seconds) + # * :print_report - if no output file specified, print to stdout (default: false) + # * :quiet - suppress most messages (default: true) + # * :rails3 - force Rails 3 mode (automatic) + # * :rails4 - force Rails 4 mode (automatic) + # * :rails5 - force Rails 5 mode (automatic) + # * :rails6 - force Rails 6 mode (automatic) + # * :report_routes - show found routes on controllers (default: false) + # * :run_checks - array of checks to run (run all if not specified) + # * :safe_methods - array of methods to consider safe + # * :show_ignored - Display warnings that are usually ignored + # * :sql_safe_methods - array of sql sanitization methods to consider safe + # * :skip_vendor - do not process vendor/ directory (default: true) + # * :skip_checks - checks not to run (run all if not specified) + # * :absolute_paths - show absolute path of each file (default: false) + # * :summary_only - only output summary section of report for plain/table (:summary_only, :no_summary, true) + # + # Alternatively, just supply a path as a string. + # + # pkg:gem/brakeman#lib/brakeman.rb:81 + def run(options); end + + # Run a scan. Generally called from Brakeman.run instead of directly. + # + # pkg:gem/brakeman#lib/brakeman.rb:442 + def scan(options); end + + # pkg:gem/brakeman#lib/brakeman.rb:118 + def set_default_logger(options = T.unsafe(nil)); end + + # Sets up options for run, checks given application path + # + # pkg:gem/brakeman#lib/brakeman.rb:127 + def set_options(options); end + + private + + # pkg:gem/brakeman#lib/brakeman.rb:309 + def get_formats_from_output_files(output_files); end + + # pkg:gem/brakeman#lib/brakeman.rb:275 + def get_formats_from_output_format(output_format); end + + # pkg:gem/brakeman#lib/brakeman.rb:345 + def get_github_url(options); end + + # pkg:gem/brakeman#lib/brakeman.rb:482 + def write_report_to_files(tracker, output_files); end + + # pkg:gem/brakeman#lib/brakeman.rb:501 + def write_report_to_formats(tracker, output_formats); end + end +end + +# pkg:gem/brakeman#lib/brakeman.rb:206 +Brakeman::CONFIG_FILES = T.let(T.unsafe(nil), Array) + +# pkg:gem/brakeman#lib/brakeman.rb:672 +class Brakeman::DependencyError < ::RuntimeError; end + +# Exit code returned when an ignored warning has no note and +# --ensure-ignore-notes is set +# +# pkg:gem/brakeman#lib/brakeman.rb:26 +Brakeman::Empty_Ignore_Note_Exit_Code = T.let(T.unsafe(nil), Integer) + +# Exit code returned when errors were found and the --exit-on-error +# option is set +# +# pkg:gem/brakeman#lib/brakeman.rb:22 +Brakeman::Errors_Found_Exit_Code = T.let(T.unsafe(nil), Integer) + +# pkg:gem/brakeman#lib/brakeman/logger.rb:2 +module Brakeman::Logger + class << self + # pkg:gem/brakeman#lib/brakeman/logger.rb:3 + def get_logger(options, dest = T.unsafe(nil)); end + end +end + +# pkg:gem/brakeman#lib/brakeman/logger.rb:18 +class Brakeman::Logger::Base + # pkg:gem/brakeman#lib/brakeman/logger.rb:19 + def initialize(options, log_destination = T.unsafe(nil)); end + + # Notify regarding errors - use sparingly + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:38 + def alert(message); end + + # Notify about important information - use sparingly + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:35 + def announce(message); end + + # Called on exit + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:60 + def cleanup(newline = T.unsafe(nil)); end + + # Use ANSI codes to color a string + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:65 + def color(message, *); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:73 + def color?; end + + # Wraps a step in the scanning process + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:44 + def context(description, &); end + + # Output debug information + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:41 + def debug(message); end + + # Output a message to the log. + # If newline is `false`, does not output a newline after message. + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:26 + def log(message, newline: T.unsafe(nil)); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:62 + def show_timing?; end + + # Wraps a substep (e.g. processing one file) + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:49 + def single_context(description, &); end + + # Show a spinner + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:57 + def spin; end + + # Update progress towards a known total + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:54 + def update_progress(current, total, type = T.unsafe(nil)); end + + private + + # pkg:gem/brakeman#lib/brakeman/logger.rb:79 + def load_highline(output_color); end +end + +# pkg:gem/brakeman#lib/brakeman/logger.rb:153 +class Brakeman::Logger::Console < ::Brakeman::Logger::Base + # pkg:gem/brakeman#lib/brakeman/logger.rb:156 + def initialize(options, *); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:181 + def alert(message); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:175 + def announce(message); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:259 + def cleanup(newline = T.unsafe(nil)); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:246 + def clear_line; end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:240 + def clear_prefix; end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:187 + def context(description, &); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:154 + def prefix; end + + # If an alert was written, redo prefix on next line + # + # pkg:gem/brakeman#lib/brakeman/logger.rb:224 + def rewrite_prefix; end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:235 + def set_prefix(message); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:251 + def spin; end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:195 + def time_step(description, &); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:208 + def update_progress(current, total, type = T.unsafe(nil)); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:229 + def write_after(message); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:218 + def write_prefix(pref); end +end + +# pkg:gem/brakeman#lib/brakeman/logger.rb:130 +class Brakeman::Logger::Debug < ::Brakeman::Logger::Plain + # pkg:gem/brakeman#lib/brakeman/logger.rb:135 + def context(description, &); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:131 + def debug(message); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:141 + def single_context(description, &); end +end + +# pkg:gem/brakeman#lib/brakeman/logger.rb:90 +class Brakeman::Logger::Plain < ::Brakeman::Logger::Base + # pkg:gem/brakeman#lib/brakeman/logger.rb:91 + def initialize(options, *); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:101 + def alert(message); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:97 + def announce(message); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:105 + def context(description, &); end + + # pkg:gem/brakeman#lib/brakeman/logger.rb:115 + def time_step(description, &); end +end + +# pkg:gem/brakeman#lib/brakeman/logger.rb:124 +class Brakeman::Logger::Quiet < ::Brakeman::Logger::Base + # pkg:gem/brakeman#lib/brakeman/logger.rb:125 + def initialize(*); end +end + +# pkg:gem/brakeman#lib/brakeman.rb:675 +class Brakeman::MissingChecksError < ::RuntimeError; end + +# Exit code returned when user requests non-existent checks +# +# pkg:gem/brakeman#lib/brakeman.rb:18 +Brakeman::Missing_Checks_Exit_Code = T.let(T.unsafe(nil), Integer) + +# pkg:gem/brakeman#lib/brakeman.rb:674 +class Brakeman::NoApplication < ::RuntimeError; end + +# pkg:gem/brakeman#lib/brakeman.rb:673 +class Brakeman::NoBrakemanError < ::RuntimeError; end + +# Exit code returned when no Rails application is detected +# +# pkg:gem/brakeman#lib/brakeman.rb:12 +Brakeman::No_App_Found_Exit_Code = T.let(T.unsafe(nil), Integer) + +# Exit code returned when brakeman was outdated +# +# pkg:gem/brakeman#lib/brakeman.rb:15 +Brakeman::Not_Latest_Version_Exit_Code = T.let(T.unsafe(nil), Integer) + +# Exit code returned when at least one obsolete ignore entry is present +# and `--ensure-no-obsolete-ignore-entries` is set. +# +# pkg:gem/brakeman#lib/brakeman.rb:30 +Brakeman::Obsolete_Ignore_Entries_Exit_Code = T.let(T.unsafe(nil), Integer) + +# pkg:gem/brakeman#lib/brakeman/version.rb:2 +Brakeman::Version = T.let(T.unsafe(nil), String) + +# This exit code is used when warnings are found and the --exit-on-warn +# option is set +# +# pkg:gem/brakeman#lib/brakeman.rb:9 +Brakeman::Warnings_Found_Exit_Code = T.let(T.unsafe(nil), Integer) diff --git a/sorbet/rbi/gems/builder@3.3.0.rbi b/sorbet/rbi/gems/builder@3.3.0.rbi new file mode 100644 index 000000000..b83a45241 --- /dev/null +++ b/sorbet/rbi/gems/builder@3.3.0.rbi @@ -0,0 +1,493 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `builder` gem. +# Please instead update this file by running `bin/tapioca gem builder`. + + +# If the Builder::XChar module is not currently defined, fail on any +# name clashes in standard library classes. +# +# !/usr/bin/env ruby +# +# pkg:gem/builder#lib/builder/xmlbase.rb:4 +module Builder + class << self + # pkg:gem/builder#lib/builder/xchar.rb:13 + def check_for_name_collision(klass, method_name, defined_constant = T.unsafe(nil)); end + end +end + +# Generic error for builder +# +# pkg:gem/builder#lib/builder/xmlbase.rb:7 +class Builder::IllegalBlockError < ::RuntimeError; end + +# XML Character converter, from Sam Ruby: +# (see http://intertwingly.net/stories/2005/09/28/xchar.rb). +# +# pkg:gem/builder#lib/builder/xchar.rb:33 +module Builder::XChar + class << self + # encode a string per XML rules + # + # pkg:gem/builder#lib/builder/xchar.rb:152 + def encode(string); end + + # convert a string to valid UTF-8, compensating for a number of + # common errors. + # + # pkg:gem/builder#lib/builder/xchar.rb:126 + def unicode(string); end + end +end + +# See +# http://intertwingly.net/stories/2004/04/14/i18n.html#CleaningWindows +# for details. +# +# pkg:gem/builder#lib/builder/xchar.rb:38 +Builder::XChar::CP1252 = T.let(T.unsafe(nil), Hash) + +# pkg:gem/builder#lib/builder/xchar.rb:100 +Builder::XChar::CP1252_DIFFERENCES = T.let(T.unsafe(nil), String) + +# pkg:gem/builder#lib/builder/xchar.rb:120 +Builder::XChar::ENCODING_BINARY = T.let(T.unsafe(nil), Encoding) + +# pkg:gem/builder#lib/builder/xchar.rb:122 +Builder::XChar::ENCODING_ISO1 = T.let(T.unsafe(nil), Encoding) + +# pkg:gem/builder#lib/builder/xchar.rb:121 +Builder::XChar::ENCODING_UTF8 = T.let(T.unsafe(nil), Encoding) + +# pkg:gem/builder#lib/builder/xchar.rb:109 +Builder::XChar::INVALID_XML_CHAR = T.let(T.unsafe(nil), Regexp) + +# See http://www.w3.org/TR/REC-xml/#dt-chardata for details. +# +# pkg:gem/builder#lib/builder/xchar.rb:69 +Builder::XChar::PREDEFINED = T.let(T.unsafe(nil), Hash) + +# http://www.fileformat.info/info/unicode/char/fffd/index.htm +# +# pkg:gem/builder#lib/builder/xchar.rb:84 +Builder::XChar::REPLACEMENT_CHAR = T.let(T.unsafe(nil), String) + +# pkg:gem/builder#lib/builder/xchar.rb:100 +Builder::XChar::UNICODE_EQUIVALENT = T.let(T.unsafe(nil), String) + +# See http://www.w3.org/TR/REC-xml/#charsets for details. +# +# pkg:gem/builder#lib/builder/xchar.rb:76 +Builder::XChar::VALID = T.let(T.unsafe(nil), Array) + +# pkg:gem/builder#lib/builder/xchar.rb:105 +Builder::XChar::XML_PREDEFINED = T.let(T.unsafe(nil), Regexp) + +# XmlBase is a base class for building XML builders. See +# Builder::XmlMarkup and Builder::XmlEvents for examples. +# +# pkg:gem/builder#lib/builder/xmlbase.rb:11 +class Builder::XmlBase < ::BasicObject + # Create an XML markup builder. + # + # out :: Object receiving the markup. +out+ must respond to + # <<. + # indent :: Number of spaces used for indentation (0 implies no + # indentation and no line breaks). + # initial :: Level of initial indentation. + # encoding :: When encoding and $KCODE are set to 'utf-8' + # characters aren't converted to character entities in + # the output stream. + # + # pkg:gem/builder#lib/builder/xmlbase.rb:27 + def initialize(indent = T.unsafe(nil), initial = T.unsafe(nil), encoding = T.unsafe(nil)); end + + # Append text to the output target without escaping any markup. + # May be used within the markup brackets as: + # + # builder.p { |x| x << "
    HI" } #=>


    HI

    + # + # This is useful when using non-builder enabled software that + # generates strings. Just insert the string directly into the + # builder without changing the inserted markup. + # + # It is also useful for stacking builder objects. Builders only + # use << to append to the target, so by supporting this + # method/operation builders can use other builders as their + # targets. + # + # pkg:gem/builder#lib/builder/xmlbase.rb:116 + def <<(text); end + + # pkg:gem/builder#lib/builder/xmlbase.rb:33 + def explicit_nil_handling?; end + + # Create XML markup based on the name of the method. This method + # is never invoked directly, but is called for each markup method + # in the markup block that isn't cached. + # + # pkg:gem/builder#lib/builder/xmlbase.rb:90 + def method_missing(sym, *args, &block); end + + # For some reason, nil? is sent to the XmlMarkup object. If nil? + # is not defined and method_missing is invoked, some strange kind + # of recursion happens. Since nil? won't ever be an XML tag, it + # is pretty safe to define it here. (Note: this is an example of + # cargo cult programming, + # cf. http://fishbowl.pastiche.org/2004/10/13/cargo_cult_programming). + # + # pkg:gem/builder#lib/builder/xmlbase.rb:126 + def nil?; end + + # Create a tag named +sym+. Other than the first argument which + # is the tag name, the arguments are the same as the tags + # implemented via method_missing. + # + # pkg:gem/builder#lib/builder/xmlbase.rb:40 + def tag!(sym, *args, &block); end + + # Append text to the output target. Escape any markup. May be + # used within the markup brackets as: + # + # builder.p { |b| b.br; b.text! "HI" } #=>


    HI

    + # + # pkg:gem/builder#lib/builder/xmlbase.rb:99 + def text!(text); end + + private + + # pkg:gem/builder#lib/builder/xmlbase.rb:134 + def _escape(text); end + + # pkg:gem/builder#lib/builder/xmlbase.rb:157 + def _escape_attribute(text); end + + # pkg:gem/builder#lib/builder/xmlbase.rb:167 + def _indent; end + + # pkg:gem/builder#lib/builder/xmlbase.rb:172 + def _nested_structures(block); end + + # pkg:gem/builder#lib/builder/xmlbase.rb:162 + def _newline; end + + # If XmlBase.cache_method_calls = true, we dynamicly create the method + # missed as an instance method on the XMLBase object. Because XML + # documents are usually very repetative in nature, the next node will + # be handled by the new method instead of method_missing. As + # method_missing is very slow, this speeds up document generation + # significantly. + # + # pkg:gem/builder#lib/builder/xmlbase.rb:185 + def cache_method_call(sym); end + + class << self + # pkg:gem/builder#lib/builder/xmlbase.rb:14 + def cache_method_calls; end + + # pkg:gem/builder#lib/builder/xmlbase.rb:14 + def cache_method_calls=(_arg0); end + end +end + +# Create a series of SAX-like XML events (e.g. start_tag, end_tag) +# from the markup code. XmlEvent objects are used in a way similar +# to XmlMarkup objects, except that a series of events are generated +# and passed to a handler rather than generating character-based +# markup. +# +# Usage: +# xe = Builder::XmlEvents.new(hander) +# xe.title("HI") # Sends start_tag/end_tag/text messages to the handler. +# +# Indentation may also be selected by providing value for the +# indentation size and initial indentation level. +# +# xe = Builder::XmlEvents.new(handler, indent_size, initial_indent_level) +# +# == XML Event Handler +# +# The handler object must expect the following events. +# +# [start_tag(tag, attrs)] +# Announces that a new tag has been found. +tag+ is the name of +# the tag and +attrs+ is a hash of attributes for the tag. +# +# [end_tag(tag)] +# Announces that an end tag for +tag+ has been found. +# +# [text(text)] +# Announces that a string of characters (+text+) has been found. +# A series of characters may be broken up into more than one +# +text+ call, so the client cannot assume that a single +# callback contains all the text data. +# +# pkg:gem/builder#lib/builder/xmlevents.rb:49 +class Builder::XmlEvents < ::Builder::XmlMarkup + # pkg:gem/builder#lib/builder/xmlevents.rb:59 + def _end_tag(sym); end + + # pkg:gem/builder#lib/builder/xmlevents.rb:54 + def _start_tag(sym, attrs, end_too = T.unsafe(nil)); end + + # pkg:gem/builder#lib/builder/xmlevents.rb:50 + def text!(text); end +end + +# Create XML markup easily. All (well, almost all) methods sent to +# an XmlMarkup object will be translated to the equivalent XML +# markup. Any method with a block will be treated as an XML markup +# tag with nested markup in the block. +# +# Examples will demonstrate this easier than words. In the +# following, +xm+ is an +XmlMarkup+ object. +# +# xm.em("emphasized") # => emphasized +# xm.em { xm.b("emp & bold") } # => emph & bold +# xm.a("A Link", "href"=>"http://onestepback.org") +# # => A Link +# xm.div { xm.br } # =>

    +# xm.target("name"=>"compile", "option"=>"fast") +# # => +# # NOTE: order of attributes is not specified. +# +# xm.instruct! # +# xm.html { # +# xm.head { # +# xm.title("History") # History +# } # +# xm.body { # +# xm.comment! "HI" # +# xm.h1("Header") #

    Header

    +# xm.p("paragraph") #

    paragraph

    +# } # +# } # +# +# == Notes: +# +# * The order that attributes are inserted in markup tags is +# undefined. +# +# * Sometimes you wish to insert text without enclosing tags. Use +# the text! method to accomplish this. +# +# Example: +# +# xm.div { #
    +# xm.text! "line"; xm.br # line
    +# xm.text! "another line"; xmbr # another line
    +# } #
    +# +# * The special XML characters <, >, and & are converted to <, +# > and & automatically. Use the << operation to +# insert text without modification. +# +# * Sometimes tags use special characters not allowed in ruby +# identifiers. Use the tag! method to handle these +# cases. +# +# Example: +# +# xml.tag!("SOAP:Envelope") { ... } +# +# will produce ... +# +# ... " +# +# tag! will also take text and attribute arguments (after +# the tag name) like normal markup methods. (But see the next +# bullet item for a better way to handle XML namespaces). +# +# * Direct support for XML namespaces is now available. If the +# first argument to a tag call is a symbol, it will be joined to +# the tag to produce a namespace:tag combination. It is easier to +# show this than describe it. +# +# xml.SOAP :Envelope do ... end +# +# Just put a space before the colon in a namespace to produce the +# right form for builder (e.g. "SOAP:Envelope" => +# "xml.SOAP :Envelope") +# +# * XmlMarkup builds the markup in any object (called a _target_) +# that accepts the << method. If no target is given, +# then XmlMarkup defaults to a string target. +# +# Examples: +# +# xm = Builder::XmlMarkup.new +# result = xm.title("yada") +# # result is a string containing the markup. +# +# buffer = "" +# xm = Builder::XmlMarkup.new(buffer) +# # The markup is appended to buffer (using <<) +# +# xm = Builder::XmlMarkup.new(STDOUT) +# # The markup is written to STDOUT (using <<) +# +# xm = Builder::XmlMarkup.new +# x2 = Builder::XmlMarkup.new(:target=>xm) +# # Markup written to +x2+ will be send to +xm+. +# +# * Indentation is enabled by providing the number of spaces to +# indent for each level as a second argument to XmlBuilder.new. +# Initial indentation may be specified using a third parameter. +# +# Example: +# +# xm = Builder::XmlMarkup.new(:indent=>2) +# # xm will produce nicely formatted and indented XML. +# +# xm = Builder::XmlMarkup.new(:indent=>2, :margin=>4) +# # xm will produce nicely formatted and indented XML with 2 +# # spaces per indent and an over all indentation level of 4. +# +# builder = Builder::XmlMarkup.new(:target=>$stdout, :indent=>2) +# builder.name { |b| b.first("Jim"); b.last("Weirich") } +# # prints: +# # +# # Jim +# # Weirich +# # +# +# * The instance_eval implementation which forces self to refer to +# the message receiver as self is now obsolete. We now use normal +# block calls to execute the markup block. This means that all +# markup methods must now be explicitly send to the xml builder. +# For instance, instead of +# +# xml.div { strong("text") } +# +# you need to write: +# +# xml.div { xml.strong("text") } +# +# Although more verbose, the subtle change in semantics within the +# block was found to be prone to error. To make this change a +# little less cumbersome, the markup block now gets the markup +# object sent as an argument, allowing you to use a shorter alias +# within the block. +# +# For example: +# +# xml_builder = Builder::XmlMarkup.new +# xml_builder.div { |xml| +# xml.strong("text") +# } +# +# pkg:gem/builder#lib/builder/xmlmarkup.rb:161 +class Builder::XmlMarkup < ::Builder::XmlBase + # Create an XML markup builder. Parameters are specified by an + # option hash. + # + # :target => target_object:: + # Object receiving the markup. +target_object+ must respond to + # the <<(a_string) operator and return + # itself. The default target is a plain string target. + # + # :indent => indentation:: + # Number of spaces used for indentation. The default is no + # indentation and no line breaks. + # + # :margin => initial_indentation_level:: + # Amount of initial indentation (specified in levels, not + # spaces). + # + # :quote => :single:: + # Use single quotes for attributes rather than double quotes. + # + # :escape_attrs => OBSOLETE:: + # The :escape_attrs option is no longer supported by builder + # (and will be quietly ignored). String attribute values are + # now automatically escaped. If you need unescaped attribute + # values (perhaps you are using entities in the attribute + # values), then give the value as a Symbol. This allows much + # finer control over escaping attribute values. + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:190 + def initialize(options = T.unsafe(nil)); end + + # Insert a CDATA section into the XML markup. + # + # For example: + # + # xml.cdata!("text to be included in cdata") + # #=> + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:270 + def cdata!(text); end + + # pkg:gem/builder#lib/builder/xmlmarkup.rb:275 + def cdata_value!(open, text); end + + # pkg:gem/builder#lib/builder/xmlmarkup.rb:204 + def comment!(comment_text); end + + # Insert an XML declaration into the XML markup. + # + # For example: + # + # xml.declare! :ELEMENT, :blah, "yada" + # # => + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:215 + def declare!(inst, *args, &block); end + + # Insert a processing instruction into the XML markup. E.g. + # + # For example: + # + # xml.instruct! + # #=> + # xml.instruct! :aaa, :bbb=>"ccc" + # #=> + # + # Note: If the encoding is setup to "UTF-8" and the value of + # $KCODE is "UTF8", then builder will emit UTF-8 encoded strings + # rather than the entity encoding normally used. + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:248 + def instruct!(directive_tag = T.unsafe(nil), attrs = T.unsafe(nil)); end + + # Return the target of the builder. + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:200 + def target!; end + + private + + # pkg:gem/builder#lib/builder/xmlmarkup.rb:326 + def _attr_value(value); end + + # Insert an ending tag. + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:310 + def _end_tag(sym); end + + # pkg:gem/builder#lib/builder/xmlmarkup.rb:335 + def _ensure_no_block(got_block); end + + # Insert the attributes (given in the hash). + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:315 + def _insert_attributes(attrs, order = T.unsafe(nil)); end + + # Insert special instruction. + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:291 + def _special(open, close, data = T.unsafe(nil), attrs = T.unsafe(nil), order = T.unsafe(nil)); end + + # Start an XML tag. If end_too is true, then the start + # tag is also the end tag (e.g.
    + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:302 + def _start_tag(sym, attrs, end_too = T.unsafe(nil)); end + + # Insert text directly in to the builder's target. + # + # pkg:gem/builder#lib/builder/xmlmarkup.rb:286 + def _text(text); end +end diff --git a/sorbet/rbi/gems/bundler-audit@0.9.3.rbi b/sorbet/rbi/gems/bundler-audit@0.9.3.rbi new file mode 100644 index 000000000..093e4f76a --- /dev/null +++ b/sorbet/rbi/gems/bundler-audit@0.9.3.rbi @@ -0,0 +1,397 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `bundler-audit` gem. +# Please instead update this file by running `bin/tapioca gem bundler-audit`. + + +# pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:22 +module Bundler::Audit; end + +# Represents an advisory loaded from the {Database}. +# +# pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:26 +class Bundler::Audit::Advisory < ::Struct + # Compares two advisories. + # + # @param [Advisory] other + # + # @return [Boolean] + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:210 + def ==(other); end + + # Determines how critical the vulnerability is. + # + # @return [:none, :low, :medium, :high, :critical, nil] + # The criticality of the vulnerability based on the CVSS score. + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:138 + def criticality; end + + # The CVE identifier. + # + # @return [String, nil] + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:93 + def cve_id; end + + # The GHSA (GitHub Security Advisory) identifier + # + # @return [String, nil] + # + # @since 0.7.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:113 + def ghsa_id; end + + # Return a compacted list of all ids + # + # @return [Array] + # + # @since 0.7.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:124 + def identifiers; end + + # The OSVDB identifier. + # + # @return [String, nil] + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:102 + def osvdb_id; end + + # Checks whether the version is patched against the advisory. + # + # @param [Gem::Version] version + # The version to compare against {#patched_versions}. + # + # @return [Boolean] + # Specifies whether the version is patched against the advisory. + # + # @since 0.2.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:184 + def patched?(version); end + + # Converts the advisory to a Hash. + # + # @return [Hash{Symbol => Object}] + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:219 + def to_h; end + + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:225 + def to_s; end + + # Checks whether the version is not affected by the advisory. + # + # @param [Gem::Version] version + # The version to compare against {#unaffected_versions}. + # + # @return [Boolean] + # Specifies whether the version is not affected by the advisory. + # + # @since 0.2.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:167 + def unaffected?(version); end + + # Checks whether the version is vulnerable to the advisory. + # + # @param [Gem::Version] version + # The version to compare against {#patched_versions}. + # + # @return [Boolean] + # Specifies whether the version is vulnerable to the advisory or not. + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:199 + def vulnerable?(version); end + + class << self + # Loads the advisory from a YAML file. + # + # @param [String] path + # The path to the advisory YAML file. + # + # @return [Advisory] + # + # @api semipublic + # + # pkg:gem/bundler-audit#lib/bundler/audit/advisory.rb:50 + def load(path); end + end +end + +# Represents the directory of advisories, grouped by gem name +# and CVE number. +# +# pkg:gem/bundler-audit#lib/bundler/audit/database.rb:29 +class Bundler::Audit::Database + # Initializes the Advisory Database. + # + # @param [String] path + # The path to the advisory database. + # + # @raise [ArgumentError] + # The path was not a directory. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:62 + def initialize(path = T.unsafe(nil)); end + + # Enumerates over every advisory in the database. + # + # @yield [advisory] + # If a block is given, it will be passed each advisory. + # + # @yieldparam [Advisory] advisory + # An advisory from the database. + # + # @return [Enumerator] + # If no block is given, an Enumerator will be returned. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:265 + def advisories(&block); end + + # Enumerates over advisories for the given gem. + # + # @param [String] name + # The gem name to lookup. + # + # @yield [advisory] + # If a block is given, each advisory for the given gem will be yielded. + # + # @yieldparam [Advisory] advisory + # An advisory for the given gem. + # + # @return [Enumerator] + # If no block is given, an Enumerator will be returned. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:288 + def advisories_for(name); end + + # Verifies whether the gem is effected by any advisories. + # + # @param [Gem::Specification] gem + # The gem to verify. + # + # @yield [advisory] + # If a block is given, it will be passed advisories that effect + # the gem. + # + # @yieldparam [Advisory] advisory + # An advisory that effects the specific version of the gem. + # + # @return [Enumerator] + # If no block is given, an Enumerator will be returned. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:312 + def check_gem(gem); end + + # The last commit ID of the repository. + # + # @return [String, nil] + # The commit hash or `nil` if the database is not a git repository. + # + # @since 0.9.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:228 + def commit_id; end + + # Determines if the database is a git repository. + # + # @return [Boolean] + # + # @since 0.8.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:180 + def git?; end + + # Inspects the database. + # + # @return [String] + # The inspected database. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:348 + def inspect; end + + # Determines the time when the database was last updated. + # + # @return [Time] + # + # @since 0.8.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:243 + def last_updated_at; end + + # The path to the advisory database. + # + # @return [String] + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:51 + def path; end + + # The number of advisories within the database. + # + # @return [Integer] + # The number of advisories. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:328 + def size; end + + # Converts the database to a String. + # + # @return [String] + # The path to the database. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:338 + def to_s; end + + # Updates the ruby-advisory-db. + # + # @param [Hash] options + # Additional options. + # + # @option options [Boolean] :quiet + # Specify whether `git` should be `--quiet`. + # + # @return [true, nil] + # * `true` - the ruby-advisory-db git repository was successfully + # updated. + # * `nil` - the ruby-advisory-db is not a git repository or the `git` + # command is not installed. + # + # @raise [UpdateFailed] + # Could not update the ruby-advisory-db git repository. + # + # @since 0.8.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:204 + def update!(options = T.unsafe(nil)); end + + protected + + # Enumerates over every advisory path in the database. + # + # @yield [path] + # The given block will be passed each advisory path. + # + # @yieldparam [String] path + # A path to an advisory `.yml` file. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:363 + def each_advisory_path(&block); end + + # Enumerates over the advisories for the given gem. + # + # @param [String] name + # The gem of the gem. + # + # @yield [path] + # The given block will be passed each advisory path. + # + # @yieldparam [String] path + # A path to an advisory `.yml` file. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:379 + def each_advisory_path_for(name, &block); end + + class << self + # Downloads the ruby-advisory-db. + # + # @param [Hash] options + # Additional options. + # + # @option options [String] :path (DEFAULT_PATH) + # The destination path for the new ruby-advisory-db. + # + # @option options [Boolean] :quiet + # Specify whether `git` should be `--quiet`. + # + # @return [Database] + # The newly downloaded database. + # + # @raise [DownloadFailed] + # Indicates that the download failed. + # + # @note + # Requires network access. + # + # @since 0.8.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:117 + def download(options = T.unsafe(nil)); end + + # Tests whether the database exists. + # + # @param [String] path + # The given path of the database to check. + # + # @return [Boolean] + # + # @since 0.8.0 + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:90 + def exists?(path = T.unsafe(nil)); end + + # The default path for the database. + # + # @return [String] + # The path to the database directory. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:76 + def path; end + + # Updates the ruby-advisory-db. + # + # @param [Hash] options + # Additional options. + # + # @option options [Boolean] :quiet + # Specify whether `git` should be `--quiet`. + # + # @return [Boolean] + # Specifies whether the update was successful. + # + # @raise [ArgumentError] + # Invalid options were given. + # + # @note + # Requires network access. + # + # @since 0.3.0 + # + # @deprecated Use {#update!} instead. + # + # pkg:gem/bundler-audit#lib/bundler/audit/database.rb:157 + def update!(options = T.unsafe(nil)); end + end +end + +# Default path to the ruby-advisory-db. +# +# @since 0.8.0 +# +# pkg:gem/bundler-audit#lib/bundler/audit/database.rb:46 +Bundler::Audit::Database::DEFAULT_PATH = T.let(T.unsafe(nil), String) + +# pkg:gem/bundler-audit#lib/bundler/audit/database.rb:31 +class Bundler::Audit::Database::DownloadFailed < ::RuntimeError; end + +# Git URL of the ruby-advisory-db. +# +# pkg:gem/bundler-audit#lib/bundler/audit/database.rb:38 +Bundler::Audit::Database::URL = T.let(T.unsafe(nil), String) + +# Path to the user's copy of the ruby-advisory-db. +# +# pkg:gem/bundler-audit#lib/bundler/audit/database.rb:41 +Bundler::Audit::Database::USER_PATH = T.let(T.unsafe(nil), String) + +# pkg:gem/bundler-audit#lib/bundler/audit/database.rb:34 +class Bundler::Audit::Database::UpdateFailed < ::RuntimeError; end + +# bundler-audit version +# +# pkg:gem/bundler-audit#lib/bundler/audit/version.rb:21 +Bundler::Audit::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/byebug@13.0.0.rbi b/sorbet/rbi/gems/byebug@13.0.0.rbi new file mode 100644 index 000000000..12a543bc0 --- /dev/null +++ b/sorbet/rbi/gems/byebug@13.0.0.rbi @@ -0,0 +1,3651 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `byebug` gem. +# Please instead update this file by running `bin/tapioca gem byebug`. + + +# Main Container for all of Byebug's code +# +# +# Main debugger's container module. Everything is defined under this module +# +# +# Namespace for all of byebug's code +# +# +# Remote debugging functionality. +# +# +# Reopen main module to define the library version +# +# pkg:gem/byebug#lib/byebug/helpers/reflection.rb:3 +module Byebug + include ::Byebug::Helpers::ReflectionHelper + extend ::Byebug::Helpers::ReflectionHelper + extend ::Byebug + + # Debugger's display expressions + # + # pkg:gem/byebug#lib/byebug/core.rb:31 + def displays; end + + # Debugger's display expressions + # + # pkg:gem/byebug#lib/byebug/core.rb:31 + def displays=(_arg0); end + + # Configuration file used for startup commands. Default value is .byebugrc + # + # pkg:gem/byebug#lib/byebug/core.rb:25 + def init_file; end + + # Configuration file used for startup commands. Default value is .byebugrc + # + # pkg:gem/byebug#lib/byebug/core.rb:25 + def init_file=(_arg0); end + + # Running mode of the debugger. Can be either: + # + # * :attached => Attached to a running program through the `byebug` method. + # * :standalone => Started through `byebug` script. + # * :off => Ignoring any `byebug` method calls. + # + # pkg:gem/byebug#lib/byebug/core.rb:41 + def mode; end + + # Running mode of the debugger. Can be either: + # + # * :attached => Attached to a running program through the `byebug` method. + # * :standalone => Started through `byebug` script. + # * :off => Ignoring any `byebug` method calls. + # + # pkg:gem/byebug#lib/byebug/core.rb:41 + def mode=(_arg0); end + + # Runs normal byebug initialization scripts. + # + # Reads and executes the commands from init file (if any) in the current + # working directory. This is only done if the current directory is different + # from your home directory. Thus, you can have more than one init file, one + # generic in your home directory, and another, specific to the program you + # are debugging, in the directory where you invoke byebug. + # + # pkg:gem/byebug#lib/byebug/core.rb:52 + def run_init_script; end + + private + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def add_catchpoint(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def breakpoints; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def catchpoints; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def contexts; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def current_context; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def debug_load(*_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def lock; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def post_mortem=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def post_mortem?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def raised_exception; end + + # List of folders to load rc files from + # + # @note Files will be loaded in the order specified here. + # + # pkg:gem/byebug#lib/byebug/core.rb:102 + def rc_dirs; end + + # Runs a initialization script file + # + # pkg:gem/byebug#lib/byebug/core.rb:91 + def run_rc_file(rc_file); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def start; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def started?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def stop; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def stoppable?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def thread_context(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def tracing=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def tracing?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def unlock; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def verbose=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def verbose?; end + + class << self + # The actual port that the control server is started at + # + # pkg:gem/byebug#lib/byebug/remote.rb:25 + def actual_control_port; end + + # The actual port that the server is started at + # + # pkg:gem/byebug#lib/byebug/remote.rb:20 + def actual_port; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def add_catchpoint(_arg0); end + + # Starts byebug, and stops at the first line of user's code. + # + # pkg:gem/byebug#lib/byebug/attacher.rb:10 + def attach; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def breakpoints; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def catchpoints; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def contexts; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def current_context; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def debug_load(*_arg0); end + + # Saves information about the unhandled exception and gives a byebug + # prompt back to the user before program termination. + # + # pkg:gem/byebug#lib/byebug/core.rb:76 + def handle_post_mortem; end + + # Interrupts the current thread + # + # pkg:gem/byebug#lib/byebug/remote.rb:32 + def interrupt; end + + # pkg:gem/byebug#lib/byebug/core.rb:61 + def load_settings; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def lock; end + + # pkg:gem/byebug#lib/byebug/remote.rb:59 + def parse_host_and_port(host_port_spec); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def post_mortem=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def post_mortem?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def raised_exception; end + + # pkg:gem/byebug#lib/byebug/attacher.rb:21 + def spawn(host = T.unsafe(nil), port = T.unsafe(nil)); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def start; end + + # Connects to the remote byebug + # + # pkg:gem/byebug#lib/byebug/remote.rb:55 + def start_client(host = T.unsafe(nil), port = T.unsafe(nil)); end + + # Starts the remote server control thread + # + # pkg:gem/byebug#lib/byebug/remote.rb:48 + def start_control(host = T.unsafe(nil), port = T.unsafe(nil)); end + + # Starts the remote server main thread + # + # pkg:gem/byebug#lib/byebug/remote.rb:39 + def start_server(host = T.unsafe(nil), port = T.unsafe(nil)); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def started?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def stop; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def stoppable?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def thread_context(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def tracing=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def tracing?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def unlock; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def verbose=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def verbose?; end + + # If in remote mode, wait for the remote connection + # + # pkg:gem/byebug#lib/byebug/remote.rb:17 + def wait_connection; end + + # If in remote mode, wait for the remote connection + # + # pkg:gem/byebug#lib/byebug/remote.rb:17 + def wait_connection=(_arg0); end + + private + + # pkg:gem/byebug#lib/byebug/remote.rb:66 + def client; end + + # pkg:gem/byebug#lib/byebug/remote.rb:76 + def control; end + + # pkg:gem/byebug#lib/byebug/remote.rb:70 + def server; end + end +end + +# Setting for automatically invoking IRB on every stop. +# +# pkg:gem/byebug#lib/byebug/settings/autoirb.rb:10 +class Byebug::AutoirbSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/autoirb.rb:13 + def initialize; end + + # pkg:gem/byebug#lib/byebug/settings/autoirb.rb:17 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/autoirb.rb:25 + def value; end + + # pkg:gem/byebug#lib/byebug/settings/autoirb.rb:21 + def value=(val); end +end + +# pkg:gem/byebug#lib/byebug/settings/autoirb.rb:11 +Byebug::AutoirbSetting::DEFAULT = T.let(T.unsafe(nil), Integer) + +# Setting for automatically listing source code on every stop. +# +# pkg:gem/byebug#lib/byebug/settings/autolist.rb:10 +class Byebug::AutolistSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/autolist.rb:13 + def initialize; end + + # pkg:gem/byebug#lib/byebug/settings/autolist.rb:17 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/autolist.rb:25 + def value; end + + # pkg:gem/byebug#lib/byebug/settings/autolist.rb:21 + def value=(val); end +end + +# pkg:gem/byebug#lib/byebug/settings/autolist.rb:11 +Byebug::AutolistSetting::DEFAULT = T.let(T.unsafe(nil), Integer) + +# Setting for automatically invoking Pry on every stop. +# +# pkg:gem/byebug#lib/byebug/settings/autopry.rb:10 +class Byebug::AutoprySetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/autopry.rb:13 + def initialize; end + + # pkg:gem/byebug#lib/byebug/settings/autopry.rb:17 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/autopry.rb:25 + def value; end + + # pkg:gem/byebug#lib/byebug/settings/autopry.rb:21 + def value=(val); end +end + +# pkg:gem/byebug#lib/byebug/settings/autopry.rb:11 +Byebug::AutoprySetting::DEFAULT = T.let(T.unsafe(nil), Integer) + +# Setting for automatically saving previously entered commands to history +# when exiting the debugger. +# +# pkg:gem/byebug#lib/byebug/settings/autosave.rb:10 +class Byebug::AutosaveSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/autosave.rb:13 + def banner; end +end + +# pkg:gem/byebug#lib/byebug/settings/autosave.rb:11 +Byebug::AutosaveSetting::DEFAULT = T.let(T.unsafe(nil), TrueClass) + +# Command to display short paths in file names. +# +# For example, when displaying source code information. +# +# pkg:gem/byebug#lib/byebug/settings/basename.rb:11 +class Byebug::BasenameSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/basename.rb:12 + def banner; end +end + +# Implements breakpoint functionality +# +# pkg:gem/byebug#lib/byebug/commands/break.rb:13 +class Byebug::BreakCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + include ::Byebug::Helpers::FileHelper + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/break.rb:42 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/break.rb:85 + def add_line_breakpoint(file, line); end + + # pkg:gem/byebug#lib/byebug/commands/break.rb:56 + def line_breakpoint(location); end + + # pkg:gem/byebug#lib/byebug/commands/break.rb:67 + def method_breakpoint(location); end + + # pkg:gem/byebug#lib/byebug/commands/break.rb:76 + def target_object(str); end + + # pkg:gem/byebug#lib/byebug/commands/break.rb:106 + def valid_breakpoints_for(path, line); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/break.rb:24 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/break.rb:20 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/break.rb:38 + def short_description; end + end +end + +# Implements breakpoints +# +# pkg:gem/byebug#lib/byebug/core.rb:4 +class Byebug::Breakpoint + # pkg:gem/byebug#lib/byebug/core.rb:4 + def initialize(_arg0, _arg1, _arg2); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def enabled=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def enabled?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def expr; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def expr=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def hit_condition; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def hit_condition=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def hit_count; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def hit_value; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def hit_value=(_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def id; end + + # Prints all information associated to the breakpoint + # + # pkg:gem/byebug#lib/byebug/breakpoint.rb:88 + def inspect; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def pos; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def source; end + + class << self + # Adds a new breakpoint + # + # @param [String] file + # @param [Fixnum] line + # @param [String] expr + # + # pkg:gem/byebug#lib/byebug/breakpoint.rb:29 + def add(file, line, expr = T.unsafe(nil)); end + + # First breakpoint, in order of creation + # + # pkg:gem/byebug#lib/byebug/breakpoint.rb:11 + def first; end + + # Last breakpoint, in order of creation + # + # pkg:gem/byebug#lib/byebug/breakpoint.rb:18 + def last; end + + # True if there's no breakpoints + # + # pkg:gem/byebug#lib/byebug/breakpoint.rb:81 + def none?; end + + # Returns true if a breakpoint could be set in line number +lineno+ in file + # name +filename. + # + # pkg:gem/byebug#lib/byebug/breakpoint.rb:74 + def potential_line?(filename, lineno); end + + # Returns an array of line numbers in file named +filename+ where + # breakpoints could be set. The list will contain an entry for each + # distinct line event call so it is possible (and possibly useful) for a + # line number appear more than once. + # + # @param filename [String] File name to inspect for possible breakpoints + # + # pkg:gem/byebug#lib/byebug/breakpoint.rb:52 + def potential_lines(filename); end + + # Removes a breakpoint + # + # @param id [integer] breakpoint number + # + # pkg:gem/byebug#lib/byebug/breakpoint.rb:40 + def remove(id); end + + private + + # pkg:gem/byebug#lib/byebug/breakpoint.rb:59 + def potential_lines_with_trace_points(iseq, lines); end + end +end + +# Setting to customize the verbosity level for stack frames. +# +# pkg:gem/byebug#lib/byebug/settings/callstyle.rb:9 +class Byebug::CallstyleSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/callstyle.rb:12 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/callstyle.rb:16 + def to_s; end +end + +# pkg:gem/byebug#lib/byebug/settings/callstyle.rb:10 +Byebug::CallstyleSetting::DEFAULT = T.let(T.unsafe(nil), String) + +# Implements exception catching. +# +# Enables the user to catch unhandled assertion when they happen. +# +# pkg:gem/byebug#lib/byebug/commands/catch.rb:12 +class Byebug::CatchCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + + # pkg:gem/byebug#lib/byebug/commands/catch.rb:38 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/catch.rb:57 + def add(exception); end + + # pkg:gem/byebug#lib/byebug/commands/catch.rb:64 + def clear; end + + # pkg:gem/byebug#lib/byebug/commands/catch.rb:68 + def info; end + + # pkg:gem/byebug#lib/byebug/commands/catch.rb:50 + def remove(exception); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/catch.rb:21 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/catch.rb:17 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/catch.rb:34 + def short_description; end + end +end + +# Parent class of all byebug commands. +# +# Subclass it and name the subclass ending with the word Command to implement +# your own custom command. +# +# @example Define a custom command +# +# class MyCustomCommand < Command +# def self.regexp +# /custom_regexp/ +# end +# +# def self.description +# "Custom long desc" +# end +# +# def.short_description +# "Custom short desc" +# end +# +# def execute +# # My command's implementation +# end +# end +# +# pkg:gem/byebug#lib/byebug/command.rb:33 +class Byebug::Command + extend ::Forwardable + extend ::Byebug::Helpers::StringHelper + + # pkg:gem/byebug#lib/byebug/command.rb:38 + def initialize(processor, input = T.unsafe(nil)); end + + # pkg:gem/byebug#lib/byebug/command.rb:51 + def arguments; end + + # pkg:gem/byebug#lib/byebug/command.rb:61 + def confirm(*, **, &); end + + # pkg:gem/byebug#lib/byebug/command.rb:43 + def context; end + + # pkg:gem/byebug#lib/byebug/command.rb:61 + def errmsg(*, **, &); end + + # pkg:gem/byebug#lib/byebug/command.rb:47 + def frame; end + + # pkg:gem/byebug#lib/byebug/command.rb:55 + def help(*, **, &); end + + # pkg:gem/byebug#lib/byebug/command.rb:55 + def match(*, **, &); end + + # pkg:gem/byebug#lib/byebug/command.rb:57 + def pr(*, **, &); end + + # pkg:gem/byebug#lib/byebug/command.rb:58 + def prc(*, **, &); end + + # pkg:gem/byebug#lib/byebug/command.rb:61 + def print(*, **, &); end + + # pkg:gem/byebug#lib/byebug/command.rb:36 + def processor; end + + # pkg:gem/byebug#lib/byebug/command.rb:59 + def prv(*, **, &); end + + # pkg:gem/byebug#lib/byebug/command.rb:61 + def puts(*, **, &); end + + class << self + # Special methods to allow command filtering in processors + # + # pkg:gem/byebug#lib/byebug/command.rb:69 + def allow_in_control; end + + # Special methods to allow command filtering in processors + # + # pkg:gem/byebug#lib/byebug/command.rb:69 + def allow_in_control=(_arg0); end + + # Special methods to allow command filtering in processors + # + # pkg:gem/byebug#lib/byebug/command.rb:69 + def allow_in_post_mortem; end + + # Special methods to allow command filtering in processors + # + # pkg:gem/byebug#lib/byebug/command.rb:69 + def allow_in_post_mortem=(_arg0); end + + # pkg:gem/byebug#lib/byebug/command.rb:73 + def always_run; end + + # pkg:gem/byebug#lib/byebug/command.rb:71 + def always_run=(_arg0); end + + # pkg:gem/byebug#lib/byebug/command.rb:88 + def columnize(width); end + + # Default help text for a command. + # + # pkg:gem/byebug#lib/byebug/command.rb:99 + def help; end + + # Command's regexp match against an input + # + # pkg:gem/byebug#lib/byebug/command.rb:106 + def match(input); end + + # Name of the command, as executed by the user. + # + # pkg:gem/byebug#lib/byebug/command.rb:80 + def to_s; end + end +end + +# Holds an array of subcommands for a command +# +# pkg:gem/byebug#lib/byebug/command_list.rb:9 +class Byebug::CommandList + include ::Enumerable + + # pkg:gem/byebug#lib/byebug/command_list.rb:12 + def initialize(commands); end + + # pkg:gem/byebug#lib/byebug/command_list.rb:20 + def each; end + + # pkg:gem/byebug#lib/byebug/command_list.rb:16 + def match(input); end + + # pkg:gem/byebug#lib/byebug/command_list.rb:24 + def to_s; end + + private + + # pkg:gem/byebug#lib/byebug/command_list.rb:30 + def width; end +end + +# Custom exception exception to signal "command not found" errors +# +# pkg:gem/byebug#lib/byebug/errors.rb:7 +class Byebug::CommandNotFound < ::NoMethodError + # pkg:gem/byebug#lib/byebug/errors.rb:8 + def initialize(input, parent = T.unsafe(nil)); end + + private + + # pkg:gem/byebug#lib/byebug/errors.rb:25 + def build_cmd(*args); end + + # pkg:gem/byebug#lib/byebug/errors.rb:21 + def help; end + + # pkg:gem/byebug#lib/byebug/errors.rb:17 + def name; end +end + +# Processes commands in regular mode. +# +# You can override this class to create your own command processor that, for +# example, whitelists only certain commands to be executed. +# +# @see PostMortemProcessor for a example +# +# pkg:gem/byebug#lib/byebug/processors/command_processor.rb:17 +class Byebug::CommandProcessor + include ::Byebug::Helpers::EvalHelper + extend ::Forwardable + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:23 + def initialize(context, interface = T.unsafe(nil)); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:64 + def at_breakpoint(brkpt); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:70 + def at_catchpoint(exception); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:80 + def at_end; end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:54 + def at_line; end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:74 + def at_return(return_value); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:58 + def at_tracing; end + + # Available commands + # + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:50 + def command_list; end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:45 + def commands(*, **, &); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:43 + def confirm(*, **, &); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:21 + def context; end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:43 + def errmsg(*, **, &); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:37 + def frame(*, **, &); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:21 + def interface; end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:39 + def pr(*, **, &); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:40 + def prc(*, **, &); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:20 + def prev_line; end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:20 + def prev_line=(_arg0); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:31 + def printer; end + + # Let the execution continue + # + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:87 + def proceed!; end + + # Handle byebug commands. + # + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:94 + def process_commands; end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:41 + def prv(*, **, &); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:43 + def puts(*, **, &); end + + protected + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:119 + def after_repl; end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:111 + def before_repl; end + + # Prompt shown before reading a command. + # + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:107 + def prompt; end + + # Main byebug's REPL + # + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:126 + def repl; end + + private + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:139 + def auto_cmds_for(run_level); end + + # Run permanent commands. + # + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:146 + def run_auto_cmds(run_level); end + + # Executes the received input + # + # Instantiates a command matching the input and runs it. If a matching + # command is not found, it evaluates the unknown input. + # + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:158 + def run_cmd(input); end + + # pkg:gem/byebug#lib/byebug/processors/command_processor.rb:167 + def safely; end +end + +# Implements conditions on breakpoints. +# +# Adds the ability to stop on breakpoints only under certain conditions. +# +# pkg:gem/byebug#lib/byebug/commands/condition.rb:12 +class Byebug::ConditionCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/condition.rb:38 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/condition.rb:21 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/condition.rb:17 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/condition.rb:34 + def short_description; end + end +end + +# Maintains context information for the debugger and it's the main +# communication point between the library and the C-extension through the +# at_breakpoint, at_catchpoint, at_tracing, at_line and at_return callbacks +# +# pkg:gem/byebug#lib/byebug/core.rb:4 +class Byebug::Context + include ::Byebug::Helpers::FileHelper + extend ::Byebug::Helpers::PathHelper + extend ::Forwardable + + # Breakpoint handler + # + # pkg:gem/byebug#lib/byebug/context.rb:113 + def at_breakpoint(breakpoint); end + + # Catchpoint handler + # + # pkg:gem/byebug#lib/byebug/context.rb:120 + def at_catchpoint(exception); end + + # End of class definition handler + # + # pkg:gem/byebug#lib/byebug/context.rb:136 + def at_end; end + + # Line handler + # + # pkg:gem/byebug#lib/byebug/context.rb:94 + def at_line; end + + # Return handler + # + # pkg:gem/byebug#lib/byebug/context.rb:127 + def at_return(return_value); end + + # Tracing handler + # + # pkg:gem/byebug#lib/byebug/context.rb:104 + def at_tracing; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def backtrace; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def dead?; end + + # pkg:gem/byebug#lib/byebug/context.rb:58 + def file(*, **, &); end + + # Reader for the current frame + # + # pkg:gem/byebug#lib/byebug/context.rb:46 + def frame; end + + # Writer for the current frame + # + # pkg:gem/byebug#lib/byebug/context.rb:53 + def frame=(pos); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def frame_binding(*_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def frame_class(*_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def frame_file(*_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def frame_line(*_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def frame_method(*_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def frame_self(*_arg0); end + + # Current file, line and source code information + # + # pkg:gem/byebug#lib/byebug/context.rb:70 + def full_location; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def ignored?; end + + # pkg:gem/byebug#lib/byebug/context.rb:87 + def interrupt; end + + # pkg:gem/byebug#lib/byebug/context.rb:58 + def line(*, **, &); end + + # Current file & line information + # + # pkg:gem/byebug#lib/byebug/context.rb:63 + def location; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def resume; end + + # Context's stack size + # + # pkg:gem/byebug#lib/byebug/context.rb:79 + def stack_size; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def step_into(*_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def step_out(*_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def step_over(*_arg0); end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def stop_reason; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def suspend; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def suspended?; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def switch; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def thnum; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def thread; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def tracing; end + + # pkg:gem/byebug#lib/byebug/core.rb:4 + def tracing=(_arg0); end + + private + + # Tells whether a file is ignored by the debugger. + # + # @param path [String] filename to be checked. + # + # pkg:gem/byebug#lib/byebug/context.rb:153 + def ignored_file?(path); end + + # pkg:gem/byebug#lib/byebug/context.rb:144 + def processor; end + + class << self + # List of files byebug will ignore while debugging + # + # pkg:gem/byebug#lib/byebug/context.rb:25 + def ignored_files; end + + # List of files byebug will ignore while debugging + # + # pkg:gem/byebug#lib/byebug/context.rb:20 + def ignored_files=(_arg0); end + + # pkg:gem/byebug#lib/byebug/context.rb:32 + def interface; end + + # pkg:gem/byebug#lib/byebug/context.rb:30 + def interface=(_arg0); end + + # pkg:gem/byebug#lib/byebug/context.rb:38 + def processor; end + + # pkg:gem/byebug#lib/byebug/context.rb:36 + def processor=(_arg0); end + end +end + +# Implements the continue command. +# +# Allows the user to continue execution until the next stopping point, a +# specific line number or until program termination. +# +# pkg:gem/byebug#lib/byebug/commands/continue.rb:13 +class Byebug::ContinueCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/continue.rb:37 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/continue.rb:64 + def modifier; end + + # pkg:gem/byebug#lib/byebug/commands/continue.rb:60 + def unconditionally?; end + + # pkg:gem/byebug#lib/byebug/commands/continue.rb:56 + def until_line?; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/continue.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/continue.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/continue.rb:33 + def short_description; end + end +end + +# Processes commands when there's not program running +# +# pkg:gem/byebug#lib/byebug/processors/control_processor.rb:9 +class Byebug::ControlProcessor < ::Byebug::CommandProcessor + # Available commands + # + # pkg:gem/byebug#lib/byebug/processors/control_processor.rb:13 + def commands; end + + # Prompt shown before reading a command. + # + # pkg:gem/byebug#lib/byebug/processors/control_processor.rb:20 + def prompt; end +end + +# Spawns a subdebugger and evaluates the given expression +# +# pkg:gem/byebug#lib/byebug/commands/debug.rb:10 +class Byebug::DebugCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + + # pkg:gem/byebug#lib/byebug/commands/debug.rb:32 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/debug.rb:17 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/debug.rb:13 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/debug.rb:28 + def short_description; end + end +end + +# pkg:gem/byebug#lib/byebug/core.rb:4 +class Byebug::DebugThread < ::Thread + class << self + # pkg:gem/byebug#lib/byebug/core.rb:4 + def inherited; end + end +end + +# Implements breakpoint deletion. +# +# pkg:gem/byebug#lib/byebug/commands/delete.rb:10 +class Byebug::DeleteCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/delete.rb:35 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/delete.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/delete.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/delete.rb:31 + def short_description; end + end +end + +# Disabling custom display expressions or breakpoints. +# +# +# Reopens the +disable+ command to define the +breakpoints+ subcommand +# +# +# Reopens the +disable+ command to define the +display+ subcommand +# +# pkg:gem/byebug#lib/byebug/commands/disable/breakpoints.rb:9 +class Byebug::DisableCommand < ::Byebug::Command + include ::Byebug::Subcommands + extend ::Byebug::Helpers::ReflectionHelper + extend ::Byebug::Subcommands::ClassMethods + + class << self + # pkg:gem/byebug#lib/byebug/commands/disable.rb:21 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/disable.rb:17 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/disable.rb:29 + def short_description; end + end +end + +# Disables all or specific breakpoints +# +# pkg:gem/byebug#lib/byebug/commands/disable/breakpoints.rb:13 +class Byebug::DisableCommand::BreakpointsCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + include ::Byebug::Helpers::ToggleHelper + + # pkg:gem/byebug#lib/byebug/commands/disable/breakpoints.rb:37 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/disable/breakpoints.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/disable/breakpoints.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/disable/breakpoints.rb:33 + def short_description; end + end +end + +# Enables all or specific displays +# +# pkg:gem/byebug#lib/byebug/commands/disable/display.rb:13 +class Byebug::DisableCommand::DisplayCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + include ::Byebug::Helpers::ToggleHelper + + # pkg:gem/byebug#lib/byebug/commands/disable/display.rb:38 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/disable/display.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/disable/display.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/disable/display.rb:34 + def short_description; end + end +end + +# Custom expressions to be displayed every time the debugger stops. +# +# pkg:gem/byebug#lib/byebug/commands/display.rb:10 +class Byebug::DisplayCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + + # pkg:gem/byebug#lib/byebug/commands/display.rb:35 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/display.rb:44 + def display_expression(exp); end + + # pkg:gem/byebug#lib/byebug/commands/display.rb:60 + def eval_expr(expression); end + + # pkg:gem/byebug#lib/byebug/commands/display.rb:50 + def print_display_expressions; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/display.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/display.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/display.rb:31 + def short_description; end + end +end + +# Move the current frame down in the backtrace. +# +# pkg:gem/byebug#lib/byebug/commands/down.rb:12 +class Byebug::DownCommand < ::Byebug::Command + include ::Byebug::Helpers::FrameHelper + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/down.rb:36 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/down.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/down.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/down.rb:32 + def short_description; end + end +end + +# Edit a file from byebug's prompt. +# +# pkg:gem/byebug#lib/byebug/commands/edit.rb:9 +class Byebug::EditCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/edit.rb:33 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/edit.rb:65 + def edit_error(type, file); end + + # pkg:gem/byebug#lib/byebug/commands/edit.rb:61 + def editor; end + + # pkg:gem/byebug#lib/byebug/commands/edit.rb:45 + def location(matched); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/edit.rb:17 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/edit.rb:13 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/edit.rb:29 + def short_description; end + end +end + +# Enabling custom display expressions or breakpoints. +# +# +# Reopens the +enable+ command to define the +breakpoints+ subcommand +# +# +# Reopens the +enable+ command to define the +display+ subcommand +# +# pkg:gem/byebug#lib/byebug/commands/enable/breakpoints.rb:9 +class Byebug::EnableCommand < ::Byebug::Command + include ::Byebug::Subcommands + extend ::Byebug::Helpers::ReflectionHelper + extend ::Byebug::Subcommands::ClassMethods + + class << self + # pkg:gem/byebug#lib/byebug/commands/enable.rb:21 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/enable.rb:17 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/enable.rb:29 + def short_description; end + end +end + +# Enables all or specific breakpoints +# +# pkg:gem/byebug#lib/byebug/commands/enable/breakpoints.rb:13 +class Byebug::EnableCommand::BreakpointsCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + include ::Byebug::Helpers::ToggleHelper + + # pkg:gem/byebug#lib/byebug/commands/enable/breakpoints.rb:37 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/enable/breakpoints.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/enable/breakpoints.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/enable/breakpoints.rb:33 + def short_description; end + end +end + +# Enables all or specific displays +# +# pkg:gem/byebug#lib/byebug/commands/enable/display.rb:13 +class Byebug::EnableCommand::DisplayCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + include ::Byebug::Helpers::ToggleHelper + + # pkg:gem/byebug#lib/byebug/commands/enable/display.rb:38 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/enable/display.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/enable/display.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/enable/display.rb:34 + def short_description; end + end +end + +# Implements the finish functionality. +# +# Allows the user to continue execution until certain frames are finished. +# +# pkg:gem/byebug#lib/byebug/commands/finish.rb:12 +class Byebug::FinishCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/finish.rb:37 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/finish.rb:53 + def max_frames; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/finish.rb:21 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/finish.rb:17 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/finish.rb:33 + def short_description; end + end +end + +# Represents a frame in the stack trace +# +# pkg:gem/byebug#lib/byebug/frame.rb:9 +class Byebug::Frame + include ::Byebug::Helpers::FileHelper + + # pkg:gem/byebug#lib/byebug/frame.rb:14 + def initialize(context, pos); end + + # pkg:gem/byebug#lib/byebug/frame.rb:31 + def _binding; end + + # pkg:gem/byebug#lib/byebug/frame.rb:35 + def _class; end + + # pkg:gem/byebug#lib/byebug/frame.rb:39 + def _method; end + + # pkg:gem/byebug#lib/byebug/frame.rb:27 + def _self; end + + # Gets current method arguments for the frame. + # + # pkg:gem/byebug#lib/byebug/frame.rb:62 + def args; end + + # Checks whether the frame is a c-frame + # + # pkg:gem/byebug#lib/byebug/frame.rb:141 + def c_frame?; end + + # pkg:gem/byebug#lib/byebug/frame.rb:43 + def current?; end + + # Builds a string containing all available args in the frame number, in a + # verbose or non verbose way according to the value of the +callstyle+ + # setting + # + # pkg:gem/byebug#lib/byebug/frame.rb:89 + def deco_args; end + + # pkg:gem/byebug#lib/byebug/frame.rb:76 + def deco_block; end + + # Builds a formatted string containing information about current method call + # + # pkg:gem/byebug#lib/byebug/frame.rb:106 + def deco_call; end + + # Returns the current class in the frame or an empty string if the current + # +callstyle+ setting is 'short' + # + # pkg:gem/byebug#lib/byebug/frame.rb:72 + def deco_class; end + + # Formatted filename in frame + # + # pkg:gem/byebug#lib/byebug/frame.rb:113 + def deco_file; end + + # pkg:gem/byebug#lib/byebug/frame.rb:80 + def deco_method; end + + # Properly formatted frame number of frame + # + # pkg:gem/byebug#lib/byebug/frame.rb:120 + def deco_pos; end + + # pkg:gem/byebug#lib/byebug/frame.rb:19 + def file; end + + # pkg:gem/byebug#lib/byebug/frame.rb:23 + def line; end + + # Gets local variables for the frame. + # + # pkg:gem/byebug#lib/byebug/frame.rb:50 + def locals; end + + # Formatted mark for the frame. + # + # --> marks the current frame + # ͱ-- marks c-frames + # marks regular frames + # + # pkg:gem/byebug#lib/byebug/frame.rb:131 + def mark; end + + # pkg:gem/byebug#lib/byebug/frame.rb:12 + def pos; end + + # pkg:gem/byebug#lib/byebug/frame.rb:145 + def to_hash; end + + private + + # pkg:gem/byebug#lib/byebug/frame.rb:158 + def c_args; end + + # pkg:gem/byebug#lib/byebug/frame.rb:178 + def prefix_and_default(arg_type); end + + # pkg:gem/byebug#lib/byebug/frame.rb:164 + def ruby_args; end + + # pkg:gem/byebug#lib/byebug/frame.rb:174 + def use_short_style?(arg); end +end + +# Move to specific frames in the backtrace. +# +# pkg:gem/byebug#lib/byebug/commands/frame.rb:12 +class Byebug::FrameCommand < ::Byebug::Command + include ::Byebug::Helpers::FrameHelper + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/frame.rb:46 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/frame.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/frame.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/frame.rb:42 + def short_description; end + end +end + +# Setting to display full paths in backtraces. +# +# pkg:gem/byebug#lib/byebug/settings/fullpath.rb:9 +class Byebug::FullpathSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/fullpath.rb:12 + def banner; end +end + +# pkg:gem/byebug#lib/byebug/settings/fullpath.rb:10 +Byebug::FullpathSetting::DEFAULT = T.let(T.unsafe(nil), TrueClass) + +# Ask for help from byebug's prompt. +# +# pkg:gem/byebug#lib/byebug/commands/help.rb:10 +class Byebug::HelpCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/help.rb:34 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/help.rb:54 + def command; end + + # pkg:gem/byebug#lib/byebug/commands/help.rb:48 + def help_for(input, cmd); end + + # pkg:gem/byebug#lib/byebug/commands/help.rb:44 + def help_for_all; end + + # pkg:gem/byebug#lib/byebug/commands/help.rb:58 + def subcommand; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/help.rb:18 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/help.rb:14 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/help.rb:30 + def short_description; end + end +end + +# pkg:gem/byebug#lib/byebug/helpers/reflection.rb:4 +module Byebug::Helpers; end + +# Utilities for interaction with executables +# +# pkg:gem/byebug#lib/byebug/helpers/bin.rb:8 +module Byebug::Helpers::BinHelper + # pkg:gem/byebug#lib/byebug/helpers/bin.rb:38 + def executable_file_extensions; end + + # pkg:gem/byebug#lib/byebug/helpers/bin.rb:24 + def find_executable(path, cmd); end + + # pkg:gem/byebug#lib/byebug/helpers/bin.rb:42 + def real_executable?(file); end + + # pkg:gem/byebug#lib/byebug/helpers/bin.rb:34 + def search_paths; end + + # Cross-platform way of finding an executable in the $PATH. + # Adapted from: https://gist.github.com/steakknife/88b6c3837a5e90a08296 + # + # pkg:gem/byebug#lib/byebug/helpers/bin.rb:13 + def which(cmd); end +end + +# Utilities to assist evaluation of code strings +# +# pkg:gem/byebug#lib/byebug/helpers/eval.rb:8 +module Byebug::Helpers::EvalHelper + # Evaluates a string containing Ruby code in a specific binding, + # handling the errors at an error level. + # + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:46 + def error_eval(str, binding = T.unsafe(nil)); end + + # Evaluates an +expression+ that might use or defer execution to threads + # other than the current one. + # + # @note This is necessary because when in byebug's prompt, every thread is + # "frozen" so that nothing gets run. So we need to unlock threads prior + # to evaluation or we will run into a deadlock. + # + # @param expression [String] Expression to evaluate + # + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:30 + def multiple_thread_eval(expression); end + + # Evaluates an +expression+ in a separate thread. + # + # @param expression [String] Expression to evaluate + # + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:14 + def separate_thread_eval(expression); end + + # Evaluates a string containing Ruby code in a specific binding, + # returning nil if an error happens. + # + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:38 + def silent_eval(str, binding = T.unsafe(nil)); end + + # Evaluates a string containing Ruby code in a specific binding, + # handling the errors at a warning level. + # + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:54 + def warning_eval(str, binding = T.unsafe(nil)); end + + private + + # Run block temporarily ignoring all TracePoint events. + # + # Used to evaluate stuff within Byebug's prompt. Otherwise, any code + # creating new threads won't be properly evaluated because new threads + # will get blocked by byebug's main thread. + # + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:91 + def allowing_other_threads(&block); end + + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:72 + def error_msg(exception); end + + # Runs the given block in a new thread, waits for it to finish and + # returns the new thread's result. + # + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:103 + def in_new_thread; end + + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:66 + def msg(exception); end + + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:60 + def safe_eval(str, binding); end + + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:111 + def safe_inspect(var); end + + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:117 + def safe_to_s(var); end + + # pkg:gem/byebug#lib/byebug/helpers/eval.rb:80 + def warning_msg(exception); end +end + +# Utilities for interaction with files +# +# pkg:gem/byebug#lib/byebug/helpers/file.rb:8 +module Byebug::Helpers::FileHelper + # Reads line number +lineno+ from file named +filename+ + # + # pkg:gem/byebug#lib/byebug/helpers/file.rb:19 + def get_line(filename, lineno); end + + # Reads lines of source file +filename+ into an array + # + # pkg:gem/byebug#lib/byebug/helpers/file.rb:12 + def get_lines(filename); end + + # Returns the number of lines in file +filename+ in a portable, + # one-line-at-a-time way. + # + # pkg:gem/byebug#lib/byebug/helpers/file.rb:30 + def n_lines(filename); end + + # Regularize file name. + # + # pkg:gem/byebug#lib/byebug/helpers/file.rb:37 + def normalize(filename); end + + # A short version of a long path + # + # pkg:gem/byebug#lib/byebug/helpers/file.rb:48 + def shortpath(fullpath); end + + # True for special files like -e, false otherwise + # + # pkg:gem/byebug#lib/byebug/helpers/file.rb:58 + def virtual_file?(name); end +end + +# Utilities to assist frame navigation +# +# pkg:gem/byebug#lib/byebug/helpers/frame.rb:8 +module Byebug::Helpers::FrameHelper + # pkg:gem/byebug#lib/byebug/helpers/frame.rb:16 + def jump_frames(steps); end + + # pkg:gem/byebug#lib/byebug/helpers/frame.rb:9 + def switch_to_frame(frame); end + + private + + # pkg:gem/byebug#lib/byebug/helpers/frame.rb:22 + def adjust_frame(new_frame); end + + # @param step [Integer] A positive or negative integer + # + # @return [Integer] +1 if step is positive / -1 if negative + # + # pkg:gem/byebug#lib/byebug/helpers/frame.rb:60 + def direction(step); end + + # pkg:gem/byebug#lib/byebug/helpers/frame.rb:51 + def frame_err(msg); end + + # Convert a possibly negative index to a positive index from the start + # of the callstack. -1 is the last position in the stack and so on. + # + # @param i [Integer] Integer to be converted in a proper positive index. + # + # pkg:gem/byebug#lib/byebug/helpers/frame.rb:70 + def index_from_start(index); end + + # pkg:gem/byebug#lib/byebug/helpers/frame.rb:30 + def navigate_to_frame(jump_no); end + + # pkg:gem/byebug#lib/byebug/helpers/frame.rb:47 + def out_of_bounds?(pos); end +end + +# Utilities to assist command parsing +# +# pkg:gem/byebug#lib/byebug/helpers/parse.rb:10 +module Byebug::Helpers::ParseHelper + # Parses +str+ of command +cmd+ as an integer between +min+ and +max+. + # + # If either +min+ or +max+ is nil, that value has no bound. + # + # @todo Remove the `cmd` parameter. It has nothing to do with the method's + # purpose. + # + # pkg:gem/byebug#lib/byebug/helpers/parse.rb:19 + def get_int(str, cmd, min = T.unsafe(nil), max = T.unsafe(nil)); end + + # @return +str+ as an integer or 1 if +str+ is empty. + # + # pkg:gem/byebug#lib/byebug/helpers/parse.rb:58 + def parse_steps(str, cmd); end + + # @return true if code is syntactically correct for Ruby, false otherwise + # + # pkg:gem/byebug#lib/byebug/helpers/parse.rb:37 + def syntax_valid?(code); end + + private + + # Temporarily disable output to $stderr + # + # pkg:gem/byebug#lib/byebug/helpers/parse.rb:72 + def without_stderr; end +end + +# Utilities for managing gem paths +# +# pkg:gem/byebug#lib/byebug/helpers/path.rb:8 +module Byebug::Helpers::PathHelper + # pkg:gem/byebug#lib/byebug/helpers/path.rb:29 + def all_files; end + + # pkg:gem/byebug#lib/byebug/helpers/path.rb:9 + def bin_file; end + + # pkg:gem/byebug#lib/byebug/helpers/path.rb:25 + def gem_files; end + + # pkg:gem/byebug#lib/byebug/helpers/path.rb:17 + def lib_files; end + + # pkg:gem/byebug#lib/byebug/helpers/path.rb:13 + def root_path; end + + # pkg:gem/byebug#lib/byebug/helpers/path.rb:21 + def test_files; end + + private + + # pkg:gem/byebug#lib/byebug/helpers/path.rb:35 + def glob_for(dir); end +end + +# Reflection utility +# +# pkg:gem/byebug#lib/byebug/helpers/reflection.rb:8 +module Byebug::Helpers::ReflectionHelper + # List of "command" classes in the including module + # + # pkg:gem/byebug#lib/byebug/helpers/reflection.rb:12 + def commands; end +end + +# Utilities for interaction with strings +# +# pkg:gem/byebug#lib/byebug/helpers/string.rb:8 +module Byebug::Helpers::StringHelper + # Converts +str+ from an_underscored-or-dasherized_string to + # ACamelizedString. + # + # pkg:gem/byebug#lib/byebug/helpers/string.rb:13 + def camelize(str); end + + # Removes a number of leading whitespace for each input line. + # + # pkg:gem/byebug#lib/byebug/helpers/string.rb:28 + def deindent(str, leading_spaces: T.unsafe(nil)); end + + # Improves indentation and spacing in +str+ for readability in Byebug's + # command prompt. + # + # pkg:gem/byebug#lib/byebug/helpers/string.rb:21 + def prettify(str); end +end + +# Utilities for thread subcommands +# +# pkg:gem/byebug#lib/byebug/helpers/thread.rb:8 +module Byebug::Helpers::ThreadHelper + # pkg:gem/byebug#lib/byebug/helpers/thread.rb:30 + def context_from_thread(thnum); end + + # pkg:gem/byebug#lib/byebug/helpers/thread.rb:26 + def current_thread?(ctx); end + + # pkg:gem/byebug#lib/byebug/helpers/thread.rb:9 + def display_context(ctx); end + + # pkg:gem/byebug#lib/byebug/helpers/thread.rb:13 + def thread_arguments(ctx); end + + private + + # pkg:gem/byebug#lib/byebug/helpers/thread.rb:62 + def debug_flag(ctx); end + + # @todo Check whether it is Byebug.current_context or context + # + # pkg:gem/byebug#lib/byebug/helpers/thread.rb:47 + def location(ctx); end + + # pkg:gem/byebug#lib/byebug/helpers/thread.rb:56 + def status_flag(ctx); end +end + +# Utilities to assist breakpoint/display enabling/disabling. +# +# pkg:gem/byebug#lib/byebug/helpers/toggle.rb:10 +module Byebug::Helpers::ToggleHelper + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/helpers/toggle.rb:13 + def enable_disable_breakpoints(is_enable, args); end + + # pkg:gem/byebug#lib/byebug/helpers/toggle.rb:26 + def enable_disable_display(is_enable, args); end + + private + + # pkg:gem/byebug#lib/byebug/helpers/toggle.rb:57 + def n_displays; end + + # pkg:gem/byebug#lib/byebug/helpers/toggle.rb:41 + def select_breakpoints(is_enable, args); end +end + +# Utilities for variable subcommands +# +# pkg:gem/byebug#lib/byebug/helpers/var.rb:10 +module Byebug::Helpers::VarHelper + include ::Byebug::Helpers::EvalHelper + + # pkg:gem/byebug#lib/byebug/helpers/var.rb:58 + def var_args; end + + # pkg:gem/byebug#lib/byebug/helpers/var.rb:37 + def var_global; end + + # pkg:gem/byebug#lib/byebug/helpers/var.rb:45 + def var_instance(str); end + + # pkg:gem/byebug#lib/byebug/helpers/var.rb:13 + def var_list(ary, binding = T.unsafe(nil)); end + + # pkg:gem/byebug#lib/byebug/helpers/var.rb:51 + def var_local; end +end + +# Setting to customize the file where byebug's history is saved. +# +# pkg:gem/byebug#lib/byebug/settings/histfile.rb:9 +class Byebug::HistfileSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/histfile.rb:12 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/histfile.rb:16 + def to_s; end +end + +# pkg:gem/byebug#lib/byebug/settings/histfile.rb:10 +Byebug::HistfileSetting::DEFAULT = T.let(T.unsafe(nil), String) + +# Handles byebug's history of commands. +# +# pkg:gem/byebug#lib/byebug/history.rb:9 +class Byebug::History + # pkg:gem/byebug#lib/byebug/history.rb:12 + def initialize; end + + # Array holding the list of commands in history + # + # pkg:gem/byebug#lib/byebug/history.rb:19 + def buffer; end + + # Discards history. + # + # pkg:gem/byebug#lib/byebug/history.rb:48 + def clear; end + + # Max number of commands to be displayed when no size has been specified. + # + # Never more than Setting[:histsize]. + # + # pkg:gem/byebug#lib/byebug/history.rb:95 + def default_max_size; end + + # Whether a specific command should not be stored in history. + # + # For now, empty lines and consecutive duplicates. + # + # pkg:gem/byebug#lib/byebug/history.rb:113 + def ignore?(buf); end + + # Array of ids of the last +number+ commands. + # + # pkg:gem/byebug#lib/byebug/history.rb:86 + def last_ids(number); end + + # Removes a command from Reline's history. + # + # pkg:gem/byebug#lib/byebug/history.rb:65 + def pop; end + + # Adds a new command to Reline's history. + # + # pkg:gem/byebug#lib/byebug/history.rb:55 + def push(cmd); end + + # Restores history from disk. + # + # pkg:gem/byebug#lib/byebug/history.rb:26 + def restore; end + + # Saves history to disk. + # + # pkg:gem/byebug#lib/byebug/history.rb:35 + def save; end + + # pkg:gem/byebug#lib/byebug/history.rb:10 + def size; end + + # Max number of commands to be displayed when a size has been specified. + # + # The only bound here is not showing more items than available. + # + # pkg:gem/byebug#lib/byebug/history.rb:104 + def specific_max_size(number); end + + # Prints the requested numbers of history entries. + # + # pkg:gem/byebug#lib/byebug/history.rb:73 + def to_s(n_cmds); end +end + +# Show history of byebug commands. +# +# pkg:gem/byebug#lib/byebug/commands/history.rb:10 +class Byebug::HistoryCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/history.rb:31 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/history.rb:19 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/history.rb:15 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/history.rb:27 + def short_description; end + end +end + +# Setting to customize the number of byebug commands to be saved in history. +# +# pkg:gem/byebug#lib/byebug/settings/histsize.rb:9 +class Byebug::HistsizeSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/histsize.rb:12 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/histsize.rb:16 + def to_s; end +end + +# pkg:gem/byebug#lib/byebug/settings/histsize.rb:10 +Byebug::HistsizeSetting::DEFAULT = T.let(T.unsafe(nil), Integer) + +# Shows info about different aspects of the debugger. +# +# +# Reopens the +info+ command to define the +breakpoints+ subcommand +# +# +# Reopens the +info+ command to define the +display+ subcommand +# +# +# Reopens the +info+ command to define the +file+ subcommand +# +# +# Reopens the +info+ command to define the +line+ subcommand +# +# +# Reopens the +info+ command to define the +args+ subcommand +# +# pkg:gem/byebug#lib/byebug/commands/info/breakpoints.rb:7 +class Byebug::InfoCommand < ::Byebug::Command + include ::Byebug::Subcommands + extend ::Byebug::Helpers::ReflectionHelper + extend ::Byebug::Subcommands::ClassMethods + + class << self + # pkg:gem/byebug#lib/byebug/commands/info.rb:25 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/info.rb:21 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/info.rb:33 + def short_description; end + end +end + +# Information about current breakpoints +# +# pkg:gem/byebug#lib/byebug/commands/info/breakpoints.rb:11 +class Byebug::InfoCommand::BreakpointsCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/info/breakpoints.rb:30 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/info/breakpoints.rb:47 + def info_breakpoint(brkpt); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/info/breakpoints.rb:18 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/info/breakpoints.rb:14 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/info/breakpoints.rb:26 + def short_description; end + end +end + +# Information about display expressions +# +# pkg:gem/byebug#lib/byebug/commands/info/display.rb:11 +class Byebug::InfoCommand::DisplayCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/info/display.rb:30 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/info/display.rb:18 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/info/display.rb:14 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/info/display.rb:26 + def short_description; end + end +end + +# Information about a particular source file +# +# pkg:gem/byebug#lib/byebug/commands/info/file.rb:13 +class Byebug::InfoCommand::FileCommand < ::Byebug::Command + include ::Byebug::Helpers::FileHelper + include ::Byebug::Helpers::StringHelper + + # pkg:gem/byebug#lib/byebug/commands/info/file.rb:38 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/info/file.rb:55 + def info_file_basic(file); end + + # pkg:gem/byebug#lib/byebug/commands/info/file.rb:63 + def info_file_breakpoints(file); end + + # pkg:gem/byebug#lib/byebug/commands/info/file.rb:70 + def info_file_mtime(file); end + + # pkg:gem/byebug#lib/byebug/commands/info/file.rb:74 + def info_file_sha1(file); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/info/file.rb:23 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/info/file.rb:19 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/info/file.rb:34 + def short_description; end + end +end + +# Information about current location +# +# pkg:gem/byebug#lib/byebug/commands/info/line.rb:11 +class Byebug::InfoCommand::LineCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/info/line.rb:30 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/info/line.rb:18 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/info/line.rb:14 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/info/line.rb:26 + def short_description; end + end +end + +# Information about arguments of the current method/block +# +# pkg:gem/byebug#lib/byebug/commands/info/program.rb:11 +class Byebug::InfoCommand::ProgramCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/info/program.rb:30 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/info/program.rb:37 + def format_stop_reason(stop_reason); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/info/program.rb:18 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/info/program.rb:14 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/info/program.rb:26 + def short_description; end + end +end + +# Main Interface class +# +# Contains common functionality to all implemented interfaces. +# +# pkg:gem/byebug#lib/byebug/interface.rb:16 +class Byebug::Interface + include ::Byebug::Helpers::FileHelper + + # pkg:gem/byebug#lib/byebug/interface.rb:22 + def initialize; end + + # Restores history according to +autosave+ setting. + # + # pkg:gem/byebug#lib/byebug/interface.rb:118 + def autorestore; end + + # Saves or clears history according to +autosave+ setting. + # + # pkg:gem/byebug#lib/byebug/interface.rb:111 + def autosave; end + + # pkg:gem/byebug#lib/byebug/interface.rb:105 + def close; end + + # pkg:gem/byebug#lib/byebug/interface.rb:19 + def command_queue; end + + # pkg:gem/byebug#lib/byebug/interface.rb:19 + def command_queue=(_arg0); end + + # Confirms user introduced an affirmative response to the input stream. + # + # pkg:gem/byebug#lib/byebug/interface.rb:101 + def confirm(prompt); end + + # Prints an error message to the error stream. + # + # pkg:gem/byebug#lib/byebug/interface.rb:80 + def errmsg(message); end + + # pkg:gem/byebug#lib/byebug/interface.rb:20 + def error; end + + # pkg:gem/byebug#lib/byebug/interface.rb:19 + def history; end + + # pkg:gem/byebug#lib/byebug/interface.rb:19 + def history=(_arg0); end + + # pkg:gem/byebug#lib/byebug/interface.rb:20 + def input; end + + # pkg:gem/byebug#lib/byebug/interface.rb:28 + def last_if_empty(input); end + + # pkg:gem/byebug#lib/byebug/interface.rb:20 + def output; end + + # Reads a new line from the interface's input stream. + # + # @return [String] New string read or the previous string if the string + # read now was empty. + # + # pkg:gem/byebug#lib/byebug/interface.rb:70 + def prepare_input(prompt); end + + # Prints an output message to the output stream without a final "\n". + # + # pkg:gem/byebug#lib/byebug/interface.rb:94 + def print(message); end + + # Prints an output message to the output stream. + # + # pkg:gem/byebug#lib/byebug/interface.rb:87 + def puts(message); end + + # Pops a command from the input stream. + # + # pkg:gem/byebug#lib/byebug/interface.rb:35 + def read_command(prompt); end + + # Pushes lines in +filename+ to the command queue. + # + # pkg:gem/byebug#lib/byebug/interface.rb:44 + def read_file(filename); end + + # Reads a new line from the interface's input stream, parses it into + # commands and saves it to history. + # + # @return [String] Representing something to be run by the debugger. + # + # pkg:gem/byebug#lib/byebug/interface.rb:54 + def read_input(prompt, save_hist = T.unsafe(nil)); end + + private + + # Splits a command line of the form "cmd1 ; cmd2 ; ... ; cmdN" into an + # array of commands: [cmd1, cmd2, ..., cmdN] + # + # pkg:gem/byebug#lib/byebug/interface.rb:128 + def split_commands(cmd_line); end +end + +# Interrupting execution of current thread. +# +# pkg:gem/byebug#lib/byebug/commands/interrupt.rb:9 +class Byebug::InterruptCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/interrupt.rb:28 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/interrupt.rb:16 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/interrupt.rb:12 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/interrupt.rb:24 + def short_description; end + end +end + +# Enter IRB from byebug's prompt +# +# pkg:gem/byebug#lib/byebug/commands/irb.rb:10 +class Byebug::IrbCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/irb.rb:29 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/irb.rb:41 + def with_clean_argv; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/irb.rb:17 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/irb.rb:13 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/irb.rb:25 + def short_description; end + end +end + +# Send custom signals to the debugged program. +# +# pkg:gem/byebug#lib/byebug/commands/kill.rb:9 +class Byebug::KillCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/kill.rb:30 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/kill.rb:16 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/kill.rb:12 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/kill.rb:26 + def short_description; end + end +end + +# Setting to enable/disable linetracing. +# +# pkg:gem/byebug#lib/byebug/settings/linetrace.rb:9 +class Byebug::LinetraceSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/linetrace.rb:10 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/linetrace.rb:18 + def value; end + + # pkg:gem/byebug#lib/byebug/settings/linetrace.rb:14 + def value=(val); end +end + +# List parts of the source code. +# +# pkg:gem/byebug#lib/byebug/commands/list.rb:12 +class Byebug::ListCommand < ::Byebug::Command + include ::Byebug::Helpers::FileHelper + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/list.rb:150 + def amend_final(*, **, &); end + + # pkg:gem/byebug#lib/byebug/commands/list.rb:40 + def execute; end + + # pkg:gem/byebug#lib/byebug/commands/list.rb:150 + def max_line(*, **, &); end + + # pkg:gem/byebug#lib/byebug/commands/list.rb:150 + def size(*, **, &); end + + private + + # Set line range to be printed by list + # + # @return first line number to list + # @return last line number to list + # + # pkg:gem/byebug#lib/byebug/commands/list.rb:79 + def auto_range(direction); end + + # Show a range of lines in the current file. + # + # @param min [Integer] Lower bound + # @param max [Integer] Upper bound + # + # pkg:gem/byebug#lib/byebug/commands/list.rb:115 + def display_lines(min, max); end + + # @param range [String] A string with an integer range format + # + # @return [String] The lower bound of the given range + # + # pkg:gem/byebug#lib/byebug/commands/list.rb:126 + def lower_bound(range); end + + # pkg:gem/byebug#lib/byebug/commands/list.rb:105 + def move(line, size, direction = T.unsafe(nil)); end + + # pkg:gem/byebug#lib/byebug/commands/list.rb:89 + def parse_range(input); end + + # Line range to be printed by `list`. + # + # If is set, range is parsed from it. + # + # Otherwise it's automatically chosen. + # + # pkg:gem/byebug#lib/byebug/commands/list.rb:60 + def range(input); end + + # pkg:gem/byebug#lib/byebug/commands/list.rb:152 + def source_file_formatter; end + + # @param str [String] A string with an integer range format + # + # @return [Array] The upper & lower bounds of the given range + # + # pkg:gem/byebug#lib/byebug/commands/list.rb:144 + def split_range(str); end + + # @param range [String] A string with an integer range format + # + # @return [String] The upper bound of the given range + # + # pkg:gem/byebug#lib/byebug/commands/list.rb:135 + def upper_bound(range); end + + # pkg:gem/byebug#lib/byebug/commands/list.rb:69 + def valid_range?(first, last); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/list.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/list.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/list.rb:36 + def short_description; end + end +end + +# Setting to customize the number of source code lines to be displayed every +# time the "list" command is invoked. +# +# pkg:gem/byebug#lib/byebug/settings/listsize.rb:10 +class Byebug::ListsizeSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/listsize.rb:13 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/listsize.rb:17 + def to_s; end +end + +# pkg:gem/byebug#lib/byebug/settings/listsize.rb:11 +Byebug::ListsizeSetting::DEFAULT = T.let(T.unsafe(nil), Integer) + +# Interface class for standard byebug use. +# +# pkg:gem/byebug#lib/byebug/interfaces/local_interface.rb:7 +class Byebug::LocalInterface < ::Byebug::Interface + # pkg:gem/byebug#lib/byebug/interfaces/local_interface.rb:10 + def initialize; end + + # Reads a single line of input using Reline. If Ctrl-D is pressed, it + # returns "continue", meaning that program's execution will go on. + # + # @param prompt Prompt to be displayed. + # + # pkg:gem/byebug#lib/byebug/interfaces/local_interface.rb:23 + def readline(prompt); end + + # Yields the block handling Ctrl-C the following way: if pressed while + # waiting for input, the line is reset to only the prompt and we ask for + # input again. + # + # @note Any external 'INT' traps are overriden during this method. + # + # pkg:gem/byebug#lib/byebug/interfaces/local_interface.rb:34 + def with_repl_like_sigint; end + + # Disable any Reline completion procs. + # + # Other gems, for example, IRB could've installed completion procs that are + # dependent on them being loaded. Disable those while byebug is the REPL + # making use of Reline. + # + # pkg:gem/byebug#lib/byebug/interfaces/local_interface.rb:51 + def without_reline_completion; end +end + +# pkg:gem/byebug#lib/byebug/interfaces/local_interface.rb:8 +Byebug::LocalInterface::EOF_ALIAS = T.let(T.unsafe(nil), String) + +# Show methods of specific classes/modules/objects. +# +# pkg:gem/byebug#lib/byebug/commands/method.rb:10 +class Byebug::MethodCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + + # pkg:gem/byebug#lib/byebug/commands/method.rb:37 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/method.rb:19 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/method.rb:15 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/method.rb:33 + def short_description; end + end +end + +# Implements the next functionality. +# +# Allows the user the continue execution until the next instruction in the +# current frame. +# +# pkg:gem/byebug#lib/byebug/commands/next.rb:13 +class Byebug::NextCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/next.rb:32 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/next.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/next.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/next.rb:28 + def short_description; end + end +end + +# Port number used for remote debugging +# +# pkg:gem/byebug#lib/byebug/remote.rb:13 +Byebug::PORT = T.let(T.unsafe(nil), Integer) + +# Processes commands in post_mortem mode +# +# pkg:gem/byebug#lib/byebug/processors/post_mortem_processor.rb:9 +class Byebug::PostMortemProcessor < ::Byebug::CommandProcessor + # pkg:gem/byebug#lib/byebug/processors/post_mortem_processor.rb:10 + def commands; end + + # pkg:gem/byebug#lib/byebug/processors/post_mortem_processor.rb:14 + def prompt; end +end + +# Setting to enable/disable post_mortem mode, i.e., a debugger prompt after +# program termination by unhandled exception. +# +# pkg:gem/byebug#lib/byebug/settings/post_mortem.rb:10 +class Byebug::PostMortemSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/post_mortem.rb:11 + def initialize; end + + # pkg:gem/byebug#lib/byebug/settings/post_mortem.rb:15 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/post_mortem.rb:23 + def value; end + + # pkg:gem/byebug#lib/byebug/settings/post_mortem.rb:19 + def value=(val); end +end + +# pkg:gem/byebug#lib/byebug/printers/base.rb:6 +module Byebug::Printers; end + +# Base printer +# +# pkg:gem/byebug#lib/byebug/printers/base.rb:10 +class Byebug::Printers::Base + # pkg:gem/byebug#lib/byebug/printers/base.rb:16 + def type; end + + private + + # pkg:gem/byebug#lib/byebug/printers/base.rb:55 + def array_of_args(collection, &_block); end + + # pkg:gem/byebug#lib/byebug/printers/base.rb:49 + def contents; end + + # pkg:gem/byebug#lib/byebug/printers/base.rb:63 + def contents_files; end + + # pkg:gem/byebug#lib/byebug/printers/base.rb:22 + def locate(path); end + + # pkg:gem/byebug#lib/byebug/printers/base.rb:45 + def parts(path); end + + # pkg:gem/byebug#lib/byebug/printers/base.rb:35 + def translate(string, args = T.unsafe(nil)); end +end + +# pkg:gem/byebug#lib/byebug/printers/base.rb:12 +class Byebug::Printers::Base::MissedArgument < ::StandardError; end + +# pkg:gem/byebug#lib/byebug/printers/base.rb:11 +class Byebug::Printers::Base::MissedPath < ::StandardError; end + +# pkg:gem/byebug#lib/byebug/printers/base.rb:14 +Byebug::Printers::Base::SEPARATOR = T.let(T.unsafe(nil), String) + +# Plain text printer +# +# pkg:gem/byebug#lib/byebug/printers/plain.rb:10 +class Byebug::Printers::Plain < ::Byebug::Printers::Base + # pkg:gem/byebug#lib/byebug/printers/plain.rb:11 + def print(path, args = T.unsafe(nil)); end + + # pkg:gem/byebug#lib/byebug/printers/plain.rb:17 + def print_collection(path, collection, &block); end + + # pkg:gem/byebug#lib/byebug/printers/plain.rb:25 + def print_variables(variables, *_unused); end + + private + + # pkg:gem/byebug#lib/byebug/printers/plain.rb:39 + def contents_files; end +end + +# Enter Pry from byebug's prompt +# +# pkg:gem/byebug#lib/byebug/commands/pry.rb:10 +class Byebug::PryCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/pry.rb:29 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/pry.rb:17 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/pry.rb:13 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/pry.rb:25 + def short_description; end + end +end + +# Exit from byebug. +# +# pkg:gem/byebug#lib/byebug/commands/quit.rb:9 +class Byebug::QuitCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/quit.rb:33 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/quit.rb:17 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/quit.rb:13 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/quit.rb:29 + def short_description; end + end +end + +# pkg:gem/byebug#lib/byebug/remote/server.rb:6 +module Byebug::Remote; end + +# Client for remote debugging +# +# pkg:gem/byebug#lib/byebug/remote/client.rb:10 +class Byebug::Remote::Client + # pkg:gem/byebug#lib/byebug/remote/client.rb:13 + def initialize(interface); end + + # pkg:gem/byebug#lib/byebug/remote/client.rb:11 + def interface; end + + # pkg:gem/byebug#lib/byebug/remote/client.rb:11 + def socket; end + + # Connects to the remote byebug + # + # pkg:gem/byebug#lib/byebug/remote/client.rb:21 + def start(host = T.unsafe(nil), port = T.unsafe(nil)); end + + # pkg:gem/byebug#lib/byebug/remote/client.rb:44 + def started?; end + + private + + # pkg:gem/byebug#lib/byebug/remote/client.rb:50 + def connect_at(host, port); end +end + +# Server for remote debugging +# +# pkg:gem/byebug#lib/byebug/remote/server.rb:10 +class Byebug::Remote::Server + # pkg:gem/byebug#lib/byebug/remote/server.rb:13 + def initialize(wait_connection:, &block); end + + # pkg:gem/byebug#lib/byebug/remote/server.rb:11 + def actual_port; end + + # Start the remote debugging server + # + # pkg:gem/byebug#lib/byebug/remote/server.rb:22 + def start(host, port); end + + # pkg:gem/byebug#lib/byebug/remote/server.rb:11 + def wait_connection; end +end + +# Interface class for remote use of byebug. +# +# pkg:gem/byebug#lib/byebug/interfaces/remote_interface.rb:9 +class Byebug::RemoteInterface < ::Byebug::Interface + # pkg:gem/byebug#lib/byebug/interfaces/remote_interface.rb:10 + def initialize(socket); end + + # pkg:gem/byebug#lib/byebug/interfaces/remote_interface.rb:41 + def close; end + + # pkg:gem/byebug#lib/byebug/interfaces/remote_interface.rb:23 + def confirm(prompt); end + + # pkg:gem/byebug#lib/byebug/interfaces/remote_interface.rb:29 + def print(message); end + + # pkg:gem/byebug#lib/byebug/interfaces/remote_interface.rb:35 + def puts(message); end + + # pkg:gem/byebug#lib/byebug/interfaces/remote_interface.rb:17 + def read_command(prompt); end + + # pkg:gem/byebug#lib/byebug/interfaces/remote_interface.rb:45 + def readline(prompt); end +end + +# Restart debugged program from within byebug. +# +# pkg:gem/byebug#lib/byebug/commands/restart.rb:14 +class Byebug::RestartCommand < ::Byebug::Command + include ::Byebug::Helpers::BinHelper + include ::Byebug::Helpers::PathHelper + + # pkg:gem/byebug#lib/byebug/commands/restart.rb:40 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/restart.rb:54 + def prepend_byebug_bin(cmd); end + + # pkg:gem/byebug#lib/byebug/commands/restart.rb:59 + def prepend_ruby_bin(cmd); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/restart.rb:25 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/restart.rb:21 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/restart.rb:36 + def short_description; end + end +end + +# Save current settings to use them in another debug session. +# +# pkg:gem/byebug#lib/byebug/commands/save.rb:9 +class Byebug::SaveCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/save.rb:36 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/save.rb:50 + def save_breakpoints(file); end + + # pkg:gem/byebug#lib/byebug/commands/save.rb:56 + def save_catchpoints(file); end + + # pkg:gem/byebug#lib/byebug/commands/save.rb:62 + def save_displays(file); end + + # pkg:gem/byebug#lib/byebug/commands/save.rb:66 + def save_settings(file); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/save.rb:17 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/save.rb:13 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/save.rb:32 + def short_description; end + end +end + +# Setting to customize the file where byebug's settings are saved. +# +# pkg:gem/byebug#lib/byebug/settings/savefile.rb:9 +class Byebug::SavefileSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/savefile.rb:12 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/savefile.rb:16 + def to_s; end +end + +# pkg:gem/byebug#lib/byebug/settings/savefile.rb:10 +Byebug::SavefileSetting::DEFAULT = T.let(T.unsafe(nil), String) + +# Interface class for command execution from script files. +# +# pkg:gem/byebug#lib/byebug/interfaces/script_interface.rb:7 +class Byebug::ScriptInterface < ::Byebug::Interface + # pkg:gem/byebug#lib/byebug/interfaces/script_interface.rb:8 + def initialize(file, verbose = T.unsafe(nil)); end + + # pkg:gem/byebug#lib/byebug/interfaces/script_interface.rb:20 + def close; end + + # pkg:gem/byebug#lib/byebug/interfaces/script_interface.rb:16 + def read_command(prompt); end + + # pkg:gem/byebug#lib/byebug/interfaces/script_interface.rb:24 + def readline(*); end +end + +# Processes commands from a file +# +# pkg:gem/byebug#lib/byebug/processors/script_processor.rb:9 +class Byebug::ScriptProcessor < ::Byebug::CommandProcessor + # pkg:gem/byebug#lib/byebug/processors/script_processor.rb:28 + def after_repl; end + + # Available commands + # + # pkg:gem/byebug#lib/byebug/processors/script_processor.rb:13 + def commands; end + + # Prompt shown before reading a command. + # + # pkg:gem/byebug#lib/byebug/processors/script_processor.rb:37 + def prompt; end + + # pkg:gem/byebug#lib/byebug/processors/script_processor.rb:17 + def repl; end + + private + + # pkg:gem/byebug#lib/byebug/processors/script_processor.rb:43 + def without_exceptions; end +end + +# Change byebug settings. +# +# pkg:gem/byebug#lib/byebug/commands/set.rb:10 +class Byebug::SetCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/set.rb:42 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/set.rb:66 + def get_onoff(arg, default); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/set.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/set.rb:38 + def help; end + + # pkg:gem/byebug#lib/byebug/commands/set.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/set.rb:34 + def short_description; end + end +end + +# Parent class for all byebug settings. +# +# pkg:gem/byebug#lib/byebug/setting.rb:9 +class Byebug::Setting + # pkg:gem/byebug#lib/byebug/setting.rb:14 + def initialize; end + + # pkg:gem/byebug#lib/byebug/setting.rb:18 + def boolean?; end + + # pkg:gem/byebug#lib/byebug/setting.rb:28 + def help; end + + # pkg:gem/byebug#lib/byebug/setting.rb:22 + def integer?; end + + # pkg:gem/byebug#lib/byebug/setting.rb:37 + def to_s; end + + # pkg:gem/byebug#lib/byebug/setting.rb:32 + def to_sym; end + + # pkg:gem/byebug#lib/byebug/setting.rb:10 + def value; end + + # pkg:gem/byebug#lib/byebug/setting.rb:10 + def value=(_arg0); end + + class << self + # pkg:gem/byebug#lib/byebug/setting.rb:46 + def [](name); end + + # pkg:gem/byebug#lib/byebug/setting.rb:50 + def []=(name, value); end + + # pkg:gem/byebug#lib/byebug/setting.rb:54 + def find(shortcut); end + + # @todo DRY this up. Very similar code exists in the CommandList class + # + # pkg:gem/byebug#lib/byebug/setting.rb:65 + def help_all; end + + # pkg:gem/byebug#lib/byebug/setting.rb:42 + def settings; end + end +end + +# pkg:gem/byebug#lib/byebug/setting.rb:12 +Byebug::Setting::DEFAULT = T.let(T.unsafe(nil), FalseClass) + +# Show byebug settings. +# +# pkg:gem/byebug#lib/byebug/commands/show.rb:9 +class Byebug::ShowCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/show.rb:35 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/show.rb:17 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/show.rb:31 + def help; end + + # pkg:gem/byebug#lib/byebug/commands/show.rb:13 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/show.rb:27 + def short_description; end + end +end + +# Allows the user to continue execution until the next breakpoint, as +# long as it is different from the current one +# +# pkg:gem/byebug#lib/byebug/commands/skip.rb:11 +class Byebug::SkipCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:70 + def auto_run; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:77 + def execute; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:53 + def initialize_attributes; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:60 + def keep_execution; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:64 + def reset_attributes; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/skip.rb:41 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:18 + def file_line; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:15 + def file_line=(_arg0); end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:22 + def file_path; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:15 + def file_path=(_arg0); end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:16 + def previous_autolist; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:37 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:31 + def restore_autolist; end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:26 + def setup_autolist(value); end + + # pkg:gem/byebug#lib/byebug/commands/skip.rb:49 + def short_description; end + end +end + +# Execute a file containing byebug commands. +# +# It can be used to restore a previously saved debugging session. +# +# pkg:gem/byebug#lib/byebug/commands/source.rb:11 +class Byebug::SourceCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/source.rb:31 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/source.rb:19 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/source.rb:15 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/source.rb:27 + def short_description; end + end +end + +# Formats specific line ranges in a source file +# +# pkg:gem/byebug#lib/byebug/source_file_formatter.rb:10 +class Byebug::SourceFileFormatter + include ::Byebug::Helpers::FileHelper + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:15 + def initialize(file, annotator); end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:67 + def amend(line, ceiling); end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:51 + def amend_final(line); end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:47 + def amend_initial(line); end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:13 + def annotator; end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:13 + def file; end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:20 + def lines(min, max); end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:33 + def lines_around(center); end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:55 + def max_initial_line; end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:59 + def max_line; end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:37 + def range_around(center); end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:41 + def range_from(min); end + + # pkg:gem/byebug#lib/byebug/source_file_formatter.rb:63 + def size; end +end + +# Setting to enable/disable the display of backtraces when evaluations raise +# errors. +# +# pkg:gem/byebug#lib/byebug/settings/stack_on_error.rb:10 +class Byebug::StackOnErrorSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/stack_on_error.rb:11 + def banner; end +end + +# Implements the step functionality. +# +# Allows the user the continue execution until the next instruction, possibly +# in a different frame. Use step to step into method calls or blocks. +# +# pkg:gem/byebug#lib/byebug/commands/step.rb:13 +class Byebug::StepCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/step.rb:32 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/step.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/step.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/step.rb:28 + def short_description; end + end +end + +# Subcommand additions. +# +# pkg:gem/byebug#lib/byebug/subcommands.rb:12 +module Byebug::Subcommands + extend ::Forwardable + + mixes_in_class_methods ::Byebug::Subcommands::ClassMethods + + # Delegates to subcommands or prints help if no subcommand specified. + # + # pkg:gem/byebug#lib/byebug/subcommands.rb:23 + def execute; end + + # pkg:gem/byebug#lib/byebug/subcommands.rb:18 + def subcommand_list(*, **, &); end + + class << self + # pkg:gem/byebug#lib/byebug/subcommands.rb:13 + def included(command); end + end +end + +# Class methods added to subcommands +# +# pkg:gem/byebug#lib/byebug/subcommands.rb:36 +module Byebug::Subcommands::ClassMethods + include ::Byebug::Helpers::ReflectionHelper + + # Default help text for a command with subcommands + # + # pkg:gem/byebug#lib/byebug/subcommands.rb:42 + def help; end + + # Command's subcommands. + # + # pkg:gem/byebug#lib/byebug/subcommands.rb:49 + def subcommand_list; end +end + +# Manipulation of Ruby threads +# +# +# Reopens the +thread+ command to define the +current+ subcommand +# +# +# Reopens the +thread+ command to define the +list+ subcommand +# +# +# Reopens the +thread+ command to define the +resume+ subcommand +# +# +# Reopens the +thread+ command to define the +stop+ subcommand +# +# +# Reopens the +thread+ command to define the +switch+ subcommand +# +# pkg:gem/byebug#lib/byebug/commands/thread/current.rb:9 +class Byebug::ThreadCommand < ::Byebug::Command + include ::Byebug::Subcommands + extend ::Byebug::Helpers::ReflectionHelper + extend ::Byebug::Subcommands::ClassMethods + + class << self + # pkg:gem/byebug#lib/byebug/commands/thread.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/thread.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/thread.rb:30 + def short_description; end + end +end + +# Information about the current thread +# +# pkg:gem/byebug#lib/byebug/commands/thread/current.rb:13 +class Byebug::ThreadCommand::CurrentCommand < ::Byebug::Command + include ::Byebug::Helpers::ThreadHelper + + # pkg:gem/byebug#lib/byebug/commands/thread/current.rb:32 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/thread/current.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/thread/current.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/thread/current.rb:28 + def short_description; end + end +end + +# Information about threads +# +# pkg:gem/byebug#lib/byebug/commands/thread/list.rb:13 +class Byebug::ThreadCommand::ListCommand < ::Byebug::Command + include ::Byebug::Helpers::ThreadHelper + + # pkg:gem/byebug#lib/byebug/commands/thread/list.rb:32 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/thread/list.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/thread/list.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/thread/list.rb:28 + def short_description; end + end +end + +# Resumes the specified thread +# +# pkg:gem/byebug#lib/byebug/commands/thread/resume.rb:13 +class Byebug::ThreadCommand::ResumeCommand < ::Byebug::Command + include ::Byebug::Helpers::ThreadHelper + + # pkg:gem/byebug#lib/byebug/commands/thread/resume.rb:32 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/thread/resume.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/thread/resume.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/thread/resume.rb:28 + def short_description; end + end +end + +# Stops the specified thread +# +# pkg:gem/byebug#lib/byebug/commands/thread/stop.rb:13 +class Byebug::ThreadCommand::StopCommand < ::Byebug::Command + include ::Byebug::Helpers::ThreadHelper + + # pkg:gem/byebug#lib/byebug/commands/thread/stop.rb:32 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/thread/stop.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/thread/stop.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/thread/stop.rb:28 + def short_description; end + end +end + +# Switches to the specified thread +# +# pkg:gem/byebug#lib/byebug/commands/thread/switch.rb:13 +class Byebug::ThreadCommand::SwitchCommand < ::Byebug::Command + include ::Byebug::Helpers::ThreadHelper + + # pkg:gem/byebug#lib/byebug/commands/thread/switch.rb:32 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/thread/switch.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/thread/switch.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/thread/switch.rb:28 + def short_description; end + end +end + +# pkg:gem/byebug#lib/byebug/core.rb:4 +class Byebug::ThreadsTable; end + +# Show (and possibly stop) at every line that changes a global variable. +# +# pkg:gem/byebug#lib/byebug/commands/tracevar.rb:9 +class Byebug::TracevarCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/tracevar.rb:32 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/tracevar.rb:48 + def on_change(name, value, stop); end + + class << self + # pkg:gem/byebug#lib/byebug/commands/tracevar.rb:16 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/tracevar.rb:10 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/tracevar.rb:28 + def short_description; end + end +end + +# Remove expressions from display list. +# +# pkg:gem/byebug#lib/byebug/commands/undisplay.rb:10 +class Byebug::UndisplayCommand < ::Byebug::Command + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/undisplay.rb:35 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/undisplay.rb:19 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/undisplay.rb:15 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/undisplay.rb:31 + def short_description; end + end +end + +# Stop tracing a global variable. +# +# pkg:gem/byebug#lib/byebug/commands/untracevar.rb:9 +class Byebug::UntracevarCommand < ::Byebug::Command + # pkg:gem/byebug#lib/byebug/commands/untracevar.rb:26 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/untracevar.rb:14 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/untracevar.rb:10 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/untracevar.rb:22 + def short_description; end + end +end + +# Move the current frame up in the backtrace. +# +# pkg:gem/byebug#lib/byebug/commands/up.rb:12 +class Byebug::UpCommand < ::Byebug::Command + include ::Byebug::Helpers::FrameHelper + include ::Byebug::Helpers::ParseHelper + + # pkg:gem/byebug#lib/byebug/commands/up.rb:36 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/up.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/up.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/up.rb:32 + def short_description; end + end +end + +# Shows variables and its values +# +# +# Reopens the +var+ command to define the +all+ subcommand +# +# +# Reopens the +var+ command to define the +args+ subcommand +# +# +# Reopens the +var+ command to define the +const+ subcommand +# +# +# Reopens the +var+ command to define the +global+ subcommand +# +# +# Reopens the +var+ command to define the +instance+ subcommand +# +# +# Reopens the +var+ command to define the +local+ subcommand +# +# pkg:gem/byebug#lib/byebug/commands/var/all.rb:9 +class Byebug::VarCommand < ::Byebug::Command + include ::Byebug::Subcommands + extend ::Byebug::Helpers::ReflectionHelper + extend ::Byebug::Subcommands::ClassMethods + + class << self + # pkg:gem/byebug#lib/byebug/commands/var.rb:25 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/var.rb:21 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/var.rb:33 + def short_description; end + end +end + +# Shows global, instance and local variables +# +# pkg:gem/byebug#lib/byebug/commands/var/all.rb:13 +class Byebug::VarCommand::AllCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + include ::Byebug::Helpers::VarHelper + + # pkg:gem/byebug#lib/byebug/commands/var/all.rb:34 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/var/all.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/var/all.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/var/all.rb:30 + def short_description; end + end +end + +# Information about arguments of the current method/block +# +# pkg:gem/byebug#lib/byebug/commands/var/args.rb:13 +class Byebug::VarCommand::ArgsCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + include ::Byebug::Helpers::VarHelper + + # pkg:gem/byebug#lib/byebug/commands/var/args.rb:34 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/var/args.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/var/args.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/var/args.rb:30 + def short_description; end + end +end + +# Shows constants +# +# pkg:gem/byebug#lib/byebug/commands/var/const.rb:13 +class Byebug::VarCommand::ConstCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + + # pkg:gem/byebug#lib/byebug/commands/var/const.rb:34 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/var/const.rb:44 + def str_obj; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/var/const.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/var/const.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/var/const.rb:30 + def short_description; end + end +end + +# Shows global variables +# +# pkg:gem/byebug#lib/byebug/commands/var/global.rb:11 +class Byebug::VarCommand::GlobalCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + include ::Byebug::Helpers::VarHelper + + # pkg:gem/byebug#lib/byebug/commands/var/global.rb:32 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/var/global.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/var/global.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/var/global.rb:28 + def short_description; end + end +end + +# Shows instance variables +# +# pkg:gem/byebug#lib/byebug/commands/var/instance.rb:13 +class Byebug::VarCommand::InstanceCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + include ::Byebug::Helpers::VarHelper + + # pkg:gem/byebug#lib/byebug/commands/var/instance.rb:34 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/var/instance.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/var/instance.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/var/instance.rb:30 + def short_description; end + end +end + +# Shows local variables in current scope +# +# pkg:gem/byebug#lib/byebug/commands/var/local.rb:13 +class Byebug::VarCommand::LocalCommand < ::Byebug::Command + include ::Byebug::Helpers::EvalHelper + include ::Byebug::Helpers::VarHelper + + # pkg:gem/byebug#lib/byebug/commands/var/local.rb:34 + def execute; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/var/local.rb:22 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/var/local.rb:18 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/var/local.rb:30 + def short_description; end + end +end + +# Show current backtrace. +# +# pkg:gem/byebug#lib/byebug/commands/where.rb:11 +class Byebug::WhereCommand < ::Byebug::Command + include ::Byebug::Helpers::FrameHelper + + # pkg:gem/byebug#lib/byebug/commands/where.rb:43 + def execute; end + + private + + # pkg:gem/byebug#lib/byebug/commands/where.rb:49 + def print_backtrace; end + + class << self + # pkg:gem/byebug#lib/byebug/commands/where.rb:20 + def description; end + + # pkg:gem/byebug#lib/byebug/commands/where.rb:16 + def regexp; end + + # pkg:gem/byebug#lib/byebug/commands/where.rb:39 + def short_description; end + end +end + +# Setting to customize the maximum width of byebug's output. +# +# pkg:gem/byebug#lib/byebug/settings/width.rb:9 +class Byebug::WidthSetting < ::Byebug::Setting + # pkg:gem/byebug#lib/byebug/settings/width.rb:12 + def banner; end + + # pkg:gem/byebug#lib/byebug/settings/width.rb:16 + def to_s; end +end + +# pkg:gem/byebug#lib/byebug/settings/width.rb:10 +Byebug::WidthSetting::DEFAULT = T.let(T.unsafe(nil), Integer) + +# Extends the extension class to be able to pass information about the +# debugging environment from the c-extension to the user. +# +# pkg:gem/byebug#lib/byebug/core.rb:113 +class Exception + # pkg:gem/byebug#lib/byebug/core.rb:114 + def __bb_context; end +end + +# Adds a `byebug` method to the Kernel module. +# +# Dropping a `byebug` call anywhere in your code, you get a debug prompt. +# +# pkg:gem/byebug#lib/byebug/attacher.rb:34 +module Kernel + # pkg:gem/byebug#lib/byebug/attacher.rb:35 + def byebug; end + + # pkg:gem/byebug#lib/byebug/attacher.rb:47 + def debugger; end + + # pkg:gem/byebug#lib/byebug/attacher.rb:41 + def remote_byebug(host = T.unsafe(nil), port = T.unsafe(nil)); end +end diff --git a/sorbet/rbi/gems/cancancan@3.7.0.rbi b/sorbet/rbi/gems/cancancan@3.7.0.rbi new file mode 100644 index 000000000..fdfd1c0d0 --- /dev/null +++ b/sorbet/rbi/gems/cancancan@3.7.0.rbi @@ -0,0 +1,1958 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `cancancan` gem. +# Please instead update this file by running `bin/tapioca gem cancancan`. + + +# this class is responsible of converting the hash of conditions +# in "where conditions" to generate the sql query. +# Every association is given the table alias that ActiveRecord gives it when joining the associations, +# so it walks the joins in the same order and registers every joined table, through tables included. +# this class is responsible of normalizing the hash of conditions +# by exploding has_many through associations +# when a condition is defined with an has_many through association this is exploded in all its parts +# TODO: it could identify STI and normalize it +# this class is responsible for detecting sti classes and creating new rules for the +# relevant subclasses, using the inheritance_column as a merger +# +# pkg:gem/cancancan#lib/cancan/version.rb:3 +module CanCan + class << self + # Determines how CanCan should build queries when calling accessible_by, + # if the query will contain a join. The default strategy is `:subquery`. + # + # # config/initializers/cancan.rb + # CanCan.accessible_by_strategy = :subquery + # + # Valid strategies are: + # - :subquery - Creates a nested query with all joins, wrapped by a + # WHERE IN query. + # - :left_join - Calls the joins directly using `left_joins`, and + # ensures records are unique using `distinct`. Note that + # `distinct` is not reliable in some cases. See + # https://github.com/CanCanCommunity/cancancan/pull/605 + # - :joined_alias_exists_subquery, :joined_alias_each_rule_as_exists_subquery - + # Build an EXISTS subquery on an aliased table. + # - a subclass of CanCan::ModelAdapters::Strategies::Base - Your own + # strategy. Implement `execute!` and return the relation. + # + # pkg:gem/cancancan#lib/cancan/config.rb:54 + def accessible_by_strategy; end + + # pkg:gem/cancancan#lib/cancan/config.rb:71 + def accessible_by_strategy=(value); end + + # pkg:gem/cancancan#lib/cancan/config.rb:105 + def custom_accessible_by_strategy?(value); end + + # pkg:gem/cancancan#lib/cancan/config.rb:60 + def default_accessible_by_strategy; end + + # pkg:gem/cancancan#lib/cancan/config.rb:111 + def does_not_support_subquery_strategy?; end + + # You can disable the rules compressor if it's causing unexpected issues. + # + # pkg:gem/cancancan#lib/cancan/config.rb:15 + def rules_compressor_enabled; end + + # pkg:gem/cancancan#lib/cancan/config.rb:21 + def rules_compressor_enabled=(value); end + + # pkg:gem/cancancan#lib/cancan/config.rb:4 + def valid_accessible_by_strategies; end + + # pkg:gem/cancancan#lib/cancan/config.rb:97 + def validate_accessible_by_strategy!(value); end + + # Overrides the strategy for the duration of the block. The override is local to the current + # thread and fiber, so it never leaks into concurrent requests. + # + # pkg:gem/cancancan#lib/cancan/config.rb:83 + def with_accessible_by_strategy(value); end + + # pkg:gem/cancancan#lib/cancan/config.rb:25 + def with_rules_compressor_enabled(value); end + end +end + +# This module is designed to be included into an Ability class. This will +# provide the "can" methods for defining and checking abilities. +# +# class Ability +# include CanCan::Ability +# +# def initialize(user) +# if user.admin? +# can :manage, :all +# else +# can :read, :all +# end +# end +# end +# +# pkg:gem/cancancan#lib/cancan/ability/rules.rb:4 +module CanCan::Ability + include ::CanCan::Ability::Rules + include ::CanCan::Ability::Actions + include ::CanCan::UnauthorizedMessageResolver + include ::CanCan::Ability::StrongParameterSupport + + # pkg:gem/cancancan#lib/cancan/ability.rb:187 + def attributes_for(action, subject); end + + # See ControllerAdditions#authorize! for documentation. + # + # pkg:gem/cancancan#lib/cancan/ability.rb:178 + def authorize!(action, subject, *args); end + + # Defines which abilities are allowed using two arguments. The first one is the action + # you're setting the permission for, the second one is the class of object you're setting it on. + # + # can :update, Article + # + # You can pass an array for either of these parameters to match any one. + # Here the user has the ability to update or destroy both articles and comments. + # + # can [:update, :destroy], [Article, Comment] + # + # You can pass :all to match any object and :manage to match any action. Here are some examples. + # + # can :manage, :all + # can :update, :all + # can :manage, Project + # + # You can pass a hash of conditions as the third argument. Here the user can only see active projects which he owns. + # + # can :read, Project, :active => true, :user_id => user.id + # + # See ActiveRecordAdditions#accessible_by for how to use this in database queries. These conditions + # are also used for initial attributes when building a record in ControllerAdditions#load_resource. + # + # If the conditions hash does not give you enough control over defining abilities, you can use a block + # along with any Ruby code you want. + # + # can :update, Project do |project| + # project.groups.include?(user.group) + # end + # + # If the block returns true then the user has that :update ability for that project, otherwise he + # will be denied access. The downside to using a block is that it cannot be used to generate + # conditions for database queries. + # + # You can pass custom objects into this "can" method, this is usually done with a symbol + # and is useful if a class isn't available to define permissions on. + # + # can :read, :stats + # can? :read, :stats # => true + # + # IMPORTANT: Neither a hash of conditions nor a block will be used when checking permission on a class. + # + # can :update, Project, :priority => 3 + # can? :update, Project # => true + # + # If you pass no arguments to +can+, the action, class, and object will be passed to the block and the + # block will always be executed. This allows you to override the full behavior if the permissions are + # defined in an external source such as the database. + # + # can do |action, object_class, object| + # # check the database and return true/false + # end + # + # pkg:gem/cancancan#lib/cancan/ability.rb:144 + def can(action = T.unsafe(nil), subject = T.unsafe(nil), *attributes_and_conditions, &block); end + + # Check if the user has permission to perform a given action on an object. + # + # can? :destroy, @project + # + # You can also pass the class instead of an instance (if you don't have one handy). + # + # can? :create, Project + # + # Nested resources can be passed through a hash, this way conditions which are + # dependent upon the association will work when using a class. + # + # can? :create, @category => Project + # + # You can also pass multiple objects to check. You only need to pass a hash + # following the pattern { :any => [many subjects] }. The behaviour is check if + # there is a permission on any of the given objects. + # + # can? :create, {:any => [Project, Rule]} + # + # + # Any additional arguments will be passed into the "can" block definition. This + # can be used to pass more information about the user's request for example. + # The block is not called when a class is passed instead of an instance. + # + # can? :create, @project, request.remote_ip + # + # can :create, Project do |project, remote_ip| + # # ... + # end + # + # Not only can you use the can? method in the controller and view (see ControllerAdditions), + # but you can also call it directly on an ability instance. + # + # ability.can? :destroy, @project + # + # This makes testing a user's abilities very easy. + # + # def test "user can only destroy projects which he owns" + # user = User.new + # ability = Ability.new(user) + # assert ability.can?(:destroy, Project.new(:user => user)) + # assert ability.cannot?(:destroy, Project.new) + # end + # + # Also see the RSpec Matchers to aid in testing. + # + # pkg:gem/cancancan#lib/cancan/ability.rb:75 + def can?(action, subject, attribute = T.unsafe(nil), *extra_args); end + + # Defines an ability which cannot be done. Accepts the same arguments as "can". + # + # can :read, :all + # cannot :read, Comment + # + # A block can be passed just like "can", however if the logic is complex it is recommended + # to use the "can" method. + # + # cannot :read, Product do |product| + # product.invisible? + # end + # + # pkg:gem/cancancan#lib/cancan/ability.rb:160 + def cannot(action = T.unsafe(nil), subject = T.unsafe(nil), *attributes_and_conditions, &block); end + + # Convenience method which works the same as "can?" but returns the opposite value. + # + # cannot? :destroy, @project + # + # pkg:gem/cancancan#lib/cancan/ability.rb:87 + def cannot?(*args); end + + # pkg:gem/cancancan#lib/cancan/ability.rb:278 + def extract_rule_in_permissions(permissions_list, rule); end + + # pkg:gem/cancancan#lib/cancan/ability.rb:195 + def has_block?(action, subject); end + + # pkg:gem/cancancan#lib/cancan/ability.rb:199 + def has_raw_sql?(action, subject); end + + # Copies all rules and aliased actions of the given +CanCan::Ability+ and adds them to +self+. + # class ReadAbility + # include CanCan::Ability + # + # def initialize + # can :read, User + # alias_action :show, :index, to: :see + # end + # end + # + # class WritingAbility + # include CanCan::Ability + # + # def initialize + # can :edit, User + # alias_action :create, :update, to: :modify + # end + # end + # + # read_ability = ReadAbility.new + # read_ability.can? :edit, User.new #=> false + # read_ability.merge(WritingAbility.new) + # read_ability.can? :edit, User.new #=> true + # read_ability.aliased_actions #=> [:see => [:show, :index], :modify => [:create, :update]] + # + # If there are collisions when merging the +aliased_actions+, the actions on +self+ will be + # overwritten. + # + # class ReadAbility + # include CanCan::Ability + # + # def initialize + # alias_action :show, :index, to: :see + # end + # end + # + # class ShowAbility + # include CanCan::Ability + # + # def initialize + # alias_action :show, to: :see + # end + # end + # + # read_ability = ReadAbility.new + # read_ability.merge(ShowAbility) + # read_ability.aliased_actions #=> [:see => [:show]] + # + # pkg:gem/cancancan#lib/cancan/ability.rb:250 + def merge(ability); end + + # pkg:gem/cancancan#lib/cancan/ability.rb:172 + def model_adapter(model_class, action); end + + # Return a hash of permissions for the user in the format of: + # { + # can: can_hash, + # cannot: cannot_hash + # } + # + # Where can_hash and cannot_hash are formatted thusly: + # { + # action: { subject: [attributes] } + # } + # + # pkg:gem/cancancan#lib/cancan/ability.rb:269 + def permissions; end + + # User shouldn't specify targets with names of real actions or it will cause Seg fault + # + # pkg:gem/cancancan#lib/cancan/ability.rb:165 + def validate_target(target, actions = T.unsafe(nil)); end + + private + + # pkg:gem/cancancan#lib/cancan/ability.rb:306 + def alternative_subjects(subject); end + + # It translates to an array the subject or the hash with multiple subjects given to can?. + # + # pkg:gem/cancancan#lib/cancan/ability.rb:298 + def extract_subjects(subject); end + + # pkg:gem/cancancan#lib/cancan/ability.rb:289 + def unauthorized_message_keys(action, subject); end +end + +# pkg:gem/cancancan#lib/cancan/ability/actions.rb:5 +module CanCan::Ability::Actions + # Alias one or more actions into another one. + # + # alias_action :update, :destroy, :to => :modify + # can :modify, Comment + # + # Then :modify permission will apply to both :update and :destroy requests. + # + # can? :update, Comment # => true + # can? :destroy, Comment # => true + # + # This only works in one direction. Passing the aliased action into the "can?" call + # will not work because aliases are meant to generate more generic actions. + # + # alias_action :update, :destroy, :to => :modify + # can :update, Comment + # can? :modify, Comment # => false + # + # Unless that exact alias is used. + # + # can :modify, Comment + # can? :modify, Comment # => true + # + # The following aliases are added by default for conveniently mapping common controller actions. + # + # alias_action :index, :show, :to => :read + # alias_action :new, :to => :create + # alias_action :edit, :to => :update + # + # This way one can use params[:action] in the controller to determine the permission. + # + # pkg:gem/cancancan#lib/cancan/ability/actions.rb:35 + def alias_action(*args); end + + # Returns a hash of aliased actions. The key is the target and the value is an array of actions aliasing the key. + # + # pkg:gem/cancancan#lib/cancan/ability/actions.rb:45 + def aliased_actions; end + + # Removes previously aliased actions including the defaults. + # + # pkg:gem/cancancan#lib/cancan/ability/actions.rb:50 + def clear_aliased_actions; end + + private + + # Given an action, it will try to find all of the actions which are aliased to it. + # This does the opposite kind of lookup as expand_actions. + # + # pkg:gem/cancancan#lib/cancan/ability/actions.rb:67 + def aliases_for_action(action); end + + # pkg:gem/cancancan#lib/cancan/ability/actions.rb:57 + def default_alias_actions; end + + # Accepts an array of actions and returns an array of actions which match. + # This should be called before "matches?" and other checking methods since they + # rely on the actions to be expanded. + # + # pkg:gem/cancancan#lib/cancan/ability/actions.rb:82 + def expand_actions(actions); end + + # pkg:gem/cancancan#lib/cancan/ability/actions.rb:75 + def expanded_actions; end +end + +# pkg:gem/cancancan#lib/cancan/ability/rules.rb:5 +module CanCan::Ability::Rules + protected + + # Must be protected as an ability can merge with other abilities. + # This means that an ability must expose their rules with another ability. + # + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:10 + def rules; end + + private + + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:16 + def add_rule(rule); end + + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:21 + def add_rule_to_index(rule, position); end + + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:72 + def matching_rule(action, subject, attribute, *extra_args); end + + # Optimizes the order of the rules, so that rules with the :all subject are evaluated first. + # + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:109 + def optimize_order!(rules); end + + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:50 + def possible_relevant_rules(subject); end + + # Returns an array of Rule instances which match the action and subject + # This does not take into consideration any hash conditions or block statements + # + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:35 + def relevant_rules(action, subject); end + + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:84 + def relevant_rules_for_match(action, subject); end + + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:96 + def relevant_rules_for_query(action, subject); end + + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:78 + def sti_classes(subject); end + + # Returns nil when no rule matches. A class that uses single table inheritance is checked together with + # its subclasses, each one with the rules of its own ancestors: the check passes when any of them passes, + # which is also when `accessible_by` can return records. + # + # pkg:gem/cancancan#lib/cancan/ability/rules.rb:65 + def subject_can?(action, subject, attribute, *extra_args); end +end + +# pkg:gem/cancancan#lib/cancan/ability/strong_parameter_support.rb:5 +module CanCan::Ability::StrongParameterSupport + # This method returns all attributes which are explicity disallowed + # + # pkg:gem/cancancan#lib/cancan/ability/strong_parameter_support.rb:12 + def disallowed_attributes(action, subject); end + + # Returns an array of attributes suitable for use with strong parameters + # + # pkg:gem/cancancan#lib/cancan/ability/strong_parameter_support.rb:7 + def permitted_attributes(action, subject); end + + private + + # pkg:gem/cancancan#lib/cancan/ability/strong_parameter_support.rb:33 + def apply_attributes(rule, subject, set); end + + # Reversing the relevant rules is important. Normal order means that 'cannot' + # rules will come before 'can' rules. However, you can't remove attributes before + # they are added. The 'reverse' is so that attributes will be added before the + # 'cannot' rules remove them. + # + # pkg:gem/cancancan#lib/cancan/ability/strong_parameter_support.rb:25 + def fold_attributes(action, subject, &block); end + + # pkg:gem/cancancan#lib/cancan/ability/strong_parameter_support.rb:43 + def get_attributes(rule, subject); end +end + +# This error is raised when a user isn't allowed to access a given controller action. +# This usually happens within a call to ControllerAdditions#authorize! but can be +# raised manually. +# +# raise CanCan::AccessDenied.new("Not authorized!", :read, Article) +# +# The passed message, action, and subject are optional and can later be retrieved when +# rescuing from the exception. +# +# exception.message # => "Not authorized!" +# exception.action # => :read +# exception.subject # => Article +# +# If the message is not specified (or is nil) it will default to "You are not authorized +# to access this page." This default can be overridden by setting default_message. +# +# exception.default_message = "Default error message" +# exception.message # => "Default error message" +# +# See ControllerAdditions#authorize! for more information on rescuing from this exception +# and customizing the message using I18n. +# +# pkg:gem/cancancan#lib/cancan/exceptions.rb:46 +class CanCan::AccessDenied < ::CanCan::Error + # pkg:gem/cancancan#lib/cancan/exceptions.rb:50 + def initialize(message = T.unsafe(nil), action = T.unsafe(nil), subject = T.unsafe(nil), conditions = T.unsafe(nil)); end + + # pkg:gem/cancancan#lib/cancan/exceptions.rb:47 + def action; end + + # pkg:gem/cancancan#lib/cancan/exceptions.rb:47 + def conditions; end + + # pkg:gem/cancancan#lib/cancan/exceptions.rb:48 + def default_message=(_arg0); end + + # pkg:gem/cancancan#lib/cancan/exceptions.rb:62 + def inspect; end + + # pkg:gem/cancancan#lib/cancan/exceptions.rb:47 + def subject; end + + # pkg:gem/cancancan#lib/cancan/exceptions.rb:58 + def to_s; end +end + +# Raised when an unexpected argument is passed as an attribute +# +# pkg:gem/cancancan#lib/cancan/exceptions.rb:20 +class CanCan::AttributeArgumentError < ::CanCan::Error; end + +# Raised when using check_authorization without calling authorize! +# +# pkg:gem/cancancan#lib/cancan/exceptions.rb:14 +class CanCan::AuthorizationNotPerformed < ::CanCan::Error; end + +# Raised when a rule is created with both a block and a hash of conditions +# +# pkg:gem/cancancan#lib/cancan/exceptions.rb:17 +class CanCan::BlockAndConditionsError < ::CanCan::Error; end + +# pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:4 +module CanCan::ConditionsMatcher + # Matches the block or conditions hash + # + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:6 + def matches_conditions?(action, subject, attribute = T.unsafe(nil), *extra_args); end + + private + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:120 + def array_like_matches_condition_hash?(attribute, value); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:137 + def call_block_with_all(action, subject, *extra_args); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:91 + def condition_match?(attribute, value); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:149 + def conditions_empty?; end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:112 + def hash_condition_match?(attribute, value); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:71 + def matches_all_conditions?(adapter, subject, conditions); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:21 + def matches_block_conditions(subject, attribute, *extra_args); end + + # Checks if the given subject matches the given conditions hash. + # This behavior can be overridden by a model adapter by defining two class methods: + # override_matching_for_conditions?(subject, conditions) and + # matches_conditions_hash?(subject, conditions) + # + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:59 + def matches_conditions_hash?(subject, conditions = T.unsafe(nil)); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:81 + def matches_hash_conditions?(adapter, subject, conditions); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:31 + def matches_non_block_conditions(subject); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:145 + def model_adapter(subject); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:39 + def nested_subject_matches_conditions?(subject_hash); end + + # Like Active Record with a relation as condition value: the selected column, or the primary key, is matched. + # + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:108 + def relation_match?(attribute, relation); end + + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:16 + def subject_class?(subject); end + + # Like Active Record in the SQL conditions, a symbol matches the string with the same name. + # + # pkg:gem/cancancan#lib/cancan/conditions_matcher.rb:103 + def value_match?(attribute, value); end +end + +# This module is automatically included into all controllers. +# It also makes the "can?" and "cannot?" methods available to all views. +# +# pkg:gem/cancancan#lib/cancan/controller_additions.rb:6 +module CanCan::ControllerAdditions + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::CanCan::ControllerAdditions::ClassMethods + + # Raises a CanCan::AccessDenied exception if the current_ability cannot + # perform the given action. This is usually called in a controller action or + # before filter to perform the authorization. + # + # def show + # @article = Article.find(params[:id]) + # authorize! :read, @article + # end + # + # A :message option can be passed to specify a different message. + # + # authorize! :read, @article, :message => "Not authorized to read #{@article.name}" + # + # You can also use I18n to customize the message. Action aliases defined in Ability work here. + # + # en: + # unauthorized: + # manage: + # all: "Not authorized to %{action} %{subject}." + # user: "Not allowed to manage other user accounts." + # update: + # project: "Not allowed to update this project." + # + # You can rescue from the exception in the controller to customize how unauthorized + # access is displayed to the user. + # + # class ApplicationController < ActionController::Base + # rescue_from CanCan::AccessDenied do |exception| + # redirect_to root_url, :alert => exception.message + # end + # end + # + # See the CanCan::AccessDenied exception for more details on working with the exception. + # + # See the load_and_authorize_resource method to automatically add the authorize! behavior + # to the default RESTful actions. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:352 + def authorize!(*args); end + + # Use in the controller or view to check the user's permission for a given action + # and object. + # + # can? :destroy, @project + # + # You can also pass the class instead of an instance (if you don't have one handy). + # + # <% if can? :create, Project %> + # <%= link_to "New Project", new_project_path %> + # <% end %> + # + # If it's a nested resource, you can pass the parent instance in a hash. This way it will + # check conditions which reach through that association. + # + # <% if can? :create, @category => Project %> + # <%= link_to "New Project", new_project_path %> + # <% end %> + # + # This simply calls "can?" on the current_ability. See Ability#can?. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:391 + def can?(*args); end + + # Convenience method which works the same as "can?" but returns the opposite value. + # + # cannot? :destroy, @project + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:399 + def cannot?(*args); end + + # Creates and returns the current user's ability and caches it. If you + # want to override how the Ability is defined then this is the place. + # Just define the method in the controller to change behavior. + # + # def current_ability + # # instead of Ability.new(current_user) + # @current_ability ||= UserAbility.new(current_account) + # end + # + # Notice it is important to cache the ability object so it is not + # recreated every time. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:368 + def current_ability; end + + class << self + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:310 + def included(base); end + end + + module GeneratedClassMethods + def _cancan_skipper; end + def _cancan_skipper=(value); end + def _cancan_skipper?; end + end + + module GeneratedInstanceMethods + def _cancan_skipper; end + def _cancan_skipper=(value); end + def _cancan_skipper?; end + end +end + +# pkg:gem/cancancan#lib/cancan/controller_additions.rb:7 +module CanCan::ControllerAdditions::ClassMethods + # Sets up a before filter which authorizes the resource using the instance variable. + # For example, if you have an ArticlesController it will check the @article instance variable + # and ensure the user can perform the current action on it. Under the hood it is doing + # something like the following. + # + # authorize!(params[:action].to_sym, @article || Article) + # + # Call this method directly on the controller class. + # + # class BooksController < ApplicationController + # authorize_resource + # end + # + # If you pass in the name of a resource which does not match the controller it will assume + # it is a parent resource. + # + # class BooksController < ApplicationController + # authorize_resource :author + # authorize_resource :book + # end + # + # Here it will authorize :+show+, @+author+ on every action before authorizing the book. + # + # That first argument is optional and will default to the singular name of the controller. + # A hash of options (see below) can also be passed to this method to further customize it. + # + # See load_and_authorize_resource to automatically load the resource too. + # + # Options: + # [:+only+] + # Only applies before filter to given actions. + # + # [:+except+] + # Does not apply before filter to given actions. + # + # [:+singleton+] + # Pass +true+ if this is a singleton resource through a +has_one+ association. + # + # [:+parent+] + # True or false depending on if the resource is considered a parent resource. + # This defaults to +true+ if a resource name is given which does not match the controller. + # + # [:+class+] + # The class to use for the model (string or constant). This passed in when the instance variable is not set. + # Pass +false+ if there is no associated class for this resource and it will use a symbol of the resource name. + # + # [:+instance_name+] + # The name of the instance variable for this resource. + # + # [:+id_param+] + # Find using a param key other than :id. For example: + # + # load_resource :id_param => :url # will use find(params[:url]) + # + # [:+through+] + # Authorize conditions on this parent resource when instance isn't available. + # + # [:+prepend+] + # Passing +true+ will use prepend_before_action instead of a normal before_action. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:186 + def authorize_resource(*args); end + + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:292 + def cancan_resource_class; end + + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:296 + def cancan_skipper; end + + # Add this to a controller to ensure it performs authorization through +authorize+! or +authorize_resource+ call. + # If neither of these authorization methods are called, + # a CanCan::AuthorizationNotPerformed exception will be raised. + # This is normally added to the ApplicationController to ensure all controller actions do authorization. + # + # class ApplicationController < ActionController::Base + # check_authorization + # end + # + # See skip_authorization_check to bypass this check on specific controller actions. + # + # Options: + # [:+only+] + # Only applies to given actions. + # + # [:+except+] + # Does not apply to given actions. + # + # [:+if+] + # Supply the name of a controller method to be called. + # The authorization check only takes place if this returns true. + # + # check_authorization :if => :admin_controller? + # + # [:+unless+] + # Supply the name of a controller method to be called. + # The authorization check only takes place if this returns false. + # + # check_authorization :unless => :devise_controller? + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:266 + def check_authorization(options = T.unsafe(nil)); end + + # Sets up a before filter which loads and authorizes the current resource. This performs both + # load_resource and authorize_resource and accepts the same arguments. See those methods for details. + # + # class BooksController < ApplicationController + # load_and_authorize_resource + # end + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:15 + def load_and_authorize_resource(*args); end + + # Sets up a before filter which loads the model resource into an instance variable. + # For example, given an ArticlesController it will load the current article into the @article + # instance variable. It does this by either calling Article.find(params[:id]) or + # Article.new(params[:article]) depending upon the action. The index action will + # automatically set @articles to Article.accessible_by(current_ability). + # + # If a conditions hash is used in the Ability, the +new+ and +create+ actions will set + # the initial attributes based on these conditions. This way these actions will satisfy + # the ability restrictions. + # + # Call this method directly on the controller class. + # + # class BooksController < ApplicationController + # load_resource + # end + # + # A resource is not loaded if the instance variable is already set. This makes it easy to override + # the behavior through a before_action on certain actions. + # + # class BooksController < ApplicationController + # before_action :find_book_by_permalink, :only => :show + # load_resource + # + # private + # + # def find_book_by_permalink + # @book = Book.find_by_permalink!(params[:id]) + # end + # end + # + # If a name is provided which does not match the controller it assumes it is a parent resource. Child + # resources can then be loaded through it. + # + # class BooksController < ApplicationController + # load_resource :author + # load_resource :book, :through => :author + # end + # + # Here the author resource will be loaded before each action using params[:author_id]. The book resource + # will then be loaded through the @author instance variable. + # + # That first argument is optional and will default to the singular name of the controller. + # A hash of options (see below) can also be passed to this method to further customize it. + # + # See load_and_authorize_resource to automatically authorize the resource too. + # + # Options: + # [:+only+] + # Only applies before filter to given actions. + # + # [:+except+] + # Does not apply before filter to given actions. + # + # [:+through+] + # Load this resource through another one. This should match the name of the parent instance variable or method. + # + # [:+through_association+] + # The name of the association to fetch the child records through the parent resource. + # This is normally not needed because it defaults to the pluralized resource name, + # or to the singular resource name when +:singleton+ is used. + # + # [:+shallow+] + # Pass +true+ to allow this resource to be loaded directly when parent is +nil+. Defaults to +false+. + # + # [:+singleton+] + # Pass +true+ if this is a singleton resource through a +has_one+ association. + # + # [:+parent+] + # True or false depending on if the resource is considered a parent resource. + # This defaults to +true+ if a resource name is given which does not match the controller. + # + # [:+class+] + # The class to use for the model (string or constant). + # + # [:+instance_name+] + # The name of the instance variable to load the resource into. + # + # [:+find_by+] + # Find using a different attribute other than id. For example. + # + # load_resource :find_by => :permalink # will use find_by_permalink!(params[:id]) + # + # [:+id_param+] + # Find using a param key other than :id. For example: + # + # load_resource :id_param => :url # will use find(params[:url]) + # + # [:+collection+] + # Specify which actions are resource collection actions in addition to :+index+. This + # is usually not necessary because it will try to guess depending on if the id param is present. + # + # load_resource :collection => [:sort, :list] + # + # [:+new+] + # Specify which actions are new resource actions in addition to :+new+ and :+create+. + # Pass an action name into here if you would like to build a new resource instead of + # fetch one. + # + # load_resource :new => :build + # + # [:+prepend+] + # Passing +true+ will use prepend_before_action instead of a normal before_action. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:122 + def load_resource(*args); end + + # Call this in the class of a controller to skip the check_authorization behavior on the actions. + # + # class HomeController < ApplicationController + # skip_authorization_check :only => :index + # end + # + # Any arguments are passed to the +before_action+ it triggers. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:287 + def skip_authorization_check(*args); end + + # Skip the authorization behavior of CanCan. This is useful when using +load_and_authorize_resource+ but want to + # only do loading on certain actions. You can pass :only and :except options to specify which actions to + # skip the effects on. It will apply to all actions by default. + # + # class ProjectsController < ApplicationController + # load_and_authorize_resource + # skip_authorize_resource :only => :index + # end + # + # You can also pass the resource name as the first argument to skip that resource. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:230 + def skip_authorize_resource(*args); end + + # Skip both the loading and authorization behavior of CanCan for this given controller. This is primarily + # useful to skip the behavior of a superclass. You can pass :only and :except options to specify which actions + # to skip the effects on. It will apply to all actions by default. + # + # class ProjectsController < SomeOtherController + # skip_load_and_authorize_resource :only => :index + # end + # + # You can also pass the resource name as the first argument to skip that resource. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:199 + def skip_load_and_authorize_resource(*args); end + + # Skip the loading behavior of CanCan. This is useful when using +load_and_authorize_resource+ but want to + # only do authorization on certain actions. You can pass :only and :except options to specify which actions to + # skip the effects on. It will apply to all actions by default. + # + # class ProjectsController < ApplicationController + # load_and_authorize_resource + # skip_load_resource :only => :index + # end + # + # You can also pass the resource name as the first argument to skip that resource. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:214 + def skip_load_resource(*args); end + + private + + # _cancan_skipper is a class_attribute: a subclass shares the hash of its superclass until it assigns + # its own. Assign a copy, so a skip in a subclass does not change the superclass or sibling classes. + # + # pkg:gem/cancancan#lib/cancan/controller_additions.rb:304 + def add_cancan_skip(behavior, name, options); end +end + +# Handle the load and authorization controller logic +# so we don't clutter up all controllers with non-interface methods. +# This class is used internally, so you do not need to call methods directly on it. +# +# pkg:gem/cancancan#lib/cancan/controller_resource.rb:7 +class CanCan::ControllerResource + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:22 + def initialize(controller, *args); end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:44 + def authorize_resource; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:29 + def load_and_authorize_resource; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:34 + def load_resource; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:50 + def parent?; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:54 + def skip?(behavior); end + + protected + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:261 + def assign_attributes(resource); end + + # The parent is assigned through the setter named after the :through option when the resource has one, + # otherwise through the inverse of the association on the parent. + # + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:271 + def assign_parent(resource); end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:138 + def authorization_action; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:256 + def build_resource; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:112 + def collection_actions; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:156 + def collection_instance; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:152 + def collection_instance=(instance); end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:174 + def fetch_parent(name); end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:233 + def find_by_dynamic_finder; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:238 + def find_by_find_by_finder; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:218 + def find_resource; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:229 + def find_resource_using_find_by; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:242 + def id_param; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:248 + def id_param_key; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:294 + def initial_attributes; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:80 + def instance_name; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:277 + def inverse_association_name; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:287 + def inverse_of_association(parent_class, association_name); end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:162 + def load_collection; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:130 + def load_collection?; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:126 + def load_instance?; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:166 + def load_resource_instance; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:120 + def member_action?; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:64 + def name; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:68 + def name_from_controller; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:72 + def namespace; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:76 + def namespaced_name; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:108 + def new_actions; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:312 + def parameters_require_sanitizing?; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:345 + def params_method; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:339 + def params_methods; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:134 + def parent_authorization_action; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:187 + def parent_name; end + + # The object to load this resource through. + # + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:183 + def parent_resource; end + + # The object that methods (such as "find", "new" or "build") are called on. + # If the :through option is passed it will go through an association on that instance. + # If the :shallow option is passed it will use the resource_class if there's no parent + # If the :singleton option is passed it won't use the association because it needs to be handled later. + # + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:214 + def resource_base; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:199 + def resource_base_through; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:191 + def resource_base_through_parent_resource; end + + # Returns the class used for this resource. This can be overridden by the :class option. + # If +false+ is passed in it will use the resource name as a symbol in which case it should + # only be used for authorization, not loading since there's no class to load through. + # + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:87 + def resource_class; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:91 + def resource_class_from_options; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:104 + def resource_class_with_parent; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:146 + def resource_instance; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:142 + def resource_instance=(instance); end + + # The params method of the controller can have side effects, so it is called at most once per request. + # + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:301 + def resource_params; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:316 + def resource_params_by_key(key); end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:322 + def resource_params_by_namespaced_name; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:328 + def sanitize_parameters; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:116 + def save_actions; end + + private + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:355 + def action_exists_in?(options); end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:363 + def adapter; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:367 + def current_ability; end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:359 + def extract_key(value); end + + class << self + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:8 + def add_before_action(controller_class, method, *args); end + + # pkg:gem/cancancan#lib/cancan/controller_resource.rb:18 + def before_callback_name(options); end + end +end + +# A general CanCan exception +# +# pkg:gem/cancancan#lib/cancan/exceptions.rb:5 +class CanCan::Error < ::StandardError; end + +# Raised when removed code is called, an alternative solution is provided in message. +# +# pkg:gem/cancancan#lib/cancan/exceptions.rb:11 +class CanCan::ImplementationRemoved < ::CanCan::Error; end + +# pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:4 +module CanCan::ModelAdapters; end + +# pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:5 +class CanCan::ModelAdapters::AbstractAdapter + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:75 + def initialize(model_class, rules); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:80 + def database_records; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:6 + def model_class; end + + class << self + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:13 + def adapter_class(model_class); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:48 + def conditions_only_on_parent?(parent, child, conditions); end + + # Override if you need custom find behavior + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:23 + def find(model_class, id); end + + # Used to determine if the given adapter should be used for the passed in class. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:18 + def for_class?(_member_class); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:8 + def inherited(subclass); end + + # Override if override_condition_matching? returns true + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:71 + def matches_condition?(_subject, _name, _value); end + + # Override if override_conditions_hash_matching? returns true + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:34 + def matches_conditions_hash?(_subject, _conditions); end + + # Override if override_nested_subject_conditions_matching? returns true + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:60 + def nested_subject_matches_conditions?(_parent, _child, _all_conditions); end + + # Used to determine if this model adapter will override the matching behavior for a specific condition. + # If this returns true then matches_condition? will be called. See Rule#matches_conditions_hash + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:66 + def override_condition_matching?(_subject, _name, _value); end + + # Used to determine if this model adapter will override the matching behavior for a hash of conditions. + # If this returns true then matches_conditions_hash? will be called. See Rule#matches_conditions_hash + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:29 + def override_conditions_hash_matching?(_subject, _conditions); end + + # Used above override_conditions_hash_matching to determine if this model adapter will override the + # matching behavior for nested subject. + # If this returns true then nested_subject_matches_conditions? will be called. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:55 + def override_nested_subject_conditions_matching?(_parent, _child, _all_conditions); end + + # Override if conditions on the parent could be under other keys, like a foreign key + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:44 + def parent_condition_keys(parent, child); end + + # Override if parent condition could be under a different key in conditions + # + # pkg:gem/cancancan#lib/cancan/model_adapters/abstract_adapter.rb:39 + def parent_condition_name(parent, _child); end + end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/active_record_4_adapter.rb:5 +class CanCan::ModelAdapters::ActiveRecord4Adapter < ::CanCan::ModelAdapters::ActiveRecordAdapter + private + + # As of rails 4, `includes()` no longer causes active record to + # look inside the where clause to decide to outer join tables + # you're using in the where. Instead, `references()` is required + # in addition to `includes()` to force the outer join. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_4_adapter.rb:37 + def build_joins_relation(relation, *_where_conditions); end + + # Rails 4.2 deprecates `sanitize_sql_hash_for_conditions` + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_4_adapter.rb:42 + def sanitize_sql(conditions); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_4_adapter.rb:50 + def sanitize_sql_activerecord4(conditions); end + + class << self + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_4_adapter.rb:9 + def for_class?(model_class); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_4_adapter.rb:17 + def matches_condition?(subject, name, value); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_4_adapter.rb:13 + def override_condition_matching?(subject, name, _value); end + end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:5 +class CanCan::ModelAdapters::ActiveRecord5Adapter < ::CanCan::ModelAdapters::ActiveRecord4Adapter + private + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:24 + def build_joins_relation(relation, *where_conditions); end + + # Rails 7.2 soft-deprecated ActiveRecord::Base.connection in favour of + # lease_connection, which better describes its lifecycle. Fall back to + # connection for Rails < 7.2 where lease_connection is not defined. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:80 + def model_connection; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:62 + def predicate_builder(model_class, table); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:51 + def predicates(conditions, conditions_extractor); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:35 + def sanitize_sql(conditions, conditions_extractor = T.unsafe(nil)); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:47 + def sanitize_sql_activerecord5(conditions, conditions_extractor); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:28 + def strategy_class; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:66 + def visit_nodes(node); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:43 + def where_node(conditions, conditions_extractor); end + + class << self + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:8 + def for_class?(model_class); end + + # rails 5 is capable of using strings in enum + # but often people use symbols in rules + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_5_adapter.rb:14 + def matches_condition?(subject, name, value); end + end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:8 +class CanCan::ModelAdapters::ActiveRecordAdapter < ::CanCan::ModelAdapters::AbstractAdapter + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:19 + def initialize(model_class, rules); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:143 + def build_relation(*where_conditions); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:17 + def compressed_rules; end + + # Returns conditions intended to be used inside a database query. Normally you will not call this + # method directly, but instead go through ModelAdditions#accessible_by. + # + # If there is only one "can" definition, a hash of conditions will be returned matching the one defined. + # + # can :manage, User, :id => 1 + # query(:manage, User).conditions # => { :id => 1 } + # + # If there are multiple "can" definitions, a SQL string will be returned to handle complex cases. + # + # can :manage, User, :id => 1 + # can :manage, User, :manager_id => 1 + # cannot :manage, User, :self_managed => true + # query(:manage, User).conditions # => "not (self_managed = 't') AND ((manager_id = 1) OR (id = 1))" + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:121 + def conditions; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:133 + def database_records; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:125 + def extract_multiple_conditions(conditions_extractor, rules); end + + # Returns the associations used in conditions for the :joins option of a search. + # See ModelAdditions#accessible_by + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:153 + def joins; end + + private + + # Removes empty hashes and moves everything into arrays. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:187 + def deep_clean(joins_hash); end + + # Takes two hashes and does a deep merge. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:192 + def deep_merge(base_hash, added_hash); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:163 + def extract_conditions(conditions_extractor); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:267 + def false_sql; end + + # Returns the merged sql and whether it is a flat chain of OR conditions. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:229 + def merge_conditions(sql, or_chain, conditions_hash, behavior, conditions_extractor); end + + # Consecutive `can` rules are joined in a flat chain of ORs, so that the nesting of the query only grows + # when `can` and `cannot` rules alternate. Deeply nested conditions overflow the parser of SQLite. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:239 + def merge_non_empty_conditions(behavior, conditions, sql, or_chain); end + + # `merge` replaces the conditions of the base relation on the columns the scope also constrains, + # so the conditions it dropped, like the one of an association like `category.articles`, are applied again. + # The conditions the scope removes with `unscope`, like the ones of a default scope, stay removed. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:205 + def merge_override_scope; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:250 + def merge_with_previous_conditions(behavior, conditions, sql, or_chain); end + + # A cannot rule only excludes the records that match its conditions: NULL does not match. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:259 + def not_conditions(conditions); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:263 + def or_conditions(conditions, sql, or_chain); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:213 + def override_scope; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:221 + def raise_override_scope_error; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:275 + def sanitize_sql(conditions, _conditions_extractor = T.unsafe(nil)); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:271 + def true_sql; end + + # Active Record cannot find the model of an aliased table in a hash of conditions, + # so the conditions on associations are converted to SQL with the model of each table. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:174 + def where_conditions; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:182 + def where_node(conditions, conditions_extractor); end + + class << self + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:83 + def child_association_to_parent(parent, child); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:73 + def matching_parent_child_polymorphic_association(parent_assoc, child_class); end + + # parent_id condition can be an array of integer or one integer, we check the parent against this + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:40 + def nested_subject_matches_conditions?(parent, child, all_conditions); end + + # When belongs_to parent_id is a condition for a model, + # we want to check the parent when testing ability for a hash {parent => model} + # + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:35 + def override_nested_subject_conditions_matching?(parent, child, all_conditions); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:52 + def parent_child_conditions(parent, child, all_conditions); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:57 + def parent_child_foreign_key(parent, child); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:48 + def parent_condition_keys(parent, child); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:101 + def parent_condition_name(parent, child); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:9 + def version_greater_or_equal?(version); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/active_record_adapter.rb:13 + def version_lower?(version); end + end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:9 +class CanCan::ModelAdapters::ConditionsExtractor + # Pass the associations given to `joins` and then to `left_joins`, as they are joined by ActiveRecord. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:11 + def initialize(model_class, *joins); end + + # The model class of a table alias returned by tableize_conditions. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:34 + def model_class_for(table_alias); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:21 + def tableize_conditions(conditions, model_class = T.unsafe(nil), path = T.unsafe(nil)); end + + private + + # Mirrors ActiveRecord::Associations::AliasTracker#aliased_table_for + # + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:107 + def aliased_table_for(table_name); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:122 + def connection; end + + # Mirrors ActiveRecord::Associations::JoinDependency#make_constraints + # + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:82 + def join_table(parent_class, chain, index); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:48 + def joins_tree(joins); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:69 + def register_association(parent_class, reflection, path); end + + # Mirrors ActiveRecord::Associations::JoinDependency#walk: the associations already joined come first. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:58 + def register_joins(model_class, tree, path); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:96 + def reuse_joined_table(remaining_chain, table, root); end + + # ActiveRecord reuses the through tables of the associations already joined since version 6.1 + # + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:102 + def reuse_joined_table?(table, root, terminated); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:118 + def table_alias_length; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_extractor.rb:40 + def tableize_association(model_class, path, conditions, result_hash); end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/conditions_normalizer.rb:7 +class CanCan::ModelAdapters::ConditionsNormalizer + class << self + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_normalizer.rb:9 + def normalize(model_class, rules); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_normalizer.rb:13 + def normalize_conditions(model_class, conditions); end + + private + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_normalizer.rb:28 + def calculate_result_hash(model_class, key, value); end + + # A through association with its own scope is not exploded, because its parts do not keep + # that scope. Active Record joins it with the scope, unless the scope takes the record as argument. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_normalizer.rb:51 + def joinable_with_scope?(reflection); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/conditions_normalizer.rb:43 + def normalizable_association?(reflection); end + end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/default_adapter.rb:5 +class CanCan::ModelAdapters::DefaultAdapter < ::CanCan::ModelAdapters::AbstractAdapter; end + +# pkg:gem/cancancan#lib/cancan/model_adapters/sti_normalizer.rb:7 +class CanCan::ModelAdapters::StiNormalizer + class << self + # pkg:gem/cancancan#lib/cancan/model_adapters/sti_normalizer.rb:9 + def normalize(rules); end + + private + + # create a new rule for the subclasses that links on the inheritance_column + # + # pkg:gem/cancancan#lib/cancan/model_adapters/sti_normalizer.rb:25 + def build_rule_for_subclass(rule, subject); end + + # The rules for the subclasses take the place of the original rule, so their precedence is kept. + # + # pkg:gem/cancancan#lib/cancan/model_adapters/sti_normalizer.rb:18 + def normalized_rules(rule); end + end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:3 +class CanCan::ModelAdapters::Strategies; end + +# pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:4 +class CanCan::ModelAdapters::Strategies::Base + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:20 + def initialize(adapter:, relation:, where_conditions:); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:5 + def adapter; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:26 + def aliased_table_name; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:7 + def compressed_rules(*, **, &); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:17 + def connection(*, **, &); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:7 + def extract_multiple_conditions(*, **, &); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:7 + def joins(*, **, &); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:7 + def model_class(*, **, &); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:18 + def quote_table_name(*, **, &); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:7 + def quoted_aliased_table_name; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:7 + def quoted_primary_key(*, **, &); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:7 + def quoted_table_name; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:5 + def relation; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/base.rb:5 + def where_conditions; end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_each_rule_as_exists_subquery.rb:6 +class CanCan::ModelAdapters::Strategies::JoinedAliasEachRuleAsExistsSubquery < ::CanCan::ModelAdapters::Strategies::Base + # Converts an array like [:child, :grand_child] into a hash like {child: {grand_child: {}} + # + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_each_rule_as_exists_subquery.rb:78 + def current_path_to_hash(current_path); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_each_rule_as_exists_subquery.rb:16 + def double_exists_sql; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_each_rule_as_exists_subquery.rb:7 + def execute!; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_each_rule_as_exists_subquery.rb:55 + def extra_joins_recursive(current_path, conditions, joins, left_joins); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_each_rule_as_exists_subquery.rb:67 + def extra_joins_recursive_merge_joins(current_path, value, joins, left_joins); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_each_rule_as_exists_subquery.rb:47 + def extract_joins_from_rule(rule); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_each_rule_as_exists_subquery.rb:27 + def sub_query_for_rule(rule); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_each_rule_as_exists_subquery.rb:34 + def sub_query_for_rules_and_join_hashes(rule_where_conditions, joins_hash, left_joins_hash); end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_exists_subquery.rb:6 +class CanCan::ModelAdapters::Strategies::JoinedAliasExistsSubquery < ::CanCan::ModelAdapters::Strategies::Base + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_exists_subquery.rb:7 + def execute!; end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/joined_alias_exists_subquery.rb:16 + def joined_alias_exists_subquery_inner_query; end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/strategies/left_join.rb:4 +class CanCan::ModelAdapters::Strategies::LeftJoin < ::CanCan::ModelAdapters::Strategies::Base + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/left_join.rb:5 + def execute!; end +end + +# pkg:gem/cancancan#lib/cancan/model_adapters/strategies/subquery.rb:4 +class CanCan::ModelAdapters::Strategies::Subquery < ::CanCan::ModelAdapters::Strategies::Base + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/subquery.rb:9 + def build_joins_relation_subquery(where_conditions); end + + # pkg:gem/cancancan#lib/cancan/model_adapters/strategies/subquery.rb:5 + def execute!; end +end + +# This module adds the accessible_by class method to a model. It is included in the model adapters. +# +# pkg:gem/cancancan#lib/cancan/model_additions.rb:5 +module CanCan::ModelAdditions + mixes_in_class_methods ::CanCan::ModelAdditions::ClassMethods + + class << self + # pkg:gem/cancancan#lib/cancan/model_additions.rb:30 + def included(base); end + end +end + +# pkg:gem/cancancan#lib/cancan/model_additions.rb:6 +module CanCan::ModelAdditions::ClassMethods + # Returns a scope which fetches only the records that the passed ability + # can perform a given action on. The action defaults to :index. This + # is usually called from a controller and passed the +current_ability+. + # + # @articles = Article.accessible_by(current_ability) + # + # Here only the articles which the user is able to read will be returned. + # If the user does not have permission to read any articles then an empty + # result is returned. Since this is a scope it can be combined with any + # other scopes or pagination. + # + # An alternative action can optionally be passed as a second argument. + # + # @articles = Article.accessible_by(current_ability, :update) + # + # Here only the articles which the user can update are returned. + # + # pkg:gem/cancancan#lib/cancan/model_additions.rb:23 + def accessible_by(ability, action = T.unsafe(nil), strategy: T.unsafe(nil)); end +end + +# Raised when behavior is not implemented, usually used in an abstract class. +# +# pkg:gem/cancancan#lib/cancan/exceptions.rb:8 +class CanCan::NotImplemented < ::CanCan::Error; end + +# pkg:gem/cancancan#lib/cancan/parameter_validators.rb:4 +module CanCan::ParameterValidators + # pkg:gem/cancancan#lib/cancan/parameter_validators.rb:5 + def valid_attribute_param?(attribute); end +end + +# pkg:gem/cancancan#lib/cancan/relevant.rb:4 +module CanCan::Relevant + # pkg:gem/cancancan#lib/cancan/relevant.rb:11 + def only_for_subclasses_of?(klass); end + + # Matches both the action, subject, and attribute, not necessarily the conditions + # + # pkg:gem/cancancan#lib/cancan/relevant.rb:6 + def relevant?(action, subject); end + + private + + # pkg:gem/cancancan#lib/cancan/relevant.rb:17 + def matches_action?(action); end + + # pkg:gem/cancancan#lib/cancan/relevant.rb:21 + def matches_subject?(subject); end + + # pkg:gem/cancancan#lib/cancan/relevant.rb:25 + def matches_subject_class?(subject); end +end + +# This class is used internally and should only be called through Ability. +# it holds the information about a "can" call made on Ability and provides +# helpful methods to determine permission checking and conditions hash generation. +# +# pkg:gem/cancancan#lib/cancan/rule.rb:11 +class CanCan::Rule + include ::CanCan::ConditionsMatcher + include ::CanCan::Relevant + include ::CanCan::ParameterValidators + + # The first argument when initializing is the base_behavior which is a true/false + # value. True for "can" and false for "cannot". The next two arguments are the action + # and subject respectively (such as :read, @project). The third argument is a hash + # of conditions and the last one is the block passed to the "can" call. + # + # pkg:gem/cancancan#lib/cancan/rule.rb:22 + def initialize(base_behavior, action, subject, *extra_args, &block); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:15 + def actions; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:77 + def associations_hash(conditions = T.unsafe(nil)); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:15 + def attributes; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:87 + def attributes_from_conditions; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:15 + def base_behavior; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:15 + def block; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:51 + def can_rule?; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:55 + def cannot_catch_all?; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:59 + def catch_all?; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:15 + def conditions; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:16 + def conditions=(_arg0); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:16 + def expanded_actions=(_arg0); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:38 + def inspect; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:97 + def matches_attributes?(attribute); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:65 + def only_block?; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:69 + def only_raw_sql?; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:15 + def subjects; end + + # pkg:gem/cancancan#lib/cancan/rule.rb:73 + def with_scope?; end + + private + + # pkg:gem/cancancan#lib/cancan/rule.rb:124 + def condition_and_block_check(conditions, block, action, subject); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:106 + def matches_action?(action); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:110 + def matches_subject?(subject); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:114 + def matches_subject_class?(subject); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:118 + def parse_attributes_from_extra_args(args); end + + # pkg:gem/cancancan#lib/cancan/rule.rb:131 + def wrap(object); end +end + +# pkg:gem/cancancan#lib/cancan/rules_compressor.rb:5 +class CanCan::RulesCompressor + # pkg:gem/cancancan#lib/cancan/rules_compressor.rb:8 + def initialize(rules); end + + # pkg:gem/cancancan#lib/cancan/rules_compressor.rb:13 + def compress(array); end + + # pkg:gem/cancancan#lib/cancan/rules_compressor.rb:6 + def initial_rules; end + + # pkg:gem/cancancan#lib/cancan/rules_compressor.rb:6 + def rules_collapsed; end + + # If we have A OR (!A AND anything ), then we can simplify to A OR anything + # If we have A OR (A OR anything ), then we can simplify to A OR anything + # If we have !A AND (A OR something), then we can simplify it to !A AND something + # If we have !A AND (!A AND something), then we can simplify it to !A AND something + # + # So as soon as we see a condition that is the same as the previous one, + # we can skip it, no matter of the base_behavior + # + # pkg:gem/cancancan#lib/cancan/rules_compressor.rb:31 + def simplify(rules); end +end + +# pkg:gem/cancancan#lib/cancan/unauthorized_message_resolver.rb:4 +module CanCan::UnauthorizedMessageResolver + # pkg:gem/cancancan#lib/cancan/unauthorized_message_resolver.rb:16 + def translate_subject(subject); end + + # pkg:gem/cancancan#lib/cancan/unauthorized_message_resolver.rb:5 + def unauthorized_message(action, subject); end +end + +# pkg:gem/cancancan#lib/cancan/version.rb:4 +CanCan::VERSION = T.let(T.unsafe(nil), String) + +# Raised when using a wrong association name +# +# pkg:gem/cancancan#lib/cancan/exceptions.rb:23 +class CanCan::WrongAssociationName < ::CanCan::Error; end + +# pkg:gem/cancancan#lib/cancancan.rb:5 +module CanCanCan; end + +# pkg:gem/cancancan#lib/cancan/sti_detector.rb:3 +class StiDetector + class << self + # pkg:gem/cancancan#lib/cancan/sti_detector.rb:4 + def sti_class?(subject); end + end +end + +# This class is responsible for matching classes and their subclasses as well as +# upmatching classes to their ancestors. +# This is used to generate sti connections +# +# pkg:gem/cancancan#lib/cancan/class_matcher.rb:6 +class SubjectClassMatcher + class << self + # pkg:gem/cancancan#lib/cancan/class_matcher.rb:25 + def matches_class_or_is_related(subject, sub); end + + # pkg:gem/cancancan#lib/cancan/class_matcher.rb:7 + def matches_subject_class?(subjects, subject); end + + # pkg:gem/cancancan#lib/cancan/class_matcher.rb:14 + def matching_class_check(subject, sub, has_subclasses); end + end +end diff --git a/sorbet/rbi/gems/capybara@3.40.0.rbi b/sorbet/rbi/gems/capybara@3.40.0.rbi new file mode 100644 index 000000000..e953b951e --- /dev/null +++ b/sorbet/rbi/gems/capybara@3.40.0.rbi @@ -0,0 +1,8285 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `capybara` gem. +# Please instead update this file by running `bin/tapioca gem capybara`. + + +# pkg:gem/capybara#lib/capybara/session/config.rb:5 +module Capybara + extend ::Capybara::DSL + + class << self + # Parse raw html into a document using Nokogiri, and adjust textarea contents as defined by the spec. + # + # @param [String] html The raw html + # @return [Nokogiri::HTML::Document] HTML document + # + # pkg:gem/capybara#lib/capybara.rb:390 + def HTML(html); end + + # Add a new selector to Capybara. Selectors can be used by various methods in Capybara + # to find certain elements on the page in a more convenient way. For example adding a + # selector to find certain table rows might look like this: + # + # Capybara.add_selector(:row) do + # xpath { |num| ".//tbody/tr[#{num}]" } + # end + # + # This makes it possible to use this selector in a variety of ways: + # + # find(:row, 3) + # page.find('table#myTable').find(:row, 3).text + # page.find('table#myTable').has_selector?(:row, 3) + # within(:row, 3) { expect(page).to have_content('$100.000') } + # + # Here is another example: + # + # Capybara.add_selector(:id) do + # xpath { |id| XPath.descendant[XPath.attr(:id) == id.to_s] } + # end + # + # Note that this particular selector already ships with Capybara. + # + # @param [Symbol] name The name of the selector to add + # @yield A block executed in the context of the new {Capybara::Selector} + # + # pkg:gem/capybara#lib/capybara.rb:182 + def add_selector(name, **options, &block); end + + # pkg:gem/capybara#lib/capybara.rb:45 + def allow_gumbo(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:45 + def allow_gumbo=(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def always_include_port(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def always_include_port=(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:45 + def app(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:45 + def app=(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def app_host(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def app_host=(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def asset_host(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def asset_host=(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def automatic_label_click(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def automatic_label_click=(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def automatic_reload(*args, **, &block); end + + # pkg:gem/capybara#lib/capybara.rb:58 + def automatic_reload=(*args, **, &block); end + + # Configure Capybara to suit your needs. + # + # Capybara.configure do |config| + # config.run_server = false + # config.app_host = 'http://www.google.com' + # end + # + # #### Configurable options + # + # - **use_html5_parsing** (Boolean = `false`) - When Nokogiri >= 1.12.0 or `nokogumbo` is installed, whether HTML5 parsing will be used for HTML strings. + # - **always_include_port** (Boolean = `false`) - Whether the Rack server's port should automatically be inserted into every visited URL + # unless another port is explicitly specified. + # - **app_host** (String, `nil`) - The default host to use when giving a relative URL to visit, must be a valid URL e.g. `http://www.example.com`. + # - **asset_host** (String = `nil`) - Where dynamic assets are hosted - will be prepended to relative asset locations if present. + # - **automatic_label_click** (Boolean = `false`) - Whether {Capybara::Node::Element#choose Element#choose}, {Capybara::Node::Element#check Element#check}, + # {Capybara::Node::Element#uncheck Element#uncheck} will attempt to click the associated `