active_cached_resource 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/LICENSE +21 -0
- data/lib/active_cached_resource/caching.rb +104 -1
- data/lib/active_cached_resource/configuration.rb +22 -1
- data/lib/active_cached_resource/logger.rb +14 -0
- data/lib/active_cached_resource/model.rb +18 -0
- data/lib/active_cached_resource/version.rb +1 -8
- data/lib/activeresource/lib/active_resource/collection.rb +2 -0
- metadata +4 -310
- data/.rspec +0 -3
- data/.rubocop.yml +0 -23
- data/.standard.yml +0 -2
- data/Rakefile +0 -29
- data/example/consumer/.dockerignore +0 -41
- data/example/consumer/.gitattributes +0 -9
- data/example/consumer/.gitignore +0 -36
- data/example/consumer/.kamal/hooks/docker-setup.sample +0 -3
- data/example/consumer/.kamal/hooks/post-deploy.sample +0 -14
- data/example/consumer/.kamal/hooks/post-proxy-reboot.sample +0 -3
- data/example/consumer/.kamal/hooks/pre-build.sample +0 -51
- data/example/consumer/.kamal/hooks/pre-connect.sample +0 -47
- data/example/consumer/.kamal/hooks/pre-deploy.sample +0 -109
- data/example/consumer/.kamal/hooks/pre-proxy-reboot.sample +0 -3
- data/example/consumer/.kamal/secrets +0 -17
- data/example/consumer/Dockerfile +0 -65
- data/example/consumer/Gemfile +0 -17
- data/example/consumer/Rakefile +0 -6
- data/example/consumer/app/controllers/application_controller.rb +0 -2
- data/example/consumer/app/controllers/concerns/.keep +0 -0
- data/example/consumer/app/jobs/application_job.rb +0 -7
- data/example/consumer/app/mailers/application_mailer.rb +0 -4
- data/example/consumer/app/models/application_record.rb +0 -3
- data/example/consumer/app/models/concerns/.keep +0 -0
- data/example/consumer/app/models/person.rb +0 -9
- data/example/consumer/app/views/layouts/mailer.html.erb +0 -13
- data/example/consumer/app/views/layouts/mailer.text.erb +0 -1
- data/example/consumer/bin/brakeman +0 -7
- data/example/consumer/bin/bundle +0 -109
- data/example/consumer/bin/dev +0 -2
- data/example/consumer/bin/docker-entrypoint +0 -14
- data/example/consumer/bin/jobs +0 -6
- data/example/consumer/bin/kamal +0 -27
- data/example/consumer/bin/rails +0 -4
- data/example/consumer/bin/rake +0 -4
- data/example/consumer/bin/rubocop +0 -8
- data/example/consumer/bin/setup +0 -34
- data/example/consumer/bin/thrust +0 -5
- data/example/consumer/config/application.rb +0 -20
- data/example/consumer/config/boot.rb +0 -3
- data/example/consumer/config/cache.yml +0 -16
- data/example/consumer/config/credentials.yml.enc +0 -1
- data/example/consumer/config/database.yml +0 -14
- data/example/consumer/config/deploy.yml +0 -116
- data/example/consumer/config/environment.rb +0 -5
- data/example/consumer/config/environments/development.rb +0 -64
- data/example/consumer/config/environments/production.rb +0 -85
- data/example/consumer/config/environments/test.rb +0 -50
- data/example/consumer/config/initializers/cors.rb +0 -16
- data/example/consumer/config/initializers/filter_parameter_logging.rb +0 -8
- data/example/consumer/config/initializers/inflections.rb +0 -16
- data/example/consumer/config/locales/en.yml +0 -31
- data/example/consumer/config/puma.rb +0 -41
- data/example/consumer/config/queue.yml +0 -18
- data/example/consumer/config/recurring.yml +0 -10
- data/example/consumer/config/routes.rb +0 -10
- data/example/consumer/config.ru +0 -6
- data/example/consumer/db/cache_schema.rb +0 -14
- data/example/consumer/db/queue_schema.rb +0 -129
- data/example/consumer/db/seeds.rb +0 -0
- data/example/consumer/lib/tasks/.keep +0 -0
- data/example/consumer/log/.keep +0 -0
- data/example/consumer/public/robots.txt +0 -1
- data/example/consumer/script/.keep +0 -0
- data/example/consumer/storage/.keep +0 -0
- data/example/consumer/tmp/.keep +0 -0
- data/example/consumer/tmp/cache/.keep +0 -0
- data/example/consumer/tmp/pids/.keep +0 -0
- data/example/consumer/tmp/storage/.keep +0 -0
- data/example/consumer/vendor/.keep +0 -0
- data/example/provider/.dockerignore +0 -41
- data/example/provider/.gitattributes +0 -9
- data/example/provider/.gitignore +0 -32
- data/example/provider/.kamal/hooks/docker-setup.sample +0 -3
- data/example/provider/.kamal/hooks/post-deploy.sample +0 -14
- data/example/provider/.kamal/hooks/post-proxy-reboot.sample +0 -3
- data/example/provider/.kamal/hooks/pre-build.sample +0 -51
- data/example/provider/.kamal/hooks/pre-connect.sample +0 -47
- data/example/provider/.kamal/hooks/pre-deploy.sample +0 -109
- data/example/provider/.kamal/hooks/pre-proxy-reboot.sample +0 -3
- data/example/provider/.kamal/secrets +0 -17
- data/example/provider/Dockerfile +0 -65
- data/example/provider/Gemfile +0 -14
- data/example/provider/Rakefile +0 -6
- data/example/provider/app/controllers/application_controller.rb +0 -2
- data/example/provider/app/controllers/concerns/.keep +0 -0
- data/example/provider/app/controllers/people_controller.rb +0 -68
- data/example/provider/app/jobs/application_job.rb +0 -7
- data/example/provider/app/mailers/application_mailer.rb +0 -4
- data/example/provider/app/models/address.rb +0 -3
- data/example/provider/app/models/application_record.rb +0 -3
- data/example/provider/app/models/company.rb +0 -3
- data/example/provider/app/models/concerns/.keep +0 -0
- data/example/provider/app/models/person.rb +0 -6
- data/example/provider/app/views/layouts/mailer.html.erb +0 -13
- data/example/provider/app/views/layouts/mailer.text.erb +0 -1
- data/example/provider/bin/brakeman +0 -7
- data/example/provider/bin/bundle +0 -109
- data/example/provider/bin/dev +0 -2
- data/example/provider/bin/docker-entrypoint +0 -14
- data/example/provider/bin/jobs +0 -6
- data/example/provider/bin/kamal +0 -27
- data/example/provider/bin/rails +0 -4
- data/example/provider/bin/rake +0 -4
- data/example/provider/bin/rubocop +0 -8
- data/example/provider/bin/setup +0 -34
- data/example/provider/bin/thrust +0 -5
- data/example/provider/config/application.rb +0 -44
- data/example/provider/config/boot.rb +0 -3
- data/example/provider/config/cache.yml +0 -16
- data/example/provider/config/credentials.yml.enc +0 -1
- data/example/provider/config/database.yml +0 -20
- data/example/provider/config/deploy.yml +0 -116
- data/example/provider/config/environment.rb +0 -5
- data/example/provider/config/environments/development.rb +0 -64
- data/example/provider/config/environments/production.rb +0 -85
- data/example/provider/config/environments/test.rb +0 -50
- data/example/provider/config/initializers/cors.rb +0 -16
- data/example/provider/config/initializers/filter_parameter_logging.rb +0 -8
- data/example/provider/config/initializers/inflections.rb +0 -16
- data/example/provider/config/locales/en.yml +0 -31
- data/example/provider/config/puma.rb +0 -41
- data/example/provider/config/queue.yml +0 -18
- data/example/provider/config/recurring.yml +0 -10
- data/example/provider/config/routes.rb +0 -4
- data/example/provider/config.ru +0 -6
- data/example/provider/db/cache_schema.rb +0 -14
- data/example/provider/db/migrate/20241202183937_create_people.rb +0 -11
- data/example/provider/db/migrate/20241202183955_create_addresses.rb +0 -13
- data/example/provider/db/migrate/20241202184017_create_companies.rb +0 -14
- data/example/provider/db/queue_schema.rb +0 -129
- data/example/provider/db/schema.rb +0 -47
- data/example/provider/db/seeds.rb +0 -18
- data/example/provider/lib/tasks/.keep +0 -0
- data/example/provider/log/.keep +0 -0
- data/example/provider/public/robots.txt +0 -1
- data/example/provider/script/.keep +0 -0
- data/example/provider/storage/.keep +0 -0
- data/example/provider/tmp/.keep +0 -0
- data/example/provider/tmp/pids/.keep +0 -0
- data/example/provider/tmp/storage/.keep +0 -0
- data/example/provider/vendor/.keep +0 -0
- data/lib/activeresource/.gitignore +0 -15
- data/lib/activeresource/examples/performance.rb +0 -72
- data/lib/activeresource/test/abstract_unit.rb +0 -154
- data/lib/activeresource/test/cases/active_job_serializer_test.rb +0 -53
- data/lib/activeresource/test/cases/association_test.rb +0 -104
- data/lib/activeresource/test/cases/associations/builder/belongs_to_test.rb +0 -42
- data/lib/activeresource/test/cases/associations/builder/has_many_test.rb +0 -28
- data/lib/activeresource/test/cases/associations/builder/has_one_test.rb +0 -28
- data/lib/activeresource/test/cases/authorization_test.rb +0 -276
- data/lib/activeresource/test/cases/base/custom_methods_test.rb +0 -155
- data/lib/activeresource/test/cases/base/equality_test.rb +0 -53
- data/lib/activeresource/test/cases/base/load_test.rb +0 -249
- data/lib/activeresource/test/cases/base/schema_test.rb +0 -428
- data/lib/activeresource/test/cases/base_errors_test.rb +0 -129
- data/lib/activeresource/test/cases/base_test.rb +0 -1622
- data/lib/activeresource/test/cases/callbacks_test.rb +0 -155
- data/lib/activeresource/test/cases/collection_test.rb +0 -196
- data/lib/activeresource/test/cases/connection_test.rb +0 -357
- data/lib/activeresource/test/cases/finder_test.rb +0 -217
- data/lib/activeresource/test/cases/format_test.rb +0 -137
- data/lib/activeresource/test/cases/http_mock_test.rb +0 -213
- data/lib/activeresource/test/cases/inheritence_test.rb +0 -19
- data/lib/activeresource/test/cases/inheriting_hash_test.rb +0 -25
- data/lib/activeresource/test/cases/log_subscriber_test.rb +0 -64
- data/lib/activeresource/test/cases/reflection_test.rb +0 -65
- data/lib/activeresource/test/cases/validations_test.rb +0 -78
- data/lib/activeresource/test/fixtures/address.rb +0 -20
- data/lib/activeresource/test/fixtures/beast.rb +0 -16
- data/lib/activeresource/test/fixtures/comment.rb +0 -5
- data/lib/activeresource/test/fixtures/customer.rb +0 -5
- data/lib/activeresource/test/fixtures/fixtures.rbi +0 -46
- data/lib/activeresource/test/fixtures/inventory.rb +0 -14
- data/lib/activeresource/test/fixtures/person.rb +0 -15
- data/lib/activeresource/test/fixtures/pet.rb +0 -6
- data/lib/activeresource/test/fixtures/post.rb +0 -5
- data/lib/activeresource/test/fixtures/product.rb +0 -11
- data/lib/activeresource/test/fixtures/project.rb +0 -19
- data/lib/activeresource/test/fixtures/proxy.rb +0 -6
- data/lib/activeresource/test/fixtures/sound.rb +0 -11
- data/lib/activeresource/test/fixtures/street_address.rb +0 -6
- data/lib/activeresource/test/fixtures/subscription_plan.rb +0 -7
- data/lib/activeresource/test/fixtures/weather.rb +0 -21
- data/lib/activeresource/test/setter_trap.rb +0 -28
- data/lib/activeresource/test/singleton_test.rb +0 -138
- data/lib/activeresource/test/threadsafe_attributes_test.rb +0 -91
- data/sorbet/config +0 -6
- data/sorbet/rbi/annotations/.gitattributes +0 -1
- data/sorbet/rbi/annotations/activemodel.rbi +0 -89
- data/sorbet/rbi/annotations/activesupport.rbi +0 -457
- data/sorbet/rbi/annotations/minitest.rbi +0 -119
- data/sorbet/rbi/annotations/rainbow.rbi +0 -269
- data/sorbet/rbi/dsl/.gitattributes +0 -1
- data/sorbet/rbi/dsl/active_support/callbacks.rbi +0 -21
- data/sorbet/rbi/gems/.gitattributes +0 -1
- data/sorbet/rbi/gems/actioncable@8.0.1.rbi +0 -252
- data/sorbet/rbi/gems/actionmailbox@8.0.1.rbi +0 -9
- data/sorbet/rbi/gems/actionmailer@8.0.1.rbi +0 -9
- data/sorbet/rbi/gems/actionpack@8.0.1.rbi +0 -21111
- data/sorbet/rbi/gems/actiontext@8.0.1.rbi +0 -9
- data/sorbet/rbi/gems/actionview@8.0.1.rbi +0 -16409
- data/sorbet/rbi/gems/activejob@8.0.1.rbi +0 -90
- data/sorbet/rbi/gems/activemodel-serializers-xml@1.0.3.rbi +0 -166
- data/sorbet/rbi/gems/activemodel@8.0.1.rbi +0 -6865
- data/sorbet/rbi/gems/activerecord@8.0.1.rbi +0 -43277
- data/sorbet/rbi/gems/activestorage@8.0.1.rbi +0 -9
- data/sorbet/rbi/gems/activesupport@8.0.1.rbi +0 -21426
- data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -585
- data/sorbet/rbi/gems/base64@0.2.0.rbi +0 -509
- data/sorbet/rbi/gems/benchmark@0.4.0.rbi +0 -618
- data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +0 -78
- data/sorbet/rbi/gems/builder@3.3.0.rbi +0 -9
- data/sorbet/rbi/gems/bump@0.10.0.rbi +0 -169
- data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -3607
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -3427
- data/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi +0 -11645
- data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +0 -9
- data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -623
- data/sorbet/rbi/gems/date@3.4.1.rbi +0 -75
- data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +0 -1131
- data/sorbet/rbi/gems/docile@1.4.1.rbi +0 -377
- data/sorbet/rbi/gems/drb@2.2.1.rbi +0 -1347
- data/sorbet/rbi/gems/erubi@1.13.0.rbi +0 -150
- data/sorbet/rbi/gems/globalid@1.2.1.rbi +0 -9
- data/sorbet/rbi/gems/i18n@1.14.6.rbi +0 -2359
- data/sorbet/rbi/gems/io-console@0.8.0.rbi +0 -9
- data/sorbet/rbi/gems/json@2.9.0.rbi +0 -1944
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14238
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +0 -240
- data/sorbet/rbi/gems/logger@1.6.3.rbi +0 -940
- data/sorbet/rbi/gems/loofah@2.23.1.rbi +0 -1081
- data/sorbet/rbi/gems/mail@2.8.1.rbi +0 -9
- data/sorbet/rbi/gems/marcel@1.0.4.rbi +0 -9
- data/sorbet/rbi/gems/method_source@1.1.0.rbi +0 -304
- data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +0 -9
- data/sorbet/rbi/gems/minitest@5.25.4.rbi +0 -1547
- data/sorbet/rbi/gems/mocha@2.7.1.rbi +0 -12
- data/sorbet/rbi/gems/msgpack@1.7.5.rbi +0 -320
- data/sorbet/rbi/gems/net-imap@0.5.2.rbi +0 -9
- data/sorbet/rbi/gems/net-pop@0.1.2.rbi +0 -9
- data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +0 -292
- data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +0 -9
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -159
- data/sorbet/rbi/gems/nio4r@2.7.4.rbi +0 -9
- data/sorbet/rbi/gems/nokogiri@1.17.2.rbi +0 -8201
- data/sorbet/rbi/gems/parallel@1.26.3.rbi +0 -291
- data/sorbet/rbi/gems/parser@3.3.6.0.rbi +0 -5519
- data/sorbet/rbi/gems/prism@1.2.0.rbi +0 -39085
- data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +0 -1151
- data/sorbet/rbi/gems/pry@0.14.2.rbi +0 -10076
- data/sorbet/rbi/gems/psych@5.2.1.rbi +0 -1785
- data/sorbet/rbi/gems/racc@1.8.1.rbi +0 -162
- data/sorbet/rbi/gems/rack-session@2.0.0.rbi +0 -727
- data/sorbet/rbi/gems/rack-test@2.1.0.rbi +0 -747
- data/sorbet/rbi/gems/rack@3.1.8.rbi +0 -4905
- data/sorbet/rbi/gems/rackup@2.2.1.rbi +0 -230
- data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +0 -758
- data/sorbet/rbi/gems/rails-html-sanitizer@1.6.2.rbi +0 -785
- data/sorbet/rbi/gems/rails@8.0.1.rbi +0 -9
- data/sorbet/rbi/gems/railties@8.0.1.rbi +0 -6347
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -403
- data/sorbet/rbi/gems/rake@13.2.1.rbi +0 -3028
- data/sorbet/rbi/gems/rbi@0.2.1.rbi +0 -4535
- data/sorbet/rbi/gems/rdoc@6.9.1.rbi +0 -12593
- data/sorbet/rbi/gems/regexp_parser@2.9.3.rbi +0 -3772
- data/sorbet/rbi/gems/reline@0.6.0.rbi +0 -2454
- data/sorbet/rbi/gems/rexml@3.4.0.rbi +0 -4871
- data/sorbet/rbi/gems/rspec-core@3.13.2.rbi +0 -11284
- data/sorbet/rbi/gems/rspec-expectations@3.13.3.rbi +0 -8183
- data/sorbet/rbi/gems/rspec-mocks@3.13.2.rbi +0 -5341
- data/sorbet/rbi/gems/rspec-support@3.13.2.rbi +0 -1630
- data/sorbet/rbi/gems/rspec@3.13.0.rbi +0 -83
- data/sorbet/rbi/gems/rubocop-ast@1.37.0.rbi +0 -7713
- data/sorbet/rbi/gems/rubocop-md@1.2.4.rbi +0 -123
- data/sorbet/rbi/gems/rubocop-minitest@0.36.0.rbi +0 -2613
- data/sorbet/rbi/gems/rubocop-packaging@0.5.2.rbi +0 -388
- data/sorbet/rbi/gems/rubocop-performance@1.23.0.rbi +0 -9
- data/sorbet/rbi/gems/rubocop-rails@2.27.0.rbi +0 -9535
- data/sorbet/rbi/gems/rubocop@1.69.2.rbi +0 -59600
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1318
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +0 -9
- data/sorbet/rbi/gems/securerandom@0.4.1.rbi +0 -78
- data/sorbet/rbi/gems/simplecov-html@0.13.1.rbi +0 -225
- data/sorbet/rbi/gems/simplecov@0.22.0.rbi +0 -2149
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +0 -9
- data/sorbet/rbi/gems/spoom@1.5.0.rbi +0 -4932
- data/sorbet/rbi/gems/sqlite3@2.3.1.rbi +0 -1824
- data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +0 -9
- data/sorbet/rbi/gems/standard-performance@1.6.0.rbi +0 -9
- data/sorbet/rbi/gems/standard@1.43.0.rbi +0 -926
- data/sorbet/rbi/gems/stringio@3.1.2.rbi +0 -9
- data/sorbet/rbi/gems/tapioca@0.16.4.rbi +0 -3597
- data/sorbet/rbi/gems/thor@1.3.2.rbi +0 -4378
- data/sorbet/rbi/gems/timeout@0.4.2.rbi +0 -151
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +0 -5918
- data/sorbet/rbi/gems/unicode-display_width@3.1.2.rbi +0 -130
- data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +0 -251
- data/sorbet/rbi/gems/uri@1.0.2.rbi +0 -2377
- data/sorbet/rbi/gems/useragent@0.16.11.rbi +0 -9
- data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +0 -9
- data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +0 -9
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
- data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18504
- data/sorbet/rbi/gems/zeitwerk@2.7.1.rbi +0 -9
- data/sorbet/tapioca/config.yml +0 -13
- data/sorbet/tapioca/require.rb +0 -13
@@ -1,509 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
|
3
|
-
# DO NOT EDIT MANUALLY
|
4
|
-
# This is an autogenerated file for types exported from the `base64` gem.
|
5
|
-
# Please instead update this file by running `bin/tapioca gem base64`.
|
6
|
-
|
7
|
-
|
8
|
-
# \Module \Base64 provides methods for:
|
9
|
-
#
|
10
|
-
# - Encoding a binary string (containing non-ASCII characters)
|
11
|
-
# as a string of printable ASCII characters.
|
12
|
-
# - Decoding such an encoded string.
|
13
|
-
#
|
14
|
-
# \Base64 is commonly used in contexts where binary data
|
15
|
-
# is not allowed or supported:
|
16
|
-
#
|
17
|
-
# - Images in HTML or CSS files, or in URLs.
|
18
|
-
# - Email attachments.
|
19
|
-
#
|
20
|
-
# A \Base64-encoded string is about one-third larger that its source.
|
21
|
-
# See the {Wikipedia article}[https://en.wikipedia.org/wiki/Base64]
|
22
|
-
# for more information.
|
23
|
-
#
|
24
|
-
# This module provides three pairs of encode/decode methods.
|
25
|
-
# Your choices among these methods should depend on:
|
26
|
-
#
|
27
|
-
# - Which character set is to be used for encoding and decoding.
|
28
|
-
# - Whether "padding" is to be used.
|
29
|
-
# - Whether encoded strings are to contain newlines.
|
30
|
-
#
|
31
|
-
# Note: Examples on this page assume that the including program has executed:
|
32
|
-
#
|
33
|
-
# require 'base64'
|
34
|
-
#
|
35
|
-
# == Encoding Character Sets
|
36
|
-
#
|
37
|
-
# A \Base64-encoded string consists only of characters from a 64-character set:
|
38
|
-
#
|
39
|
-
# - <tt>('A'..'Z')</tt>.
|
40
|
-
# - <tt>('a'..'z')</tt>.
|
41
|
-
# - <tt>('0'..'9')</tt>.
|
42
|
-
# - <tt>=</tt>, the 'padding' character.
|
43
|
-
# - Either:
|
44
|
-
# - <tt>%w[+ /]</tt>:
|
45
|
-
# {RFC-2045-compliant}[https://datatracker.ietf.org/doc/html/rfc2045];
|
46
|
-
# _not_ safe for URLs.
|
47
|
-
# - <tt>%w[- _]</tt>:
|
48
|
-
# {RFC-4648-compliant}[https://datatracker.ietf.org/doc/html/rfc4648];
|
49
|
-
# safe for URLs.
|
50
|
-
#
|
51
|
-
# If you are working with \Base64-encoded strings that will come from
|
52
|
-
# or be put into URLs, you should choose this encoder-decoder pair
|
53
|
-
# of RFC-4648-compliant methods:
|
54
|
-
#
|
55
|
-
# - Base64.urlsafe_encode64 and Base64.urlsafe_decode64.
|
56
|
-
#
|
57
|
-
# Otherwise, you may choose any of the pairs in this module,
|
58
|
-
# including the pair above, or the RFC-2045-compliant pairs:
|
59
|
-
#
|
60
|
-
# - Base64.encode64 and Base64.decode64.
|
61
|
-
# - Base64.strict_encode64 and Base64.strict_decode64.
|
62
|
-
#
|
63
|
-
# == Padding
|
64
|
-
#
|
65
|
-
# \Base64-encoding changes a triplet of input bytes
|
66
|
-
# into a quartet of output characters.
|
67
|
-
#
|
68
|
-
# <b>Padding in Encode Methods</b>
|
69
|
-
#
|
70
|
-
# Padding -- extending an encoded string with zero, one, or two trailing
|
71
|
-
# <tt>=</tt> characters -- is performed by methods Base64.encode64,
|
72
|
-
# Base64.strict_encode64, and, by default, Base64.urlsafe_encode64:
|
73
|
-
#
|
74
|
-
# Base64.encode64('s') # => "cw==\n"
|
75
|
-
# Base64.strict_encode64('s') # => "cw=="
|
76
|
-
# Base64.urlsafe_encode64('s') # => "cw=="
|
77
|
-
# Base64.urlsafe_encode64('s', padding: false) # => "cw"
|
78
|
-
#
|
79
|
-
# When padding is performed, the encoded string is always of length <em>4n</em>,
|
80
|
-
# where +n+ is a non-negative integer:
|
81
|
-
#
|
82
|
-
# - Input bytes of length <em>3n</em> generate unpadded output characters
|
83
|
-
# of length <em>4n</em>:
|
84
|
-
#
|
85
|
-
# # n = 1: 3 bytes => 4 characters.
|
86
|
-
# Base64.strict_encode64('123') # => "MDEy"
|
87
|
-
# # n = 2: 6 bytes => 8 characters.
|
88
|
-
# Base64.strict_encode64('123456') # => "MDEyMzQ1"
|
89
|
-
#
|
90
|
-
# - Input bytes of length <em>3n+1</em> generate padded output characters
|
91
|
-
# of length <em>4(n+1)</em>, with two padding characters at the end:
|
92
|
-
#
|
93
|
-
# # n = 1: 4 bytes => 8 characters.
|
94
|
-
# Base64.strict_encode64('1234') # => "MDEyMw=="
|
95
|
-
# # n = 2: 7 bytes => 12 characters.
|
96
|
-
# Base64.strict_encode64('1234567') # => "MDEyMzQ1Ng=="
|
97
|
-
#
|
98
|
-
# - Input bytes of length <em>3n+2</em> generate padded output characters
|
99
|
-
# of length <em>4(n+1)</em>, with one padding character at the end:
|
100
|
-
#
|
101
|
-
# # n = 1: 5 bytes => 8 characters.
|
102
|
-
# Base64.strict_encode64('12345') # => "MDEyMzQ="
|
103
|
-
# # n = 2: 8 bytes => 12 characters.
|
104
|
-
# Base64.strict_encode64('12345678') # => "MDEyMzQ1Njc="
|
105
|
-
#
|
106
|
-
# When padding is suppressed, for a positive integer <em>n</em>:
|
107
|
-
#
|
108
|
-
# - Input bytes of length <em>3n</em> generate unpadded output characters
|
109
|
-
# of length <em>4n</em>:
|
110
|
-
#
|
111
|
-
# # n = 1: 3 bytes => 4 characters.
|
112
|
-
# Base64.urlsafe_encode64('123', padding: false) # => "MDEy"
|
113
|
-
# # n = 2: 6 bytes => 8 characters.
|
114
|
-
# Base64.urlsafe_encode64('123456', padding: false) # => "MDEyMzQ1"
|
115
|
-
#
|
116
|
-
# - Input bytes of length <em>3n+1</em> generate unpadded output characters
|
117
|
-
# of length <em>4n+2</em>, with two padding characters at the end:
|
118
|
-
#
|
119
|
-
# # n = 1: 4 bytes => 6 characters.
|
120
|
-
# Base64.urlsafe_encode64('1234', padding: false) # => "MDEyMw"
|
121
|
-
# # n = 2: 7 bytes => 10 characters.
|
122
|
-
# Base64.urlsafe_encode64('1234567', padding: false) # => "MDEyMzQ1Ng"
|
123
|
-
#
|
124
|
-
# - Input bytes of length <em>3n+2</em> generate unpadded output characters
|
125
|
-
# of length <em>4n+3</em>, with one padding character at the end:
|
126
|
-
#
|
127
|
-
# # n = 1: 5 bytes => 7 characters.
|
128
|
-
# Base64.urlsafe_encode64('12345', padding: false) # => "MDEyMzQ"
|
129
|
-
# # m = 2: 8 bytes => 11 characters.
|
130
|
-
# Base64.urlsafe_encode64('12345678', padding: false) # => "MDEyMzQ1Njc"
|
131
|
-
#
|
132
|
-
# <b>Padding in Decode Methods</b>
|
133
|
-
#
|
134
|
-
# All of the \Base64 decode methods support (but do not require) padding.
|
135
|
-
#
|
136
|
-
# \Method Base64.decode64 does not check the size of the padding:
|
137
|
-
#
|
138
|
-
# Base64.decode64("MDEyMzQ1Njc") # => "01234567"
|
139
|
-
# Base64.decode64("MDEyMzQ1Njc=") # => "01234567"
|
140
|
-
# Base64.decode64("MDEyMzQ1Njc==") # => "01234567"
|
141
|
-
#
|
142
|
-
# \Method Base64.strict_decode64 strictly enforces padding size:
|
143
|
-
#
|
144
|
-
# Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError
|
145
|
-
# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567"
|
146
|
-
# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError
|
147
|
-
#
|
148
|
-
# \Method Base64.urlsafe_decode64 allows padding in +str+,
|
149
|
-
# which if present, must be correct:
|
150
|
-
# see {Padding}[Base64.html#module-Base64-label-Padding], above:
|
151
|
-
#
|
152
|
-
# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567"
|
153
|
-
# Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567"
|
154
|
-
# Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError.
|
155
|
-
#
|
156
|
-
# == Newlines
|
157
|
-
#
|
158
|
-
# An encoded string returned by Base64.encode64 or Base64.urlsafe_encode64
|
159
|
-
# has an embedded newline character
|
160
|
-
# after each 60-character sequence, and, if non-empty, at the end:
|
161
|
-
#
|
162
|
-
# # No newline if empty.
|
163
|
-
# encoded = Base64.encode64("\x00" * 0)
|
164
|
-
# encoded.index("\n") # => nil
|
165
|
-
#
|
166
|
-
# # Newline at end of short output.
|
167
|
-
# encoded = Base64.encode64("\x00" * 1)
|
168
|
-
# encoded.size # => 4
|
169
|
-
# encoded.index("\n") # => 4
|
170
|
-
#
|
171
|
-
# # Newline at end of longer output.
|
172
|
-
# encoded = Base64.encode64("\x00" * 45)
|
173
|
-
# encoded.size # => 60
|
174
|
-
# encoded.index("\n") # => 60
|
175
|
-
#
|
176
|
-
# # Newlines embedded and at end of still longer output.
|
177
|
-
# encoded = Base64.encode64("\x00" * 46)
|
178
|
-
# encoded.size # => 65
|
179
|
-
# encoded.rindex("\n") # => 65
|
180
|
-
# encoded.split("\n").map {|s| s.size } # => [60, 4]
|
181
|
-
#
|
182
|
-
# The string to be encoded may itself contain newlines,
|
183
|
-
# which are encoded as \Base64:
|
184
|
-
#
|
185
|
-
# # Base64.encode64("\n\n\n") # => "CgoK\n"
|
186
|
-
# s = "This is line 1\nThis is line 2\n"
|
187
|
-
# Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
|
188
|
-
#
|
189
|
-
# source://base64//lib/base64.rb#184
|
190
|
-
module Base64
|
191
|
-
private
|
192
|
-
|
193
|
-
# Returns a string containing the decoding of an RFC-2045-compliant
|
194
|
-
# \Base64-encoded string +str+:
|
195
|
-
#
|
196
|
-
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
|
197
|
-
# Base64.decode64(s) # => "This is line 1\nThis is line 2\n"
|
198
|
-
#
|
199
|
-
# Non-\Base64 characters in +str+ are ignored;
|
200
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
201
|
-
# these include newline characters and characters <tt>-</tt> and <tt>/</tt>:
|
202
|
-
#
|
203
|
-
# Base64.decode64("\x00\n-_") # => ""
|
204
|
-
#
|
205
|
-
# Padding in +str+ (even if incorrect) is ignored:
|
206
|
-
#
|
207
|
-
# Base64.decode64("MDEyMzQ1Njc") # => "01234567"
|
208
|
-
# Base64.decode64("MDEyMzQ1Njc=") # => "01234567"
|
209
|
-
# Base64.decode64("MDEyMzQ1Njc==") # => "01234567"
|
210
|
-
#
|
211
|
-
# source://base64//lib/base64.rb#241
|
212
|
-
def decode64(str); end
|
213
|
-
|
214
|
-
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +bin+.
|
215
|
-
#
|
216
|
-
# Per RFC 2045, the returned string may contain the URL-unsafe characters
|
217
|
-
# <tt>+</tt> or <tt>/</tt>;
|
218
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
219
|
-
#
|
220
|
-
# Base64.encode64("\xFB\xEF\xBE") # => "++++\n"
|
221
|
-
# Base64.encode64("\xFF\xFF\xFF") # => "////\n"
|
222
|
-
#
|
223
|
-
# The returned string may include padding;
|
224
|
-
# see {Padding}[Base64.html#module-Base64-label-Padding] above.
|
225
|
-
#
|
226
|
-
# Base64.encode64('*') # => "Kg==\n"
|
227
|
-
#
|
228
|
-
# The returned string ends with a newline character, and if sufficiently long
|
229
|
-
# will have one or more embedded newline characters;
|
230
|
-
# see {Newlines}[Base64.html#module-Base64-label-Newlines] above:
|
231
|
-
#
|
232
|
-
# Base64.encode64('*') # => "Kg==\n"
|
233
|
-
# Base64.encode64('*' * 46)
|
234
|
-
# # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq\nKg==\n"
|
235
|
-
#
|
236
|
-
# The string to be encoded may itself contain newlines,
|
237
|
-
# which will be encoded as ordinary \Base64:
|
238
|
-
#
|
239
|
-
# Base64.encode64("\n\n\n") # => "CgoK\n"
|
240
|
-
# s = "This is line 1\nThis is line 2\n"
|
241
|
-
# Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
|
242
|
-
#
|
243
|
-
# source://base64//lib/base64.rb#219
|
244
|
-
def encode64(bin); end
|
245
|
-
|
246
|
-
# Returns a string containing the decoding of an RFC-2045-compliant
|
247
|
-
# \Base64-encoded string +str+:
|
248
|
-
#
|
249
|
-
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
|
250
|
-
# Base64.strict_decode64(s) # => "This is line 1\nThis is line 2\n"
|
251
|
-
#
|
252
|
-
# Non-\Base64 characters in +str+ not allowed;
|
253
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
254
|
-
# these include newline characters and characters <tt>-</tt> and <tt>/</tt>:
|
255
|
-
#
|
256
|
-
# Base64.strict_decode64("\n") # Raises ArgumentError
|
257
|
-
# Base64.strict_decode64('-') # Raises ArgumentError
|
258
|
-
# Base64.strict_decode64('_') # Raises ArgumentError
|
259
|
-
#
|
260
|
-
# Padding in +str+, if present, must be correct:
|
261
|
-
#
|
262
|
-
# Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError
|
263
|
-
# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567"
|
264
|
-
# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError
|
265
|
-
#
|
266
|
-
# source://base64//lib/base64.rb#297
|
267
|
-
def strict_decode64(str); end
|
268
|
-
|
269
|
-
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +bin+.
|
270
|
-
#
|
271
|
-
# Per RFC 2045, the returned string may contain the URL-unsafe characters
|
272
|
-
# <tt>+</tt> or <tt>/</tt>;
|
273
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
274
|
-
#
|
275
|
-
# Base64.strict_encode64("\xFB\xEF\xBE") # => "++++\n"
|
276
|
-
# Base64.strict_encode64("\xFF\xFF\xFF") # => "////\n"
|
277
|
-
#
|
278
|
-
# The returned string may include padding;
|
279
|
-
# see {Padding}[Base64.html#module-Base64-label-Padding] above.
|
280
|
-
#
|
281
|
-
# Base64.strict_encode64('*') # => "Kg==\n"
|
282
|
-
#
|
283
|
-
# The returned string will have no newline characters, regardless of its length;
|
284
|
-
# see {Newlines}[Base64.html#module-Base64-label-Newlines] above:
|
285
|
-
#
|
286
|
-
# Base64.strict_encode64('*') # => "Kg=="
|
287
|
-
# Base64.strict_encode64('*' * 46)
|
288
|
-
# # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg=="
|
289
|
-
#
|
290
|
-
# The string to be encoded may itself contain newlines,
|
291
|
-
# which will be encoded as ordinary \Base64:
|
292
|
-
#
|
293
|
-
# Base64.strict_encode64("\n\n\n") # => "CgoK"
|
294
|
-
# s = "This is line 1\nThis is line 2\n"
|
295
|
-
# Base64.strict_encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
|
296
|
-
#
|
297
|
-
# source://base64//lib/base64.rb#273
|
298
|
-
def strict_encode64(bin); end
|
299
|
-
|
300
|
-
# Returns the decoding of an RFC-4648-compliant \Base64-encoded string +str+:
|
301
|
-
#
|
302
|
-
# +str+ may not contain non-Base64 characters;
|
303
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
304
|
-
#
|
305
|
-
# Base64.urlsafe_decode64('+') # Raises ArgumentError.
|
306
|
-
# Base64.urlsafe_decode64('/') # Raises ArgumentError.
|
307
|
-
# Base64.urlsafe_decode64("\n") # Raises ArgumentError.
|
308
|
-
#
|
309
|
-
# Padding in +str+, if present, must be correct:
|
310
|
-
# see {Padding}[Base64.html#module-Base64-label-Padding], above:
|
311
|
-
#
|
312
|
-
# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567"
|
313
|
-
# Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567"
|
314
|
-
# Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError.
|
315
|
-
#
|
316
|
-
# source://base64//lib/base64.rb#351
|
317
|
-
def urlsafe_decode64(str); end
|
318
|
-
|
319
|
-
# Returns the RFC-4648-compliant \Base64-encoding of +bin+.
|
320
|
-
#
|
321
|
-
# Per RFC 4648, the returned string will not contain the URL-unsafe characters
|
322
|
-
# <tt>+</tt> or <tt>/</tt>,
|
323
|
-
# but instead may contain the URL-safe characters
|
324
|
-
# <tt>-</tt> and <tt>_</tt>;
|
325
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
326
|
-
#
|
327
|
-
# Base64.urlsafe_encode64("\xFB\xEF\xBE") # => "----"
|
328
|
-
# Base64.urlsafe_encode64("\xFF\xFF\xFF") # => "____"
|
329
|
-
#
|
330
|
-
# By default, the returned string may have padding;
|
331
|
-
# see {Padding}[Base64.html#module-Base64-label-Padding], above:
|
332
|
-
#
|
333
|
-
# Base64.urlsafe_encode64('*') # => "Kg=="
|
334
|
-
#
|
335
|
-
# Optionally, you can suppress padding:
|
336
|
-
#
|
337
|
-
# Base64.urlsafe_encode64('*', padding: false) # => "Kg"
|
338
|
-
#
|
339
|
-
# The returned string will have no newline characters, regardless of its length;
|
340
|
-
# see {Newlines}[Base64.html#module-Base64-label-Newlines] above:
|
341
|
-
#
|
342
|
-
# Base64.urlsafe_encode64('*') # => "Kg=="
|
343
|
-
# Base64.urlsafe_encode64('*' * 46)
|
344
|
-
# # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg=="
|
345
|
-
#
|
346
|
-
# source://base64//lib/base64.rb#328
|
347
|
-
def urlsafe_encode64(bin, padding: T.unsafe(nil)); end
|
348
|
-
|
349
|
-
class << self
|
350
|
-
# Returns a string containing the decoding of an RFC-2045-compliant
|
351
|
-
# \Base64-encoded string +str+:
|
352
|
-
#
|
353
|
-
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
|
354
|
-
# Base64.decode64(s) # => "This is line 1\nThis is line 2\n"
|
355
|
-
#
|
356
|
-
# Non-\Base64 characters in +str+ are ignored;
|
357
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
358
|
-
# these include newline characters and characters <tt>-</tt> and <tt>/</tt>:
|
359
|
-
#
|
360
|
-
# Base64.decode64("\x00\n-_") # => ""
|
361
|
-
#
|
362
|
-
# Padding in +str+ (even if incorrect) is ignored:
|
363
|
-
#
|
364
|
-
# Base64.decode64("MDEyMzQ1Njc") # => "01234567"
|
365
|
-
# Base64.decode64("MDEyMzQ1Njc=") # => "01234567"
|
366
|
-
# Base64.decode64("MDEyMzQ1Njc==") # => "01234567"
|
367
|
-
#
|
368
|
-
# source://base64//lib/base64.rb#241
|
369
|
-
def decode64(str); end
|
370
|
-
|
371
|
-
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +bin+.
|
372
|
-
#
|
373
|
-
# Per RFC 2045, the returned string may contain the URL-unsafe characters
|
374
|
-
# <tt>+</tt> or <tt>/</tt>;
|
375
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
376
|
-
#
|
377
|
-
# Base64.encode64("\xFB\xEF\xBE") # => "++++\n"
|
378
|
-
# Base64.encode64("\xFF\xFF\xFF") # => "////\n"
|
379
|
-
#
|
380
|
-
# The returned string may include padding;
|
381
|
-
# see {Padding}[Base64.html#module-Base64-label-Padding] above.
|
382
|
-
#
|
383
|
-
# Base64.encode64('*') # => "Kg==\n"
|
384
|
-
#
|
385
|
-
# The returned string ends with a newline character, and if sufficiently long
|
386
|
-
# will have one or more embedded newline characters;
|
387
|
-
# see {Newlines}[Base64.html#module-Base64-label-Newlines] above:
|
388
|
-
#
|
389
|
-
# Base64.encode64('*') # => "Kg==\n"
|
390
|
-
# Base64.encode64('*' * 46)
|
391
|
-
# # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq\nKg==\n"
|
392
|
-
#
|
393
|
-
# The string to be encoded may itself contain newlines,
|
394
|
-
# which will be encoded as ordinary \Base64:
|
395
|
-
#
|
396
|
-
# Base64.encode64("\n\n\n") # => "CgoK\n"
|
397
|
-
# s = "This is line 1\nThis is line 2\n"
|
398
|
-
# Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
|
399
|
-
#
|
400
|
-
# source://base64//lib/base64.rb#219
|
401
|
-
def encode64(bin); end
|
402
|
-
|
403
|
-
# Returns a string containing the decoding of an RFC-2045-compliant
|
404
|
-
# \Base64-encoded string +str+:
|
405
|
-
#
|
406
|
-
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
|
407
|
-
# Base64.strict_decode64(s) # => "This is line 1\nThis is line 2\n"
|
408
|
-
#
|
409
|
-
# Non-\Base64 characters in +str+ not allowed;
|
410
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
411
|
-
# these include newline characters and characters <tt>-</tt> and <tt>/</tt>:
|
412
|
-
#
|
413
|
-
# Base64.strict_decode64("\n") # Raises ArgumentError
|
414
|
-
# Base64.strict_decode64('-') # Raises ArgumentError
|
415
|
-
# Base64.strict_decode64('_') # Raises ArgumentError
|
416
|
-
#
|
417
|
-
# Padding in +str+, if present, must be correct:
|
418
|
-
#
|
419
|
-
# Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError
|
420
|
-
# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567"
|
421
|
-
# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError
|
422
|
-
#
|
423
|
-
# source://base64//lib/base64.rb#297
|
424
|
-
def strict_decode64(str); end
|
425
|
-
|
426
|
-
# Returns a string containing the RFC-2045-compliant \Base64-encoding of +bin+.
|
427
|
-
#
|
428
|
-
# Per RFC 2045, the returned string may contain the URL-unsafe characters
|
429
|
-
# <tt>+</tt> or <tt>/</tt>;
|
430
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
431
|
-
#
|
432
|
-
# Base64.strict_encode64("\xFB\xEF\xBE") # => "++++\n"
|
433
|
-
# Base64.strict_encode64("\xFF\xFF\xFF") # => "////\n"
|
434
|
-
#
|
435
|
-
# The returned string may include padding;
|
436
|
-
# see {Padding}[Base64.html#module-Base64-label-Padding] above.
|
437
|
-
#
|
438
|
-
# Base64.strict_encode64('*') # => "Kg==\n"
|
439
|
-
#
|
440
|
-
# The returned string will have no newline characters, regardless of its length;
|
441
|
-
# see {Newlines}[Base64.html#module-Base64-label-Newlines] above:
|
442
|
-
#
|
443
|
-
# Base64.strict_encode64('*') # => "Kg=="
|
444
|
-
# Base64.strict_encode64('*' * 46)
|
445
|
-
# # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg=="
|
446
|
-
#
|
447
|
-
# The string to be encoded may itself contain newlines,
|
448
|
-
# which will be encoded as ordinary \Base64:
|
449
|
-
#
|
450
|
-
# Base64.strict_encode64("\n\n\n") # => "CgoK"
|
451
|
-
# s = "This is line 1\nThis is line 2\n"
|
452
|
-
# Base64.strict_encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
|
453
|
-
#
|
454
|
-
# source://base64//lib/base64.rb#273
|
455
|
-
def strict_encode64(bin); end
|
456
|
-
|
457
|
-
# Returns the decoding of an RFC-4648-compliant \Base64-encoded string +str+:
|
458
|
-
#
|
459
|
-
# +str+ may not contain non-Base64 characters;
|
460
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
461
|
-
#
|
462
|
-
# Base64.urlsafe_decode64('+') # Raises ArgumentError.
|
463
|
-
# Base64.urlsafe_decode64('/') # Raises ArgumentError.
|
464
|
-
# Base64.urlsafe_decode64("\n") # Raises ArgumentError.
|
465
|
-
#
|
466
|
-
# Padding in +str+, if present, must be correct:
|
467
|
-
# see {Padding}[Base64.html#module-Base64-label-Padding], above:
|
468
|
-
#
|
469
|
-
# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567"
|
470
|
-
# Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567"
|
471
|
-
# Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError.
|
472
|
-
#
|
473
|
-
# source://base64//lib/base64.rb#351
|
474
|
-
def urlsafe_decode64(str); end
|
475
|
-
|
476
|
-
# Returns the RFC-4648-compliant \Base64-encoding of +bin+.
|
477
|
-
#
|
478
|
-
# Per RFC 4648, the returned string will not contain the URL-unsafe characters
|
479
|
-
# <tt>+</tt> or <tt>/</tt>,
|
480
|
-
# but instead may contain the URL-safe characters
|
481
|
-
# <tt>-</tt> and <tt>_</tt>;
|
482
|
-
# see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
|
483
|
-
#
|
484
|
-
# Base64.urlsafe_encode64("\xFB\xEF\xBE") # => "----"
|
485
|
-
# Base64.urlsafe_encode64("\xFF\xFF\xFF") # => "____"
|
486
|
-
#
|
487
|
-
# By default, the returned string may have padding;
|
488
|
-
# see {Padding}[Base64.html#module-Base64-label-Padding], above:
|
489
|
-
#
|
490
|
-
# Base64.urlsafe_encode64('*') # => "Kg=="
|
491
|
-
#
|
492
|
-
# Optionally, you can suppress padding:
|
493
|
-
#
|
494
|
-
# Base64.urlsafe_encode64('*', padding: false) # => "Kg"
|
495
|
-
#
|
496
|
-
# The returned string will have no newline characters, regardless of its length;
|
497
|
-
# see {Newlines}[Base64.html#module-Base64-label-Newlines] above:
|
498
|
-
#
|
499
|
-
# Base64.urlsafe_encode64('*') # => "Kg=="
|
500
|
-
# Base64.urlsafe_encode64('*' * 46)
|
501
|
-
# # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg=="
|
502
|
-
#
|
503
|
-
# source://base64//lib/base64.rb#328
|
504
|
-
def urlsafe_encode64(bin, padding: T.unsafe(nil)); end
|
505
|
-
end
|
506
|
-
end
|
507
|
-
|
508
|
-
# source://base64//lib/base64.rb#186
|
509
|
-
Base64::VERSION = T.let(T.unsafe(nil), String)
|